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