module TD.Query.GetGiftOnChainPurchaseTransaction
(GetGiftOnChainPurchaseTransaction(..)
, defaultGetGiftOnChainPurchaseTransaction
) 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
import qualified TD.Data.MessageSender as MessageSender
import qualified TD.Data.FormattedText as FormattedText
data GetGiftOnChainPurchaseTransaction
= GetGiftOnChainPurchaseTransaction
{ GetGiftOnChainPurchaseTransaction -> Maybe Text
gift_name :: Maybe T.Text
, GetGiftOnChainPurchaseTransaction -> Maybe MessageSender
owner_id :: Maybe MessageSender.MessageSender
, GetGiftOnChainPurchaseTransaction -> Maybe Int
gram_amount :: Maybe Int
, GetGiftOnChainPurchaseTransaction -> Maybe FormattedText
text :: Maybe FormattedText.FormattedText
, GetGiftOnChainPurchaseTransaction -> Maybe Bool
is_private :: Maybe Bool
}
deriving (GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool
(GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool)
-> (GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool)
-> Eq GetGiftOnChainPurchaseTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool
== :: GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool
$c/= :: GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool
/= :: GetGiftOnChainPurchaseTransaction
-> GetGiftOnChainPurchaseTransaction -> Bool
Eq, Int -> GetGiftOnChainPurchaseTransaction -> ShowS
[GetGiftOnChainPurchaseTransaction] -> ShowS
GetGiftOnChainPurchaseTransaction -> String
(Int -> GetGiftOnChainPurchaseTransaction -> ShowS)
-> (GetGiftOnChainPurchaseTransaction -> String)
-> ([GetGiftOnChainPurchaseTransaction] -> ShowS)
-> Show GetGiftOnChainPurchaseTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGiftOnChainPurchaseTransaction -> ShowS
showsPrec :: Int -> GetGiftOnChainPurchaseTransaction -> ShowS
$cshow :: GetGiftOnChainPurchaseTransaction -> String
show :: GetGiftOnChainPurchaseTransaction -> String
$cshowList :: [GetGiftOnChainPurchaseTransaction] -> ShowS
showList :: [GetGiftOnChainPurchaseTransaction] -> ShowS
Show)
instance I.ShortShow GetGiftOnChainPurchaseTransaction where
shortShow :: GetGiftOnChainPurchaseTransaction -> String
shortShow
GetGiftOnChainPurchaseTransaction
{ gift_name :: GetGiftOnChainPurchaseTransaction -> Maybe Text
gift_name = Maybe Text
gift_name_
, owner_id :: GetGiftOnChainPurchaseTransaction -> Maybe MessageSender
owner_id = Maybe MessageSender
owner_id_
, gram_amount :: GetGiftOnChainPurchaseTransaction -> Maybe Int
gram_amount = Maybe Int
gram_amount_
, text :: GetGiftOnChainPurchaseTransaction -> Maybe FormattedText
text = Maybe FormattedText
text_
, is_private :: GetGiftOnChainPurchaseTransaction -> Maybe Bool
is_private = Maybe Bool
is_private_
}
= String
"GetGiftOnChainPurchaseTransaction"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"gift_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
gift_name_
, String
"owner_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
owner_id_
, String
"gram_amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
gram_amount_
, String
"text" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
text_
, String
"is_private" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_private_
]
instance AT.ToJSON GetGiftOnChainPurchaseTransaction where
toJSON :: GetGiftOnChainPurchaseTransaction -> Value
toJSON
GetGiftOnChainPurchaseTransaction
{ gift_name :: GetGiftOnChainPurchaseTransaction -> Maybe Text
gift_name = Maybe Text
gift_name_
, owner_id :: GetGiftOnChainPurchaseTransaction -> Maybe MessageSender
owner_id = Maybe MessageSender
owner_id_
, gram_amount :: GetGiftOnChainPurchaseTransaction -> Maybe Int
gram_amount = Maybe Int
gram_amount_
, text :: GetGiftOnChainPurchaseTransaction -> Maybe FormattedText
text = Maybe FormattedText
text_
, is_private :: GetGiftOnChainPurchaseTransaction -> Maybe Bool
is_private = Maybe Bool
is_private_
}
= [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
"getGiftOnChainPurchaseTransaction"
, Key
"gift_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
gift_name_
, Key
"owner_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
owner_id_
, Key
"gram_amount" 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
gram_amount_
, Key
"text" Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
text_
, Key
"is_private" 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_private_
]
defaultGetGiftOnChainPurchaseTransaction :: GetGiftOnChainPurchaseTransaction
defaultGetGiftOnChainPurchaseTransaction :: GetGiftOnChainPurchaseTransaction
defaultGetGiftOnChainPurchaseTransaction =
GetGiftOnChainPurchaseTransaction
{ gift_name :: Maybe Text
gift_name = Maybe Text
forall a. Maybe a
Nothing
, owner_id :: Maybe MessageSender
owner_id = Maybe MessageSender
forall a. Maybe a
Nothing
, gram_amount :: Maybe Int
gram_amount = Maybe Int
forall a. Maybe a
Nothing
, text :: Maybe FormattedText
text = Maybe FormattedText
forall a. Maybe a
Nothing
, is_private :: Maybe Bool
is_private = Maybe Bool
forall a. Maybe a
Nothing
}