{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.Coupon where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified RecurlyClient.Common
import RecurlyClient.TypeAlias
import {-# SOURCE #-} RecurlyClient.Types.CouponDiscount
import {-# SOURCE #-} RecurlyClient.Types.ItemMini
import {-# SOURCE #-} RecurlyClient.Types.PlanMini
import {-# SOURCE #-} RecurlyClient.Types.UniqueCouponCode
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data Coupon = Coupon
{ Coupon -> Maybe Bool
couponApplies_to_all_items :: (GHC.Maybe.Maybe GHC.Types.Bool)
, Coupon -> Maybe Bool
couponApplies_to_all_plans :: (GHC.Maybe.Maybe GHC.Types.Bool)
, Coupon -> Maybe Bool
couponApplies_to_non_plan_charges :: (GHC.Maybe.Maybe GHC.Types.Bool)
, Coupon -> Maybe Text
couponCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe CouponCoupon_type
couponCoupon_type :: (GHC.Maybe.Maybe CouponCoupon_type)
, Coupon -> Maybe JsonDateTime
couponCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, Coupon -> Maybe CouponDiscount
couponDiscount :: (GHC.Maybe.Maybe CouponDiscount)
, Coupon -> Maybe CouponDuration
couponDuration :: (GHC.Maybe.Maybe CouponDuration)
, Coupon -> Maybe JsonDateTime
couponExpired_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, Coupon -> Maybe Int
couponFree_trial_amount :: (GHC.Maybe.Maybe GHC.Types.Int)
, Coupon -> Maybe CouponFree_trial_unit
couponFree_trial_unit :: (GHC.Maybe.Maybe CouponFree_trial_unit)
, Coupon -> Maybe Text
couponHosted_page_description :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe Text
couponId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe Text
couponInvoice_description :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe [ItemMini]
couponItems :: (GHC.Maybe.Maybe [ItemMini])
, Coupon -> Maybe Int
couponMax_redemptions :: (GHC.Maybe.Maybe GHC.Types.Int)
, Coupon -> Maybe Int
couponMax_redemptions_per_account :: (GHC.Maybe.Maybe GHC.Types.Int)
, Coupon -> Maybe Text
couponName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe Text
couponObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe [PlanMini]
couponPlans :: (GHC.Maybe.Maybe [PlanMini])
, Coupon -> Maybe JsonDateTime
couponRedeem_by :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, Coupon -> Maybe CouponRedemption_resource
couponRedemption_resource :: (GHC.Maybe.Maybe CouponRedemption_resource)
, Coupon -> Maybe CouponState
couponState :: (GHC.Maybe.Maybe CouponState)
, Coupon -> Maybe Int
couponTemporal_amount :: (GHC.Maybe.Maybe GHC.Types.Int)
, Coupon -> Maybe CouponTemporal_unit
couponTemporal_unit :: (GHC.Maybe.Maybe CouponTemporal_unit)
, Coupon -> Maybe Text
couponUnique_code_template :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, Coupon -> Maybe CouponUnique_coupon_code
couponUnique_coupon_code :: (GHC.Maybe.Maybe CouponUnique_coupon_code)
, Coupon -> Maybe Int
couponUnique_coupon_codes_count :: (GHC.Maybe.Maybe GHC.Types.Int)
, Coupon -> Maybe JsonDateTime
couponUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
}
deriving
( Int -> Coupon -> ShowS
[Coupon] -> ShowS
Coupon -> String
(Int -> Coupon -> ShowS)
-> (Coupon -> String) -> ([Coupon] -> ShowS) -> Show Coupon
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Coupon -> ShowS
showsPrec :: Int -> Coupon -> ShowS
$cshow :: Coupon -> String
show :: Coupon -> String
$cshowList :: [Coupon] -> ShowS
showList :: [Coupon] -> ShowS
GHC.Show.Show
, Coupon -> Coupon -> Bool
(Coupon -> Coupon -> Bool)
-> (Coupon -> Coupon -> Bool) -> Eq Coupon
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Coupon -> Coupon -> Bool
== :: Coupon -> Coupon -> Bool
$c/= :: Coupon -> Coupon -> Bool
/= :: Coupon -> Coupon -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON Coupon where
toJSON :: Coupon -> Value
toJSON Coupon
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_all_items" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_all_items Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_all_plans" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_all_plans Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_non_plan_charges" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_non_plan_charges Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponCode Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponCoupon_type -> [Pair])
-> Maybe CouponCoupon_type
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponCoupon_type -> Pair) -> CouponCoupon_type -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"coupon_type" Key -> CouponCoupon_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponCoupon_type
couponCoupon_type Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponCreated_at Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponDiscount -> [Pair]) -> Maybe CouponDiscount -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponDiscount -> Pair) -> CouponDiscount -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"discount" Key -> CouponDiscount -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponDiscount
couponDiscount Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponDuration -> [Pair]) -> Maybe CouponDuration -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponDuration -> Pair) -> CouponDuration -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"duration" Key -> CouponDuration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponDuration
couponDuration Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponExpired_at Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"free_trial_amount" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponFree_trial_amount Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponFree_trial_unit -> [Pair])
-> Maybe CouponFree_trial_unit
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponFree_trial_unit -> Pair)
-> CouponFree_trial_unit
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"free_trial_unit" Key -> CouponFree_trial_unit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponFree_trial_unit
couponFree_trial_unit Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"hosted_page_description" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponHosted_page_description Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponId Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_description" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponInvoice_description Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> ([ItemMini] -> [Pair]) -> Maybe [ItemMini] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> ([ItemMini] -> Pair) -> [ItemMini] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"items" Key -> [ItemMini] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe [ItemMini]
couponItems Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"max_redemptions" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponMax_redemptions Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"max_redemptions_per_account" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponMax_redemptions_per_account Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponName Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponObject Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> ([PlanMini] -> [Pair]) -> Maybe [PlanMini] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> ([PlanMini] -> Pair) -> [PlanMini] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plans" Key -> [PlanMini] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe [PlanMini]
couponPlans Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeem_by" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponRedeem_by Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponRedemption_resource -> [Pair])
-> Maybe CouponRedemption_resource
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponRedemption_resource -> Pair)
-> CouponRedemption_resource
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redemption_resource" Key -> CouponRedemption_resource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponRedemption_resource
couponRedemption_resource Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (CouponState -> [Pair]) -> Maybe CouponState -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (CouponState -> Pair) -> CouponState -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponState
couponState Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"temporal_amount" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponTemporal_amount Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponTemporal_unit -> [Pair])
-> Maybe CouponTemporal_unit
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponTemporal_unit -> Pair) -> CouponTemporal_unit -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"temporal_unit" Key -> CouponTemporal_unit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponTemporal_unit
couponTemporal_unit Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_code_template" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponUnique_code_template Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponUnique_coupon_code -> [Pair])
-> Maybe CouponUnique_coupon_code
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponUnique_coupon_code -> Pair)
-> CouponUnique_coupon_code
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_coupon_code" Key -> CouponUnique_coupon_code -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponUnique_coupon_code
couponUnique_coupon_code Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_coupon_codes_count" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponUnique_coupon_codes_count Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponUpdated_at Coupon
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: Coupon -> Encoding
toEncoding Coupon
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_all_items" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_all_items Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_all_plans" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_all_plans Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_non_plan_charges" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Bool
couponApplies_to_non_plan_charges Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponCode Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponCoupon_type -> [Series])
-> Maybe CouponCoupon_type
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponCoupon_type -> Series) -> CouponCoupon_type -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"coupon_type" Key -> CouponCoupon_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponCoupon_type
couponCoupon_type Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponCreated_at Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponDiscount -> [Series]) -> Maybe CouponDiscount -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponDiscount -> Series) -> CouponDiscount -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"discount" Key -> CouponDiscount -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponDiscount
couponDiscount Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponDuration -> [Series]) -> Maybe CouponDuration -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponDuration -> Series) -> CouponDuration -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"duration" Key -> CouponDuration -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponDuration
couponDuration Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponExpired_at Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"free_trial_amount" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponFree_trial_amount Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponFree_trial_unit -> [Series])
-> Maybe CouponFree_trial_unit
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponFree_trial_unit -> Series)
-> CouponFree_trial_unit
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"free_trial_unit" Key -> CouponFree_trial_unit -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponFree_trial_unit
couponFree_trial_unit Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"hosted_page_description" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponHosted_page_description Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponId Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_description" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponInvoice_description Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([ItemMini] -> [Series]) -> Maybe [ItemMini] -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> ([ItemMini] -> Series) -> [ItemMini] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"items" Key -> [ItemMini] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe [ItemMini]
couponItems Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"max_redemptions" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponMax_redemptions Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"max_redemptions_per_account" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponMax_redemptions_per_account Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponName Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponObject Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([PlanMini] -> [Series]) -> Maybe [PlanMini] -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> ([PlanMini] -> Series) -> [PlanMini] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plans" Key -> [PlanMini] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe [PlanMini]
couponPlans Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeem_by" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponRedeem_by Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponRedemption_resource -> [Series])
-> Maybe CouponRedemption_resource
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponRedemption_resource -> Series)
-> CouponRedemption_resource
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redemption_resource" Key -> CouponRedemption_resource -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponRedemption_resource
couponRedemption_resource Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponState -> [Series]) -> Maybe CouponState -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponState -> Series) -> CouponState -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponState
couponState Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"temporal_amount" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponTemporal_amount Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponTemporal_unit -> [Series])
-> Maybe CouponTemporal_unit
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponTemporal_unit -> Series)
-> CouponTemporal_unit
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"temporal_unit" Key -> CouponTemporal_unit -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponTemporal_unit
couponTemporal_unit Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_code_template" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Text
couponUnique_code_template Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponUnique_coupon_code -> [Series])
-> Maybe CouponUnique_coupon_code
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponUnique_coupon_code -> Series)
-> CouponUnique_coupon_code
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_coupon_code" Key -> CouponUnique_coupon_code -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe CouponUnique_coupon_code
couponUnique_coupon_code Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"unique_coupon_codes_count" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe Int
couponUnique_coupon_codes_count Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Coupon -> Maybe JsonDateTime
couponUpdated_at Coupon
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON Coupon where
parseJSON :: Value -> Parser Coupon
parseJSON = String -> (Object -> Parser Coupon) -> Value -> Parser Coupon
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Coupon" (\Object
obj -> (((((((((((((((((((((((((((((Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon
Coupon Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"applies_to_all_items")) Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"applies_to_all_plans")) Parser
(Maybe Bool
-> Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"applies_to_non_plan_charges")) Parser
(Maybe Text
-> Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"code")) Parser
(Maybe CouponCoupon_type
-> Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponCoupon_type)
-> Parser
(Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponCoupon_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"coupon_type")) Parser
(Maybe JsonDateTime
-> Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
(Maybe CouponDiscount
-> Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponDiscount)
-> Parser
(Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponDiscount)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"discount")) Parser
(Maybe CouponDuration
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponDuration)
-> Parser
(Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponDuration)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"duration")) Parser
(Maybe JsonDateTime
-> Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"expired_at")) Parser
(Maybe Int
-> Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Int)
-> Parser
(Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"free_trial_amount")) Parser
(Maybe CouponFree_trial_unit
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponFree_trial_unit)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponFree_trial_unit)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"free_trial_unit")) Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"hosted_page_description")) Parser
(Maybe Text
-> Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
(Maybe Text
-> Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"invoice_description")) Parser
(Maybe [ItemMini]
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe [ItemMini])
-> Parser
(Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [ItemMini])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"items")) Parser
(Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"max_redemptions")) Parser
(Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"max_redemptions_per_account")) Parser
(Maybe Text
-> Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"name")) Parser
(Maybe Text
-> Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser
(Maybe [PlanMini]
-> Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe [PlanMini])
-> Parser
(Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [PlanMini])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"plans")) Parser
(Maybe JsonDateTime
-> Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"redeem_by")) Parser
(Maybe CouponRedemption_resource
-> Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponRedemption_resource)
-> Parser
(Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponRedemption_resource)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"redemption_resource")) Parser
(Maybe CouponState
-> Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponState)
-> Parser
(Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state")) Parser
(Maybe Int
-> Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Int)
-> Parser
(Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"temporal_amount")) Parser
(Maybe CouponTemporal_unit
-> Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe CouponTemporal_unit)
-> Parser
(Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponTemporal_unit)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"temporal_unit")) Parser
(Maybe Text
-> Maybe CouponUnique_coupon_code
-> Maybe Int
-> Maybe JsonDateTime
-> Coupon)
-> Parser (Maybe Text)
-> Parser
(Maybe CouponUnique_coupon_code
-> Maybe Int -> Maybe JsonDateTime -> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"unique_code_template")) Parser
(Maybe CouponUnique_coupon_code
-> Maybe Int -> Maybe JsonDateTime -> Coupon)
-> Parser (Maybe CouponUnique_coupon_code)
-> Parser (Maybe Int -> Maybe JsonDateTime -> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponUnique_coupon_code)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"unique_coupon_code")) Parser (Maybe Int -> Maybe JsonDateTime -> Coupon)
-> Parser (Maybe Int) -> Parser (Maybe JsonDateTime -> Coupon)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"unique_coupon_codes_count")) Parser (Maybe JsonDateTime -> Coupon)
-> Parser (Maybe JsonDateTime) -> Parser Coupon
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))
mkCoupon :: Coupon
mkCoupon :: Coupon
mkCoupon =
Coupon
{ couponApplies_to_all_items :: Maybe Bool
couponApplies_to_all_items = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, couponApplies_to_all_plans :: Maybe Bool
couponApplies_to_all_plans = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, couponApplies_to_non_plan_charges :: Maybe Bool
couponApplies_to_non_plan_charges = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, couponCode :: Maybe Text
couponCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponCoupon_type :: Maybe CouponCoupon_type
couponCoupon_type = Maybe CouponCoupon_type
forall a. Maybe a
GHC.Maybe.Nothing
, couponCreated_at :: Maybe JsonDateTime
couponCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponDiscount :: Maybe CouponDiscount
couponDiscount = Maybe CouponDiscount
forall a. Maybe a
GHC.Maybe.Nothing
, couponDuration :: Maybe CouponDuration
couponDuration = Maybe CouponDuration
forall a. Maybe a
GHC.Maybe.Nothing
, couponExpired_at :: Maybe JsonDateTime
couponExpired_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponFree_trial_amount :: Maybe Int
couponFree_trial_amount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, couponFree_trial_unit :: Maybe CouponFree_trial_unit
couponFree_trial_unit = Maybe CouponFree_trial_unit
forall a. Maybe a
GHC.Maybe.Nothing
, couponHosted_page_description :: Maybe Text
couponHosted_page_description = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponId :: Maybe Text
couponId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponInvoice_description :: Maybe Text
couponInvoice_description = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponItems :: Maybe [ItemMini]
couponItems = Maybe [ItemMini]
forall a. Maybe a
GHC.Maybe.Nothing
, couponMax_redemptions :: Maybe Int
couponMax_redemptions = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, couponMax_redemptions_per_account :: Maybe Int
couponMax_redemptions_per_account = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, couponName :: Maybe Text
couponName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponObject :: Maybe Text
couponObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponPlans :: Maybe [PlanMini]
couponPlans = Maybe [PlanMini]
forall a. Maybe a
GHC.Maybe.Nothing
, couponRedeem_by :: Maybe JsonDateTime
couponRedeem_by = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponRedemption_resource :: Maybe CouponRedemption_resource
couponRedemption_resource = Maybe CouponRedemption_resource
forall a. Maybe a
GHC.Maybe.Nothing
, couponState :: Maybe CouponState
couponState = Maybe CouponState
forall a. Maybe a
GHC.Maybe.Nothing
, couponTemporal_amount :: Maybe Int
couponTemporal_amount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, couponTemporal_unit :: Maybe CouponTemporal_unit
couponTemporal_unit = Maybe CouponTemporal_unit
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_code_template :: Maybe Text
couponUnique_code_template = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_code :: Maybe CouponUnique_coupon_code
couponUnique_coupon_code = Maybe CouponUnique_coupon_code
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codes_count :: Maybe Int
couponUnique_coupon_codes_count = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, couponUpdated_at :: Maybe JsonDateTime
couponUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
}
data CouponCoupon_type
=
CouponCoupon_typeOther Data.Aeson.Types.Internal.Value
|
CouponCoupon_typeTyped Data.Text.Internal.Text
|
CouponCoupon_typeEnumBulk
|
CouponCoupon_typeEnumSingle_code
deriving (Int -> CouponCoupon_type -> ShowS
[CouponCoupon_type] -> ShowS
CouponCoupon_type -> String
(Int -> CouponCoupon_type -> ShowS)
-> (CouponCoupon_type -> String)
-> ([CouponCoupon_type] -> ShowS)
-> Show CouponCoupon_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponCoupon_type -> ShowS
showsPrec :: Int -> CouponCoupon_type -> ShowS
$cshow :: CouponCoupon_type -> String
show :: CouponCoupon_type -> String
$cshowList :: [CouponCoupon_type] -> ShowS
showList :: [CouponCoupon_type] -> ShowS
GHC.Show.Show, CouponCoupon_type -> CouponCoupon_type -> Bool
(CouponCoupon_type -> CouponCoupon_type -> Bool)
-> (CouponCoupon_type -> CouponCoupon_type -> Bool)
-> Eq CouponCoupon_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponCoupon_type -> CouponCoupon_type -> Bool
== :: CouponCoupon_type -> CouponCoupon_type -> Bool
$c/= :: CouponCoupon_type -> CouponCoupon_type -> Bool
/= :: CouponCoupon_type -> CouponCoupon_type -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponCoupon_type where
toJSON :: CouponCoupon_type -> Value
toJSON (CouponCoupon_typeOther Value
val) = Value
val
toJSON (CouponCoupon_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponCoupon_type
CouponCoupon_typeEnumBulk) = Value
"bulk"
toJSON (CouponCoupon_type
CouponCoupon_typeEnumSingle_code) = Value
"single_code"
instance Data.Aeson.Types.FromJSON.FromJSON CouponCoupon_type where
parseJSON :: Value -> Parser CouponCoupon_type
parseJSON Value
val =
CouponCoupon_type -> Parser CouponCoupon_type
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"bulk" -> CouponCoupon_type
CouponCoupon_typeEnumBulk
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"single_code" -> CouponCoupon_type
CouponCoupon_typeEnumSingle_code
| Bool
GHC.Base.otherwise -> Value -> CouponCoupon_type
CouponCoupon_typeOther Value
val
)
data CouponDuration
=
CouponDurationOther Data.Aeson.Types.Internal.Value
|
CouponDurationTyped Data.Text.Internal.Text
|
CouponDurationEnumForever
|
CouponDurationEnumSingle_use
|
CouponDurationEnumTemporal
deriving (Int -> CouponDuration -> ShowS
[CouponDuration] -> ShowS
CouponDuration -> String
(Int -> CouponDuration -> ShowS)
-> (CouponDuration -> String)
-> ([CouponDuration] -> ShowS)
-> Show CouponDuration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponDuration -> ShowS
showsPrec :: Int -> CouponDuration -> ShowS
$cshow :: CouponDuration -> String
show :: CouponDuration -> String
$cshowList :: [CouponDuration] -> ShowS
showList :: [CouponDuration] -> ShowS
GHC.Show.Show, CouponDuration -> CouponDuration -> Bool
(CouponDuration -> CouponDuration -> Bool)
-> (CouponDuration -> CouponDuration -> Bool) -> Eq CouponDuration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponDuration -> CouponDuration -> Bool
== :: CouponDuration -> CouponDuration -> Bool
$c/= :: CouponDuration -> CouponDuration -> Bool
/= :: CouponDuration -> CouponDuration -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponDuration where
toJSON :: CouponDuration -> Value
toJSON (CouponDurationOther Value
val) = Value
val
toJSON (CouponDurationTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponDuration
CouponDurationEnumForever) = Value
"forever"
toJSON (CouponDuration
CouponDurationEnumSingle_use) = Value
"single_use"
toJSON (CouponDuration
CouponDurationEnumTemporal) = Value
"temporal"
instance Data.Aeson.Types.FromJSON.FromJSON CouponDuration where
parseJSON :: Value -> Parser CouponDuration
parseJSON Value
val =
CouponDuration -> Parser CouponDuration
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"forever" -> CouponDuration
CouponDurationEnumForever
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"single_use" -> CouponDuration
CouponDurationEnumSingle_use
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"temporal" -> CouponDuration
CouponDurationEnumTemporal
| Bool
GHC.Base.otherwise -> Value -> CouponDuration
CouponDurationOther Value
val
)
data CouponFree_trial_unit
=
CouponFree_trial_unitOther Data.Aeson.Types.Internal.Value
|
CouponFree_trial_unitTyped Data.Text.Internal.Text
|
CouponFree_trial_unitEnumDay
|
CouponFree_trial_unitEnumMonth
|
CouponFree_trial_unitEnumWeek
deriving (Int -> CouponFree_trial_unit -> ShowS
[CouponFree_trial_unit] -> ShowS
CouponFree_trial_unit -> String
(Int -> CouponFree_trial_unit -> ShowS)
-> (CouponFree_trial_unit -> String)
-> ([CouponFree_trial_unit] -> ShowS)
-> Show CouponFree_trial_unit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponFree_trial_unit -> ShowS
showsPrec :: Int -> CouponFree_trial_unit -> ShowS
$cshow :: CouponFree_trial_unit -> String
show :: CouponFree_trial_unit -> String
$cshowList :: [CouponFree_trial_unit] -> ShowS
showList :: [CouponFree_trial_unit] -> ShowS
GHC.Show.Show, CouponFree_trial_unit -> CouponFree_trial_unit -> Bool
(CouponFree_trial_unit -> CouponFree_trial_unit -> Bool)
-> (CouponFree_trial_unit -> CouponFree_trial_unit -> Bool)
-> Eq CouponFree_trial_unit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponFree_trial_unit -> CouponFree_trial_unit -> Bool
== :: CouponFree_trial_unit -> CouponFree_trial_unit -> Bool
$c/= :: CouponFree_trial_unit -> CouponFree_trial_unit -> Bool
/= :: CouponFree_trial_unit -> CouponFree_trial_unit -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponFree_trial_unit where
toJSON :: CouponFree_trial_unit -> Value
toJSON (CouponFree_trial_unitOther Value
val) = Value
val
toJSON (CouponFree_trial_unitTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponFree_trial_unit
CouponFree_trial_unitEnumDay) = Value
"day"
toJSON (CouponFree_trial_unit
CouponFree_trial_unitEnumMonth) = Value
"month"
toJSON (CouponFree_trial_unit
CouponFree_trial_unitEnumWeek) = Value
"week"
instance Data.Aeson.Types.FromJSON.FromJSON CouponFree_trial_unit where
parseJSON :: Value -> Parser CouponFree_trial_unit
parseJSON Value
val =
CouponFree_trial_unit -> Parser CouponFree_trial_unit
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"day" -> CouponFree_trial_unit
CouponFree_trial_unitEnumDay
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> CouponFree_trial_unit
CouponFree_trial_unitEnumMonth
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> CouponFree_trial_unit
CouponFree_trial_unitEnumWeek
| Bool
GHC.Base.otherwise -> Value -> CouponFree_trial_unit
CouponFree_trial_unitOther Value
val
)
data CouponRedemption_resource
=
CouponRedemption_resourceOther Data.Aeson.Types.Internal.Value
|
CouponRedemption_resourceTyped Data.Text.Internal.Text
|
CouponRedemption_resourceEnumAccount
|
CouponRedemption_resourceEnumSubscription
deriving (Int -> CouponRedemption_resource -> ShowS
[CouponRedemption_resource] -> ShowS
CouponRedemption_resource -> String
(Int -> CouponRedemption_resource -> ShowS)
-> (CouponRedemption_resource -> String)
-> ([CouponRedemption_resource] -> ShowS)
-> Show CouponRedemption_resource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponRedemption_resource -> ShowS
showsPrec :: Int -> CouponRedemption_resource -> ShowS
$cshow :: CouponRedemption_resource -> String
show :: CouponRedemption_resource -> String
$cshowList :: [CouponRedemption_resource] -> ShowS
showList :: [CouponRedemption_resource] -> ShowS
GHC.Show.Show, CouponRedemption_resource -> CouponRedemption_resource -> Bool
(CouponRedemption_resource -> CouponRedemption_resource -> Bool)
-> (CouponRedemption_resource -> CouponRedemption_resource -> Bool)
-> Eq CouponRedemption_resource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponRedemption_resource -> CouponRedemption_resource -> Bool
== :: CouponRedemption_resource -> CouponRedemption_resource -> Bool
$c/= :: CouponRedemption_resource -> CouponRedemption_resource -> Bool
/= :: CouponRedemption_resource -> CouponRedemption_resource -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponRedemption_resource where
toJSON :: CouponRedemption_resource -> Value
toJSON (CouponRedemption_resourceOther Value
val) = Value
val
toJSON (CouponRedemption_resourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponRedemption_resource
CouponRedemption_resourceEnumAccount) = Value
"account"
toJSON (CouponRedemption_resource
CouponRedemption_resourceEnumSubscription) = Value
"subscription"
instance Data.Aeson.Types.FromJSON.FromJSON CouponRedemption_resource where
parseJSON :: Value -> Parser CouponRedemption_resource
parseJSON Value
val =
CouponRedemption_resource -> Parser CouponRedemption_resource
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"account" -> CouponRedemption_resource
CouponRedemption_resourceEnumAccount
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"subscription" -> CouponRedemption_resource
CouponRedemption_resourceEnumSubscription
| Bool
GHC.Base.otherwise -> Value -> CouponRedemption_resource
CouponRedemption_resourceOther Value
val
)
data CouponState
=
CouponStateOther Data.Aeson.Types.Internal.Value
|
CouponStateTyped Data.Text.Internal.Text
|
CouponStateEnumExpired
|
CouponStateEnumMaxed_out
|
CouponStateEnumRedeemable
deriving (Int -> CouponState -> ShowS
[CouponState] -> ShowS
CouponState -> String
(Int -> CouponState -> ShowS)
-> (CouponState -> String)
-> ([CouponState] -> ShowS)
-> Show CouponState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponState -> ShowS
showsPrec :: Int -> CouponState -> ShowS
$cshow :: CouponState -> String
show :: CouponState -> String
$cshowList :: [CouponState] -> ShowS
showList :: [CouponState] -> ShowS
GHC.Show.Show, CouponState -> CouponState -> Bool
(CouponState -> CouponState -> Bool)
-> (CouponState -> CouponState -> Bool) -> Eq CouponState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponState -> CouponState -> Bool
== :: CouponState -> CouponState -> Bool
$c/= :: CouponState -> CouponState -> Bool
/= :: CouponState -> CouponState -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponState where
toJSON :: CouponState -> Value
toJSON (CouponStateOther Value
val) = Value
val
toJSON (CouponStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponState
CouponStateEnumExpired) = Value
"expired"
toJSON (CouponState
CouponStateEnumMaxed_out) = Value
"maxed_out"
toJSON (CouponState
CouponStateEnumRedeemable) = Value
"redeemable"
instance Data.Aeson.Types.FromJSON.FromJSON CouponState where
parseJSON :: Value -> Parser CouponState
parseJSON Value
val =
CouponState -> Parser CouponState
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"expired" -> CouponState
CouponStateEnumExpired
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"maxed_out" -> CouponState
CouponStateEnumMaxed_out
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"redeemable" -> CouponState
CouponStateEnumRedeemable
| Bool
GHC.Base.otherwise -> Value -> CouponState
CouponStateOther Value
val
)
data CouponTemporal_unit
=
CouponTemporal_unitOther Data.Aeson.Types.Internal.Value
|
CouponTemporal_unitTyped Data.Text.Internal.Text
|
CouponTemporal_unitEnumDay
|
CouponTemporal_unitEnumMonth
|
CouponTemporal_unitEnumWeek
|
CouponTemporal_unitEnumYear
deriving (Int -> CouponTemporal_unit -> ShowS
[CouponTemporal_unit] -> ShowS
CouponTemporal_unit -> String
(Int -> CouponTemporal_unit -> ShowS)
-> (CouponTemporal_unit -> String)
-> ([CouponTemporal_unit] -> ShowS)
-> Show CouponTemporal_unit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponTemporal_unit -> ShowS
showsPrec :: Int -> CouponTemporal_unit -> ShowS
$cshow :: CouponTemporal_unit -> String
show :: CouponTemporal_unit -> String
$cshowList :: [CouponTemporal_unit] -> ShowS
showList :: [CouponTemporal_unit] -> ShowS
GHC.Show.Show, CouponTemporal_unit -> CouponTemporal_unit -> Bool
(CouponTemporal_unit -> CouponTemporal_unit -> Bool)
-> (CouponTemporal_unit -> CouponTemporal_unit -> Bool)
-> Eq CouponTemporal_unit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponTemporal_unit -> CouponTemporal_unit -> Bool
== :: CouponTemporal_unit -> CouponTemporal_unit -> Bool
$c/= :: CouponTemporal_unit -> CouponTemporal_unit -> Bool
/= :: CouponTemporal_unit -> CouponTemporal_unit -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponTemporal_unit where
toJSON :: CouponTemporal_unit -> Value
toJSON (CouponTemporal_unitOther Value
val) = Value
val
toJSON (CouponTemporal_unitTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponTemporal_unit
CouponTemporal_unitEnumDay) = Value
"day"
toJSON (CouponTemporal_unit
CouponTemporal_unitEnumMonth) = Value
"month"
toJSON (CouponTemporal_unit
CouponTemporal_unitEnumWeek) = Value
"week"
toJSON (CouponTemporal_unit
CouponTemporal_unitEnumYear) = Value
"year"
instance Data.Aeson.Types.FromJSON.FromJSON CouponTemporal_unit where
parseJSON :: Value -> Parser CouponTemporal_unit
parseJSON Value
val =
CouponTemporal_unit -> Parser CouponTemporal_unit
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"day" -> CouponTemporal_unit
CouponTemporal_unitEnumDay
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> CouponTemporal_unit
CouponTemporal_unitEnumMonth
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> CouponTemporal_unit
CouponTemporal_unitEnumWeek
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"year" -> CouponTemporal_unit
CouponTemporal_unitEnumYear
| Bool
GHC.Base.otherwise -> Value -> CouponTemporal_unit
CouponTemporal_unitOther Value
val
)
data CouponUnique_coupon_code = CouponUnique_coupon_code
{ CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_code :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeExpired_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeRedeemed_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, CouponUnique_coupon_code -> Maybe CouponUnique_coupon_codeState
couponUnique_coupon_codeState :: (GHC.Maybe.Maybe CouponUnique_coupon_codeState)
, CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
}
deriving
( Int -> CouponUnique_coupon_code -> ShowS
[CouponUnique_coupon_code] -> ShowS
CouponUnique_coupon_code -> String
(Int -> CouponUnique_coupon_code -> ShowS)
-> (CouponUnique_coupon_code -> String)
-> ([CouponUnique_coupon_code] -> ShowS)
-> Show CouponUnique_coupon_code
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponUnique_coupon_code -> ShowS
showsPrec :: Int -> CouponUnique_coupon_code -> ShowS
$cshow :: CouponUnique_coupon_code -> String
show :: CouponUnique_coupon_code -> String
$cshowList :: [CouponUnique_coupon_code] -> ShowS
showList :: [CouponUnique_coupon_code] -> ShowS
GHC.Show.Show
, CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool
(CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool)
-> (CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool)
-> Eq CouponUnique_coupon_code
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool
== :: CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool
$c/= :: CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool
/= :: CouponUnique_coupon_code -> CouponUnique_coupon_code -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON CouponUnique_coupon_code where
toJSON :: CouponUnique_coupon_code -> Value
toJSON CouponUnique_coupon_code
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_code CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_id CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeCode CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeCreated_at CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeExpired_at CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeId CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeObject CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeemed_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeRedeemed_at CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponUnique_coupon_codeState -> [Pair])
-> Maybe CouponUnique_coupon_codeState
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (CouponUnique_coupon_codeState -> Pair)
-> CouponUnique_coupon_codeState
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponUnique_coupon_codeState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe CouponUnique_coupon_codeState
couponUnique_coupon_codeState CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeUpdated_at CouponUnique_coupon_code
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: CouponUnique_coupon_code -> Encoding
toEncoding CouponUnique_coupon_code
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_code CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeBulk_coupon_id CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeCode CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeCreated_at CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeExpired_at CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeId CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe Text
couponUnique_coupon_codeObject CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeemed_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeRedeemed_at CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponUnique_coupon_codeState -> [Series])
-> Maybe CouponUnique_coupon_codeState
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (CouponUnique_coupon_codeState -> Series)
-> CouponUnique_coupon_codeState
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponUnique_coupon_codeState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe CouponUnique_coupon_codeState
couponUnique_coupon_codeState CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponUnique_coupon_code -> Maybe JsonDateTime
couponUnique_coupon_codeUpdated_at CouponUnique_coupon_code
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON CouponUnique_coupon_code where
parseJSON :: Value -> Parser CouponUnique_coupon_code
parseJSON = String
-> (Object -> Parser CouponUnique_coupon_code)
-> Value
-> Parser CouponUnique_coupon_code
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CouponUnique_coupon_code" (\Object
obj -> ((((((((((Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code
CouponUnique_coupon_code Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"bulk_coupon_code")) Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"bulk_coupon_id")) Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe Text)
-> Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"code")) Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"expired_at")) Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe Text)
-> Parser
(Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser
(Maybe JsonDateTime
-> Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime
-> CouponUnique_coupon_code)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime -> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"redeemed_at")) Parser
(Maybe CouponUnique_coupon_codeState
-> Maybe JsonDateTime -> CouponUnique_coupon_code)
-> Parser (Maybe CouponUnique_coupon_codeState)
-> Parser (Maybe JsonDateTime -> CouponUnique_coupon_code)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe CouponUnique_coupon_codeState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state")) Parser (Maybe JsonDateTime -> CouponUnique_coupon_code)
-> Parser (Maybe JsonDateTime) -> Parser CouponUnique_coupon_code
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))
mkCouponUnique_coupon_code :: CouponUnique_coupon_code
mkCouponUnique_coupon_code :: CouponUnique_coupon_code
mkCouponUnique_coupon_code =
CouponUnique_coupon_code
{ couponUnique_coupon_codeBulk_coupon_code :: Maybe Text
couponUnique_coupon_codeBulk_coupon_code = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeBulk_coupon_id :: Maybe Text
couponUnique_coupon_codeBulk_coupon_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeCode :: Maybe Text
couponUnique_coupon_codeCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeCreated_at :: Maybe JsonDateTime
couponUnique_coupon_codeCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeExpired_at :: Maybe JsonDateTime
couponUnique_coupon_codeExpired_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeId :: Maybe Text
couponUnique_coupon_codeId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeObject :: Maybe Text
couponUnique_coupon_codeObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeRedeemed_at :: Maybe JsonDateTime
couponUnique_coupon_codeRedeemed_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeState :: Maybe CouponUnique_coupon_codeState
couponUnique_coupon_codeState = Maybe CouponUnique_coupon_codeState
forall a. Maybe a
GHC.Maybe.Nothing
, couponUnique_coupon_codeUpdated_at :: Maybe JsonDateTime
couponUnique_coupon_codeUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
}
data CouponUnique_coupon_codeState
=
CouponUnique_coupon_codeStateOther Data.Aeson.Types.Internal.Value
|
CouponUnique_coupon_codeStateTyped Data.Text.Internal.Text
|
CouponUnique_coupon_codeStateEnumExpired
|
CouponUnique_coupon_codeStateEnumInactive
|
CouponUnique_coupon_codeStateEnumMaxed_out
|
CouponUnique_coupon_codeStateEnumRedeemable
deriving (Int -> CouponUnique_coupon_codeState -> ShowS
[CouponUnique_coupon_codeState] -> ShowS
CouponUnique_coupon_codeState -> String
(Int -> CouponUnique_coupon_codeState -> ShowS)
-> (CouponUnique_coupon_codeState -> String)
-> ([CouponUnique_coupon_codeState] -> ShowS)
-> Show CouponUnique_coupon_codeState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponUnique_coupon_codeState -> ShowS
showsPrec :: Int -> CouponUnique_coupon_codeState -> ShowS
$cshow :: CouponUnique_coupon_codeState -> String
show :: CouponUnique_coupon_codeState -> String
$cshowList :: [CouponUnique_coupon_codeState] -> ShowS
showList :: [CouponUnique_coupon_codeState] -> ShowS
GHC.Show.Show, CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool
(CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool)
-> (CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool)
-> Eq CouponUnique_coupon_codeState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool
== :: CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool
$c/= :: CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool
/= :: CouponUnique_coupon_codeState
-> CouponUnique_coupon_codeState -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CouponUnique_coupon_codeState where
toJSON :: CouponUnique_coupon_codeState -> Value
toJSON (CouponUnique_coupon_codeStateOther Value
val) = Value
val
toJSON (CouponUnique_coupon_codeStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumExpired) = Value
"expired"
toJSON (CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumInactive) = Value
"inactive"
toJSON (CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumMaxed_out) = Value
"maxed_out"
toJSON (CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumRedeemable) = Value
"redeemable"
instance Data.Aeson.Types.FromJSON.FromJSON CouponUnique_coupon_codeState where
parseJSON :: Value -> Parser CouponUnique_coupon_codeState
parseJSON Value
val =
CouponUnique_coupon_codeState
-> Parser CouponUnique_coupon_codeState
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"expired" -> CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumExpired
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inactive" -> CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumInactive
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"maxed_out" -> CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumMaxed_out
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"redeemable" -> CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateEnumRedeemable
| Bool
GHC.Base.otherwise -> Value -> CouponUnique_coupon_codeState
CouponUnique_coupon_codeStateOther Value
val
)