{-# 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 postAccountsAccountExternalAccountsId
module StripeAPI.Operations.PostAccountsAccountExternalAccountsId 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/accounts/{account}/external_accounts/{id}
--
-- \<p>Updates the metadata, account holder name, and account holder type of a bank account belonging to a \<a href=\"\/docs\/connect\/custom-accounts\">Custom account\<\/a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.\<\/p>
--
-- \<p>You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.\<\/p>
postAccountsAccountExternalAccountsId ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  PostAccountsAccountExternalAccountsIdParameters ->
  -- | The request body to send
  GHC.Maybe.Maybe PostAccountsAccountExternalAccountsIdRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostAccountsAccountExternalAccountsIdResponse)
postAccountsAccountExternalAccountsId :: PostAccountsAccountExternalAccountsIdParameters
-> Maybe PostAccountsAccountExternalAccountsIdRequestBody
-> StripeT
     m (Response PostAccountsAccountExternalAccountsIdResponse)
postAccountsAccountExternalAccountsId
  PostAccountsAccountExternalAccountsIdParameters
parameters
  Maybe PostAccountsAccountExternalAccountsIdRequestBody
body =
    (Response ByteString
 -> Response PostAccountsAccountExternalAccountsIdResponse)
-> StripeT m (Response ByteString)
-> StripeT
     m (Response PostAccountsAccountExternalAccountsIdResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
      ( \Response ByteString
response_0 ->
          (ByteString -> PostAccountsAccountExternalAccountsIdResponse)
-> Response ByteString
-> Response PostAccountsAccountExternalAccountsIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
            ( (String -> PostAccountsAccountExternalAccountsIdResponse)
-> (PostAccountsAccountExternalAccountsIdResponse
    -> PostAccountsAccountExternalAccountsIdResponse)
-> Either String PostAccountsAccountExternalAccountsIdResponse
-> PostAccountsAccountExternalAccountsIdResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostAccountsAccountExternalAccountsIdResponse
PostAccountsAccountExternalAccountsIdResponseError PostAccountsAccountExternalAccountsIdResponse
-> PostAccountsAccountExternalAccountsIdResponse
forall a. a -> a
GHC.Base.id
                (Either String PostAccountsAccountExternalAccountsIdResponse
 -> PostAccountsAccountExternalAccountsIdResponse)
-> (ByteString
    -> Either String PostAccountsAccountExternalAccountsIdResponse)
-> ByteString
-> PostAccountsAccountExternalAccountsIdResponse
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) ->
                                     ExternalAccount -> PostAccountsAccountExternalAccountsIdResponse
PostAccountsAccountExternalAccountsIdResponse200
                                       (ExternalAccount -> PostAccountsAccountExternalAccountsIdResponse)
-> Either String ExternalAccount
-> Either String PostAccountsAccountExternalAccountsIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String ExternalAccount
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              ExternalAccount
                                                        )
                                   | 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 -> PostAccountsAccountExternalAccountsIdResponse
PostAccountsAccountExternalAccountsIdResponseDefault
                                       (Error -> PostAccountsAccountExternalAccountsIdResponse)
-> Either String Error
-> Either String PostAccountsAccountExternalAccountsIdResponse
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 PostAccountsAccountExternalAccountsIdResponse
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 PostAccountsAccountExternalAccountsIdRequestBody
-> 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/accounts/" 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 (PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathAccount PostAccountsAccountExternalAccountsIdParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (String
"/external_accounts/" 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 (PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathId PostAccountsAccountExternalAccountsIdParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
""))))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostAccountsAccountExternalAccountsIdRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/external_accounts\/{id}.POST.parameters@ in the specification.
data PostAccountsAccountExternalAccountsIdParameters = PostAccountsAccountExternalAccountsIdParameters
  { -- | pathAccount: Represents the parameter named \'account\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathAccount :: Data.Text.Internal.Text,
    -- | pathId: Represents the parameter named \'id\'
    PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathId :: Data.Text.Internal.Text
  }
  deriving
    ( Int
-> PostAccountsAccountExternalAccountsIdParameters
-> String
-> String
[PostAccountsAccountExternalAccountsIdParameters]
-> String -> String
PostAccountsAccountExternalAccountsIdParameters -> String
(Int
 -> PostAccountsAccountExternalAccountsIdParameters
 -> String
 -> String)
-> (PostAccountsAccountExternalAccountsIdParameters -> String)
-> ([PostAccountsAccountExternalAccountsIdParameters]
    -> String -> String)
-> Show PostAccountsAccountExternalAccountsIdParameters
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountsAccountExternalAccountsIdParameters]
-> String -> String
$cshowList :: [PostAccountsAccountExternalAccountsIdParameters]
-> String -> String
show :: PostAccountsAccountExternalAccountsIdParameters -> String
$cshow :: PostAccountsAccountExternalAccountsIdParameters -> String
showsPrec :: Int
-> PostAccountsAccountExternalAccountsIdParameters
-> String
-> String
$cshowsPrec :: Int
-> PostAccountsAccountExternalAccountsIdParameters
-> String
-> String
GHC.Show.Show,
      PostAccountsAccountExternalAccountsIdParameters
