module TD.Query.GetChats
(GetChats(..)
, defaultGetChats
) 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 GetChats
= GetChats
{ GetChats -> Maybe ChatList
chat_list :: Maybe ChatList.ChatList
, GetChats -> Maybe Int
limit :: Maybe Int
}
deriving (GetChats -> GetChats -> Bool
(GetChats -> GetChats -> Bool)
-> (GetChats -> GetChats -> Bool) -> Eq GetChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChats -> GetChats -> Bool
== :: GetChats -> GetChats -> Bool
$c/= :: GetChats -> GetChats -> Bool
/= :: GetChats -> GetChats -> Bool
Eq, Int -> GetChats -> ShowS
[GetChats] -> ShowS
GetChats -> String
(Int -> GetChats -> ShowS)
-> (GetChats -> String) -> ([GetChats] -> ShowS) -> Show GetChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChats -> ShowS
showsPrec :: Int -> GetChats -> ShowS
$cshow :: GetChats -> String
show :: GetChats -> String
$cshowList :: [GetChats] -> ShowS
showList :: [GetChats] -> ShowS
Show)
instance I.ShortShow GetChats where
shortShow :: GetChats -> String
shortShow
GetChats
{ chat_list :: GetChats -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, limit :: GetChats -> Maybe Int
limit = Maybe Int
limit_
}
= String
"GetChats"
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 GetChats where
toJSON :: GetChats -> Value
toJSON
GetChats
{ chat_list :: GetChats -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, limit :: GetChats -> 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
"getChats"
, 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_
]
defaultGetChats :: GetChats
defaultGetChats :: GetChats
defaultGetChats =
GetChats
{ chat_list :: Maybe ChatList
chat_list = Maybe ChatList
forall a. Maybe a
Nothing
, limit :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Nothing
}