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