{-# 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 postSubscriptionItems
module StripeAPI.Operations.PostSubscriptionItems 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/subscription_items
--
-- \<p>Adds a new item to an existing subscription. No existing items will be changed or replaced.\<\/p>
postSubscriptionItems ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | The request body to send
  PostSubscriptionItemsRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostSubscriptionItemsResponse)
postSubscriptionItems :: PostSubscriptionItemsRequestBody
-> StripeT m (Response PostSubscriptionItemsResponse)
postSubscriptionItems PostSubscriptionItemsRequestBody
body =
  (Response ByteString -> Response PostSubscriptionItemsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostSubscriptionItemsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> PostSubscriptionItemsResponse)
-> Response ByteString -> Response PostSubscriptionItemsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> PostSubscriptionItemsResponse)
-> (PostSubscriptionItemsResponse -> PostSubscriptionItemsResponse)
-> Either String PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostSubscriptionItemsResponse
PostSubscriptionItemsResponseError PostSubscriptionItemsResponse -> PostSubscriptionItemsResponse
forall a. a -> a
GHC.Base.id
              (Either String PostSubscriptionItemsResponse
 -> PostSubscriptionItemsResponse)
-> (ByteString -> Either String PostSubscriptionItemsResponse)
-> ByteString
-> PostSubscriptionItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                             if
                                 | (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   SubscriptionItem -> PostSubscriptionItemsResponse
PostSubscriptionItemsResponse200
                                     (SubscriptionItem -> PostSubscriptionItemsResponse)
-> Either String SubscriptionItem
-> Either String PostSubscriptionItemsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String SubscriptionItem
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            SubscriptionItem
                                                      )
                                 | Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   Error -> PostSubscriptionItemsResponse
PostSubscriptionItemsResponseDefault
                                     (Error -> PostSubscriptionItemsResponse)
-> Either String Error
-> Either String PostSubscriptionItemsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            Error
                                                      )
                                 | Bool
GHC.Base.otherwise -> String -> Either String PostSubscriptionItemsResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                         )
                Response ByteString
response_0
          )
          Response ByteString
response_0
    )
    (Text
-> Text
-> [QueryParameter]
-> Maybe PostSubscriptionItemsRequestBody
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack String
"/v1/subscription_items") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty (PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBody
forall a. a -> Maybe a
GHC.Maybe.Just PostSubscriptionItemsRequestBody
body) RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostSubscriptionItemsRequestBody = PostSubscriptionItemsRequestBody
  { -- | billing_thresholds: Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
    PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
postSubscriptionItemsRequestBodyBillingThresholds :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants),
    -- | expand: Specifies which fields in the response should be expanded.
    PostSubscriptionItemsRequestBody -> Maybe [Text]
postSubscriptionItemsRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | 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\`.
    PostSubscriptionItemsRequestBody -> Maybe Object
postSubscriptionItemsRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | payment_behavior: Use \`allow_incomplete\` to transition the subscription to \`status=past_due\` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription\'s invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication) for Billing to learn more. This is the default behavior.
    --
    -- Use \`default_incomplete\` to transition the subscription to \`status=past_due\` when payment is required and await explicit confirmation of the invoice\'s payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication), or collecting a mandate for a bank debit payment method.
    --
    -- Use \`pending_if_incomplete\` to update the subscription using [pending updates](https:\/\/stripe.com\/docs\/billing\/subscriptions\/pending-updates). When you use \`pending_if_incomplete\` you can only pass the parameters [supported by pending updates](https:\/\/stripe.com\/docs\/billing\/pending-updates-reference\#supported-attributes).
    --
    -- Use \`error_if_incomplete\` if you want Stripe to return an HTTP 402 status code if a subscription\'s invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https:\/\/stripe.com\/docs\/upgrades\#2019-03-14) to learn more.
    PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
postSubscriptionItemsRequestBodyPaymentBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'),
    -- | price: The ID of the price object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostSubscriptionItemsRequestBody -> Maybe Text
postSubscriptionItemsRequestBodyPrice :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | price_data: Data used to generate a new [Price](https:\/\/stripe.com\/docs\/api\/prices) object inline.
    PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPriceData'
postSubscriptionItemsRequestBodyPriceData :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPriceData'),
    -- | proration_behavior: Determines how to handle [prorations](https:\/\/stripe.com\/docs\/subscriptions\/billing-cycle\#prorations) when the billing cycle changes (e.g., when switching plans, resetting \`billing_cycle_anchor=now\`, or starting a trial), or if an item\'s \`quantity\` changes. Valid values are \`create_prorations\`, \`none\`, or \`always_invoice\`.
    --
    -- Passing \`create_prorations\` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https:\/\/stripe.com\/docs\/subscriptions\/upgrading-downgrading\#immediate-payment). In order to always invoice immediately for prorations, pass \`always_invoice\`.
    --
    -- Prorations can be disabled by passing \`none\`.
    PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
postSubscriptionItemsRequestBodyProrationBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyProrationBehavior'),
    -- | proration_date: If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https:\/\/stripe.com\/docs\/api\#retrieve_customer_invoice) endpoint.
    PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyProrationDate :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | quantity: The quantity you\'d like to apply to the subscription item you\'re creating.
    PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyQuantity :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | subscription: The identifier of the subscription to modify.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostSubscriptionItemsRequestBody -> Text
postSubscriptionItemsRequestBodySubscription :: Data.Text.Internal.Text,
    -- | tax_rates: A list of [Tax Rate](https:\/\/stripe.com\/docs\/api\/tax_rates) ids. These Tax Rates will override the [\`default_tax_rates\`](https:\/\/stripe.com\/docs\/api\/subscriptions\/create\#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
    PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
postSubscriptionItemsRequestBodyTaxRates :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants)
  }
  deriving
    ( Int -> PostSubscriptionItemsRequestBody -> ShowS
[PostSubscriptionItemsRequestBody] -> ShowS
PostSubscriptionItemsRequestBody -> String
(Int -> PostSubscriptionItemsRequestBody -> ShowS)
-> (PostSubscriptionItemsRequestBody -> String)
-> ([PostSubscriptionItemsRequestBody] -> ShowS)
-> Show PostSubscriptionItemsRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBody] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBody] -> ShowS
show :: PostSubscriptionItemsRequestBody -> String
$cshow :: PostSubscriptionItemsRequestBody -> String
showsPrec :: Int -> PostSubscriptionItemsRequestBody -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsRequestBody -> ShowS
GHC.Show.Show,
      PostSubscriptionItemsRequestBody
-> PostSubscriptionItemsRequestBody -> Bool
(PostSubscriptionItemsRequestBody
 -> PostSubscriptionItemsRequestBody -> Bool)
-> (PostSubscriptionItemsRequestBody
    -> PostSubscriptionItemsRequestBody -> Bool)
-> Eq PostSubscriptionItemsRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBody
-> PostSubscriptionItemsRequestBody -> Bool
$c/= :: PostSubscriptionItemsRequestBody
-> PostSubscriptionItemsRequestBody -> Bool
== :: PostSubscriptionItemsRequestBody
-> PostSubscriptionItemsRequestBody -> Bool
$c== :: PostSubscriptionItemsRequestBody
-> PostSubscriptionItemsRequestBody -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBody where
  toJSON :: PostSubscriptionItemsRequestBody -> Value
toJSON PostSubscriptionItemsRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"billing_thresholds" Text
-> Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
postSubscriptionItemsRequestBodyBillingThresholds PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe [Text]
postSubscriptionItemsRequestBodyExpand PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Object
postSubscriptionItemsRequestBodyMetadata PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"payment_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
postSubscriptionItemsRequestBodyPaymentBehavior PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"price" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Text
postSubscriptionItemsRequestBodyPrice PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"price_data" Text -> Maybe PostSubscriptionItemsRequestBodyPriceData' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPriceData'
postSubscriptionItemsRequestBodyPriceData PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"proration_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
postSubscriptionItemsRequestBodyProrationBehavior PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"proration_date" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyProrationDate PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyQuantity PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subscription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Text
postSubscriptionItemsRequestBodySubscription PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_rates" Text
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
postSubscriptionItemsRequestBodyTaxRates PostSubscriptionItemsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostSubscriptionItemsRequestBody -> Encoding
toEncoding PostSubscriptionItemsRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"billing_thresholds" Text
-> Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
postSubscriptionItemsRequestBodyBillingThresholds PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe [Text]
postSubscriptionItemsRequestBodyExpand PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Object
postSubscriptionItemsRequestBodyMetadata PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"payment_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
postSubscriptionItemsRequestBodyPaymentBehavior PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"price" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Text
postSubscriptionItemsRequestBodyPrice PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"price_data" Text -> Maybe PostSubscriptionItemsRequestBodyPriceData' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyPriceData'
postSubscriptionItemsRequestBodyPriceData PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"proration_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
postSubscriptionItemsRequestBodyProrationBehavior PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"proration_date" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyProrationDate PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Maybe Int
postSubscriptionItemsRequestBodyQuantity PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subscription" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody -> Text
postSubscriptionItemsRequestBodySubscription PostSubscriptionItemsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"tax_rates" Text
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBody
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
postSubscriptionItemsRequestBodyTaxRates PostSubscriptionItemsRequestBody
obj)))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBody where
  parseJSON :: Value -> Parser PostSubscriptionItemsRequestBody
parseJSON = String
-> (Object -> Parser PostSubscriptionItemsRequestBody)
-> Value
-> Parser PostSubscriptionItemsRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostSubscriptionItemsRequestBody" (\Object
obj -> (((((((((((Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
 -> Maybe [Text]
 -> Maybe Object
 -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
 -> Maybe Text
 -> Maybe PostSubscriptionItemsRequestBodyPriceData'
 -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
 -> Maybe Int
 -> Maybe Int
 -> Text
 -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
 -> PostSubscriptionItemsRequestBody)
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
      -> Maybe [Text]
      -> Maybe Object
      -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
      -> Maybe Text
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Maybe [Text]
-> Maybe Object
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
-> Maybe Text
-> Maybe PostSubscriptionItemsRequestBodyPriceData'
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
-> Maybe Int
-> Maybe Int
-> Text
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBody
PostSubscriptionItemsRequestBody Parser
  (Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
   -> Maybe [Text]
   -> Maybe Object
   -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
   -> Maybe Text
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants)
-> Parser
     (Maybe [Text]
      -> Maybe Object
      -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
      -> Maybe Text
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"billing_thresholds")) Parser
  (Maybe [Text]
   -> Maybe Object
   -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
   -> Maybe Text
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Object
      -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
      -> Maybe Text
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"expand")) Parser
  (Maybe Object
   -> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
   -> Maybe Text
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe Object)
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
      -> Maybe Text
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
  (Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
   -> Maybe Text
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe PostSubscriptionItemsRequestBodyPaymentBehavior')
-> Parser
     (Maybe Text
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostSubscriptionItemsRequestBodyPaymentBehavior')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"payment_behavior")) Parser
  (Maybe Text
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyPriceData'
      -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"price")) Parser
  (Maybe PostSubscriptionItemsRequestBodyPriceData'
   -> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe PostSubscriptionItemsRequestBodyPriceData')
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
      -> Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostSubscriptionItemsRequestBodyPriceData')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"price_data")) Parser
  (Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
   -> Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyProrationBehavior')
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyProrationBehavior')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"proration_behavior")) Parser
  (Maybe Int
   -> Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"proration_date")) Parser
  (Maybe Int
   -> Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe Int)
-> Parser
     (Text
      -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"quantity")) Parser
  (Text
   -> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser Text
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
      -> PostSubscriptionItemsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"subscription")) Parser
  (Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
   -> PostSubscriptionItemsRequestBody)
-> Parser (Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants)
-> Parser PostSubscriptionItemsRequestBody
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_rates"))

-- | Create a new 'PostSubscriptionItemsRequestBody' with all required fields.
mkPostSubscriptionItemsRequestBody ::
  -- | 'postSubscriptionItemsRequestBodySubscription'
  Data.Text.Internal.Text ->
  PostSubscriptionItemsRequestBody
mkPostSubscriptionItemsRequestBody :: Text -> PostSubscriptionItemsRequestBody
mkPostSubscriptionItemsRequestBody Text
postSubscriptionItemsRequestBodySubscription =
  PostSubscriptionItemsRequestBody :: Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Maybe [Text]
-> Maybe Object
-> Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
-> Maybe Text
-> Maybe PostSubscriptionItemsRequestBodyPriceData'
-> Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
-> Maybe Int
-> Maybe Int
-> Text
-> Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBody
PostSubscriptionItemsRequestBody
    { postSubscriptionItemsRequestBodyBillingThresholds :: Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
postSubscriptionItemsRequestBodyBillingThresholds = Maybe PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyExpand :: Maybe [Text]
postSubscriptionItemsRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyMetadata :: Maybe Object
postSubscriptionItemsRequestBodyMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyPaymentBehavior :: Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
postSubscriptionItemsRequestBodyPaymentBehavior = Maybe PostSubscriptionItemsRequestBodyPaymentBehavior'
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyPrice :: Maybe Text
postSubscriptionItemsRequestBodyPrice = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyPriceData :: Maybe PostSubscriptionItemsRequestBodyPriceData'
postSubscriptionItemsRequestBodyPriceData = Maybe PostSubscriptionItemsRequestBodyPriceData'
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyProrationBehavior :: Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
postSubscriptionItemsRequestBodyProrationBehavior = Maybe PostSubscriptionItemsRequestBodyProrationBehavior'
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyProrationDate :: Maybe Int
postSubscriptionItemsRequestBodyProrationDate = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyQuantity :: Maybe Int
postSubscriptionItemsRequestBodyQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodySubscription :: Text
postSubscriptionItemsRequestBodySubscription = Text
postSubscriptionItemsRequestBodySubscription,
      postSubscriptionItemsRequestBodyTaxRates :: Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
postSubscriptionItemsRequestBodyTaxRates = Maybe PostSubscriptionItemsRequestBodyTaxRates'Variants
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_thresholds.anyOf@ in the specification.
data PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 = PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
  { -- | usage_gte
    PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte :: GHC.Types.Int
  }
  deriving
    ( Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> ShowS
[PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1] -> ShowS
PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> String
(Int
 -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
 -> ShowS)
-> (PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
    -> String)
-> ([PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1]
    -> ShowS)
-> Show PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1] -> ShowS
show :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> String
$cshow :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> String
showsPrec :: Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> ShowS
$cshowsPrec :: Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> ShowS
GHC.Show.Show,
      PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Bool
(PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
 -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
 -> Bool)
-> (PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
    -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
    -> Bool)
-> Eq PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Bool
$c/= :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Bool
== :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Bool
$c== :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 where
  toJSON :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Value
toJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"usage_gte" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> Encoding
toEncoding PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"usage_gte" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
obj)

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 where
  parseJSON :: Value
-> Parser PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
parseJSON = String
-> (Object
    -> Parser PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1)
-> Value
-> Parser PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1" (\Object
obj -> (Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1)
-> Parser
     (Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 Parser
  (Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1)
-> Parser Int
-> Parser PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"usage_gte"))

-- | Create a new 'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1' with all required fields.
mkPostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 ::
  -- | 'postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte'
  GHC.Types.Int ->
  PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
mkPostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 :: Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
mkPostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte = PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 :: Int -> PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 {postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte :: Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte = Int
postSubscriptionItemsRequestBodyBillingThresholds'OneOf1UsageGte}

-- | Defines the oneOf schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.billing_thresholds.anyOf@ in the specification.
--
-- Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
data PostSubscriptionItemsRequestBodyBillingThresholds'Variants
  = -- | Represents the JSON value @""@
    PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString
  | PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
  deriving (Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> ShowS
[PostSubscriptionItemsRequestBodyBillingThresholds'Variants]
-> ShowS
PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> String
(Int
 -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
 -> ShowS)
-> (PostSubscriptionItemsRequestBodyBillingThresholds'Variants
    -> String)
-> ([PostSubscriptionItemsRequestBodyBillingThresholds'Variants]
    -> ShowS)
-> Show PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyBillingThresholds'Variants]
-> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyBillingThresholds'Variants]
-> ShowS
show :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> String
$cshow :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> String
showsPrec :: Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> ShowS
$cshowsPrec :: Int
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Bool
(PostSubscriptionItemsRequestBodyBillingThresholds'Variants
 -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
 -> Bool)
-> (PostSubscriptionItemsRequestBodyBillingThresholds'Variants
    -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
    -> Bool)
-> Eq PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Bool
$c/= :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Bool
== :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Bool
$c== :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyBillingThresholds'Variants where
  toJSON :: PostSubscriptionItemsRequestBodyBillingThresholds'Variants -> Value
toJSON (PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
a) = PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
a
  toJSON (PostSubscriptionItemsRequestBodyBillingThresholds'Variants
PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString) = Value
""

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyBillingThresholds'Variants where
  parseJSON :: Value
-> Parser
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
parseJSON Value
val =
    if
        | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Parser
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostSubscriptionItemsRequestBodyBillingThresholds'Variants
PostSubscriptionItemsRequestBodyBillingThresholds'EmptyString
        | Bool
GHC.Base.otherwise -> case (PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
PostSubscriptionItemsRequestBodyBillingThresholds'PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1 (PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
 -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants)
-> Result PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
-> Result
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value
-> Result PostSubscriptionItemsRequestBodyBillingThresholds'OneOf1
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Result
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Result
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String
-> Result
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
          Data.Aeson.Types.Internal.Success PostSubscriptionItemsRequestBodyBillingThresholds'Variants
a -> PostSubscriptionItemsRequestBodyBillingThresholds'Variants
-> Parser
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostSubscriptionItemsRequestBodyBillingThresholds'Variants
a
          Data.Aeson.Types.Internal.Error String
a -> String
-> Parser
     PostSubscriptionItemsRequestBodyBillingThresholds'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_behavior@ in the specification.
--
-- Use \`allow_incomplete\` to transition the subscription to \`status=past_due\` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription\'s invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication) for Billing to learn more. This is the default behavior.
--
-- Use \`default_incomplete\` to transition the subscription to \`status=past_due\` when payment is required and await explicit confirmation of the invoice\'s payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https:\/\/stripe.com\/docs\/billing\/migration\/strong-customer-authentication), or collecting a mandate for a bank debit payment method.
--
-- Use \`pending_if_incomplete\` to update the subscription using [pending updates](https:\/\/stripe.com\/docs\/billing\/subscriptions\/pending-updates). When you use \`pending_if_incomplete\` you can only pass the parameters [supported by pending updates](https:\/\/stripe.com\/docs\/billing\/pending-updates-reference\#supported-attributes).
--
-- Use \`error_if_incomplete\` if you want Stripe to return an HTTP 402 status code if a subscription\'s invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https:\/\/stripe.com\/docs\/upgrades\#2019-03-14) to learn more.
data PostSubscriptionItemsRequestBodyPaymentBehavior'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSubscriptionItemsRequestBodyPaymentBehavior'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.
    PostSubscriptionItemsRequestBodyPaymentBehavior'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"allow_incomplete"@
    PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete
  | -- | Represents the JSON value @"default_incomplete"@
    PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete
  | -- | Represents the JSON value @"error_if_incomplete"@
    PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete
  | -- | Represents the JSON value @"pending_if_incomplete"@
    PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete
  deriving (Int -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> ShowS
[PostSubscriptionItemsRequestBodyPaymentBehavior'] -> ShowS
PostSubscriptionItemsRequestBodyPaymentBehavior' -> String
(Int -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> ShowS)
-> (PostSubscriptionItemsRequestBodyPaymentBehavior' -> String)
-> ([PostSubscriptionItemsRequestBodyPaymentBehavior'] -> ShowS)
-> Show PostSubscriptionItemsRequestBodyPaymentBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyPaymentBehavior'] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyPaymentBehavior'] -> ShowS
show :: PostSubscriptionItemsRequestBodyPaymentBehavior' -> String
$cshow :: PostSubscriptionItemsRequestBodyPaymentBehavior' -> String
showsPrec :: Int -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyPaymentBehavior'
-> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool
(PostSubscriptionItemsRequestBodyPaymentBehavior'
 -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool)
-> (PostSubscriptionItemsRequestBodyPaymentBehavior'
    -> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool)
-> Eq PostSubscriptionItemsRequestBodyPaymentBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyPaymentBehavior'
-> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool
$c/= :: PostSubscriptionItemsRequestBodyPaymentBehavior'
-> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool
== :: PostSubscriptionItemsRequestBodyPaymentBehavior'
-> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool
$c== :: PostSubscriptionItemsRequestBodyPaymentBehavior'
-> PostSubscriptionItemsRequestBodyPaymentBehavior' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPaymentBehavior' where
  toJSON :: PostSubscriptionItemsRequestBodyPaymentBehavior' -> Value
toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'Other Value
val) = Value
val
  toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete) = Value
"allow_incomplete"
  toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete) = Value
"default_incomplete"
  toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete) = Value
"error_if_incomplete"
  toJSON (PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete) = Value
"pending_if_incomplete"

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPaymentBehavior' where
  parseJSON :: Value -> Parser PostSubscriptionItemsRequestBodyPaymentBehavior'
parseJSON Value
val =
    PostSubscriptionItemsRequestBodyPaymentBehavior'
-> Parser PostSubscriptionItemsRequestBodyPaymentBehavior'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"allow_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumAllowIncomplete
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"default_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumDefaultIncomplete
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"error_if_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumErrorIfIncomplete
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pending_if_incomplete" -> PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'EnumPendingIfIncomplete
            | Bool
GHC.Base.otherwise -> Value -> PostSubscriptionItemsRequestBodyPaymentBehavior'
PostSubscriptionItemsRequestBodyPaymentBehavior'Other Value
val
      )

-- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data@ in the specification.
--
-- Data used to generate a new [Price](https:\/\/stripe.com\/docs\/api\/prices) object inline.
data PostSubscriptionItemsRequestBodyPriceData' = PostSubscriptionItemsRequestBodyPriceData'
  { -- | currency
    PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Currency :: Data.Text.Internal.Text,
    -- | product
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Product :: Data.Text.Internal.Text,
    -- | recurring
    PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring :: PostSubscriptionItemsRequestBodyPriceData'Recurring',
    -- | tax_behavior
    PostSubscriptionItemsRequestBodyPriceData'
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
postSubscriptionItemsRequestBodyPriceData'TaxBehavior :: (GHC.Maybe.Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'),
    -- | unit_amount
    PostSubscriptionItemsRequestBodyPriceData' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'UnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | unit_amount_decimal
    PostSubscriptionItemsRequestBodyPriceData' -> Maybe Text
postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PostSubscriptionItemsRequestBodyPriceData' -> ShowS
[PostSubscriptionItemsRequestBodyPriceData'] -> ShowS
PostSubscriptionItemsRequestBodyPriceData' -> String
(Int -> PostSubscriptionItemsRequestBodyPriceData' -> ShowS)
-> (PostSubscriptionItemsRequestBodyPriceData' -> String)
-> ([PostSubscriptionItemsRequestBodyPriceData'] -> ShowS)
-> Show PostSubscriptionItemsRequestBodyPriceData'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyPriceData'] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyPriceData'] -> ShowS
show :: PostSubscriptionItemsRequestBodyPriceData' -> String
$cshow :: PostSubscriptionItemsRequestBodyPriceData' -> String
showsPrec :: Int -> PostSubscriptionItemsRequestBodyPriceData' -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsRequestBodyPriceData' -> ShowS
GHC.Show.Show,
      PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData' -> Bool
(PostSubscriptionItemsRequestBodyPriceData'
 -> PostSubscriptionItemsRequestBodyPriceData' -> Bool)
-> (PostSubscriptionItemsRequestBodyPriceData'
    -> PostSubscriptionItemsRequestBodyPriceData' -> Bool)
-> Eq PostSubscriptionItemsRequestBodyPriceData'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData' -> Bool
$c/= :: PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData' -> Bool
== :: PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData' -> Bool
$c== :: PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData' where
  toJSON :: PostSubscriptionItemsRequestBodyPriceData' -> Value
toJSON PostSubscriptionItemsRequestBodyPriceData'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Currency PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"product" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Product PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"recurring" Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
postSubscriptionItemsRequestBodyPriceData'TaxBehavior PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'UnitAmount PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount_decimal" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Maybe Text
postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal PostSubscriptionItemsRequestBodyPriceData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostSubscriptionItemsRequestBodyPriceData' -> Encoding
toEncoding PostSubscriptionItemsRequestBodyPriceData'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Currency PostSubscriptionItemsRequestBodyPriceData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"product" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Text
postSubscriptionItemsRequestBodyPriceData'Product PostSubscriptionItemsRequestBodyPriceData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"recurring" Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring PostSubscriptionItemsRequestBodyPriceData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_behavior" Text
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
postSubscriptionItemsRequestBodyPriceData'TaxBehavior PostSubscriptionItemsRequestBodyPriceData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'UnitAmount PostSubscriptionItemsRequestBodyPriceData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"unit_amount_decimal" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData' -> Maybe Text
postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal PostSubscriptionItemsRequestBodyPriceData'
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData' where
  parseJSON :: Value -> Parser PostSubscriptionItemsRequestBodyPriceData'
parseJSON = String
-> (Object -> Parser PostSubscriptionItemsRequestBodyPriceData')
-> Value
-> Parser PostSubscriptionItemsRequestBodyPriceData'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostSubscriptionItemsRequestBodyPriceData'" (\Object
obj -> ((((((Text
 -> Text
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring'
 -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
 -> Maybe Int
 -> Maybe Text
 -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser
     (Text
      -> Text
      -> PostSubscriptionItemsRequestBodyPriceData'Recurring'
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
      -> Maybe Int
      -> Maybe Text
      -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> Maybe Int
-> Maybe Text
-> PostSubscriptionItemsRequestBodyPriceData'
PostSubscriptionItemsRequestBodyPriceData' Parser
  (Text
   -> Text
   -> PostSubscriptionItemsRequestBodyPriceData'Recurring'
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
   -> Maybe Int
   -> Maybe Text
   -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser Text
-> Parser
     (Text
      -> PostSubscriptionItemsRequestBodyPriceData'Recurring'
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
      -> Maybe Int
      -> Maybe Text
      -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"currency")) Parser
  (Text
   -> PostSubscriptionItemsRequestBodyPriceData'Recurring'
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
   -> Maybe Int
   -> Maybe Text
   -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser Text
-> Parser
     (PostSubscriptionItemsRequestBodyPriceData'Recurring'
      -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
      -> Maybe Int
      -> Maybe Text
      -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"product")) Parser
  (PostSubscriptionItemsRequestBodyPriceData'Recurring'
   -> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
   -> Maybe Int
   -> Maybe Text
   -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
      -> Maybe Int
      -> Maybe Text
      -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"recurring")) Parser
  (Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
   -> Maybe Int
   -> Maybe Text
   -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior')
-> Parser
     (Maybe Int
      -> Maybe Text -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_behavior")) Parser
  (Maybe Int
   -> Maybe Text -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> PostSubscriptionItemsRequestBodyPriceData')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"unit_amount")) Parser (Maybe Text -> PostSubscriptionItemsRequestBodyPriceData')
-> Parser (Maybe Text)
-> Parser PostSubscriptionItemsRequestBodyPriceData'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"unit_amount_decimal"))

-- | Create a new 'PostSubscriptionItemsRequestBodyPriceData'' with all required fields.
mkPostSubscriptionItemsRequestBodyPriceData' ::
  -- | 'postSubscriptionItemsRequestBodyPriceData'Currency'
  Data.Text.Internal.Text ->
  -- | 'postSubscriptionItemsRequestBodyPriceData'Product'
  Data.Text.Internal.Text ->
  -- | 'postSubscriptionItemsRequestBodyPriceData'Recurring'
  PostSubscriptionItemsRequestBodyPriceData'Recurring' ->
  PostSubscriptionItemsRequestBodyPriceData'
mkPostSubscriptionItemsRequestBodyPriceData' :: Text
-> Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'
mkPostSubscriptionItemsRequestBodyPriceData' Text
postSubscriptionItemsRequestBodyPriceData'Currency Text
postSubscriptionItemsRequestBodyPriceData'Product PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring =
  PostSubscriptionItemsRequestBodyPriceData' :: Text
-> Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> Maybe Int
-> Maybe Text
-> PostSubscriptionItemsRequestBodyPriceData'
PostSubscriptionItemsRequestBodyPriceData'
    { postSubscriptionItemsRequestBodyPriceData'Currency :: Text
postSubscriptionItemsRequestBodyPriceData'Currency = Text
postSubscriptionItemsRequestBodyPriceData'Currency,
      postSubscriptionItemsRequestBodyPriceData'Product :: Text
postSubscriptionItemsRequestBodyPriceData'Product = Text
postSubscriptionItemsRequestBodyPriceData'Product,
      postSubscriptionItemsRequestBodyPriceData'Recurring :: PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring = PostSubscriptionItemsRequestBodyPriceData'Recurring'
postSubscriptionItemsRequestBodyPriceData'Recurring,
      postSubscriptionItemsRequestBodyPriceData'TaxBehavior :: Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
postSubscriptionItemsRequestBodyPriceData'TaxBehavior = Maybe PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyPriceData'UnitAmount :: Maybe Int
postSubscriptionItemsRequestBodyPriceData'UnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal :: Maybe Text
postSubscriptionItemsRequestBodyPriceData'UnitAmountDecimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring@ in the specification.
data PostSubscriptionItemsRequestBodyPriceData'Recurring' = PostSubscriptionItemsRequestBodyPriceData'Recurring'
  { -- | interval
    PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval',
    -- | interval_count
    PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount :: (GHC.Maybe.Maybe GHC.Types.Int)
  }
  deriving
    ( Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> ShowS
[PostSubscriptionItemsRequestBodyPriceData'Recurring'] -> ShowS
PostSubscriptionItemsRequestBodyPriceData'Recurring' -> String
(Int
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> ShowS)
-> (PostSubscriptionItemsRequestBodyPriceData'Recurring' -> String)
-> ([PostSubscriptionItemsRequestBodyPriceData'Recurring']
    -> ShowS)
-> Show PostSubscriptionItemsRequestBodyPriceData'Recurring'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyPriceData'Recurring'] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyPriceData'Recurring'] -> ShowS
show :: PostSubscriptionItemsRequestBodyPriceData'Recurring' -> String
$cshow :: PostSubscriptionItemsRequestBodyPriceData'Recurring' -> String
showsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> ShowS
$cshowsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> ShowS
GHC.Show.Show,
      PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool
(PostSubscriptionItemsRequestBodyPriceData'Recurring'
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool)
-> (PostSubscriptionItemsRequestBodyPriceData'Recurring'
    -> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool)
-> Eq PostSubscriptionItemsRequestBodyPriceData'Recurring'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool
$c/= :: PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool
== :: PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool
$c== :: PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'Recurring' where
  toJSON :: PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Value
toJSON PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"interval" Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"interval_count" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Encoding
toEncoding PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"interval" Text
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'Recurring'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"interval_count" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostSubscriptionItemsRequestBodyPriceData'Recurring' -> Maybe Int
postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount PostSubscriptionItemsRequestBodyPriceData'Recurring'
obj))

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'Recurring' where
  parseJSON :: Value
-> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring'
parseJSON = String
-> (Object
    -> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring')
-> Value
-> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostSubscriptionItemsRequestBodyPriceData'Recurring'" (\Object
obj -> ((PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
 -> Maybe Int
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring')
-> Parser
     (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
      -> Maybe Int
      -> PostSubscriptionItemsRequestBodyPriceData'Recurring')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Maybe Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
PostSubscriptionItemsRequestBodyPriceData'Recurring' Parser
  (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
   -> Maybe Int
   -> PostSubscriptionItemsRequestBodyPriceData'Recurring')
-> Parser
     PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Parser
     (Maybe Int -> PostSubscriptionItemsRequestBodyPriceData'Recurring')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"interval")) Parser
  (Maybe Int -> PostSubscriptionItemsRequestBodyPriceData'Recurring')
-> Parser (Maybe Int)
-> Parser PostSubscriptionItemsRequestBodyPriceData'Recurring'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"interval_count"))

-- | Create a new 'PostSubscriptionItemsRequestBodyPriceData'Recurring'' with all required fields.
mkPostSubscriptionItemsRequestBodyPriceData'Recurring' ::
  -- | 'postSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
  PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' ->
  PostSubscriptionItemsRequestBodyPriceData'Recurring'
mkPostSubscriptionItemsRequestBodyPriceData'Recurring' :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
mkPostSubscriptionItemsRequestBodyPriceData'Recurring' PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval =
  PostSubscriptionItemsRequestBodyPriceData'Recurring' :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Maybe Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'
PostSubscriptionItemsRequestBodyPriceData'Recurring'
    { postSubscriptionItemsRequestBodyPriceData'Recurring'Interval :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval = PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
postSubscriptionItemsRequestBodyPriceData'Recurring'Interval,
      postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount :: Maybe Int
postSubscriptionItemsRequestBodyPriceData'Recurring'IntervalCount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.recurring.properties.interval@ in the specification.
data PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'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.
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"day"@
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay
  | -- | Represents the JSON value @"month"@
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth
  | -- | Represents the JSON value @"week"@
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek
  | -- | Represents the JSON value @"year"@
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear
  deriving (Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> ShowS
[PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval']
-> ShowS
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> String
(Int
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
 -> ShowS)
-> (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
    -> String)
-> ([PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval']
    -> ShowS)
-> Show
     PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval']
-> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval']
-> ShowS
show :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> String
$cshow :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> String
showsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> ShowS
$cshowsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Bool
(PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
 -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
 -> Bool)
-> (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
    -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
    -> Bool)
-> Eq PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Bool
$c/= :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Bool
== :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Bool
$c== :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' where
  toJSON :: PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Value
toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Other Value
val) = Value
val
  toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay) = Value
"day"
  toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth) = Value
"month"
  toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek) = Value
"week"
  toJSON (PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear) = Value
"year"

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval' where
  parseJSON :: Value
-> Parser
     PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
parseJSON Value
val =
    PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
-> Parser
     PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"day" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumDay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumMonth
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumWeek
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"year" -> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'EnumYear
            | Bool
GHC.Base.otherwise -> Value
-> PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'
PostSubscriptionItemsRequestBodyPriceData'Recurring'Interval'Other Value
val
      )

-- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.price_data.properties.tax_behavior@ in the specification.
data PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'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.
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"exclusive"@
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive
  | -- | Represents the JSON value @"inclusive"@
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive
  | -- | Represents the JSON value @"unspecified"@
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified
  deriving (Int
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> ShowS
[PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'] -> ShowS
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> String
(Int
 -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> ShowS)
-> (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
    -> String)
-> ([PostSubscriptionItemsRequestBodyPriceData'TaxBehavior']
    -> ShowS)
-> Show PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'] -> ShowS
show :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> String
$cshow :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> String
showsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> ShowS
$cshowsPrec :: Int
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool
(PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
 -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool)
-> (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
    -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool)
-> Eq PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool
$c/= :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool
== :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool
$c== :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' where
  toJSON :: PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' -> Value
toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Other Value
val) = Value
val
  toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive) = Value
"exclusive"
  toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive) = Value
"inclusive"
  toJSON (PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified) = Value
"unspecified"

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyPriceData'TaxBehavior' where
  parseJSON :: Value
-> Parser PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
parseJSON Value
val =
    PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
-> Parser PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"exclusive" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumExclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inclusive" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumInclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unspecified" -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'EnumUnspecified
            | Bool
GHC.Base.otherwise -> Value -> PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'
PostSubscriptionItemsRequestBodyPriceData'TaxBehavior'Other Value
val
      )

-- | Defines the enum schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.proration_behavior@ in the specification.
--
-- Determines how to handle [prorations](https:\/\/stripe.com\/docs\/subscriptions\/billing-cycle\#prorations) when the billing cycle changes (e.g., when switching plans, resetting \`billing_cycle_anchor=now\`, or starting a trial), or if an item\'s \`quantity\` changes. Valid values are \`create_prorations\`, \`none\`, or \`always_invoice\`.
--
-- Passing \`create_prorations\` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https:\/\/stripe.com\/docs\/subscriptions\/upgrading-downgrading\#immediate-payment). In order to always invoice immediately for prorations, pass \`always_invoice\`.
--
-- Prorations can be disabled by passing \`none\`.
data PostSubscriptionItemsRequestBodyProrationBehavior'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSubscriptionItemsRequestBodyProrationBehavior'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.
    PostSubscriptionItemsRequestBodyProrationBehavior'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"always_invoice"@
    PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice
  | -- | Represents the JSON value @"create_prorations"@
    PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations
  | -- | Represents the JSON value @"none"@
    PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone
  deriving (Int -> PostSubscriptionItemsRequestBodyProrationBehavior' -> ShowS
[PostSubscriptionItemsRequestBodyProrationBehavior'] -> ShowS
PostSubscriptionItemsRequestBodyProrationBehavior' -> String
(Int
 -> PostSubscriptionItemsRequestBodyProrationBehavior' -> ShowS)
-> (PostSubscriptionItemsRequestBodyProrationBehavior' -> String)
-> ([PostSubscriptionItemsRequestBodyProrationBehavior'] -> ShowS)
-> Show PostSubscriptionItemsRequestBodyProrationBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyProrationBehavior'] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyProrationBehavior'] -> ShowS
show :: PostSubscriptionItemsRequestBodyProrationBehavior' -> String
$cshow :: PostSubscriptionItemsRequestBodyProrationBehavior' -> String
showsPrec :: Int -> PostSubscriptionItemsRequestBodyProrationBehavior' -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsRequestBodyProrationBehavior' -> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyProrationBehavior'
-> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool
(PostSubscriptionItemsRequestBodyProrationBehavior'
 -> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool)
-> (PostSubscriptionItemsRequestBodyProrationBehavior'
    -> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool)
-> Eq PostSubscriptionItemsRequestBodyProrationBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyProrationBehavior'
-> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool
$c/= :: PostSubscriptionItemsRequestBodyProrationBehavior'
-> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool
== :: PostSubscriptionItemsRequestBodyProrationBehavior'
-> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool
$c== :: PostSubscriptionItemsRequestBodyProrationBehavior'
-> PostSubscriptionItemsRequestBodyProrationBehavior' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyProrationBehavior' where
  toJSON :: PostSubscriptionItemsRequestBodyProrationBehavior' -> Value
toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'Other Value
val) = Value
val
  toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice) = Value
"always_invoice"
  toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations) = Value
"create_prorations"
  toJSON (PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone) = Value
"none"

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyProrationBehavior' where
  parseJSON :: Value -> Parser PostSubscriptionItemsRequestBodyProrationBehavior'
parseJSON Value
val =
    PostSubscriptionItemsRequestBodyProrationBehavior'
-> Parser PostSubscriptionItemsRequestBodyProrationBehavior'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"always_invoice" -> PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumAlwaysInvoice
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"create_prorations" -> PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumCreateProrations
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"none" -> PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'EnumNone
            | Bool
GHC.Base.otherwise -> Value -> PostSubscriptionItemsRequestBodyProrationBehavior'
PostSubscriptionItemsRequestBodyProrationBehavior'Other Value
val
      )

-- | Defines the oneOf schema located at @paths.\/v1\/subscription_items.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.tax_rates.anyOf@ in the specification.
--
-- A list of [Tax Rate](https:\/\/stripe.com\/docs\/api\/tax_rates) ids. These Tax Rates will override the [\`default_tax_rates\`](https:\/\/stripe.com\/docs\/api\/subscriptions\/create\#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
data PostSubscriptionItemsRequestBodyTaxRates'Variants
  = -- | Represents the JSON value @""@
    PostSubscriptionItemsRequestBodyTaxRates'EmptyString
  | PostSubscriptionItemsRequestBodyTaxRates'ListTText ([Data.Text.Internal.Text])
  deriving (Int -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> ShowS
[PostSubscriptionItemsRequestBodyTaxRates'Variants] -> ShowS
PostSubscriptionItemsRequestBodyTaxRates'Variants -> String
(Int -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> ShowS)
-> (PostSubscriptionItemsRequestBodyTaxRates'Variants -> String)
-> ([PostSubscriptionItemsRequestBodyTaxRates'Variants] -> ShowS)
-> Show PostSubscriptionItemsRequestBodyTaxRates'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsRequestBodyTaxRates'Variants] -> ShowS
$cshowList :: [PostSubscriptionItemsRequestBodyTaxRates'Variants] -> ShowS
show :: PostSubscriptionItemsRequestBodyTaxRates'Variants -> String
$cshow :: PostSubscriptionItemsRequestBodyTaxRates'Variants -> String
showsPrec :: Int -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> ShowS
GHC.Show.Show, PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool
(PostSubscriptionItemsRequestBodyTaxRates'Variants
 -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool)
-> (PostSubscriptionItemsRequestBodyTaxRates'Variants
    -> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool)
-> Eq PostSubscriptionItemsRequestBodyTaxRates'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool
$c/= :: PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool
== :: PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool
$c== :: PostSubscriptionItemsRequestBodyTaxRates'Variants
-> PostSubscriptionItemsRequestBodyTaxRates'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSubscriptionItemsRequestBodyTaxRates'Variants where
  toJSON :: PostSubscriptionItemsRequestBodyTaxRates'Variants -> Value
toJSON (PostSubscriptionItemsRequestBodyTaxRates'ListTText [Text]
a) = [Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON [Text]
a
  toJSON (PostSubscriptionItemsRequestBodyTaxRates'Variants
PostSubscriptionItemsRequestBodyTaxRates'EmptyString) = Value
""

instance Data.Aeson.Types.FromJSON.FromJSON PostSubscriptionItemsRequestBodyTaxRates'Variants where
  parseJSON :: Value -> Parser PostSubscriptionItemsRequestBodyTaxRates'Variants
parseJSON Value
val =
    if
        | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostSubscriptionItemsRequestBodyTaxRates'Variants
-> Parser PostSubscriptionItemsRequestBodyTaxRates'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostSubscriptionItemsRequestBodyTaxRates'Variants
PostSubscriptionItemsRequestBodyTaxRates'EmptyString
        | Bool
GHC.Base.otherwise -> case ([Text] -> PostSubscriptionItemsRequestBodyTaxRates'Variants
PostSubscriptionItemsRequestBodyTaxRates'ListTText ([Text] -> PostSubscriptionItemsRequestBodyTaxRates'Variants)
-> Result [Text]
-> Result PostSubscriptionItemsRequestBodyTaxRates'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result [Text]
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result PostSubscriptionItemsRequestBodyTaxRates'Variants
-> Result PostSubscriptionItemsRequestBodyTaxRates'Variants
-> Result PostSubscriptionItemsRequestBodyTaxRates'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result PostSubscriptionItemsRequestBodyTaxRates'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
          Data.Aeson.Types.Internal.Success PostSubscriptionItemsRequestBodyTaxRates'Variants
a -> PostSubscriptionItemsRequestBodyTaxRates'Variants
-> Parser PostSubscriptionItemsRequestBodyTaxRates'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostSubscriptionItemsRequestBodyTaxRates'Variants
a
          Data.Aeson.Types.Internal.Error String
a -> String -> Parser PostSubscriptionItemsRequestBodyTaxRates'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Represents a response of the operation 'postSubscriptionItems'.
--
-- 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), 'PostSubscriptionItemsResponseError' is used.
data PostSubscriptionItemsResponse
  = -- | Means either no matching case available or a parse error
    PostSubscriptionItemsResponseError GHC.Base.String
  | -- | Successful response.
    PostSubscriptionItemsResponse200 SubscriptionItem
  | -- | Error response.
    PostSubscriptionItemsResponseDefault Error
  deriving (Int -> PostSubscriptionItemsResponse -> ShowS
[PostSubscriptionItemsResponse] -> ShowS
PostSubscriptionItemsResponse -> String
(Int -> PostSubscriptionItemsResponse -> ShowS)
-> (PostSubscriptionItemsResponse -> String)
-> ([PostSubscriptionItemsResponse] -> ShowS)
-> Show PostSubscriptionItemsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSubscriptionItemsResponse] -> ShowS
$cshowList :: [PostSubscriptionItemsResponse] -> ShowS
show :: PostSubscriptionItemsResponse -> String
$cshow :: PostSubscriptionItemsResponse -> String
showsPrec :: Int -> PostSubscriptionItemsResponse -> ShowS
$cshowsPrec :: Int -> PostSubscriptionItemsResponse -> ShowS
GHC.Show.Show, PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse -> Bool
(PostSubscriptionItemsResponse
 -> PostSubscriptionItemsResponse -> Bool)
-> (PostSubscriptionItemsResponse
    -> PostSubscriptionItemsResponse -> Bool)
-> Eq PostSubscriptionItemsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse -> Bool
$c/= :: PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse -> Bool
== :: PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse -> Bool
$c== :: PostSubscriptionItemsResponse
-> PostSubscriptionItemsResponse -> Bool
GHC.Classes.Eq)