module TD.Data.StorePaymentPurpose
(StorePaymentPurpose(..)) 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.FormattedText as FormattedText
import qualified TD.Data.GiveawayParameters as GiveawayParameters
data StorePaymentPurpose
= StorePaymentPurposePremiumSubscription
{ StorePaymentPurpose -> Maybe Bool
is_restore :: Maybe Bool
, StorePaymentPurpose -> Maybe Bool
is_upgrade :: Maybe Bool
}
| StorePaymentPurposePremiumGiftCodes
{ StorePaymentPurpose -> Maybe Int
boosted_chat_id :: Maybe Int
, StorePaymentPurpose -> Maybe Text
currency :: Maybe T.Text
, StorePaymentPurpose -> Maybe Int
amount :: Maybe Int
, StorePaymentPurpose -> Maybe [Int]
user_ids :: Maybe [Int]
, StorePaymentPurpose -> Maybe FormattedText
text :: Maybe FormattedText.FormattedText
}
| StorePaymentPurposePremiumGiveaway
{ StorePaymentPurpose -> Maybe GiveawayParameters
parameters :: Maybe GiveawayParameters.GiveawayParameters
, currency :: Maybe T.Text
, amount :: Maybe Int
}
| StorePaymentPurposeStarGiveaway
{ parameters :: Maybe GiveawayParameters.GiveawayParameters
, currency :: Maybe T.Text
, amount :: Maybe Int
, StorePaymentPurpose -> Maybe Int
winner_count :: Maybe Int
, StorePaymentPurpose -> Maybe Int
star_count :: Maybe Int
}
| StorePaymentPurposeStars
{ currency :: Maybe T.Text
, amount :: Maybe Int
, star_count :: Maybe Int
}
| StorePaymentPurposeGiftedStars
{ StorePaymentPurpose -> Maybe Int
user_id :: Maybe Int
, currency :: Maybe T.Text
, amount :: Maybe Int
, star_count :: Maybe Int
}
deriving (StorePaymentPurpose -> StorePaymentPurpose -> Bool
(StorePaymentPurpose -> StorePaymentPurpose -> Bool)
-> (StorePaymentPurpose -> StorePaymentPurpose -> Bool)
-> Eq StorePaymentPurpose
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StorePaymentPurpose -> StorePaymentPurpose -> Bool
== :: StorePaymentPurpose -> StorePaymentPurpose -> Bool
$c/= :: StorePaymentPurpose -> StorePaymentPurpose -> Bool
/= :: StorePaymentPurpose -> StorePaymentPurpose -> Bool
Eq, Int -> StorePaymentPurpose -> ShowS
[StorePaymentPurpose] -> ShowS
StorePaymentPurpose -> String
(Int -> StorePaymentPurpose -> ShowS)
-> (StorePaymentPurpose -> String)
-> ([StorePaymentPurpose] -> ShowS)
-> Show StorePaymentPurpose
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StorePaymentPurpose -> ShowS
showsPrec :: Int -> StorePaymentPurpose -> ShowS
$cshow :: StorePaymentPurpose -> String
show :: StorePaymentPurpose -> String
$cshowList :: [StorePaymentPurpose] -> ShowS
showList :: [StorePaymentPurpose] -> ShowS
Show)
instance I.ShortShow StorePaymentPurpose where
shortShow :: StorePaymentPurpose -> String
shortShow StorePaymentPurposePremiumSubscription
{ is_restore :: StorePaymentPurpose -> Maybe Bool
is_restore = Maybe Bool
is_restore_
, is_upgrade :: StorePaymentPurpose -> Maybe Bool
is_upgrade = Maybe Bool
is_upgrade_
}
= String
"StorePaymentPurposePremiumSubscription"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"is_restore" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_restore_
, String
"is_upgrade" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_upgrade_
]
shortShow StorePaymentPurposePremiumGiftCodes
{ boosted_chat_id :: StorePaymentPurpose -> Maybe Int
boosted_chat_id = Maybe Int
boosted_chat_id_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, user_ids :: StorePaymentPurpose -> Maybe [Int]
user_ids = Maybe [Int]
user_ids_
, text :: StorePaymentPurpose -> Maybe FormattedText
text = Maybe FormattedText
text_
}
= String
"StorePaymentPurposePremiumGiftCodes"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"boosted_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
boosted_chat_id_
, String
"currency" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
currency_
, String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
, String
"user_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
user_ids_
, String
"text" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
text_
]
shortShow StorePaymentPurposePremiumGiveaway
{ parameters :: StorePaymentPurpose -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
}
= String
"StorePaymentPurposePremiumGiveaway"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"parameters" String -> Maybe GiveawayParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe GiveawayParameters
parameters_
, String
"currency" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
currency_
, String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
]
shortShow StorePaymentPurposeStarGiveaway
{ parameters :: StorePaymentPurpose -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, winner_count :: StorePaymentPurpose -> Maybe Int
winner_count = Maybe Int
winner_count_
, star_count :: StorePaymentPurpose -> Maybe Int
star_count = Maybe Int
star_count_
}
= String
"StorePaymentPurposeStarGiveaway"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"parameters" String -> Maybe GiveawayParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe GiveawayParameters
parameters_
, String
"currency" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
currency_
, String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
, 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_
]
shortShow StorePaymentPurposeStars
{ currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, star_count :: StorePaymentPurpose -> Maybe Int
star_count = Maybe Int
star_count_
}
= String
"StorePaymentPurposeStars"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"currency" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
currency_
, String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
, String
"star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
]
shortShow StorePaymentPurposeGiftedStars
{ user_id :: StorePaymentPurpose -> Maybe Int
user_id = Maybe Int
user_id_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, star_count :: StorePaymentPurpose -> Maybe Int
star_count = Maybe Int
star_count_
}
= String
"StorePaymentPurposeGiftedStars"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
, String
"currency" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
currency_
, String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
, String
"star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
]
instance AT.FromJSON StorePaymentPurpose where
parseJSON :: Value -> Parser StorePaymentPurpose
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"storePaymentPurposePremiumSubscription" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumSubscription Value
v
String
"storePaymentPurposePremiumGiftCodes" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiftCodes Value
v
String
"storePaymentPurposePremiumGiveaway" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiveaway Value
v
String
"storePaymentPurposeStarGiveaway" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeStarGiveaway Value
v
String
"storePaymentPurposeStars" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeStars Value
v
String
"storePaymentPurposeGiftedStars" -> Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeGiftedStars Value
v
String
_ -> Parser StorePaymentPurpose
forall a. Monoid a => a
mempty
where
parseStorePaymentPurposePremiumSubscription :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposePremiumSubscription :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumSubscription = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposePremiumSubscription" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
is_restore_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_restore"
Maybe Bool
is_upgrade_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_upgrade"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposePremiumSubscription
{ is_restore :: Maybe Bool
is_restore = Maybe Bool
is_restore_
, is_upgrade :: Maybe Bool
is_upgrade = Maybe Bool
is_upgrade_
}
parseStorePaymentPurposePremiumGiftCodes :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiftCodes :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiftCodes = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposePremiumGiftCodes" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
boosted_chat_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"boosted_chat_id"
Maybe Text
currency_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"currency"
Maybe Int
amount_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"amount"
Maybe [Int]
user_ids_ <- Object
o Object -> Key -> Parser (Maybe [Int])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_ids"
Maybe FormattedText
text_ <- Object
o Object -> Key -> Parser (Maybe FormattedText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"text"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposePremiumGiftCodes
{ boosted_chat_id :: Maybe Int
boosted_chat_id = Maybe Int
boosted_chat_id_
, currency :: Maybe Text
currency = Maybe Text
currency_
, amount :: Maybe Int
amount = Maybe Int
amount_
, user_ids :: Maybe [Int]
user_ids = Maybe [Int]
user_ids_
, text :: Maybe FormattedText
text = Maybe FormattedText
text_
}
parseStorePaymentPurposePremiumGiveaway :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiveaway :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposePremiumGiveaway = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposePremiumGiveaway" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe GiveawayParameters
parameters_ <- Object
o Object -> Key -> Parser (Maybe GiveawayParameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"parameters"
Maybe Text
currency_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"currency"
Maybe Int
amount_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"amount"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposePremiumGiveaway
{ parameters :: Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: Maybe Text
currency = Maybe Text
currency_
, amount :: Maybe Int
amount = Maybe Int
amount_
}
parseStorePaymentPurposeStarGiveaway :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposeStarGiveaway :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeStarGiveaway = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposeStarGiveaway" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe GiveawayParameters
parameters_ <- Object
o Object -> Key -> Parser (Maybe GiveawayParameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"parameters"
Maybe Text
currency_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"currency"
Maybe Int
amount_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"amount"
Maybe Int
winner_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"winner_count"
Maybe Int
star_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"star_count"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposeStarGiveaway
{ parameters :: Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: Maybe Text
currency = Maybe Text
currency_
, amount :: Maybe Int
amount = Maybe Int
amount_
, winner_count :: Maybe Int
winner_count = Maybe Int
winner_count_
, star_count :: Maybe Int
star_count = Maybe Int
star_count_
}
parseStorePaymentPurposeStars :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposeStars :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeStars = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposeStars" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
currency_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"currency"
Maybe Int
amount_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"amount"
Maybe Int
star_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"star_count"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposeStars
{ currency :: Maybe Text
currency = Maybe Text
currency_
, amount :: Maybe Int
amount = Maybe Int
amount_
, star_count :: Maybe Int
star_count = Maybe Int
star_count_
}
parseStorePaymentPurposeGiftedStars :: A.Value -> AT.Parser StorePaymentPurpose
parseStorePaymentPurposeGiftedStars :: Value -> Parser StorePaymentPurpose
parseStorePaymentPurposeGiftedStars = String
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorePaymentPurposeGiftedStars" ((Object -> Parser StorePaymentPurpose)
-> Value -> Parser StorePaymentPurpose)
-> (Object -> Parser StorePaymentPurpose)
-> Value
-> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_id"
Maybe Text
currency_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"currency"
Maybe Int
amount_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"amount"
Maybe Int
star_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"star_count"
StorePaymentPurpose -> Parser StorePaymentPurpose
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorePaymentPurpose -> Parser StorePaymentPurpose)
-> StorePaymentPurpose -> Parser StorePaymentPurpose
forall a b. (a -> b) -> a -> b
$ StorePaymentPurposeGiftedStars
{ user_id :: Maybe Int
user_id = Maybe Int
user_id_
, currency :: Maybe Text
currency = Maybe Text
currency_
, amount :: Maybe Int
amount = Maybe Int
amount_
, star_count :: Maybe Int
star_count = Maybe Int
star_count_
}
parseJSON Value
_ = Parser StorePaymentPurpose
forall a. Monoid a => a
mempty
instance AT.ToJSON StorePaymentPurpose where
toJSON :: StorePaymentPurpose -> Value
toJSON StorePaymentPurposePremiumSubscription
{ is_restore :: StorePaymentPurpose -> Maybe Bool
is_restore = Maybe Bool
is_restore_
, is_upgrade :: StorePaymentPurpose -> Maybe Bool
is_upgrade = Maybe Bool
is_upgrade_
}
= [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
"storePaymentPurposePremiumSubscription"
, Key
"is_restore" 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_restore_
, Key
"is_upgrade" 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_upgrade_
]
toJSON StorePaymentPurposePremiumGiftCodes
{ boosted_chat_id :: StorePaymentPurpose -> Maybe Int
boosted_chat_id = Maybe Int
boosted_chat_id_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, user_ids :: StorePaymentPurpose -> Maybe [Int]
user_ids = Maybe [Int]
user_ids_
, text :: StorePaymentPurpose -> Maybe FormattedText
text = Maybe FormattedText
text_
}
= [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
"storePaymentPurposePremiumGiftCodes"
, Key
"boosted_chat_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
boosted_chat_id_
, Key
"currency" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
currency_
, Key
"amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
amount_
, Key
"user_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
user_ids_
, 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_
]
toJSON StorePaymentPurposePremiumGiveaway
{ parameters :: StorePaymentPurpose -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
}
= [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
"storePaymentPurposePremiumGiveaway"
, 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
"currency" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
currency_
, Key
"amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
amount_
]
toJSON StorePaymentPurposeStarGiveaway
{ parameters :: StorePaymentPurpose -> Maybe GiveawayParameters
parameters = Maybe GiveawayParameters
parameters_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, winner_count :: StorePaymentPurpose -> Maybe Int
winner_count = Maybe Int
winner_count_
, star_count :: StorePaymentPurpose -> 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
"storePaymentPurposeStarGiveaway"
, 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
"currency" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
currency_
, Key
"amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
amount_
, 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_
]
toJSON StorePaymentPurposeStars
{ currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, star_count :: StorePaymentPurpose -> 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
"storePaymentPurposeStars"
, Key
"currency" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
currency_
, Key
"amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
amount_
, 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_
]
toJSON StorePaymentPurposeGiftedStars
{ user_id :: StorePaymentPurpose -> Maybe Int
user_id = Maybe Int
user_id_
, currency :: StorePaymentPurpose -> Maybe Text
currency = Maybe Text
currency_
, amount :: StorePaymentPurpose -> Maybe Int
amount = Maybe Int
amount_
, star_count :: StorePaymentPurpose -> 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
"storePaymentPurposeGiftedStars"
, Key
"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
user_id_
, Key
"currency" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
currency_
, Key
"amount" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
amount_
, 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_
]