{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the types generated from the schema ExternalSubscription
module RecurlyClient.Types.ExternalSubscription 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.AccountMini
import {-# SOURCE #-} RecurlyClient.Types.ExternalPaymentPhase
import {-# SOURCE #-} RecurlyClient.Types.ExternalProductReferenceMini
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

{- | Defines the object schema located at @components.schemas.ExternalSubscription@ in the specification.

Subscription from an external resource such as Apple App Store or Google Play Store.
-}
data ExternalSubscription = ExternalSubscription
    { ExternalSubscription -> Maybe AccountMini
externalSubscriptionAccount :: (GHC.Maybe.Maybe AccountMini)
    -- ^ account
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionActivated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ activated_at: When the external subscription was activated in the external platform.
    , ExternalSubscription -> Maybe Text
externalSubscriptionApp_identifier :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ app_identifier: Identifier of the app that generated the external subscription.
    , ExternalSubscription -> Maybe Bool
externalSubscriptionAuto_renew :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ auto_renew: An indication of whether or not the external subscription will auto-renew at the expiration date.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCanceled_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ canceled_at: When the external subscription was canceled in the external platform.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at: When the external subscription was created in Recurly.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionExpires_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ expires_at: When the external subscription expires in the external platform.
    , ExternalSubscription -> Maybe Text
externalSubscriptionExternal_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ external_id: The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store.
    , ExternalSubscription -> Maybe [ExternalPaymentPhase]
externalSubscriptionExternal_payment_phases :: (GHC.Maybe.Maybe [ExternalPaymentPhase])
    -- ^ external_payment_phases: The phases of the external subscription payment lifecycle.
    , ExternalSubscription -> Maybe ExternalProductReferenceMini
externalSubscriptionExternal_product_reference :: (GHC.Maybe.Maybe ExternalProductReferenceMini)
    -- ^ external_product_reference: External Product Reference details
    , ExternalSubscription -> Maybe Text
externalSubscriptionId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id: System-generated unique identifier for an external subscription ID, e.g. \`e28zov4fw0v2\`.
    , ExternalSubscription -> Maybe Bool
externalSubscriptionImported :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ imported: An indication of whether or not the external subscription was created by a historical data import.
    , ExternalSubscription -> Maybe Bool
externalSubscriptionIn_grace_period :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ in_grace_period: An indication of whether or not the external subscription is in a grace period.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionLast_purchased :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ last_purchased: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade\/downgrade.
    , ExternalSubscription -> Maybe Text
externalSubscriptionObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , ExternalSubscription -> Maybe Int
externalSubscriptionQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ quantity: An indication of the quantity of a subscribed item\'s quantity.
    --
    -- Constraints:
    --
    -- * Minimum  of 0.0
    , ExternalSubscription -> Maybe Text
externalSubscriptionState :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ state: External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused.
    , ExternalSubscription -> Maybe Bool
externalSubscriptionTest :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ test: An indication of whether or not the external subscription was purchased in a sandbox environment.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_ends_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ trial_ends_at: When the external subscription trial period ends in the external platform.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_started_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ trial_started_at: When the external subscription trial period started in the external platform.
    , ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at: When the external subscription was updated in Recurly.
    , ExternalSubscription -> Maybe Text
externalSubscriptionUuid :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ uuid: Universally Unique Identifier created automatically.
    }
    deriving
        ( Int -> ExternalSubscription -> ShowS
[ExternalSubscription] -> ShowS
ExternalSubscription -> String
(Int -> ExternalSubscription -> ShowS)
-> (ExternalSubscription -> String)
-> ([ExternalSubscription] -> ShowS)
-> Show ExternalSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExternalSubscription -> ShowS
showsPrec :: Int -> ExternalSubscription -> ShowS
$cshow :: ExternalSubscription -> String
show :: ExternalSubscription -> String
$cshowList :: [ExternalSubscription] -> ShowS
showList :: [ExternalSubscription] -> ShowS
GHC.Show.Show
        , ExternalSubscription -> ExternalSubscription -> Bool
(ExternalSubscription -> ExternalSubscription -> Bool)
-> (ExternalSubscription -> ExternalSubscription -> Bool)
-> Eq ExternalSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalSubscription -> ExternalSubscription -> Bool
== :: ExternalSubscription -> ExternalSubscription -> Bool
$c/= :: ExternalSubscription -> ExternalSubscription -> Bool
/= :: ExternalSubscription -> ExternalSubscription -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON ExternalSubscription where
    toJSON :: ExternalSubscription -> Value
toJSON ExternalSubscription
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (AccountMini -> [Pair]) -> Maybe AccountMini -> [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]) -> (AccountMini -> Pair) -> AccountMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account" Key -> AccountMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe AccountMini
externalSubscriptionAccount ExternalSubscription
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
"activated_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionActivated_at ExternalSubscription
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
"app_identifier" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionApp_identifier ExternalSubscription
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
"auto_renew" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionAuto_renew ExternalSubscription
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
"canceled_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCanceled_at ExternalSubscription
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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCreated_at ExternalSubscription
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
"expires_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionExpires_at ExternalSubscription
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
"external_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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionExternal_id ExternalSubscription
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([ExternalPaymentPhase] -> [Pair])
-> Maybe [ExternalPaymentPhase]
-> [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])
-> ([ExternalPaymentPhase] -> Pair)
-> [ExternalPaymentPhase]
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_payment_phases" Key -> [ExternalPaymentPhase] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe [ExternalPaymentPhase]
externalSubscriptionExternal_payment_phases ExternalSubscription
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (ExternalProductReferenceMini -> [Pair])
-> Maybe ExternalProductReferenceMini
-> [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])
-> (ExternalProductReferenceMini -> Pair)
-> ExternalProductReferenceMini
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe ExternalProductReferenceMini
externalSubscriptionExternal_product_reference ExternalSubscription
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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionId ExternalSubscription
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
"imported" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionImported ExternalSubscription
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
"in_grace_period" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionIn_grace_period ExternalSubscription
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
"last_purchased" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionLast_purchased ExternalSubscription
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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionObject ExternalSubscription
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
"quantity" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Int
externalSubscriptionQuantity ExternalSubscription
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
"state" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionState ExternalSubscription
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
"test" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionTest ExternalSubscription
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
"trial_ends_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_ends_at ExternalSubscription
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
"trial_started_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_started_at ExternalSubscription
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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionUpdated_at ExternalSubscription
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
"uuid" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionUuid ExternalSubscription
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: ExternalSubscription -> Encoding
toEncoding ExternalSubscription
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]
-> (AccountMini -> [Series]) -> Maybe AccountMini -> [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])
-> (AccountMini -> Series) -> AccountMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account" Key -> AccountMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe AccountMini
externalSubscriptionAccount ExternalSubscription
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
"activated_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionActivated_at ExternalSubscription
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
"app_identifier" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionApp_identifier ExternalSubscription
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
"auto_renew" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionAuto_renew ExternalSubscription
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
"canceled_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCanceled_at ExternalSubscription
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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionCreated_at ExternalSubscription
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
"expires_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionExpires_at ExternalSubscription
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
"external_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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionExternal_id ExternalSubscription
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([ExternalPaymentPhase] -> [Series])
-> Maybe [ExternalPaymentPhase]
-> [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])
-> ([ExternalPaymentPhase] -> Series)
-> [ExternalPaymentPhase]
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_payment_phases" Key -> [ExternalPaymentPhase] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe [ExternalPaymentPhase]
externalSubscriptionExternal_payment_phases ExternalSubscription
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (ExternalProductReferenceMini -> [Series])
-> Maybe ExternalProductReferenceMini
-> [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])
-> (ExternalProductReferenceMini -> Series)
-> ExternalProductReferenceMini
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe ExternalProductReferenceMini
externalSubscriptionExternal_product_reference ExternalSubscription
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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionId ExternalSubscription
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
"imported" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionImported ExternalSubscription
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
"in_grace_period" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionIn_grace_period ExternalSubscription
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
"last_purchased" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionLast_purchased ExternalSubscription
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..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionObject ExternalSubscription
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
"quantity" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Int
externalSubscriptionQuantity ExternalSubscription
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
"state" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionState ExternalSubscription
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
"test" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Bool
externalSubscriptionTest ExternalSubscription
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
"trial_ends_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_ends_at ExternalSubscription
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
"trial_started_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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionTrial_started_at ExternalSubscription
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..=)) (ExternalSubscription -> Maybe JsonDateTime
externalSubscriptionUpdated_at ExternalSubscription
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
"uuid" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscription -> Maybe Text
externalSubscriptionUuid ExternalSubscription
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON ExternalSubscription where
    parseJSON :: Value -> Parser ExternalSubscription
parseJSON = String
-> (Object -> Parser ExternalSubscription)
-> Value
-> Parser ExternalSubscription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ExternalSubscription" (\Object
obj -> ((((((((((((((((((((((Maybe AccountMini
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Bool
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe [ExternalPaymentPhase]
 -> Maybe ExternalProductReferenceMini
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Bool
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe Text
 -> ExternalSubscription)
-> Parser
     (Maybe AccountMini
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe AccountMini
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe [ExternalPaymentPhase]
-> Maybe ExternalProductReferenceMini
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> ExternalSubscription
ExternalSubscription Parser
  (Maybe AccountMini
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe AccountMini)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 AccountMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"account")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"activated_at")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"app_identifier")) Parser
  (Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"auto_renew")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"canceled_at")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"expires_at")) Parser
  (Maybe Text
   -> Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Text)
-> Parser
     (Maybe [ExternalPaymentPhase]
      -> Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"external_id")) Parser
  (Maybe [ExternalPaymentPhase]
   -> Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe [ExternalPaymentPhase])
-> Parser
     (Maybe ExternalProductReferenceMini
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 [ExternalPaymentPhase])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"external_payment_phases")) Parser
  (Maybe ExternalProductReferenceMini
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe ExternalProductReferenceMini)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 ExternalProductReferenceMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"external_product_reference")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 Bool
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"imported")) Parser
  (Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"in_grace_period")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"last_purchased")) Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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 Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"quantity")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"state")) Parser
  (Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> ExternalSubscription)
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
"test")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime -> Maybe Text -> ExternalSubscription)
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
"trial_ends_at")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime -> Maybe Text -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime -> Maybe Text -> ExternalSubscription)
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
"trial_started_at")) Parser (Maybe JsonDateTime -> Maybe Text -> ExternalSubscription)
-> Parser (Maybe JsonDateTime)
-> Parser (Maybe Text -> ExternalSubscription)
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")) Parser (Maybe Text -> ExternalSubscription)
-> Parser (Maybe Text) -> Parser ExternalSubscription
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
"uuid"))

-- | Create a new 'ExternalSubscription' with all required fields.
mkExternalSubscription :: ExternalSubscription
mkExternalSubscription :: ExternalSubscription
mkExternalSubscription =
    ExternalSubscription
        { externalSubscriptionAccount :: Maybe AccountMini
externalSubscriptionAccount = Maybe AccountMini
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionActivated_at :: Maybe JsonDateTime
externalSubscriptionActivated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionApp_identifier :: Maybe Text
externalSubscriptionApp_identifier = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionAuto_renew :: Maybe Bool
externalSubscriptionAuto_renew = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCanceled_at :: Maybe JsonDateTime
externalSubscriptionCanceled_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreated_at :: Maybe JsonDateTime
externalSubscriptionCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionExpires_at :: Maybe JsonDateTime
externalSubscriptionExpires_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionExternal_id :: Maybe Text
externalSubscriptionExternal_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionExternal_payment_phases :: Maybe [ExternalPaymentPhase]
externalSubscriptionExternal_payment_phases = Maybe [ExternalPaymentPhase]
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionExternal_product_reference :: Maybe ExternalProductReferenceMini
externalSubscriptionExternal_product_reference = Maybe ExternalProductReferenceMini
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionId :: Maybe Text
externalSubscriptionId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionImported :: Maybe Bool
externalSubscriptionImported = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionIn_grace_period :: Maybe Bool
externalSubscriptionIn_grace_period = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionLast_purchased :: Maybe JsonDateTime
externalSubscriptionLast_purchased = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionObject :: Maybe Text
externalSubscriptionObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionQuantity :: Maybe Int
externalSubscriptionQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionState :: Maybe Text
externalSubscriptionState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionTest :: Maybe Bool
externalSubscriptionTest = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionTrial_ends_at :: Maybe JsonDateTime
externalSubscriptionTrial_ends_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionTrial_started_at :: Maybe JsonDateTime
externalSubscriptionTrial_started_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionUpdated_at :: Maybe JsonDateTime
externalSubscriptionUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionUuid :: Maybe Text
externalSubscriptionUuid = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        }