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