module TD.Query.AnswerInlineQuery
(AnswerInlineQuery(..)
, defaultAnswerInlineQuery
) 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.InlineQueryResultsButton as InlineQueryResultsButton
import qualified TD.Data.InputInlineQueryResult as InputInlineQueryResult
import qualified Data.Text as T
data AnswerInlineQuery
= AnswerInlineQuery
{ AnswerInlineQuery -> Maybe Int
inline_query_id :: Maybe Int
, AnswerInlineQuery -> Maybe Bool
is_personal :: Maybe Bool
, AnswerInlineQuery -> Maybe InlineQueryResultsButton
button :: Maybe InlineQueryResultsButton.InlineQueryResultsButton
, AnswerInlineQuery -> Maybe [InputInlineQueryResult]
results :: Maybe [InputInlineQueryResult.InputInlineQueryResult]
, AnswerInlineQuery -> Maybe Int
cache_time :: Maybe Int
, AnswerInlineQuery -> Maybe Text
next_offset :: Maybe T.Text
}
deriving (AnswerInlineQuery -> AnswerInlineQuery -> Bool
(AnswerInlineQuery -> AnswerInlineQuery -> Bool)
-> (AnswerInlineQuery -> AnswerInlineQuery -> Bool)
-> Eq AnswerInlineQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnswerInlineQuery -> AnswerInlineQuery -> Bool
== :: AnswerInlineQuery -> AnswerInlineQuery -> Bool
$c/= :: AnswerInlineQuery -> AnswerInlineQuery -> Bool
/= :: AnswerInlineQuery -> AnswerInlineQuery -> Bool
Eq, Int -> AnswerInlineQuery -> ShowS
[AnswerInlineQuery] -> ShowS
AnswerInlineQuery -> String
(Int -> AnswerInlineQuery -> ShowS)
-> (AnswerInlineQuery -> String)
-> ([AnswerInlineQuery] -> ShowS)
-> Show AnswerInlineQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnswerInlineQuery -> ShowS
showsPrec :: Int -> AnswerInlineQuery -> ShowS
$cshow :: AnswerInlineQuery -> String
show :: AnswerInlineQuery -> String
$cshowList :: [AnswerInlineQuery] -> ShowS
showList :: [AnswerInlineQuery] -> ShowS
Show)
instance I.ShortShow AnswerInlineQuery where
shortShow :: AnswerInlineQuery -> String
shortShow
AnswerInlineQuery
{ inline_query_id :: AnswerInlineQuery -> Maybe Int
inline_query_id = Maybe Int
inline_query_id_
, is_personal :: AnswerInlineQuery -> Maybe Bool
is_personal = Maybe Bool
is_personal_
, button :: AnswerInlineQuery -> Maybe InlineQueryResultsButton
button = Maybe InlineQueryResultsButton
button_
, results :: AnswerInlineQuery -> Maybe [InputInlineQueryResult]
results = Maybe [InputInlineQueryResult]
results_
, cache_time :: AnswerInlineQuery -> Maybe Int
cache_time = Maybe Int
cache_time_
, next_offset :: AnswerInlineQuery -> Maybe Text
next_offset = Maybe Text
next_offset_
}
= String
"AnswerInlineQuery"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"inline_query_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
inline_query_id_
, String
"is_personal" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_personal_
, String
"button" String -> Maybe InlineQueryResultsButton -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InlineQueryResultsButton
button_
, String
"results" String -> Maybe [InputInlineQueryResult] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [InputInlineQueryResult]
results_
, String
"cache_time" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
cache_time_
, String
"next_offset" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
next_offset_
]
instance AT.ToJSON AnswerInlineQuery where
toJSON :: AnswerInlineQuery -> Value
toJSON
AnswerInlineQuery
{ inline_query_id :: AnswerInlineQuery -> Maybe Int
inline_query_id = Maybe Int
inline_query_id_
, is_personal :: AnswerInlineQuery -> Maybe Bool
is_personal = Maybe Bool
is_personal_
, button :: AnswerInlineQuery -> Maybe InlineQueryResultsButton
button = Maybe InlineQueryResultsButton
button_
, results :: AnswerInlineQuery -> Maybe [InputInlineQueryResult]
results = Maybe [InputInlineQueryResult]
results_
, cache_time :: AnswerInlineQuery -> Maybe Int
cache_time = Maybe Int
cache_time_
, next_offset :: AnswerInlineQuery -> Maybe Text
next_offset = Maybe Text
next_offset_
}
= [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
"answerInlineQuery"
, Key
"inline_query_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
inline_query_id_
, Key
"is_personal" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_personal_
, Key
"button" Key -> Maybe InlineQueryResultsButton -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InlineQueryResultsButton
button_
, Key
"results" Key -> Maybe [InputInlineQueryResult] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [InputInlineQueryResult]
results_
, Key
"cache_time" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
cache_time_
, Key
"next_offset" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
next_offset_
]
defaultAnswerInlineQuery :: AnswerInlineQuery
defaultAnswerInlineQuery :: AnswerInlineQuery
defaultAnswerInlineQuery =
AnswerInlineQuery
{ inline_query_id :: Maybe Int
inline_query_id = Maybe Int
forall a. Maybe a
Nothing
, is_personal :: Maybe Bool
is_personal = Maybe Bool
forall a. Maybe a
Nothing
, button :: Maybe InlineQueryResultsButton
button = Maybe InlineQueryResultsButton
forall a. Maybe a
Nothing
, results :: Maybe [InputInlineQueryResult]
results = Maybe [InputInlineQueryResult]
forall a. Maybe a
Nothing
, cache_time :: Maybe Int
cache_time = Maybe Int
forall a. Maybe a
Nothing
, next_offset :: Maybe Text
next_offset = Maybe Text
forall a. Maybe a
Nothing
}