module TD.Data.TopChatCategory
(TopChatCategory(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data TopChatCategory
= TopChatCategoryUsers
| TopChatCategoryBots
| TopChatCategoryGroups
| TopChatCategoryChannels
| TopChatCategoryInlineBots
| TopChatCategoryWebAppBots
| TopChatCategoryCalls
| TopChatCategoryForwardChats
deriving (TopChatCategory -> TopChatCategory -> Bool
(TopChatCategory -> TopChatCategory -> Bool)
-> (TopChatCategory -> TopChatCategory -> Bool)
-> Eq TopChatCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TopChatCategory -> TopChatCategory -> Bool
== :: TopChatCategory -> TopChatCategory -> Bool
$c/= :: TopChatCategory -> TopChatCategory -> Bool
/= :: TopChatCategory -> TopChatCategory -> Bool
Eq, Int -> TopChatCategory -> ShowS
[TopChatCategory] -> ShowS
TopChatCategory -> String
(Int -> TopChatCategory -> ShowS)
-> (TopChatCategory -> String)
-> ([TopChatCategory] -> ShowS)
-> Show TopChatCategory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TopChatCategory -> ShowS
showsPrec :: Int -> TopChatCategory -> ShowS
$cshow :: TopChatCategory -> String
show :: TopChatCategory -> String
$cshowList :: [TopChatCategory] -> ShowS
showList :: [TopChatCategory] -> ShowS
Show)
instance I.ShortShow TopChatCategory where
shortShow :: TopChatCategory -> String
shortShow TopChatCategory
TopChatCategoryUsers
= String
"TopChatCategoryUsers"
shortShow TopChatCategory
TopChatCategoryBots
= String
"TopChatCategoryBots"
shortShow TopChatCategory
TopChatCategoryGroups
= String
"TopChatCategoryGroups"
shortShow TopChatCategory
TopChatCategoryChannels
= String
"TopChatCategoryChannels"
shortShow TopChatCategory
TopChatCategoryInlineBots
= String
"TopChatCategoryInlineBots"
shortShow TopChatCategory
TopChatCategoryWebAppBots
= String
"TopChatCategoryWebAppBots"
shortShow TopChatCategory
TopChatCategoryCalls
= String
"TopChatCategoryCalls"
shortShow TopChatCategory
TopChatCategoryForwardChats
= String
"TopChatCategoryForwardChats"
instance AT.FromJSON TopChatCategory where
parseJSON :: Value -> Parser TopChatCategory
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
"topChatCategoryUsers" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryUsers
String
"topChatCategoryBots" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryBots
String
"topChatCategoryGroups" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryGroups
String
"topChatCategoryChannels" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryChannels
String
"topChatCategoryInlineBots" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryInlineBots
String
"topChatCategoryWebAppBots" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryWebAppBots
String
"topChatCategoryCalls" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryCalls
String
"topChatCategoryForwardChats" -> TopChatCategory -> Parser TopChatCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TopChatCategory
TopChatCategoryForwardChats
String
_ -> Parser TopChatCategory
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser TopChatCategory
forall a. Monoid a => a
mempty
instance AT.ToJSON TopChatCategory where
toJSON :: TopChatCategory -> Value
toJSON TopChatCategory
TopChatCategoryUsers
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryUsers"
]
toJSON TopChatCategory
TopChatCategoryBots
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryBots"
]
toJSON TopChatCategory
TopChatCategoryGroups
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryGroups"
]
toJSON TopChatCategory
TopChatCategoryChannels
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryChannels"
]
toJSON TopChatCategory
TopChatCategoryInlineBots
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryInlineBots"
]
toJSON TopChatCategory
TopChatCategoryWebAppBots
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryWebAppBots"
]
toJSON TopChatCategory
TopChatCategoryCalls
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryCalls"
]
toJSON TopChatCategory
TopChatCategoryForwardChats
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"topChatCategoryForwardChats"
]