{-# 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 getPaymentMethods
module StripeAPI.Operations.GetPaymentMethods 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

-- | > GET /v1/payment_methods
--
-- \<p>Returns a list of PaymentMethods for a given Customer\<\/p>
getPaymentMethods ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetPaymentMethodsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetPaymentMethodsResponse)
getPaymentMethods :: GetPaymentMethodsParameters
-> StripeT m (Response GetPaymentMethodsResponse)
getPaymentMethods GetPaymentMethodsParameters
parameters =
  (Response ByteString -> Response GetPaymentMethodsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetPaymentMethodsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetPaymentMethodsResponse)
-> Response ByteString -> Response GetPaymentMethodsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetPaymentMethodsResponse)
-> (GetPaymentMethodsResponse -> GetPaymentMethodsResponse)
-> Either String GetPaymentMethodsResponse
-> GetPaymentMethodsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetPaymentMethodsResponse
GetPaymentMethodsResponseError GetPaymentMethodsResponse -> GetPaymentMethodsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetPaymentMethodsResponse
 -> GetPaymentMethodsResponse)
-> (ByteString -> Either String GetPaymentMethodsResponse)
-> ByteString
-> GetPaymentMethodsResponse
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) ->
                                   GetPaymentMethodsResponseBody200 -> GetPaymentMethodsResponse
GetPaymentMethodsResponse200
                                     (GetPaymentMethodsResponseBody200 -> GetPaymentMethodsResponse)
-> Either String GetPaymentMethodsResponseBody200
-> Either String GetPaymentMethodsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetPaymentMethodsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetPaymentMethodsResponseBody200
                                                      )
                                 | 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 -> GetPaymentMethodsResponse
GetPaymentMethodsResponseDefault
                                     (Error -> GetPaymentMethodsResponse)
