module TD.Data.CanSendMessageToUserResult
(CanSendMessageToUserResult(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data CanSendMessageToUserResult
= CanSendMessageToUserResultOk
| CanSendMessageToUserResultUserIsDeleted
| CanSendMessageToUserResultUserRestrictsNewChats
deriving (CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool
(CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool)
-> (CanSendMessageToUserResult
-> CanSendMessageToUserResult -> Bool)
-> Eq CanSendMessageToUserResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool
== :: CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool
$c/= :: CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool
/= :: CanSendMessageToUserResult -> CanSendMessageToUserResult -> Bool
Eq, Int -> CanSendMessageToUserResult -> ShowS
[CanSendMessageToUserResult] -> ShowS
CanSendMessageToUserResult -> String
(Int -> CanSendMessageToUserResult -> ShowS)
-> (CanSendMessageToUserResult -> String)
-> ([CanSendMessageToUserResult] -> ShowS)
-> Show CanSendMessageToUserResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CanSendMessageToUserResult -> ShowS
showsPrec :: Int -> CanSendMessageToUserResult -> ShowS
$cshow :: CanSendMessageToUserResult -> String
show :: CanSendMessageToUserResult -> String
$cshowList :: [CanSendMessageToUserResult] -> ShowS
showList :: [CanSendMessageToUserResult] -> ShowS
Show)
instance I.ShortShow CanSendMessageToUserResult where
shortShow :: CanSendMessageToUserResult -> String
shortShow CanSendMessageToUserResult
CanSendMessageToUserResultOk
= String
"CanSendMessageToUserResultOk"
shortShow CanSendMessageToUserResult
CanSendMessageToUserResultUserIsDeleted
= String
"CanSendMessageToUserResultUserIsDeleted"
shortShow CanSendMessageToUserResult
CanSendMessageToUserResultUserRestrictsNewChats
= String
"CanSendMessageToUserResultUserRestrictsNewChats"
instance AT.FromJSON CanSendMessageToUserResult where
parseJSON :: Value -> Parser CanSendMessageToUserResult
parseJSON (AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"canSendMessageToUserResultOk" -> CanSendMessageToUserResult -> Parser CanSendMessageToUserResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CanSendMessageToUserResult
CanSendMessageToUserResultOk
String
"canSendMessageToUserResultUserIsDeleted" -> CanSendMessageToUserResult -> Parser CanSendMessageToUserResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CanSendMessageToUserResult
CanSendMessageToUserResultUserIsDeleted
String
"canSendMessageToUserResultUserRestrictsNewChats" -> CanSendMessageToUserResult -> Parser CanSendMessageToUserResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CanSendMessageToUserResult
CanSendMessageToUserResultUserRestrictsNewChats
String
_ -> Parser CanSendMessageToUserResult
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser CanSendMessageToUserResult
forall a. Monoid a => a
mempty