{-# 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 getCustomersCustomerCards
module StripeAPI.Operations.GetCustomersCustomerCards 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/customers/{customer}/cards
--
-- \<p>You can see a list of the cards belonging to a customer.
-- Note that the 10 most recent sources are always available on the \<code>Customer\<\/code> object.
-- If you need more than those 10, you can use this API method and the \<code>limit\<\/code> and \<code>starting_after\<\/code> parameters to page through additional cards.\<\/p>
getCustomersCustomerCards ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetCustomersCustomerCardsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetCustomersCustomerCardsResponse)
getCustomersCustomerCards :: GetCustomersCustomerCardsParameters
-> ClientT m (Response GetCustomersCustomerCardsResponse)
getCustomersCustomerCards GetCustomersCustomerCardsParameters
parameters =
  (Response ByteString -> Response GetCustomersCustomerCardsResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response GetCustomersCustomerCardsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetCustomersCustomerCardsResponse)
-> Response ByteString
-> Response GetCustomersCustomerCardsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetCustomersCustomerCardsResponse)
-> (GetCustomersCustomerCardsResponse
    -> GetCustomersCustomerCardsResponse)
-> Either String GetCustomersCustomerCardsResponse
-> GetCustomersCustomerCardsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetCustomersCustomerCardsResponse
GetCustomersCustomerCardsResponseError GetCustomersCustomerCardsResponse
-> GetCustomersCustomerCardsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetCustomersCustomerCardsResponse
 -> GetCustomersCustomerCardsResponse)
-> (ByteString -> Either String GetCustomersCustomerCardsResponse)
-> ByteString
-> GetCustomersCustomerCardsResponse
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) ->
                                   GetCustomersCustomerCardsResponseBody200
-> GetCustomersCustomerCardsResponse
GetCustomersCustomerCardsResponse200
                                     (GetCustomersCustomerCardsResponseBody200
 -> GetCustomersCustomerCardsResponse)
-> Either String GetCustomersCustomerCardsResponseBody200
-> Either String GetCustomersCustomerCardsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString
-> Either String GetCustomersCustomerCardsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetCustomersCustomerCardsResponseBody200
                                                      )
                                 | 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 -> GetCustomersCustomerCardsResponse
GetCustomersCustomerCardsResponseDefault
                                     (Error -> GetCustomersCustomerCardsResponse)
