{-# LANGUAGE ExplicitForAll #-} {-# 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 different functions to run the operation postPlans module StripeAPI.Operations.PostPlans where import qualified Control.Monad.Fail import qualified Control.Monad.Trans.Reader 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.Either 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 Data.Vector import qualified GHC.Base import qualified GHC.Classes import qualified GHC.Int import qualified GHC.Show import qualified GHC.Types import qualified Network.HTTP.Client import qualified Network.HTTP.Client as Network.HTTP.Client.Request import qualified Network.HTTP.Client as Network.HTTP.Client.Types import qualified Network.HTTP.Simple import qualified Network.HTTP.Types import qualified Network.HTTP.Types as Network.HTTP.Types.Status import qualified Network.HTTP.Types as Network.HTTP.Types.URI import qualified StripeAPI.Common import StripeAPI.Types import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | > POST /v1/plans -- -- \

You can now model subscriptions more flexibly using the \Prices API\<\/a>. It replaces the Plans API and is backwards compatible to simplify your migration.\<\/p> postPlans :: forall m. StripeAPI.Common.MonadHTTP m => -- | The request body to send PostPlansRequestBody -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostPlansResponse) postPlans body = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either PostPlansResponseError GHC.Base.id GHC.Base.. ( \response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> PostPlansResponse200 Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String Plan ) | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) -> PostPlansResponseDefault Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String Error ) | GHC.Base.otherwise -> Data.Either.Left "Missing default response type" ) response_0 ) response_0 ) (StripeAPI.Common.doBodyCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "POST") (Data.Text.pack "/v1/plans") GHC.Base.mempty (GHC.Maybe.Just body) StripeAPI.Common.RequestBodyEncodingFormData) -- | Defines the object schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification. data PostPlansRequestBody = PostPlansRequestBody { -- | active: Whether the plan is currently available for new subscriptions. Defaults to \`true\`. postPlansRequestBodyActive :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | aggregate_usage: Specifies a usage aggregation strategy for plans of \`usage_type=metered\`. Allowed values are \`sum\` for summing up all usage during a period, \`last_during_period\` for using the last usage record reported within a period, \`last_ever\` for using the last usage record ever (across period bounds) or \`max\` which uses the usage record with the maximum reported usage during a period. Defaults to \`sum\`. postPlansRequestBodyAggregateUsage :: (GHC.Maybe.Maybe PostPlansRequestBodyAggregateUsage'), -- | amount: A positive integer in %s (or 0 for a free plan) representing how much to charge on a recurring basis. postPlansRequestBodyAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | amount_decimal: Same as \`amount\`, but accepts a decimal value with at most 12 decimal places. Only one of \`amount\` and \`amount_decimal\` can be set. postPlansRequestBodyAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | billing_scheme: Describes how to compute the price per period. Either \`per_unit\` or \`tiered\`. \`per_unit\` indicates that the fixed amount (specified in \`amount\`) will be charged per unit in \`quantity\` (for plans with \`usage_type=licensed\`), or per unit of total usage (for plans with \`usage_type=metered\`). \`tiered\` indicates that the unit pricing will be computed using a tiering strategy as defined using the \`tiers\` and \`tiers_mode\` attributes. postPlansRequestBodyBillingScheme :: (GHC.Maybe.Maybe PostPlansRequestBodyBillingScheme'), -- | currency: Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies). postPlansRequestBodyCurrency :: Data.Text.Internal.Text, -- | expand: Specifies which fields in the response should be expanded. postPlansRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])), -- | id: An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes. -- -- Constraints: -- -- * Maximum length of 5000 postPlansRequestBodyId :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | interval: Specifies billing frequency. Either \`day\`, \`week\`, \`month\` or \`year\`. postPlansRequestBodyInterval :: PostPlansRequestBodyInterval', -- | interval_count: The number of intervals between subscription billings. For example, \`interval=month\` and \`interval_count=3\` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). postPlansRequestBodyIntervalCount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`. postPlansRequestBodyMetadata :: (GHC.Maybe.Maybe PostPlansRequestBodyMetadata'Variants), -- | nickname: A brief description of the plan, hidden from customers. -- -- Constraints: -- -- * Maximum length of 5000 postPlansRequestBodyNickname :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | product postPlansRequestBodyProduct :: (GHC.Maybe.Maybe PostPlansRequestBodyProduct'Variants), -- | tiers: Each element represents a pricing tier. This parameter requires \`billing_scheme\` to be set to \`tiered\`. See also the documentation for \`billing_scheme\`. postPlansRequestBodyTiers :: (GHC.Maybe.Maybe ([PostPlansRequestBodyTiers'])), -- | tiers_mode: Defines if the tiering price should be \`graduated\` or \`volume\` based. In \`volume\`-based tiering, the maximum quantity within a period determines the per unit price, in \`graduated\` tiering pricing can successively change as the quantity grows. postPlansRequestBodyTiersMode :: (GHC.Maybe.Maybe PostPlansRequestBodyTiersMode'), -- | transform_usage: Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with \`tiers\`. postPlansRequestBodyTransformUsage :: (GHC.Maybe.Maybe PostPlansRequestBodyTransformUsage'), -- | trial_period_days: Default number of trial days when subscribing a customer to this plan using [\`trial_from_plan=true\`](https:\/\/stripe.com\/docs\/api\#create_subscription-trial_from_plan). postPlansRequestBodyTrialPeriodDays :: (GHC.Maybe.Maybe GHC.Types.Int), -- | usage_type: Configures how the quantity per period should be determined. Can be either \`metered\` or \`licensed\`. \`licensed\` automatically bills the \`quantity\` set when adding it to a subscription. \`metered\` aggregates the total usage based on usage records. Defaults to \`licensed\`. postPlansRequestBodyUsageType :: (GHC.Maybe.Maybe PostPlansRequestBodyUsageType') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBody where toJSON obj = Data.Aeson.Types.Internal.object ("active" Data.Aeson.Types.ToJSON..= postPlansRequestBodyActive obj : "aggregate_usage" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAggregateUsage obj : "amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAmount obj : "amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAmountDecimal obj : "billing_scheme" Data.Aeson.Types.ToJSON..= postPlansRequestBodyBillingScheme obj : "currency" Data.Aeson.Types.ToJSON..= postPlansRequestBodyCurrency obj : "expand" Data.Aeson.Types.ToJSON..= postPlansRequestBodyExpand obj : "id" Data.Aeson.Types.ToJSON..= postPlansRequestBodyId obj : "interval" Data.Aeson.Types.ToJSON..= postPlansRequestBodyInterval obj : "interval_count" Data.Aeson.Types.ToJSON..= postPlansRequestBodyIntervalCount obj : "metadata" Data.Aeson.Types.ToJSON..= postPlansRequestBodyMetadata obj : "nickname" Data.Aeson.Types.ToJSON..= postPlansRequestBodyNickname obj : "product" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct obj : "tiers" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers obj : "tiers_mode" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiersMode obj : "transform_usage" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage obj : "trial_period_days" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTrialPeriodDays obj : "usage_type" Data.Aeson.Types.ToJSON..= postPlansRequestBodyUsageType obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("active" Data.Aeson.Types.ToJSON..= postPlansRequestBodyActive obj) GHC.Base.<> (("aggregate_usage" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAggregateUsage obj) GHC.Base.<> (("amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAmount obj) GHC.Base.<> (("amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyAmountDecimal obj) GHC.Base.<> (("billing_scheme" Data.Aeson.Types.ToJSON..= postPlansRequestBodyBillingScheme obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= postPlansRequestBodyCurrency obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postPlansRequestBodyExpand obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= postPlansRequestBodyId obj) GHC.Base.<> (("interval" Data.Aeson.Types.ToJSON..= postPlansRequestBodyInterval obj) GHC.Base.<> (("interval_count" Data.Aeson.Types.ToJSON..= postPlansRequestBodyIntervalCount obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postPlansRequestBodyMetadata obj) GHC.Base.<> (("nickname" Data.Aeson.Types.ToJSON..= postPlansRequestBodyNickname obj) GHC.Base.<> (("product" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct obj) GHC.Base.<> (("tiers" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers obj) GHC.Base.<> (("tiers_mode" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiersMode obj) GHC.Base.<> (("transform_usage" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage obj) GHC.Base.<> (("trial_period_days" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTrialPeriodDays obj) GHC.Base.<> ("usage_type" Data.Aeson.Types.ToJSON..= postPlansRequestBodyUsageType obj)))))))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBody where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostPlansRequestBody" (\obj -> (((((((((((((((((GHC.Base.pure PostPlansRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "active")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "aggregate_usage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "amount_decimal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "billing_scheme")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "interval")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "interval_count")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "nickname")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "product")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tiers")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tiers_mode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "transform_usage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "trial_period_days")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "usage_type")) -- | Create a new 'PostPlansRequestBody' with all required fields. mkPostPlansRequestBody :: -- | 'postPlansRequestBodyCurrency' Data.Text.Internal.Text -> -- | 'postPlansRequestBodyInterval' PostPlansRequestBodyInterval' -> PostPlansRequestBody mkPostPlansRequestBody postPlansRequestBodyCurrency postPlansRequestBodyInterval = PostPlansRequestBody { postPlansRequestBodyActive = GHC.Maybe.Nothing, postPlansRequestBodyAggregateUsage = GHC.Maybe.Nothing, postPlansRequestBodyAmount = GHC.Maybe.Nothing, postPlansRequestBodyAmountDecimal = GHC.Maybe.Nothing, postPlansRequestBodyBillingScheme = GHC.Maybe.Nothing, postPlansRequestBodyCurrency = postPlansRequestBodyCurrency, postPlansRequestBodyExpand = GHC.Maybe.Nothing, postPlansRequestBodyId = GHC.Maybe.Nothing, postPlansRequestBodyInterval = postPlansRequestBodyInterval, postPlansRequestBodyIntervalCount = GHC.Maybe.Nothing, postPlansRequestBodyMetadata = GHC.Maybe.Nothing, postPlansRequestBodyNickname = GHC.Maybe.Nothing, postPlansRequestBodyProduct = GHC.Maybe.Nothing, postPlansRequestBodyTiers = GHC.Maybe.Nothing, postPlansRequestBodyTiersMode = GHC.Maybe.Nothing, postPlansRequestBodyTransformUsage = GHC.Maybe.Nothing, postPlansRequestBodyTrialPeriodDays = GHC.Maybe.Nothing, postPlansRequestBodyUsageType = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.aggregate_usage@ in the specification. -- -- Specifies a usage aggregation strategy for plans of \`usage_type=metered\`. Allowed values are \`sum\` for summing up all usage during a period, \`last_during_period\` for using the last usage record reported within a period, \`last_ever\` for using the last usage record ever (across period bounds) or \`max\` which uses the usage record with the maximum reported usage during a period. Defaults to \`sum\`. data PostPlansRequestBodyAggregateUsage' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyAggregateUsage'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. PostPlansRequestBodyAggregateUsage'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"last_during_period"@ PostPlansRequestBodyAggregateUsage'EnumLastDuringPeriod | -- | Represents the JSON value @"last_ever"@ PostPlansRequestBodyAggregateUsage'EnumLastEver | -- | Represents the JSON value @"max"@ PostPlansRequestBodyAggregateUsage'EnumMax | -- | Represents the JSON value @"sum"@ PostPlansRequestBodyAggregateUsage'EnumSum deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyAggregateUsage' where toJSON (PostPlansRequestBodyAggregateUsage'Other val) = val toJSON (PostPlansRequestBodyAggregateUsage'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyAggregateUsage'EnumLastDuringPeriod) = "last_during_period" toJSON (PostPlansRequestBodyAggregateUsage'EnumLastEver) = "last_ever" toJSON (PostPlansRequestBodyAggregateUsage'EnumMax) = "max" toJSON (PostPlansRequestBodyAggregateUsage'EnumSum) = "sum" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyAggregateUsage' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "last_during_period" -> PostPlansRequestBodyAggregateUsage'EnumLastDuringPeriod | val GHC.Classes.== "last_ever" -> PostPlansRequestBodyAggregateUsage'EnumLastEver | val GHC.Classes.== "max" -> PostPlansRequestBodyAggregateUsage'EnumMax | val GHC.Classes.== "sum" -> PostPlansRequestBodyAggregateUsage'EnumSum | GHC.Base.otherwise -> PostPlansRequestBodyAggregateUsage'Other val ) -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_scheme@ in the specification. -- -- Describes how to compute the price per period. Either \`per_unit\` or \`tiered\`. \`per_unit\` indicates that the fixed amount (specified in \`amount\`) will be charged per unit in \`quantity\` (for plans with \`usage_type=licensed\`), or per unit of total usage (for plans with \`usage_type=metered\`). \`tiered\` indicates that the unit pricing will be computed using a tiering strategy as defined using the \`tiers\` and \`tiers_mode\` attributes. data PostPlansRequestBodyBillingScheme' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyBillingScheme'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. PostPlansRequestBodyBillingScheme'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"per_unit"@ PostPlansRequestBodyBillingScheme'EnumPerUnit | -- | Represents the JSON value @"tiered"@ PostPlansRequestBodyBillingScheme'EnumTiered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyBillingScheme' where toJSON (PostPlansRequestBodyBillingScheme'Other val) = val toJSON (PostPlansRequestBodyBillingScheme'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyBillingScheme'EnumPerUnit) = "per_unit" toJSON (PostPlansRequestBodyBillingScheme'EnumTiered) = "tiered" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyBillingScheme' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "per_unit" -> PostPlansRequestBodyBillingScheme'EnumPerUnit | val GHC.Classes.== "tiered" -> PostPlansRequestBodyBillingScheme'EnumTiered | GHC.Base.otherwise -> PostPlansRequestBodyBillingScheme'Other val ) -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.interval@ in the specification. -- -- Specifies billing frequency. Either \`day\`, \`week\`, \`month\` or \`year\`. data PostPlansRequestBodyInterval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyInterval'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. PostPlansRequestBodyInterval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ PostPlansRequestBodyInterval'EnumDay | -- | Represents the JSON value @"month"@ PostPlansRequestBodyInterval'EnumMonth | -- | Represents the JSON value @"week"@ PostPlansRequestBodyInterval'EnumWeek | -- | Represents the JSON value @"year"@ PostPlansRequestBodyInterval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyInterval' where toJSON (PostPlansRequestBodyInterval'Other val) = val toJSON (PostPlansRequestBodyInterval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyInterval'EnumDay) = "day" toJSON (PostPlansRequestBodyInterval'EnumMonth) = "month" toJSON (PostPlansRequestBodyInterval'EnumWeek) = "week" toJSON (PostPlansRequestBodyInterval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyInterval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> PostPlansRequestBodyInterval'EnumDay | val GHC.Classes.== "month" -> PostPlansRequestBodyInterval'EnumMonth | val GHC.Classes.== "week" -> PostPlansRequestBodyInterval'EnumWeek | val GHC.Classes.== "year" -> PostPlansRequestBodyInterval'EnumYear | GHC.Base.otherwise -> PostPlansRequestBodyInterval'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.metadata.anyOf@ in the specification. -- -- Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`. data PostPlansRequestBodyMetadata'Variants = -- | Represents the JSON value @""@ PostPlansRequestBodyMetadata'EmptyString | PostPlansRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyMetadata'Variants where toJSON (PostPlansRequestBodyMetadata'Object a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostPlansRequestBodyMetadata'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyMetadata'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostPlansRequestBodyMetadata'EmptyString | GHC.Base.otherwise -> case (PostPlansRequestBodyMetadata'Object Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the object schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.product.anyOf@ in the specification. -- -- The product whose pricing the created plan will represent. This can either be the ID of an existing product, or a dictionary containing fields used to create a [service product](https:\/\/stripe.com\/docs\/api\#product_object-type). data PostPlansRequestBodyProduct'OneOf1 = PostPlansRequestBodyProduct'OneOf1 { -- | active postPlansRequestBodyProduct'OneOf1Active :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | id -- -- Constraints: -- -- * Maximum length of 5000 postPlansRequestBodyProduct'OneOf1Id :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | metadata postPlansRequestBodyProduct'OneOf1Metadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | name -- -- Constraints: -- -- * Maximum length of 5000 postPlansRequestBodyProduct'OneOf1Name :: Data.Text.Internal.Text, -- | statement_descriptor -- -- Constraints: -- -- * Maximum length of 22 postPlansRequestBodyProduct'OneOf1StatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | tax_code -- -- Constraints: -- -- * Maximum length of 5000 postPlansRequestBodyProduct'OneOf1TaxCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | unit_label -- -- Constraints: -- -- * Maximum length of 12 postPlansRequestBodyProduct'OneOf1UnitLabel :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyProduct'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("active" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Active obj : "id" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Id obj : "metadata" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Metadata obj : "name" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Name obj : "statement_descriptor" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1StatementDescriptor obj : "tax_code" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1TaxCode obj : "unit_label" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1UnitLabel obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("active" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Active obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Id obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Metadata obj) GHC.Base.<> (("name" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1Name obj) GHC.Base.<> (("statement_descriptor" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1StatementDescriptor obj) GHC.Base.<> (("tax_code" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1TaxCode obj) GHC.Base.<> ("unit_label" Data.Aeson.Types.ToJSON..= postPlansRequestBodyProduct'OneOf1UnitLabel obj))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyProduct'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostPlansRequestBodyProduct'OneOf1" (\obj -> ((((((GHC.Base.pure PostPlansRequestBodyProduct'OneOf1 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "active")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "statement_descriptor")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_code")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "unit_label")) -- | Create a new 'PostPlansRequestBodyProduct'OneOf1' with all required fields. mkPostPlansRequestBodyProduct'OneOf1 :: -- | 'postPlansRequestBodyProduct'OneOf1Name' Data.Text.Internal.Text -> PostPlansRequestBodyProduct'OneOf1 mkPostPlansRequestBodyProduct'OneOf1 postPlansRequestBodyProduct'OneOf1Name = PostPlansRequestBodyProduct'OneOf1 { postPlansRequestBodyProduct'OneOf1Active = GHC.Maybe.Nothing, postPlansRequestBodyProduct'OneOf1Id = GHC.Maybe.Nothing, postPlansRequestBodyProduct'OneOf1Metadata = GHC.Maybe.Nothing, postPlansRequestBodyProduct'OneOf1Name = postPlansRequestBodyProduct'OneOf1Name, postPlansRequestBodyProduct'OneOf1StatementDescriptor = GHC.Maybe.Nothing, postPlansRequestBodyProduct'OneOf1TaxCode = GHC.Maybe.Nothing, postPlansRequestBodyProduct'OneOf1UnitLabel = GHC.Maybe.Nothing } -- | Defines the oneOf schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.product.anyOf@ in the specification. data PostPlansRequestBodyProduct'Variants = PostPlansRequestBodyProduct'PostPlansRequestBodyProduct'OneOf1 PostPlansRequestBodyProduct'OneOf1 | PostPlansRequestBodyProduct'Text Data.Text.Internal.Text deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyProduct'Variants where toJSON (PostPlansRequestBodyProduct'PostPlansRequestBodyProduct'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostPlansRequestBodyProduct'Text a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyProduct'Variants where parseJSON val = case (PostPlansRequestBodyProduct'PostPlansRequestBodyProduct'OneOf1 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((PostPlansRequestBodyProduct'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the object schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.tiers.items@ in the specification. data PostPlansRequestBodyTiers' = PostPlansRequestBodyTiers' { -- | flat_amount postPlansRequestBodyTiers'FlatAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | flat_amount_decimal postPlansRequestBodyTiers'FlatAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | unit_amount postPlansRequestBodyTiers'UnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | unit_amount_decimal postPlansRequestBodyTiers'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | up_to postPlansRequestBodyTiers'UpTo :: PostPlansRequestBodyTiers'UpTo'Variants } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyTiers' where toJSON obj = Data.Aeson.Types.Internal.object ("flat_amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'FlatAmount obj : "flat_amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'FlatAmountDecimal obj : "unit_amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UnitAmount obj : "unit_amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UnitAmountDecimal obj : "up_to" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UpTo obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("flat_amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'FlatAmount obj) GHC.Base.<> (("flat_amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'FlatAmountDecimal obj) GHC.Base.<> (("unit_amount" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UnitAmount obj) GHC.Base.<> (("unit_amount_decimal" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UnitAmountDecimal obj) GHC.Base.<> ("up_to" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTiers'UpTo obj))))) instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyTiers' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostPlansRequestBodyTiers'" (\obj -> ((((GHC.Base.pure PostPlansRequestBodyTiers' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "flat_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "flat_amount_decimal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "unit_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "unit_amount_decimal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "up_to")) -- | Create a new 'PostPlansRequestBodyTiers'' with all required fields. mkPostPlansRequestBodyTiers' :: -- | 'postPlansRequestBodyTiers'UpTo' PostPlansRequestBodyTiers'UpTo'Variants -> PostPlansRequestBodyTiers' mkPostPlansRequestBodyTiers' postPlansRequestBodyTiers'UpTo = PostPlansRequestBodyTiers' { postPlansRequestBodyTiers'FlatAmount = GHC.Maybe.Nothing, postPlansRequestBodyTiers'FlatAmountDecimal = GHC.Maybe.Nothing, postPlansRequestBodyTiers'UnitAmount = GHC.Maybe.Nothing, postPlansRequestBodyTiers'UnitAmountDecimal = GHC.Maybe.Nothing, postPlansRequestBodyTiers'UpTo = postPlansRequestBodyTiers'UpTo } -- | Defines the oneOf schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.tiers.items.properties.up_to.anyOf@ in the specification. data PostPlansRequestBodyTiers'UpTo'Variants = -- | Represents the JSON value @"inf"@ PostPlansRequestBodyTiers'UpTo'Inf | PostPlansRequestBodyTiers'UpTo'Int GHC.Types.Int deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyTiers'UpTo'Variants where toJSON (PostPlansRequestBodyTiers'UpTo'Int a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostPlansRequestBodyTiers'UpTo'Inf) = "inf" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyTiers'UpTo'Variants where parseJSON val = if | val GHC.Classes.== "inf" -> GHC.Base.pure PostPlansRequestBodyTiers'UpTo'Inf | GHC.Base.otherwise -> case (PostPlansRequestBodyTiers'UpTo'Int Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.tiers_mode@ in the specification. -- -- Defines if the tiering price should be \`graduated\` or \`volume\` based. In \`volume\`-based tiering, the maximum quantity within a period determines the per unit price, in \`graduated\` tiering pricing can successively change as the quantity grows. data PostPlansRequestBodyTiersMode' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyTiersMode'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. PostPlansRequestBodyTiersMode'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"graduated"@ PostPlansRequestBodyTiersMode'EnumGraduated | -- | Represents the JSON value @"volume"@ PostPlansRequestBodyTiersMode'EnumVolume deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyTiersMode' where toJSON (PostPlansRequestBodyTiersMode'Other val) = val toJSON (PostPlansRequestBodyTiersMode'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyTiersMode'EnumGraduated) = "graduated" toJSON (PostPlansRequestBodyTiersMode'EnumVolume) = "volume" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyTiersMode' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "graduated" -> PostPlansRequestBodyTiersMode'EnumGraduated | val GHC.Classes.== "volume" -> PostPlansRequestBodyTiersMode'EnumVolume | GHC.Base.otherwise -> PostPlansRequestBodyTiersMode'Other val ) -- | Defines the object schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.transform_usage@ in the specification. -- -- Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with \`tiers\`. data PostPlansRequestBodyTransformUsage' = PostPlansRequestBodyTransformUsage' { -- | divide_by postPlansRequestBodyTransformUsage'DivideBy :: GHC.Types.Int, -- | round postPlansRequestBodyTransformUsage'Round :: PostPlansRequestBodyTransformUsage'Round' } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyTransformUsage' where toJSON obj = Data.Aeson.Types.Internal.object ("divide_by" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage'DivideBy obj : "round" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage'Round obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("divide_by" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage'DivideBy obj) GHC.Base.<> ("round" Data.Aeson.Types.ToJSON..= postPlansRequestBodyTransformUsage'Round obj)) instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyTransformUsage' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostPlansRequestBodyTransformUsage'" (\obj -> (GHC.Base.pure PostPlansRequestBodyTransformUsage' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "divide_by")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "round")) -- | Create a new 'PostPlansRequestBodyTransformUsage'' with all required fields. mkPostPlansRequestBodyTransformUsage' :: -- | 'postPlansRequestBodyTransformUsage'DivideBy' GHC.Types.Int -> -- | 'postPlansRequestBodyTransformUsage'Round' PostPlansRequestBodyTransformUsage'Round' -> PostPlansRequestBodyTransformUsage' mkPostPlansRequestBodyTransformUsage' postPlansRequestBodyTransformUsage'DivideBy postPlansRequestBodyTransformUsage'Round = PostPlansRequestBodyTransformUsage' { postPlansRequestBodyTransformUsage'DivideBy = postPlansRequestBodyTransformUsage'DivideBy, postPlansRequestBodyTransformUsage'Round = postPlansRequestBodyTransformUsage'Round } -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.transform_usage.properties.round@ in the specification. data PostPlansRequestBodyTransformUsage'Round' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyTransformUsage'Round'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. PostPlansRequestBodyTransformUsage'Round'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"down"@ PostPlansRequestBodyTransformUsage'Round'EnumDown | -- | Represents the JSON value @"up"@ PostPlansRequestBodyTransformUsage'Round'EnumUp deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyTransformUsage'Round' where toJSON (PostPlansRequestBodyTransformUsage'Round'Other val) = val toJSON (PostPlansRequestBodyTransformUsage'Round'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyTransformUsage'Round'EnumDown) = "down" toJSON (PostPlansRequestBodyTransformUsage'Round'EnumUp) = "up" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyTransformUsage'Round' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "down" -> PostPlansRequestBodyTransformUsage'Round'EnumDown | val GHC.Classes.== "up" -> PostPlansRequestBodyTransformUsage'Round'EnumUp | GHC.Base.otherwise -> PostPlansRequestBodyTransformUsage'Round'Other val ) -- | Defines the enum schema located at @paths.\/v1\/plans.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.usage_type@ in the specification. -- -- Configures how the quantity per period should be determined. Can be either \`metered\` or \`licensed\`. \`licensed\` automatically bills the \`quantity\` set when adding it to a subscription. \`metered\` aggregates the total usage based on usage records. Defaults to \`licensed\`. data PostPlansRequestBodyUsageType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostPlansRequestBodyUsageType'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. PostPlansRequestBodyUsageType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"licensed"@ PostPlansRequestBodyUsageType'EnumLicensed | -- | Represents the JSON value @"metered"@ PostPlansRequestBodyUsageType'EnumMetered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostPlansRequestBodyUsageType' where toJSON (PostPlansRequestBodyUsageType'Other val) = val toJSON (PostPlansRequestBodyUsageType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostPlansRequestBodyUsageType'EnumLicensed) = "licensed" toJSON (PostPlansRequestBodyUsageType'EnumMetered) = "metered" instance Data.Aeson.Types.FromJSON.FromJSON PostPlansRequestBodyUsageType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "licensed" -> PostPlansRequestBodyUsageType'EnumLicensed | val GHC.Classes.== "metered" -> PostPlansRequestBodyUsageType'EnumMetered | GHC.Base.otherwise -> PostPlansRequestBodyUsageType'Other val ) -- | Represents a response of the operation 'postPlans'. -- -- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'PostPlansResponseError' is used. data PostPlansResponse = -- | Means either no matching case available or a parse error PostPlansResponseError GHC.Base.String | -- | Successful response. PostPlansResponse200 Plan | -- | Error response. PostPlansResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq)