module TD.Query.AssignAppStoreTransaction
(AssignAppStoreTransaction(..)
, defaultAssignAppStoreTransaction
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.ByteString as BS
import qualified TD.Data.StorePaymentPurpose as StorePaymentPurpose
data AssignAppStoreTransaction
= AssignAppStoreTransaction
{ AssignAppStoreTransaction -> Maybe ByteString
receipt :: Maybe BS.ByteString
, AssignAppStoreTransaction -> Maybe StorePaymentPurpose
purpose :: Maybe StorePaymentPurpose.StorePaymentPurpose
}
deriving (AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool
(AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool)
-> (AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool)
-> Eq AssignAppStoreTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool
== :: AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool
$c/= :: AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool
/= :: AssignAppStoreTransaction -> AssignAppStoreTransaction -> Bool
Eq, Int -> AssignAppStoreTransaction -> ShowS
[AssignAppStoreTransaction] -> ShowS
AssignAppStoreTransaction -> String
(Int -> AssignAppStoreTransaction -> ShowS)
-> (AssignAppStoreTransaction -> String)
-> ([AssignAppStoreTransaction] -> ShowS)
-> Show AssignAppStoreTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssignAppStoreTransaction -> ShowS
showsPrec :: Int -> AssignAppStoreTransaction -> ShowS
$cshow :: AssignAppStoreTransaction -> String
show :: AssignAppStoreTransaction -> String
$cshowList :: [AssignAppStoreTransaction] -> ShowS
showList :: [AssignAppStoreTransaction] -> ShowS
Show)
instance I.ShortShow AssignAppStoreTransaction where
shortShow :: AssignAppStoreTransaction -> String
shortShow
AssignAppStoreTransaction
{ receipt :: AssignAppStoreTransaction -> Maybe ByteString
receipt = Maybe ByteString
receipt_
, purpose :: AssignAppStoreTransaction -> Maybe StorePaymentPurpose
purpose = Maybe StorePaymentPurpose
purpose_
}
= String
"AssignAppStoreTransaction"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"receipt" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
receipt_
, String
"purpose" String -> Maybe StorePaymentPurpose -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StorePaymentPurpose
purpose_
]
instance AT.ToJSON AssignAppStoreTransaction where
toJSON :: AssignAppStoreTransaction -> Value
toJSON
AssignAppStoreTransaction
{ receipt :: AssignAppStoreTransaction -> Maybe ByteString
receipt = Maybe ByteString
receipt_
, purpose :: AssignAppStoreTransaction -> Maybe StorePaymentPurpose
purpose = Maybe StorePaymentPurpose
purpose_
}
= [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
"assignAppStoreTransaction"
, Key
"receipt" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
receipt_
, Key
"purpose" Key -> Maybe StorePaymentPurpose -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StorePaymentPurpose
purpose_
]
defaultAssignAppStoreTransaction :: AssignAppStoreTransaction
defaultAssignAppStoreTransaction :: AssignAppStoreTransaction
defaultAssignAppStoreTransaction =
AssignAppStoreTransaction
{ receipt :: Maybe ByteString
receipt = Maybe ByteString
forall a. Maybe a
Nothing
, purpose :: Maybe StorePaymentPurpose
purpose = Maybe StorePaymentPurpose
forall a. Maybe a
Nothing
}