-> Either String Error
-> Either String GetCustomersCustomerCardsResponse
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 GetCustomersCustomerCardsResponse
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] -> ClientT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> ClientT 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/customers/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel (GetCustomersCustomerCardsParameters -> Text
getCustomersCustomerCardsParametersPathCustomer GetCustomersCustomerCardsParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
"/cards")))
        [ 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.<$> GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryEndingBefore GetCustomersCustomerCardsParameters
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.<$> GetCustomersCustomerCardsParameters -> Maybe [Text]
getCustomersCustomerCardsParametersQueryExpand GetCustomersCustomerCardsParameters
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.<$> GetCustomersCustomerCardsParameters -> Maybe Int
getCustomersCustomerCardsParametersQueryLimit GetCustomersCustomerCardsParameters
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.<$> GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryStartingAfter GetCustomersCustomerCardsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/customers\/{customer}\/cards.GET.parameters@ in the specification.
data GetCustomersCustomerCardsParameters = GetCustomersCustomerCardsParameters
  { -- | pathCustomer: Represents the parameter named \'customer\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetCustomersCustomerCardsParameters -> Text
getCustomersCustomerCardsParametersPathCustomer :: 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.
    GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetCustomersCustomerCardsParameters -> Maybe [Text]
getCustomersCustomerCardsParametersQueryExpand :: (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.
    GetCustomersCustomerCardsParameters -> Maybe Int
getCustomersCustomerCardsParametersQueryLimit :: (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.
    GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetCustomersCustomerCardsParameters -> String -> String
[GetCustomersCustomerCardsParameters] -> String -> String
GetCustomersCustomerCardsParameters -> String
(Int -> GetCustomersCustomerCardsParameters -> String -> String)
-> (GetCustomersCustomerCardsParameters -> String)
-> ([GetCustomersCustomerCardsParameters] -> String -> String)
-> Show GetCustomersCustomerCardsParameters
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [GetCustomersCustomerCardsParameters] -> String -> String
$cshowList :: [GetCustomersCustomerCardsParameters] -> String -> String
show :: GetCustomersCustomerCardsParameters -> String
$cshow :: GetCustomersCustomerCardsParameters -> String
showsPrec :: Int -> GetCustomersCustomerCardsParameters -> String -> String
$cshowsPrec :: Int -> GetCustomersCustomerCardsParameters -> String -> String
GHC.Show.Show,
      GetCustomersCustomerCardsParameters
-> GetCustomersCustomerCardsParameters -> Bool
(GetCustomersCustomerCardsParameters
 -> GetCustomersCustomerCardsParameters -> Bool)
-> (GetCustomersCustomerCardsParameters
    -> GetCustomersCustomerCardsParameters -> Bool)
-> Eq GetCustomersCustomerCardsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCustomersCustomerCardsParameters
-> GetCustomersCustomerCardsParameters -> Bool
$c/= :: GetCustomersCustomerCardsParameters
-> GetCustomersCustomerCardsParameters -> Bool
== :: GetCustomersCustomerCardsParameters
-> GetCustomersCustomerCardsParameters -> Bool
$c== :: GetCustomersCustomerCardsParameters
-> GetCustomersCustomerCardsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetCustomersCustomerCardsParameters where
  toJSON :: GetCustomersCustomerCardsParameters -> Value
toJSON GetCustomersCustomerCardsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"pathCustomer" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersCustomerCardsParameters -> Text
getCustomersCustomerCardsParametersPathCustomer GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryEndingBefore GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe [Text]
getCustomersCustomerCardsParametersQueryExpand GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Int
getCustomersCustomerCardsParametersQueryLimit GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryStartingAfter GetCustomersCustomerCardsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetCustomersCustomerCardsParameters -> Encoding
toEncoding GetCustomersCustomerCardsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"pathCustomer" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersCustomerCardsParameters -> Text
getCustomersCustomerCardsParametersPathCustomer GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryEndingBefore GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe [Text]
getCustomersCustomerCardsParametersQueryExpand GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Int
getCustomersCustomerCardsParametersQueryLimit GetCustomersCustomerCardsParameters
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..= GetCustomersCustomerCardsParameters -> Maybe Text
getCustomersCustomerCardsParametersQueryStartingAfter GetCustomersCustomerCardsParameters
obj)))))

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

-- | Create a new 'GetCustomersCustomerCardsParameters' with all required fields.
mkGetCustomersCustomerCardsParameters ::
  -- | 'getCustomersCustomerCardsParametersPathCustomer'
  Data.Text.Internal.Text ->
  GetCustomersCustomerCardsParameters
mkGetCustomersCustomerCardsParameters :: Text -> GetCustomersCustomerCardsParameters
mkGetCustomersCustomerCardsParameters Text
getCustomersCustomerCardsParametersPathCustomer =
  GetCustomersCustomerCardsParameters :: Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCustomersCustomerCardsParameters
