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