module TD.Query.LaunchPrepaidGiveaway
(LaunchPrepaidGiveaway(..)
, defaultLaunchPrepaidGiveaway
) 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.GiveawayParameters as GiveawayParameters
data LaunchPrepaidGiveaway
= LaunchPrepaidGiveaway
{ LaunchPrepaidGiveaway -> Maybe Int
giveaway_id :: Maybe Int
, LaunchPrepaidGiveaway -> Maybe GiveawayParameters
parameters :: Maybe GiveawayParameters.GiveawayParameters
, LaunchPrepaidGiveaway -> Maybe Int
winner_count :: Maybe Int
, LaunchPrepaidGiveaway -> Maybe Int
star_count :: Maybe Int
}
deriving (LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool
(LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool)
-> (LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool)
-> Eq LaunchPrepaidGiveaway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool
== :: LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool
$c/= :: LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool
/= :: LaunchPrepaidGiveaway -> LaunchPrepaidGiveaway -> Bool
Eq, Int -> LaunchPrepaidGiveaway -> ShowS
[LaunchPrepaidGiveaway] -> ShowS
LaunchPrepaidGiveaway -> String
(Int -> LaunchPrepaidGiveaway -> ShowS)
-> (LaunchPrepaidGiveaway -> String)
-> ([LaunchPrepaidGiveaway] -> ShowS)
-> Show LaunchPrepaidGiveaway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LaunchPrepaidGiveaway -> ShowS
showsPrec :: Int -> LaunchPrepaidGiveaway -> ShowS
$cshow :: LaunchPrepaidGiveaway -> String
show :: LaunchPrepaidGiveaway -> String
$cshowList :: [LaunchPrepaidGiveaway] -> ShowS
showList :: [LaunchPrepaidGiveaway] -> ShowS
Show)
instance I.ShortShow LaunchPrepaidGiveaway where
shortShow :: LaunchPrepaidGiveaway -> String
shortShow
LaunchPrepaidGiveaway
{ giveaway_id :: LaunchPrepaidGiveaway -> Maybe Int
giveaway_id = Maybe Int
giveaway_id_
, parameters :: LaunchPrepaidGiveaway -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, winner_count :: LaunchPrepaidGiveaway -> Maybe Int
winner_count = Maybe Int
winner_count_
, star_count :: LaunchPrepaidGiveaway -> Maybe Int
star_count = Maybe Int
star_count_
}
= String
"LaunchPrepaidGiveaway"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"giveaway_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
giveaway_id_
, String
"parameters" String -> Maybe GiveawayParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe GiveawayParameters
parameters_
, String
"winner_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
winner_count_
, String
"star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
]
instance AT.ToJSON LaunchPrepaidGiveaway where
toJSON :: LaunchPrepaidGiveaway -> Value
toJSON
LaunchPrepaidGiveaway
{ giveaway_id :: LaunchPrepaidGiveaway -> Maybe Int
giveaway_id = Maybe Int
giveaway_id_
, parameters :: LaunchPrepaidGiveaway -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, winner_count :: LaunchPrepaidGiveaway -> Maybe Int
winner_count = Maybe Int
winner_count_
, star_count :: LaunchPrepaidGiveaway -> Maybe Int
star_count = Maybe Int
star_count_
}
= [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
"launchPrepaidGiveaway"
, Key
"giveaway_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
giveaway_id_
, Key
"parameters" Key -> Maybe GiveawayParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe GiveawayParameters
parameters_
, Key
"winner_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
winner_count_
, Key
"star_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
star_count_
]
defaultLaunchPrepaidGiveaway :: LaunchPrepaidGiveaway
defaultLaunchPrepaidGiveaway :: LaunchPrepaidGiveaway
defaultLaunchPrepaidGiveaway =
LaunchPrepaidGiveaway
{ giveaway_id :: Maybe Int
giveaway_id = Maybe Int
forall a. Maybe a
Nothing
, parameters :: Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
forall a. Maybe a
Nothing
, winner_count :: Maybe Int
winner_count = Maybe Int
forall a. Maybe a
Nothing
, star_count :: Maybe Int
star_count = Maybe Int
forall a. Maybe a
Nothing
}