module TD.Query.LoadChats
(LoadChats(..)
, defaultLoadChats
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.ChatList as ChatList
data LoadChats
= LoadChats
{ LoadChats -> Maybe ChatList
chat_list :: Maybe ChatList.ChatList
, LoadChats -> Maybe Int
limit :: Maybe Int
}
deriving (LoadChats -> LoadChats -> Bool
(LoadChats -> LoadChats -> Bool)
-> (LoadChats -> LoadChats -> Bool) -> Eq LoadChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LoadChats -> LoadChats -> Bool
== :: LoadChats -> LoadChats -> Bool
$c/= :: LoadChats -> LoadChats -> Bool
/= :: LoadChats -> LoadChats -> Bool
Eq, Int -> LoadChats -> ShowS
[LoadChats] -> ShowS
LoadChats -> String
(Int -> LoadChats -> ShowS)
-> (LoadChats -> String)
-> ([LoadChats] -> ShowS)
-> Show LoadChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LoadChats -> ShowS
showsPrec :: Int -> LoadChats -> ShowS
$cshow :: LoadChats -> String
show :: LoadChats -> String
$cshowList :: [LoadChats] -> ShowS
showList :: [LoadChats] -> ShowS
Show)
instance I.ShortShow LoadChats where
shortShow :: LoadChats -> String
shortShow
LoadChats
{ chat_list :: LoadChats -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, limit :: LoadChats -> Maybe Int
limit = Maybe Int
limit_
}
= String
"LoadChats"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_list" String -> Maybe ChatList -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatList
chat_list_
, String
"limit" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
]
instance AT.ToJSON LoadChats where
toJSON :: LoadChats -> Value
toJSON
LoadChats
{ chat_list :: LoadChats -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, limit :: LoadChats -> Maybe Int
limit = Maybe Int
limit_
}
= [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
"loadChats"
, Key
"chat_list" Key -> Maybe ChatList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatList
chat_list_
, Key
"limit" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
]
defaultLoadChats :: LoadChats
defaultLoadChats :: LoadChats
defaultLoadChats =
LoadChats
{ chat_list :: Maybe ChatList
chat_list = Maybe ChatList
forall a. Maybe a
Nothing
, limit :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Nothing
}