module TD.Query.AnswerPreCheckoutQuery
(AnswerPreCheckoutQuery(..)
, defaultAnswerPreCheckoutQuery
) 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 AnswerPreCheckoutQuery
= AnswerPreCheckoutQuery
{ AnswerPreCheckoutQuery -> Maybe Int
pre_checkout_query_id :: Maybe Int
, AnswerPreCheckoutQuery -> Maybe Text
error_message :: Maybe T.Text
}
deriving (AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool
(AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool)
-> (AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool)
-> Eq AnswerPreCheckoutQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool
== :: AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool
$c/= :: AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool
/= :: AnswerPreCheckoutQuery -> AnswerPreCheckoutQuery -> Bool
Eq, Int -> AnswerPreCheckoutQuery -> ShowS
[AnswerPreCheckoutQuery] -> ShowS
AnswerPreCheckoutQuery -> String
(Int -> AnswerPreCheckoutQuery -> ShowS)
-> (AnswerPreCheckoutQuery -> String)
-> ([AnswerPreCheckoutQuery] -> ShowS)
-> Show AnswerPreCheckoutQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnswerPreCheckoutQuery -> ShowS
showsPrec :: Int -> AnswerPreCheckoutQuery -> ShowS
$cshow :: AnswerPreCheckoutQuery -> String
show :: AnswerPreCheckoutQuery -> String
$cshowList :: [AnswerPreCheckoutQuery] -> ShowS
showList :: [AnswerPreCheckoutQuery] -> ShowS
Show)
instance I.ShortShow AnswerPreCheckoutQuery where
shortShow :: AnswerPreCheckoutQuery -> String
shortShow
AnswerPreCheckoutQuery
{ pre_checkout_query_id :: AnswerPreCheckoutQuery -> Maybe Int
pre_checkout_query_id = Maybe Int
pre_checkout_query_id_
, error_message :: AnswerPreCheckoutQuery -> Maybe Text
error_message = Maybe Text
error_message_
}
= String
"AnswerPreCheckoutQuery"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"pre_checkout_query_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
pre_checkout_query_id_
, String
"error_message" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
error_message_
]
instance AT.ToJSON AnswerPreCheckoutQuery where
toJSON :: AnswerPreCheckoutQuery -> Value
toJSON
AnswerPreCheckoutQuery
{ pre_checkout_query_id :: AnswerPreCheckoutQuery -> Maybe Int
pre_checkout_query_id = Maybe Int
pre_checkout_query_id_
, error_message :: AnswerPreCheckoutQuery -> Maybe Text
error_message = Maybe Text
error_message_
}
= [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
"answerPreCheckoutQuery"
, Key
"pre_checkout_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
pre_checkout_query_id_
, Key
"error_message" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
error_message_
]
defaultAnswerPreCheckoutQuery :: AnswerPreCheckoutQuery
defaultAnswerPreCheckoutQuery :: AnswerPreCheckoutQuery
defaultAnswerPreCheckoutQuery =
AnswerPreCheckoutQuery
{ pre_checkout_query_id :: Maybe Int
pre_checkout_query_id = Maybe Int
forall a. Maybe a
Nothing
, error_message :: Maybe Text
error_message = Maybe Text
forall a. Maybe a
Nothing
}