module TD.Query.GetCallbackQueryAnswer
(GetCallbackQueryAnswer(..)
, defaultGetCallbackQueryAnswer
) 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.CallbackQueryPayload as CallbackQueryPayload
data GetCallbackQueryAnswer
= GetCallbackQueryAnswer
{ GetCallbackQueryAnswer -> Maybe Int
chat_id :: Maybe Int
, GetCallbackQueryAnswer -> Maybe Int
message_id :: Maybe Int
, GetCallbackQueryAnswer -> Maybe CallbackQueryPayload
payload :: Maybe CallbackQueryPayload.CallbackQueryPayload
}
deriving (GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool
(GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool)
-> (GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool)
-> Eq GetCallbackQueryAnswer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool
== :: GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool
$c/= :: GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool
/= :: GetCallbackQueryAnswer -> GetCallbackQueryAnswer -> Bool
Eq, Int -> GetCallbackQueryAnswer -> ShowS
[GetCallbackQueryAnswer] -> ShowS
GetCallbackQueryAnswer -> String
(Int -> GetCallbackQueryAnswer -> ShowS)
-> (GetCallbackQueryAnswer -> String)
-> ([GetCallbackQueryAnswer] -> ShowS)
-> Show GetCallbackQueryAnswer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCallbackQueryAnswer -> ShowS
showsPrec :: Int -> GetCallbackQueryAnswer -> ShowS
$cshow :: GetCallbackQueryAnswer -> String
show :: GetCallbackQueryAnswer -> String
$cshowList :: [GetCallbackQueryAnswer] -> ShowS
showList :: [GetCallbackQueryAnswer] -> ShowS
Show)
instance I.ShortShow GetCallbackQueryAnswer where
shortShow :: GetCallbackQueryAnswer -> String
shortShow
GetCallbackQueryAnswer
{ chat_id :: GetCallbackQueryAnswer -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetCallbackQueryAnswer -> Maybe Int
message_id = Maybe Int
message_id_
, payload :: GetCallbackQueryAnswer -> Maybe CallbackQueryPayload
payload = Maybe CallbackQueryPayload
payload_
}
= String
"GetCallbackQueryAnswer"
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_
, String
"payload" String -> Maybe CallbackQueryPayload -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe CallbackQueryPayload
payload_
]
instance AT.ToJSON GetCallbackQueryAnswer where
toJSON :: GetCallbackQueryAnswer -> Value
toJSON
GetCallbackQueryAnswer
{ chat_id :: GetCallbackQueryAnswer -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetCallbackQueryAnswer -> Maybe Int
message_id = Maybe Int
message_id_
, payload :: GetCallbackQueryAnswer -> Maybe CallbackQueryPayload
payload = Maybe CallbackQueryPayload
payload_
}
= [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
"getCallbackQueryAnswer"
, 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_
, Key
"payload" Key -> Maybe CallbackQueryPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe CallbackQueryPayload
payload_
]
defaultGetCallbackQueryAnswer :: GetCallbackQueryAnswer
defaultGetCallbackQueryAnswer :: GetCallbackQueryAnswer
defaultGetCallbackQueryAnswer =
GetCallbackQueryAnswer
{ 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
, payload :: Maybe CallbackQueryPayload
payload = Maybe CallbackQueryPayload
forall a. Maybe a
Nothing
}