GetCustomersCustomerCardsParameters
    { getCustomersCustomerCardsParametersPathCustomer :: Text
getCustomersCustomerCardsParametersPathCustomer = Text
getCustomersCustomerCardsParametersPathCustomer,
      getCustomersCustomerCardsParametersQueryEndingBefore :: Maybe Text
getCustomersCustomerCardsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerCardsParametersQueryExpand :: Maybe [Text]
getCustomersCustomerCardsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerCardsParametersQueryLimit :: Maybe Int
getCustomersCustomerCardsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerCardsParametersQueryStartingAfter :: Maybe Text
getCustomersCustomerCardsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

instance Data.Aeson.Types.ToJSON.ToJSON GetCustomersCustomerCardsResponseBody200 where
  toJSON :: GetCustomersCustomerCardsResponseBody200 -> Value
toJSON GetCustomersCustomerCardsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [Card] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersCustomerCardsResponseBody200 -> [Card]
getCustomersCustomerCardsResponseBody200Data GetCustomersCustomerCardsResponseBody200
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..= GetCustomersCustomerCardsResponseBody200 -> Bool
getCustomersCustomerCardsResponseBody200HasMore GetCustomersCustomerCardsResponseBody200
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..= GetCustomersCustomerCardsResponseBody200 -> Text
getCustomersCustomerCardsResponseBody200Url GetCustomersCustomerCardsResponseBody200
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 :: GetCustomersCustomerCardsResponseBody200 -> Encoding
toEncoding GetCustomersCustomerCardsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [Card] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersCustomerCardsResponseBody200 -> [Card]
getCustomersCustomerCardsResponseBody200Data GetCustomersCustomerCardsResponseBody200
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..= GetCustomersCustomerCardsResponseBody200 -> Bool
getCustomersCustomerCardsResponseBody200HasMore GetCustomersCustomerCardsResponseBody200
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..= GetCustomersCustomerCardsResponseBody200 -> Text
getCustomersCustomerCardsResponseBody200Url GetCustomersCustomerCardsResponseBody200
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 GetCustomersCustomerCardsResponseBody200 where
  parseJSON :: Value -> Parser GetCustomersCustomerCardsResponseBody200
parseJSON = String
-> (Object -> Parser GetCustomersCustomerCardsResponseBody200)
-> Value
-> Parser GetCustomersCustomerCardsResponseBody200
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCustomersCustomerCardsResponseBody200" (\Object
obj -> ((([Card]
 -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200)
-> Parser
     ([Card]
      -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [Card] -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200
GetCustomersCustomerCardsResponseBody200 Parser
  ([Card]
   -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200)
-> Parser [Card]
-> Parser
     (Bool -> Text -> GetCustomersCustomerCardsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [Card]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser (Bool -> Text -> GetCustomersCustomerCardsResponseBody200)
-> Parser Bool
-> Parser (Text -> GetCustomersCustomerCardsResponseBody200)
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 -> GetCustomersCustomerCardsResponseBody200)
-> Parser Text -> Parser GetCustomersCustomerCardsResponseBody200
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 'GetCustomersCustomerCardsResponseBody200' with all required fields.
mkGetCustomersCustomerCardsResponseBody200 ::
  -- | 'getCustomersCustomerCardsResponseBody200Data'
  [Card] ->
  -- | 'getCustomersCustomerCardsResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getCustomersCustomerCardsResponseBody200Url'
  Data.Text.Internal.Text ->
  GetCustomersCustomerCardsResponseBody200
mkGetCustomersCustomerCardsResponseBody200 :: [Card] -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200
mkGetCustomersCustomerCardsResponseBody200 [Card]
getCustomersCustomerCardsResponseBody200Data Bool
getCustomersCustomerCardsResponseBody200HasMore Text
getCustomersCustomerCardsResponseBody200Url =
  GetCustomersCustomerCardsResponseBody200 :: [Card] -> Bool -> Text -> GetCustomersCustomerCardsResponseBody200
GetCustomersCustomerCardsResponseBody200
    { getCustomersCustomerCardsResponseBody200Data :: [Card]
getCustomersCustomerCardsResponseBody200Data = [Card]
getCustomersCustomerCardsResponseBody200Data,
      getCustomersCustomerCardsResponseBody200HasMore :: Bool
getCustomersCustomerCardsResponseBody200HasMore = Bool
getCustomersCustomerCardsResponseBody200HasMore,
      getCustomersCustomerCardsResponseBody200Url :: Text
getCustomersCustomerCardsResponseBody200Url = Text
getCustomersCustomerCardsResponseBody200Url
    }