-> PostAccountsAccountExternalAccountsIdParameters -> Bool
(PostAccountsAccountExternalAccountsIdParameters
 -> PostAccountsAccountExternalAccountsIdParameters -> Bool)
-> (PostAccountsAccountExternalAccountsIdParameters
    -> PostAccountsAccountExternalAccountsIdParameters -> Bool)
-> Eq PostAccountsAccountExternalAccountsIdParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountsAccountExternalAccountsIdParameters
-> PostAccountsAccountExternalAccountsIdParameters -> Bool
$c/= :: PostAccountsAccountExternalAccountsIdParameters
-> PostAccountsAccountExternalAccountsIdParameters -> Bool
== :: PostAccountsAccountExternalAccountsIdParameters
-> PostAccountsAccountExternalAccountsIdParameters -> Bool
$c== :: PostAccountsAccountExternalAccountsIdParameters
-> PostAccountsAccountExternalAccountsIdParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountExternalAccountsIdParameters where
  toJSON :: PostAccountsAccountExternalAccountsIdParameters -> Value
toJSON PostAccountsAccountExternalAccountsIdParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"pathAccount" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathAccount PostAccountsAccountExternalAccountsIdParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"pathId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathId PostAccountsAccountExternalAccountsIdParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostAccountsAccountExternalAccountsIdParameters -> Encoding
toEncoding PostAccountsAccountExternalAccountsIdParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"pathAccount" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathAccount PostAccountsAccountExternalAccountsIdParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"pathId" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdParameters -> Text
postAccountsAccountExternalAccountsIdParametersPathId PostAccountsAccountExternalAccountsIdParameters
obj))

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

-- | Create a new 'PostAccountsAccountExternalAccountsIdParameters' with all required fields.
mkPostAccountsAccountExternalAccountsIdParameters ::
  -- | 'postAccountsAccountExternalAccountsIdParametersPathAccount'
  Data.Text.Internal.Text ->
  -- | 'postAccountsAccountExternalAccountsIdParametersPathId'
  Data.Text.Internal.Text ->
  PostAccountsAccountExternalAccountsIdParameters
mkPostAccountsAccountExternalAccountsIdParameters :: Text -> Text -> PostAccountsAccountExternalAccountsIdParameters
mkPostAccountsAccountExternalAccountsIdParameters Text
postAccountsAccountExternalAccountsIdParametersPathAccount Text
postAccountsAccountExternalAccountsIdParametersPathId =
  PostAccountsAccountExternalAccountsIdParameters :: Text -> Text -> PostAccountsAccountExternalAccountsIdParameters
PostAccountsAccountExternalAccountsIdParameters
    { postAccountsAccountExternalAccountsIdParametersPathAccount :: Text
postAccountsAccountExternalAccountsIdParametersPathAccount = Text
postAccountsAccountExternalAccountsIdParametersPathAccount,
      postAccountsAccountExternalAccountsIdParametersPathId :: Text
postAccountsAccountExternalAccountsIdParametersPathId = Text
postAccountsAccountExternalAccountsIdParametersPathId
    }

-- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostAccountsAccountExternalAccountsIdRequestBody = PostAccountsAccountExternalAccountsIdRequestBody
  { -- | account_holder_name: The name of the person or business that owns the bank account.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderName :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | account_holder_type: The type of entity that holds the account. This can be either \`individual\` or \`company\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderType :: (GHC.Maybe.Maybe PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'),
    -- | address_city: City\/District\/Suburb\/Town\/Village.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_country: Billing address country, if provided when creating card.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line1: Address line 1 (Street address\/PO Box\/Company name).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine1 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line2: Address line 2 (Apartment\/Suite\/Unit\/Building).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_state: State\/County\/Province\/Region.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressState :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_zip: ZIP or postal code.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressZip :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | default_for_currency: When set to true, this becomes the default external account for its currency.
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountsAccountExternalAccountsIdRequestBodyDefaultForCurrency :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | exp_month: Two digit number representing the card’s expiration month.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpMonth :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | exp_year: Four digit number representing the card’s expiration year.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpYear :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | expand: Specifies which fields in the response should be expanded.
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountsAccountExternalAccountsIdRequestBodyExpand :: (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\`.
    PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountsAccountExternalAccountsIdRequestBodyMetadata :: (GHC.Maybe.Maybe PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants),
    -- | name: Cardholder name.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int
-> PostAccountsAccountExternalAccountsIdRequestBody
-> String
-> String
[PostAccountsAccountExternalAccountsIdRequestBody]
-> String -> String
PostAccountsAccountExternalAccountsIdRequestBody -> String
(Int
 -> PostAccountsAccountExternalAccountsIdRequestBody
 -> String
 -> String)
-> (PostAccountsAccountExternalAccountsIdRequestBody -> String)
-> ([PostAccountsAccountExternalAccountsIdRequestBody]
    -> String -> String)
-> Show PostAccountsAccountExternalAccountsIdRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountsAccountExternalAccountsIdRequestBody]
-> String -> String
$cshowList :: [PostAccountsAccountExternalAccountsIdRequestBody]
-> String -> String
show :: PostAccountsAccountExternalAccountsIdRequestBody -> String
$cshow :: PostAccountsAccountExternalAccountsIdRequestBody -> String
showsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBody
-> String
-> String
$cshowsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBody
-> String
-> String
GHC.Show.Show,
      PostAccountsAccountExternalAccountsIdRequestBody
-> PostAccountsAccountExternalAccountsIdRequestBody -> Bool
(PostAccountsAccountExternalAccountsIdRequestBody
 -> PostAccountsAccountExternalAccountsIdRequestBody -> Bool)
-> (PostAccountsAccountExternalAccountsIdRequestBody
    -> PostAccountsAccountExternalAccountsIdRequestBody -> Bool)
-> Eq PostAccountsAccountExternalAccountsIdRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountsAccountExternalAccountsIdRequestBody
-> PostAccountsAccountExternalAccountsIdRequestBody -> Bool
$c/= :: PostAccountsAccountExternalAccountsIdRequestBody
-> PostAccountsAccountExternalAccountsIdRequestBody -> Bool
== :: PostAccountsAccountExternalAccountsIdRequestBody
-> PostAccountsAccountExternalAccountsIdRequestBody -> Bool
$c== :: PostAccountsAccountExternalAccountsIdRequestBody
-> PostAccountsAccountExternalAccountsIdRequestBody -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountExternalAccountsIdRequestBody where
  toJSON :: PostAccountsAccountExternalAccountsIdRequestBody -> Value
toJSON PostAccountsAccountExternalAccountsIdRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"account_holder_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderName PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"account_holder_type" Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderType PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_city" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCity PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCountry PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line1" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine1 PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line2" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine2 PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_state" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressState PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_zip" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressZip PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"default_for_currency" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountsAccountExternalAccountsIdRequestBodyDefaultForCurrency PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_month" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpMonth PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_year" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpYear PostAccountsAccountExternalAccountsIdRequestBody
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..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountsAccountExternalAccountsIdRequestBodyExpand PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountsAccountExternalAccountsIdRequestBodyMetadata PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyName PostAccountsAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostAccountsAccountExternalAccountsIdRequestBody -> Encoding
toEncoding PostAccountsAccountExternalAccountsIdRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"account_holder_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderName PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"account_holder_type" Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderType PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_city" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCity PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCountry PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line1" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine1 PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line2" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine2 PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_state" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressState PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_zip" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressZip PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"default_for_currency" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountsAccountExternalAccountsIdRequestBodyDefaultForCurrency PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_month" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpMonth PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_year" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpYear PostAccountsAccountExternalAccountsIdRequestBody
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..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountsAccountExternalAccountsIdRequestBodyExpand PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountsAccountExternalAccountsIdRequestBodyMetadata PostAccountsAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountsAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyName PostAccountsAccountExternalAccountsIdRequestBody
obj))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountExternalAccountsIdRequestBody where
  parseJSON :: Value -> Parser PostAccountsAccountExternalAccountsIdRequestBody
parseJSON = String
-> (Object
    -> Parser PostAccountsAccountExternalAccountsIdRequestBody)
-> Value
-> Parser PostAccountsAccountExternalAccountsIdRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostAccountsAccountExternalAccountsIdRequestBody" (\Object
obj -> ((((((((((((((Maybe Text
 -> Maybe
      PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe
      PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> Maybe Text
 -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe Text
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Maybe Text
-> PostAccountsAccountExternalAccountsIdRequestBody
PostAccountsAccountExternalAccountsIdRequestBody Parser
  (Maybe Text
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"account_holder_name")) Parser
  (Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType')
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"account_holder_type")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_city")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_country")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_line1")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_line2")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_state")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"address_zip")) Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"default_for_currency")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"exp_month")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe
           PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountsAccountExternalAccountsIdRequestBody)
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
"exp_year")) Parser
  (Maybe [Text]
   -> Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe [Text])
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text -> PostAccountsAccountExternalAccountsIdRequestBody)
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
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants)
-> Parser
     (Maybe Text -> PostAccountsAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe
        PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
  (Maybe Text -> PostAccountsAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser PostAccountsAccountExternalAccountsIdRequestBody
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
"name"))

-- | Create a new 'PostAccountsAccountExternalAccountsIdRequestBody' with all required fields.
mkPostAccountsAccountExternalAccountsIdRequestBody :: PostAccountsAccountExternalAccountsIdRequestBody
mkPostAccountsAccountExternalAccountsIdRequestBody :: PostAccountsAccountExternalAccountsIdRequestBody
mkPostAccountsAccountExternalAccountsIdRequestBody =
  PostAccountsAccountExternalAccountsIdRequestBody :: Maybe Text
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Maybe Text
-> PostAccountsAccountExternalAccountsIdRequestBody
PostAccountsAccountExternalAccountsIdRequestBody
    { postAccountsAccountExternalAccountsIdRequestBodyAccountHolderName :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAccountHolderType :: Maybe
  PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountsAccountExternalAccountsIdRequestBodyAccountHolderType = Maybe
  PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressCity :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCity = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressCountry :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressLine1 :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine1 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressLine2 :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressLine2 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressState :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyAddressZip :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyAddressZip = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyDefaultForCurrency :: Maybe Bool
postAccountsAccountExternalAccountsIdRequestBodyDefaultForCurrency = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyExpMonth :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpMonth = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyExpYear :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyExpYear = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyExpand :: Maybe [Text]
postAccountsAccountExternalAccountsIdRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyMetadata :: Maybe
  PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountsAccountExternalAccountsIdRequestBodyMetadata = Maybe
  PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountsAccountExternalAccountsIdRequestBodyName :: Maybe Text
postAccountsAccountExternalAccountsIdRequestBodyName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/accounts\/{account}\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.account_holder_type@ in the specification.
--
-- The type of entity that holds the account. This can be either \`individual\` or \`company\`.
data PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'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.
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @""@
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString
  | -- | Represents the JSON value @"company"@
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany
  | -- | Represents the JSON value @"individual"@
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual
  deriving (Int
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
[PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
(Int
 -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> String
 -> String)
-> (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> String)
-> ([PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType']
    -> String -> String)
-> Show
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
$cshowList :: [PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
show :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
$cshow :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
showsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
$cshowsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
GHC.Show.Show, PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
(PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> Bool)
-> (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> Bool)
-> Eq
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
$c/= :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
== :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
$c== :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType' where
  toJSON :: PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Value
toJSON (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'Other Value
val) = Value
val
  toJSON (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString) = Value
""
  toJSON (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany) = Value
"company"
  toJSON (PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual) = Value
"individual"

instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType' where
  parseJSON :: Value
-> Parser
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
parseJSON Value
val =
    PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Parser
     PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
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
"" -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"company" -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"individual" -> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual
            | Bool
GHC.Base.otherwise -> Value
-> PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountsAccountExternalAccountsIdRequestBodyAccountHolderType'Other Value
val
      )

-- | Defines the oneOf schema located at @paths.\/v1\/accounts\/{account}\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.metadata.anyOf@ in the specification.
--
-- Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`.
data PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
  = -- | Represents the JSON value @""@
    PostAccountsAccountExternalAccountsIdRequestBodyMetadata'EmptyString
  | PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
  deriving (Int
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
[PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
(Int
 -> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> String
 -> String)
-> (PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> String)
-> ([PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants]
    -> String -> String)
-> Show
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
$cshowList :: [PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
show :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
$cshow :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
showsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
$cshowsPrec :: Int
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
GHC.Show.Show, PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
(PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> Bool)
-> (PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> Bool)
-> Eq
     PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
$c/= :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
== :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
$c== :: PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountsAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
GHC.Classes.Eq)

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

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

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