-> Either String Error -> Either String GetPaymentMethodsResponse
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 GetPaymentMethodsResponse
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] -> StripeT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
StripeAPI.Common.doCallWithConfigurationM
        (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"GET")
        (String -> Text
Data.Text.pack String
"/v1/payment_methods")
        [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"customer") (Value -> Maybe Value
forall a. a -> Maybe a
GHC.Maybe.Just (Value -> Maybe Value) -> Value -> Maybe Value
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetPaymentMethodsParameters -> Text
getPaymentMethodsParametersQueryCustomer GetPaymentMethodsParameters
parameters)) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"ending_before") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryEndingBefore GetPaymentMethodsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"expand") ([Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ([Text] -> Value) -> Maybe [Text] -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPaymentMethodsParameters -> Maybe [Text]
getPaymentMethodsParametersQueryExpand GetPaymentMethodsParameters
parameters) (String -> Text
Data.Text.pack String
"deepObject") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"limit") (Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Int -> Value) -> Maybe Int -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPaymentMethodsParameters -> Maybe Int
getPaymentMethodsParametersQueryLimit GetPaymentMethodsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"starting_after") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryStartingAfter GetPaymentMethodsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"type") (Value -> Maybe Value
forall a. a -> Maybe a
GHC.Maybe.Just (Value -> Maybe Value) -> Value -> Maybe Value
forall a b. (a -> b) -> a -> b
GHC.Base.$ GetPaymentMethodsParametersQueryType' -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetPaymentMethodsParameters
-> GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType GetPaymentMethodsParameters
parameters)) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/payment_methods.GET.parameters@ in the specification.
data GetPaymentMethodsParameters = GetPaymentMethodsParameters
  { -- | queryCustomer: Represents the parameter named \'customer\'
    --
    -- The ID of the customer whose PaymentMethods will be retrieved.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetPaymentMethodsParameters -> Text
getPaymentMethodsParametersQueryCustomer :: Data.Text.Internal.Text,
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetPaymentMethodsParameters -> Maybe [Text]
getPaymentMethodsParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryLimit: Represents the parameter named \'limit\'
    --
    -- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
    GetPaymentMethodsParameters -> Maybe Int
getPaymentMethodsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryStarting_after: Represents the parameter named \'starting_after\'
    --
    -- A cursor for use in pagination. \`starting_after\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with \`obj_foo\`, your subsequent call can include \`starting_after=obj_foo\` in order to fetch the next page of the list.
    GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryType: Represents the parameter named \'type\'
    --
    -- A required filter on the list, based on the object \`type\` field.
    GetPaymentMethodsParameters
-> GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType :: GetPaymentMethodsParametersQueryType'
  }
  deriving
    ( Int -> GetPaymentMethodsParameters -> ShowS
[GetPaymentMethodsParameters] -> ShowS
GetPaymentMethodsParameters -> String
(Int -> GetPaymentMethodsParameters -> ShowS)
-> (GetPaymentMethodsParameters -> String)
-> ([GetPaymentMethodsParameters] -> ShowS)
-> Show GetPaymentMethodsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPaymentMethodsParameters] -> ShowS
$cshowList :: [GetPaymentMethodsParameters] -> ShowS
show :: GetPaymentMethodsParameters -> String
$cshow :: GetPaymentMethodsParameters -> String
showsPrec :: Int -> GetPaymentMethodsParameters -> ShowS
$cshowsPrec :: Int -> GetPaymentMethodsParameters -> ShowS
GHC.Show.Show,
      GetPaymentMethodsParameters -> GetPaymentMethodsParameters -> Bool
(GetPaymentMethodsParameters
 -> GetPaymentMethodsParameters -> Bool)
-> (GetPaymentMethodsParameters
    -> GetPaymentMethodsParameters -> Bool)
-> Eq GetPaymentMethodsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPaymentMethodsParameters -> GetPaymentMethodsParameters -> Bool
$c/= :: GetPaymentMethodsParameters -> GetPaymentMethodsParameters -> Bool
== :: GetPaymentMethodsParameters -> GetPaymentMethodsParameters -> Bool
$c== :: GetPaymentMethodsParameters -> GetPaymentMethodsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetPaymentMethodsParameters where
  toJSON :: GetPaymentMethodsParameters -> Value
toJSON GetPaymentMethodsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryCustomer" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Text
getPaymentMethodsParametersQueryCustomer GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryEnding_before" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryEndingBefore GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryExpand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe [Text]
getPaymentMethodsParametersQueryExpand GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryLimit" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Int
getPaymentMethodsParametersQueryLimit GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryStarting_after" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryStartingAfter GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryType" Text -> GetPaymentMethodsParametersQueryType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters
-> GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType GetPaymentMethodsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetPaymentMethodsParameters -> Encoding
toEncoding GetPaymentMethodsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryCustomer" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Text
getPaymentMethodsParametersQueryCustomer GetPaymentMethodsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryEnding_before" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryEndingBefore GetPaymentMethodsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryExpand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe [Text]
getPaymentMethodsParametersQueryExpand GetPaymentMethodsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryLimit" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Int
getPaymentMethodsParametersQueryLimit GetPaymentMethodsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryStarting_after" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters -> Maybe Text
getPaymentMethodsParametersQueryStartingAfter GetPaymentMethodsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"queryType" Text -> GetPaymentMethodsParametersQueryType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsParameters
-> GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType GetPaymentMethodsParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetPaymentMethodsParameters where
  parseJSON :: Value -> Parser GetPaymentMethodsParameters
parseJSON = String
-> (Object -> Parser GetPaymentMethodsParameters)
-> Value
-> Parser GetPaymentMethodsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetPaymentMethodsParameters" (\Object
obj -> ((((((Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> GetPaymentMethodsParametersQueryType'
 -> GetPaymentMethodsParameters)
-> Parser
     (Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParameters
GetPaymentMethodsParameters Parser
  (Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
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
"queryCustomer")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
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
"queryEnding_before")) Parser
  (Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe Text
      -> GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
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
"queryExpand")) Parser
  (Maybe Int
   -> Maybe Text
   -> GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryLimit")) Parser
  (Maybe Text
   -> GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser (Maybe Text)
-> Parser
     (GetPaymentMethodsParametersQueryType'
      -> GetPaymentMethodsParameters)
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
"queryStarting_after")) Parser
  (GetPaymentMethodsParametersQueryType'
   -> GetPaymentMethodsParameters)
-> Parser GetPaymentMethodsParametersQueryType'
-> Parser GetPaymentMethodsParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser GetPaymentMethodsParametersQueryType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"queryType"))

-- | Create a new 'GetPaymentMethodsParameters' with all required fields.
mkGetPaymentMethodsParameters ::
  -- | 'getPaymentMethodsParametersQueryCustomer'
  Data.Text.Internal.Text ->
  -- | 'getPaymentMethodsParametersQueryType'
  GetPaymentMethodsParametersQueryType' ->
  GetPaymentMethodsParameters
mkGetPaymentMethodsParameters :: Text
-> GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParameters
mkGetPaymentMethodsParameters Text
getPaymentMethodsParametersQueryCustomer GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType =
  GetPaymentMethodsParameters :: Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParameters
GetPaymentMethodsParameters
    { getPaymentMethodsParametersQueryCustomer :: Text
getPaymentMethodsParametersQueryCustomer = Text
getPaymentMethodsParametersQueryCustomer,
      getPaymentMethodsParametersQueryEndingBefore :: Maybe Text
getPaymentMethodsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPaymentMethodsParametersQueryExpand :: Maybe [Text]
getPaymentMethodsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getPaymentMethodsParametersQueryLimit :: Maybe Int
getPaymentMethodsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getPaymentMethodsParametersQueryStartingAfter :: Maybe Text
getPaymentMethodsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPaymentMethodsParametersQueryType :: GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType = GetPaymentMethodsParametersQueryType'
getPaymentMethodsParametersQueryType
    }

-- | Defines the enum schema located at @paths.\/v1\/payment_methods.GET.parameters.properties.queryType@ in the specification.
--
-- Represents the parameter named \'type\'
--
-- A required filter on the list, based on the object \`type\` field.
data GetPaymentMethodsParametersQueryType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    GetPaymentMethodsParametersQueryType'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.
    GetPaymentMethodsParametersQueryType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"acss_debit"@
    GetPaymentMethodsParametersQueryType'EnumAcssDebit
  | -- | Represents the JSON value @"afterpay_clearpay"@
    GetPaymentMethodsParametersQueryType'EnumAfterpayClearpay
  | -- | Represents the JSON value @"alipay"@
    GetPaymentMethodsParametersQueryType'EnumAlipay
  | -- | Represents the JSON value @"au_becs_debit"@
    GetPaymentMethodsParametersQueryType'EnumAuBecsDebit
  | -- | Represents the JSON value @"bacs_debit"@
    GetPaymentMethodsParametersQueryType'EnumBacsDebit
  | -- | Represents the JSON value @"bancontact"@
    GetPaymentMethodsParametersQueryType'EnumBancontact
  | -- | Represents the JSON value @"boleto"@
    GetPaymentMethodsParametersQueryType'EnumBoleto
  | -- | Represents the JSON value @"card"@
    GetPaymentMethodsParametersQueryType'EnumCard
  | -- | Represents the JSON value @"eps"@
    GetPaymentMethodsParametersQueryType'EnumEps
  | -- | Represents the JSON value @"fpx"@
    GetPaymentMethodsParametersQueryType'EnumFpx
  | -- | Represents the JSON value @"giropay"@
    GetPaymentMethodsParametersQueryType'EnumGiropay
  | -- | Represents the JSON value @"grabpay"@
    GetPaymentMethodsParametersQueryType'EnumGrabpay
  | -- | Represents the JSON value @"ideal"@
    GetPaymentMethodsParametersQueryType'EnumIdeal
  | -- | Represents the JSON value @"oxxo"@
    GetPaymentMethodsParametersQueryType'EnumOxxo
  | -- | Represents the JSON value @"p24"@
    GetPaymentMethodsParametersQueryType'EnumP24
  | -- | Represents the JSON value @"sepa_debit"@
    GetPaymentMethodsParametersQueryType'EnumSepaDebit
  | -- | Represents the JSON value @"sofort"@
    GetPaymentMethodsParametersQueryType'EnumSofort
  deriving (Int -> GetPaymentMethodsParametersQueryType' -> ShowS
[GetPaymentMethodsParametersQueryType'] -> ShowS
GetPaymentMethodsParametersQueryType' -> String
(Int -> GetPaymentMethodsParametersQueryType' -> ShowS)
-> (GetPaymentMethodsParametersQueryType' -> String)
-> ([GetPaymentMethodsParametersQueryType'] -> ShowS)
-> Show GetPaymentMethodsParametersQueryType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPaymentMethodsParametersQueryType'] -> ShowS
$cshowList :: [GetPaymentMethodsParametersQueryType'] -> ShowS
show :: GetPaymentMethodsParametersQueryType' -> String
$cshow :: GetPaymentMethodsParametersQueryType' -> String
showsPrec :: Int -> GetPaymentMethodsParametersQueryType' -> ShowS
$cshowsPrec :: Int -> GetPaymentMethodsParametersQueryType' -> ShowS
GHC.Show.Show, GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParametersQueryType' -> Bool
(GetPaymentMethodsParametersQueryType'
 -> GetPaymentMethodsParametersQueryType' -> Bool)
-> (GetPaymentMethodsParametersQueryType'
    -> GetPaymentMethodsParametersQueryType' -> Bool)
-> Eq GetPaymentMethodsParametersQueryType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParametersQueryType' -> Bool
$c/= :: GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParametersQueryType' -> Bool
== :: GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParametersQueryType' -> Bool
$c== :: GetPaymentMethodsParametersQueryType'
-> GetPaymentMethodsParametersQueryType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GetPaymentMethodsParametersQueryType' where
  toJSON :: GetPaymentMethodsParametersQueryType' -> Value
toJSON (GetPaymentMethodsParametersQueryType'Other Value
val) = Value
val
  toJSON (GetPaymentMethodsParametersQueryType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAcssDebit) = Value
"acss_debit"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAfterpayClearpay) = Value
"afterpay_clearpay"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAlipay) = Value
"alipay"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAuBecsDebit) = Value
"au_becs_debit"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBacsDebit) = Value
"bacs_debit"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBancontact) = Value
"bancontact"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBoleto) = Value
"boleto"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumCard) = Value
"card"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumEps) = Value
"eps"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumFpx) = Value
"fpx"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumGiropay) = Value
"giropay"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumGrabpay) = Value
"grabpay"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumIdeal) = Value
"ideal"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumOxxo) = Value
"oxxo"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumP24) = Value
"p24"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumSepaDebit) = Value
"sepa_debit"
  toJSON (GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumSofort) = Value
"sofort"

instance Data.Aeson.Types.FromJSON.FromJSON GetPaymentMethodsParametersQueryType' where
  parseJSON :: Value -> Parser GetPaymentMethodsParametersQueryType'
parseJSON Value
val =
    GetPaymentMethodsParametersQueryType'
-> Parser GetPaymentMethodsParametersQueryType'
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
"acss_debit" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAcssDebit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"afterpay_clearpay" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAfterpayClearpay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"alipay" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAlipay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"au_becs_debit" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumAuBecsDebit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"bacs_debit" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBacsDebit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"bancontact" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBancontact
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"boleto" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumBoleto
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"card" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumCard
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"eps" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumEps
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fpx" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumFpx
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"giropay" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumGiropay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"grabpay" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumGrabpay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ideal" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumIdeal
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"oxxo" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumOxxo
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"p24" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumP24
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sepa_debit" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumSepaDebit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sofort" -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'EnumSofort
            | Bool
GHC.Base.otherwise -> Value -> GetPaymentMethodsParametersQueryType'
GetPaymentMethodsParametersQueryType'Other Value
val
      )

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

-- | Defines the object schema located at @paths.\/v1\/payment_methods.GET.responses.200.content.application\/json.schema@ in the specification.
data GetPaymentMethodsResponseBody200 = GetPaymentMethodsResponseBody200
  { -- | data
    GetPaymentMethodsResponseBody200 -> [PaymentMethod]
getPaymentMethodsResponseBody200Data :: ([PaymentMethod]),
    -- | has_more: True if this list has another page of items after this one that can be fetched.
    GetPaymentMethodsResponseBody200 -> Bool
getPaymentMethodsResponseBody200HasMore :: GHC.Types.Bool,
    -- | url: The URL where this list can be accessed.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    -- * Must match pattern \'^\/v1\/payment_methods\'
    GetPaymentMethodsResponseBody200 -> Text
getPaymentMethodsResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> GetPaymentMethodsResponseBody200 -> ShowS
[GetPaymentMethodsResponseBody200] -> ShowS
GetPaymentMethodsResponseBody200 -> String
(Int -> GetPaymentMethodsResponseBody200 -> ShowS)
-> (GetPaymentMethodsResponseBody200 -> String)
-> ([GetPaymentMethodsResponseBody200] -> ShowS)
-> Show GetPaymentMethodsResponseBody200
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPaymentMethodsResponseBody200] -> ShowS
$cshowList :: [GetPaymentMethodsResponseBody200] -> ShowS
show :: GetPaymentMethodsResponseBody200 -> String
$cshow :: GetPaymentMethodsResponseBody200 -> String
showsPrec :: Int -> GetPaymentMethodsResponseBody200 -> ShowS
$cshowsPrec :: Int -> GetPaymentMethodsResponseBody200 -> ShowS
GHC.Show.Show,
      GetPaymentMethodsResponseBody200
-> GetPaymentMethodsResponseBody200 -> Bool
(GetPaymentMethodsResponseBody200
 -> GetPaymentMethodsResponseBody200 -> Bool)
-> (GetPaymentMethodsResponseBody200
    -> GetPaymentMethodsResponseBody200 -> Bool)
-> Eq GetPaymentMethodsResponseBody200
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPaymentMethodsResponseBody200
-> GetPaymentMethodsResponseBody200 -> Bool
$c/= :: GetPaymentMethodsResponseBody200
-> GetPaymentMethodsResponseBody200 -> Bool
== :: GetPaymentMethodsResponseBody200
-> GetPaymentMethodsResponseBody200 -> Bool
$c== :: GetPaymentMethodsResponseBody200
-> GetPaymentMethodsResponseBody200 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetPaymentMethodsResponseBody200 where
  toJSON :: GetPaymentMethodsResponseBody200 -> Value
toJSON GetPaymentMethodsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [PaymentMethod] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> [PaymentMethod]
getPaymentMethodsResponseBody200Data GetPaymentMethodsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"has_more" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> Bool
getPaymentMethodsResponseBody200HasMore GetPaymentMethodsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> Text
getPaymentMethodsResponseBody200Url GetPaymentMethodsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetPaymentMethodsResponseBody200 -> Encoding
toEncoding GetPaymentMethodsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [PaymentMethod] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> [PaymentMethod]
getPaymentMethodsResponseBody200Data GetPaymentMethodsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"has_more" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> Bool
getPaymentMethodsResponseBody200HasMore GetPaymentMethodsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPaymentMethodsResponseBody200 -> Text
getPaymentMethodsResponseBody200Url GetPaymentMethodsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list"))))

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

-- | Create a new 'GetPaymentMethodsResponseBody200' with all required fields.
mkGetPaymentMethodsResponseBody200 ::
  -- | 'getPaymentMethodsResponseBody200Data'
  [PaymentMethod] ->
  -- | 'getPaymentMethodsResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getPaymentMethodsResponseBody200Url'
  Data.Text.Internal.Text ->
  GetPaymentMethodsResponseBody200
mkGetPaymentMethodsResponseBody200 :: [PaymentMethod] -> Bool -> Text -> GetPaymentMethodsResponseBody200
mkGetPaymentMethodsResponseBody200 [PaymentMethod]
getPaymentMethodsResponseBody200Data Bool
getPaymentMethodsResponseBody200HasMore Text
getPaymentMethodsResponseBody200Url =
  GetPaymentMethodsResponseBody200 :: [PaymentMethod] -> Bool -> Text -> GetPaymentMethodsResponseBody200
GetPaymentMethodsResponseBody200
    { getPaymentMethodsResponseBody200Data :: [PaymentMethod]
getPaymentMethodsResponseBody200Data = [PaymentMethod]
getPaymentMethodsResponseBody200Data,
      getPaymentMethodsResponseBody200HasMore :: Bool
getPaymentMethodsResponseBody200HasMore = Bool
getPaymentMethodsResponseBody200HasMore,
      getPaymentMethodsResponseBody200Url :: Text
getPaymentMethodsResponseBody200Url = Text
getPaymentMethodsResponseBody200Url
    }