{-# 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 deleteCustomersCustomerSubscriptionsSubscriptionExposedId
module StripeAPI.Operations.DeleteCustomersCustomerSubscriptionsSubscriptionExposedId 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

-- | > DELETE /v1/customers/{customer}/subscriptions/{subscription_exposed_id}
--
-- \<p>Cancels a customer’s subscription. If you set the \<code>at_period_end\<\/code> parameter to \<code>true\<\/code>, the subscription will remain active until the end of the period, at which point it will be canceled and not renewed. Otherwise, with the default \<code>false\<\/code> value, the subscription is terminated immediately. In either case, the customer will not be charged again for the subscription.\<\/p>
--
-- \<p>Note, however, that any pending invoice items that you’ve created will still be charged for at the end of the period, unless manually \<a href=\"\#delete_invoiceitem\">deleted\<\/a>. If you’ve set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.\<\/p>
--
-- \<p>By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.\<\/p>
deleteCustomersCustomerSubscriptionsSubscriptionExposedId ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters ->
  -- | The request body to send
  GHC.Maybe.Maybe DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
deleteCustomersCustomerSubscriptionsSubscriptionExposedId :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Maybe
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> ClientT
     m
     (Response
        DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
deleteCustomersCustomerSubscriptionsSubscriptionExposedId
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
parameters
  Maybe
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
body =
    (Response ByteString
 -> Response
      DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> ClientT m (Response ByteString)
-> ClientT
     m
     (Response
        DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
      ( \Response ByteString
response_0 ->
          (ByteString
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> Response ByteString
-> Response
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
            ( (String
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
    -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> Either
     String
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponseError DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
forall a. a -> a
GHC.Base.id
                (Either
   String
   DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> (ByteString
    -> Either
         String
         DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> ByteString
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
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) ->
                                     Subscription
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse200
                                       (Subscription
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> Either String Subscription
-> Either
     String
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Subscription
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              Subscription
                                                        )
                                   | 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
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponseDefault
                                       (Error
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse)
-> Either String Error
-> Either
     String
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
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
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponse
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
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> ClientT 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
"DELETE") (String -> Text
Data.Text.pack (String
"/v1/customers/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (String
"/subscriptions/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
""))))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/customers\/{customer}\/subscriptions\/{subscription_exposed_id}.DELETE.parameters@ in the specification.
data DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters = DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
  { -- | pathCustomer: Represents the parameter named \'customer\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer :: Data.Text.Internal.Text,
    -- | pathSubscription_exposed_id: Represents the parameter named \'subscription_exposed_id\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId :: Data.Text.Internal.Text
  }
  deriving
    ( Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
-> String
[DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters]
-> String -> String
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
(Int
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
 -> String
 -> String)
-> (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
    -> String)
-> ([DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters]
    -> String -> String)
-> Show
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters]
-> String -> String
$cshowList :: [DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters]
-> String -> String
show :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
$cshow :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
showsPrec :: Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
-> String
$cshowsPrec :: Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> String
-> String
GHC.Show.Show,
      DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Bool
(DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
 -> Bool)
-> (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
    -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
    -> Bool)
-> Eq
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Bool
$c/= :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Bool
== :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Bool
$c== :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters where
  toJSON :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Value
toJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"pathCustomer" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"pathSubscription_exposed_id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Encoding
toEncoding DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"pathCustomer" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"pathSubscription_exposed_id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
-> Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
obj))

instance Data.Aeson.Types.FromJSON.FromJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters where
  parseJSON :: Value
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
parseJSON = String
-> (Object
    -> Parser
         DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
-> Value
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters" (\Object
obj -> ((Text
 -> Text
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
-> Parser
     (Text
      -> Text
      -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Text
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters Parser
  (Text
   -> Text
   -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
-> Parser Text
-> Parser
     (Text
      -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
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
"pathCustomer")) Parser
  (Text
   -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters)
-> Parser Text
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
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
"pathSubscription_exposed_id"))

-- | Create a new 'DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters' with all required fields.
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters ::
  -- | 'deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer'
  Data.Text.Internal.Text ->
  -- | 'deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId'
  Data.Text.Internal.Text ->
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters :: Text
-> Text
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId =
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters :: Text
-> Text
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParameters
    { deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer :: Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer = Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathCustomer,
      deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId :: Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId = Text
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParametersPathSubscriptionExposedId
    }

-- | Defines the object schema located at @paths.\/v1\/customers\/{customer}\/subscriptions\/{subscription_exposed_id}.DELETE.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody = DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
  { -- | expand: Specifies which fields in the response should be expanded.
    DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe [Text]
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | invoice_now: Can be set to \`true\` if \`at_period_end\` is not set to \`true\`. Will generate a final invoice that invoices for any un-invoiced metered usage and new\/pending proration invoice items.
    DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyInvoiceNow :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | prorate: Can be set to \`true\` if \`at_period_end\` is not set to \`true\`. Will generate a proration invoice item that credits remaining unused time until the subscription period end.
    DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyProrate :: (GHC.Maybe.Maybe GHC.Types.Bool)
  }
  deriving
    ( Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
-> String
[DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody]
-> String -> String
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
(Int
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
 -> String
 -> String)
-> (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
    -> String)
-> ([DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody]
    -> String -> String)
-> Show
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody]
-> String -> String
$cshowList :: [DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody]
-> String -> String
show :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
$cshow :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
showsPrec :: Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
-> String
$cshowsPrec :: Int
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> String
-> String
GHC.Show.Show,
      DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Bool
(DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
 -> Bool)
-> (DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
    -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
    -> Bool)
-> Eq
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Bool
$c/= :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Bool
== :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Bool
$c== :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody where
  toJSON :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Value
toJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe [Text]
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyExpand DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice_now" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyInvoiceNow DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"prorate" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyProrate DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Encoding
toEncoding DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe [Text]
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyExpand DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice_now" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyInvoiceNow DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"prorate" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
-> Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyProrate DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
obj)))

instance Data.Aeson.Types.FromJSON.FromJSON DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody where
  parseJSON :: Value
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
parseJSON = String
-> (Object
    -> Parser
         DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
-> Value
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody" (\Object
obj -> (((Maybe [Text]
 -> Maybe Bool
 -> Maybe Bool
 -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe Bool
      -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe [Text]
-> Maybe Bool
-> Maybe Bool
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody Parser
  (Maybe [Text]
   -> Maybe Bool
   -> Maybe Bool
   -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
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 Bool
   -> Maybe Bool
   -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"invoice_now")) Parser
  (Maybe Bool
   -> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody)
-> Parser (Maybe Bool)
-> Parser
     DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"prorate"))

-- | Create a new 'DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody' with all required fields.
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody :: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
mkDeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody =
  DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody :: Maybe [Text]
-> Maybe Bool
-> Maybe Bool
-> DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBody
    { deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyExpand :: Maybe [Text]
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyInvoiceNow :: Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyInvoiceNow = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyProrate :: Maybe Bool
deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodyProrate = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
    }

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