module TD.Query.UpgradeGift
(UpgradeGift(..)
, defaultUpgradeGift
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data UpgradeGift
= UpgradeGift
{ UpgradeGift -> Maybe Int
sender_user_id :: Maybe Int
, UpgradeGift -> Maybe Int
message_id :: Maybe Int
, UpgradeGift -> Maybe Bool
keep_original_details :: Maybe Bool
}
deriving (UpgradeGift -> UpgradeGift -> Bool
(UpgradeGift -> UpgradeGift -> Bool)
-> (UpgradeGift -> UpgradeGift -> Bool) -> Eq UpgradeGift
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpgradeGift -> UpgradeGift -> Bool
== :: UpgradeGift -> UpgradeGift -> Bool
$c/= :: UpgradeGift -> UpgradeGift -> Bool
/= :: UpgradeGift -> UpgradeGift -> Bool
Eq, Int -> UpgradeGift -> ShowS
[UpgradeGift] -> ShowS
UpgradeGift -> String
(Int -> UpgradeGift -> ShowS)
-> (UpgradeGift -> String)
-> ([UpgradeGift] -> ShowS)
-> Show UpgradeGift
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpgradeGift -> ShowS
showsPrec :: Int -> UpgradeGift -> ShowS
$cshow :: UpgradeGift -> String
show :: UpgradeGift -> String
$cshowList :: [UpgradeGift] -> ShowS
showList :: [UpgradeGift] -> ShowS
Show)
instance I.ShortShow UpgradeGift where
shortShow :: UpgradeGift -> String
shortShow
UpgradeGift
{ sender_user_id :: UpgradeGift -> Maybe Int
sender_user_id = Maybe Int
sender_user_id_
, message_id :: UpgradeGift -> Maybe Int
message_id = Maybe Int
message_id_
, keep_original_details :: UpgradeGift -> Maybe Bool
keep_original_details = Maybe Bool
keep_original_details_
}
= String
"UpgradeGift"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"sender_user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
sender_user_id_
, String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"keep_original_details" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
keep_original_details_
]
instance AT.ToJSON UpgradeGift where
toJSON :: UpgradeGift -> Value
toJSON
UpgradeGift
{ sender_user_id :: UpgradeGift -> Maybe Int
sender_user_id = Maybe Int
sender_user_id_
, message_id :: UpgradeGift -> Maybe Int
message_id = Maybe Int
message_id_
, keep_original_details :: UpgradeGift -> Maybe Bool
keep_original_details = Maybe Bool
keep_original_details_
}
= [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
"upgradeGift"
, Key
"sender_user_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
sender_user_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
"keep_original_details" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
keep_original_details_
]
defaultUpgradeGift :: UpgradeGift
defaultUpgradeGift :: UpgradeGift
defaultUpgradeGift =
UpgradeGift
{ sender_user_id :: Maybe Int
sender_user_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, keep_original_details :: Maybe Bool
keep_original_details = Maybe Bool
forall a. Maybe a
Nothing
}