{-# 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 PortalCustomerUpdate module StripeAPI.Types.PortalCustomerUpdate 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.Char8 import qualified Data.ByteString.Char8 as Data.ByteString.Internal import qualified Data.Functor import qualified Data.Scientific import qualified Data.Text import qualified 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 StripeAPI.Common import StripeAPI.TypeAlias import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.portal_customer_update@ in the specification. data PortalCustomerUpdate = PortalCustomerUpdate { -- | allowed_updates: The types of customer updates that are supported. When empty, customers are not updateable. portalCustomerUpdateAllowedUpdates :: ([PortalCustomerUpdateAllowedUpdates']), -- | enabled: Whether the feature is enabled. portalCustomerUpdateEnabled :: GHC.Types.Bool } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PortalCustomerUpdate where toJSON obj = Data.Aeson.Types.Internal.object ("allowed_updates" Data.Aeson.Types.ToJSON..= portalCustomerUpdateAllowedUpdates obj : "enabled" Data.Aeson.Types.ToJSON..= portalCustomerUpdateEnabled obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("allowed_updates" Data.Aeson.Types.ToJSON..= portalCustomerUpdateAllowedUpdates obj) GHC.Base.<> ("enabled" Data.Aeson.Types.ToJSON..= portalCustomerUpdateEnabled obj)) instance Data.Aeson.Types.FromJSON.FromJSON PortalCustomerUpdate where parseJSON = Data.Aeson.Types.FromJSON.withObject "PortalCustomerUpdate" (\obj -> (GHC.Base.pure PortalCustomerUpdate GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "allowed_updates")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "enabled")) -- | Create a new 'PortalCustomerUpdate' with all required fields. mkPortalCustomerUpdate :: -- | 'portalCustomerUpdateAllowedUpdates' [PortalCustomerUpdateAllowedUpdates'] -> -- | 'portalCustomerUpdateEnabled' GHC.Types.Bool -> PortalCustomerUpdate mkPortalCustomerUpdate portalCustomerUpdateAllowedUpdates portalCustomerUpdateEnabled = PortalCustomerUpdate { portalCustomerUpdateAllowedUpdates = portalCustomerUpdateAllowedUpdates, portalCustomerUpdateEnabled = portalCustomerUpdateEnabled } -- | Defines the enum schema located at @components.schemas.portal_customer_update.properties.allowed_updates.items@ in the specification. data PortalCustomerUpdateAllowedUpdates' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PortalCustomerUpdateAllowedUpdates'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PortalCustomerUpdateAllowedUpdates'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"address"@ PortalCustomerUpdateAllowedUpdates'EnumAddress | -- | Represents the JSON value @"email"@ PortalCustomerUpdateAllowedUpdates'EnumEmail | -- | Represents the JSON value @"phone"@ PortalCustomerUpdateAllowedUpdates'EnumPhone | -- | Represents the JSON value @"shipping"@ PortalCustomerUpdateAllowedUpdates'EnumShipping | -- | Represents the JSON value @"tax_id"@ PortalCustomerUpdateAllowedUpdates'EnumTaxId deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PortalCustomerUpdateAllowedUpdates' where toJSON (PortalCustomerUpdateAllowedUpdates'Other val) = val toJSON (PortalCustomerUpdateAllowedUpdates'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PortalCustomerUpdateAllowedUpdates'EnumAddress) = "address" toJSON (PortalCustomerUpdateAllowedUpdates'EnumEmail) = "email" toJSON (PortalCustomerUpdateAllowedUpdates'EnumPhone) = "phone" toJSON (PortalCustomerUpdateAllowedUpdates'EnumShipping) = "shipping" toJSON (PortalCustomerUpdateAllowedUpdates'EnumTaxId) = "tax_id" instance Data.Aeson.Types.FromJSON.FromJSON PortalCustomerUpdateAllowedUpdates' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "address" -> PortalCustomerUpdateAllowedUpdates'EnumAddress | val GHC.Classes.== "email" -> PortalCustomerUpdateAllowedUpdates'EnumEmail | val GHC.Classes.== "phone" -> PortalCustomerUpdateAllowedUpdates'EnumPhone | val GHC.Classes.== "shipping" -> PortalCustomerUpdateAllowedUpdates'EnumShipping | val GHC.Classes.== "tax_id" -> PortalCustomerUpdateAllowedUpdates'EnumTaxId | GHC.Base.otherwise -> PortalCustomerUpdateAllowedUpdates'Other val )