{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.ExternalSubscriptionUpdate 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.ExternalProductReferenceUpdate
import {-# SOURCE #-} RecurlyClient.Types.ExternalSubscriptionBase
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data ExternalSubscriptionUpdate = ExternalSubscriptionUpdate
{ ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateActivated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateApp_identifier :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateAuto_renew :: (GHC.Maybe.Maybe GHC.Types.Bool)
, ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateExpires_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateExternal_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ExternalSubscriptionUpdate -> Maybe ExternalProductReferenceUpdate
externalSubscriptionUpdateExternal_product_reference :: (GHC.Maybe.Maybe ExternalProductReferenceUpdate)
, ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateImported :: (GHC.Maybe.Maybe GHC.Types.Bool)
, ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateLast_purchased :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, ExternalSubscriptionUpdate -> Maybe Int
externalSubscriptionUpdateQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
, ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateState :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_ends_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_started_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
}
deriving
( Int -> ExternalSubscriptionUpdate -> ShowS
[ExternalSubscriptionUpdate] -> ShowS
ExternalSubscriptionUpdate -> String
(Int -> ExternalSubscriptionUpdate -> ShowS)
-> (ExternalSubscriptionUpdate -> String)
-> ([ExternalSubscriptionUpdate] -> ShowS)
-> Show ExternalSubscriptionUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExternalSubscriptionUpdate -> ShowS
showsPrec :: Int -> ExternalSubscriptionUpdate -> ShowS
$cshow :: ExternalSubscriptionUpdate -> String
show :: ExternalSubscriptionUpdate -> String
$cshowList :: [ExternalSubscriptionUpdate] -> ShowS
showList :: [ExternalSubscriptionUpdate] -> ShowS
GHC.Show.Show
, ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool
(ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool)
-> (ExternalSubscriptionUpdate
-> ExternalSubscriptionUpdate -> Bool)
-> Eq ExternalSubscriptionUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool
== :: ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool
$c/= :: ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool
/= :: ExternalSubscriptionUpdate -> ExternalSubscriptionUpdate -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON ExternalSubscriptionUpdate where
toJSON :: ExternalSubscriptionUpdate -> Value
toJSON ExternalSubscriptionUpdate
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateActivated_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateApp_identifier ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateAuto_renew ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateExpires_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateExternal_id ExternalSubscriptionUpdate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (ExternalProductReferenceUpdate -> [Pair])
-> Maybe ExternalProductReferenceUpdate
-> [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])
-> (ExternalProductReferenceUpdate -> Pair)
-> ExternalProductReferenceUpdate
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionUpdate -> Maybe ExternalProductReferenceUpdate
externalSubscriptionUpdateExternal_product_reference ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateImported ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateLast_purchased ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Int
externalSubscriptionUpdateQuantity ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateState ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_ends_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_started_at ExternalSubscriptionUpdate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: ExternalSubscriptionUpdate -> Encoding
toEncoding ExternalSubscriptionUpdate
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]
-> (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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateActivated_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateApp_identifier ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateAuto_renew ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateExpires_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateExternal_id ExternalSubscriptionUpdate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (ExternalProductReferenceUpdate -> [Series])
-> Maybe ExternalProductReferenceUpdate
-> [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])
-> (ExternalProductReferenceUpdate -> Series)
-> ExternalProductReferenceUpdate
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceUpdate -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionUpdate -> Maybe ExternalProductReferenceUpdate
externalSubscriptionUpdateExternal_product_reference ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Bool
externalSubscriptionUpdateImported ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateLast_purchased ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Int
externalSubscriptionUpdateQuantity ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe Text
externalSubscriptionUpdateState ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_ends_at ExternalSubscriptionUpdate
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..=)) (ExternalSubscriptionUpdate -> Maybe JsonDateTime
externalSubscriptionUpdateTrial_started_at ExternalSubscriptionUpdate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON ExternalSubscriptionUpdate where
parseJSON :: Value -> Parser ExternalSubscriptionUpdate
parseJSON = String
-> (Object -> Parser ExternalSubscriptionUpdate)
-> Value
-> Parser ExternalSubscriptionUpdate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ExternalSubscriptionUpdate" (\Object
obj -> ((((((((((((Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate
ExternalSubscriptionUpdate Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Bool)
-> Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Text
-> Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Text)
-> Parser
(Maybe ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 ExternalProductReferenceUpdate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe ExternalProductReferenceUpdate)
-> Parser
(Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 ExternalProductReferenceUpdate)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"external_product_reference")) Parser
(Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Bool)
-> Parser
(Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
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 JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionUpdate)
-> Parser (Maybe Text)
-> Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime -> ExternalSubscriptionUpdate)
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 JsonDateTime
-> Maybe JsonDateTime -> ExternalSubscriptionUpdate)
-> Parser (Maybe JsonDateTime)
-> Parser (Maybe JsonDateTime -> ExternalSubscriptionUpdate)
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 -> ExternalSubscriptionUpdate)
-> Parser (Maybe JsonDateTime) -> Parser ExternalSubscriptionUpdate
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"))
mkExternalSubscriptionUpdate :: ExternalSubscriptionUpdate
mkExternalSubscriptionUpdate :: ExternalSubscriptionUpdate
mkExternalSubscriptionUpdate =
ExternalSubscriptionUpdate
{ externalSubscriptionUpdateActivated_at :: Maybe JsonDateTime
externalSubscriptionUpdateActivated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateApp_identifier :: Maybe Text
externalSubscriptionUpdateApp_identifier = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateAuto_renew :: Maybe Bool
externalSubscriptionUpdateAuto_renew = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateExpires_at :: Maybe JsonDateTime
externalSubscriptionUpdateExpires_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateExternal_id :: Maybe Text
externalSubscriptionUpdateExternal_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateExternal_product_reference :: Maybe ExternalProductReferenceUpdate
externalSubscriptionUpdateExternal_product_reference = Maybe ExternalProductReferenceUpdate
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateImported :: Maybe Bool
externalSubscriptionUpdateImported = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateLast_purchased :: Maybe JsonDateTime
externalSubscriptionUpdateLast_purchased = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateQuantity :: Maybe Int
externalSubscriptionUpdateQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateState :: Maybe Text
externalSubscriptionUpdateState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateTrial_ends_at :: Maybe JsonDateTime
externalSubscriptionUpdateTrial_ends_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, externalSubscriptionUpdateTrial_started_at :: Maybe JsonDateTime
externalSubscriptionUpdateTrial_started_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
}