{-# 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 getCustomersCustomerTaxIds
module StripeAPI.Operations.GetCustomersCustomerTaxIds 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}/tax_ids
--
-- \<p>Returns a list of tax IDs for a customer.\<\/p>
getCustomersCustomerTaxIds ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetCustomersCustomerTaxIdsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetCustomersCustomerTaxIdsResponse)
getCustomersCustomerTaxIds :: GetCustomersCustomerTaxIdsParameters
-> StripeT m (Response GetCustomersCustomerTaxIdsResponse)
getCustomersCustomerTaxIds GetCustomersCustomerTaxIdsParameters
parameters =
  (Response ByteString
 -> Response GetCustomersCustomerTaxIdsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetCustomersCustomerTaxIdsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetCustomersCustomerTaxIdsResponse)
-> Response ByteString
-> Response GetCustomersCustomerTaxIdsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetCustomersCustomerTaxIdsResponse)
-> (GetCustomersCustomerTaxIdsResponse
    -> GetCustomersCustomerTaxIdsResponse)
-> Either String GetCustomersCustomerTaxIdsResponse
-> GetCustomersCustomerTaxIdsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetCustomersCustomerTaxIdsResponse
GetCustomersCustomerTaxIdsResponseError GetCustomersCustomerTaxIdsResponse
-> GetCustomersCustomerTaxIdsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetCustomersCustomerTaxIdsResponse
 -> GetCustomersCustomerTaxIdsResponse)
-> (ByteString -> Either String GetCustomersCustomerTaxIdsResponse)
-> ByteString
-> GetCustomersCustomerTaxIdsResponse
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) ->
                                   GetCustomersCustomerTaxIdsResponseBody200
-> GetCustomersCustomerTaxIdsResponse
GetCustomersCustomerTaxIdsResponse200
                                     (GetCustomersCustomerTaxIdsResponseBody200
 -> GetCustomersCustomerTaxIdsResponse)
-> Either String GetCustomersCustomerTaxIdsResponseBody200
-> Either String GetCustomersCustomerTaxIdsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString
-> Either String GetCustomersCustomerTaxIdsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetCustomersCustomerTaxIdsResponseBody200
                                                      )
                                 | 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 -> GetCustomersCustomerTaxIdsResponse
GetCustomersCustomerTaxIdsResponseDefault
                                     (Error -> GetCustomersCustomerTaxIdsResponse)
-> Either String Error
-> Either String GetCustomersCustomerTaxIdsResponse
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 GetCustomersCustomerTaxIdsResponse
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/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 (GetCustomersCustomerTaxIdsParameters -> Text
getCustomersCustomerTaxIdsParametersPathCustomer GetCustomersCustomerTaxIdsParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
"/tax_ids")))
        [ 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.<$> GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryEndingBefore GetCustomersCustomerTaxIdsParameters
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.<$> GetCustomersCustomerTaxIdsParameters -> Maybe [Text]
getCustomersCustomerTaxIdsParametersQueryExpand GetCustomersCustomerTaxIdsParameters
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.<$> GetCustomersCustomerTaxIdsParameters -> Maybe Int
getCustomersCustomerTaxIdsParametersQueryLimit GetCustomersCustomerTaxIdsParameters
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.<$> GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryStartingAfter GetCustomersCustomerTaxIdsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

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

instance Data.Aeson.Types.ToJSON.ToJSON GetCustomersCustomerTaxIdsParameters where
  toJSON :: GetCustomersCustomerTaxIdsParameters -> Value
toJSON GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Text
getCustomersCustomerTaxIdsParametersPathCustomer GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryEndingBefore GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe [Text]
getCustomersCustomerTaxIdsParametersQueryExpand GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Int
getCustomersCustomerTaxIdsParametersQueryLimit GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryStartingAfter GetCustomersCustomerTaxIdsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetCustomersCustomerTaxIdsParameters -> Encoding
toEncoding GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Text
getCustomersCustomerTaxIdsParametersPathCustomer GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryEndingBefore GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe [Text]
getCustomersCustomerTaxIdsParametersQueryExpand GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Int
getCustomersCustomerTaxIdsParametersQueryLimit GetCustomersCustomerTaxIdsParameters
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..= GetCustomersCustomerTaxIdsParameters -> Maybe Text
getCustomersCustomerTaxIdsParametersQueryStartingAfter GetCustomersCustomerTaxIdsParameters
obj)))))

instance Data.Aeson.Types.FromJSON.FromJSON GetCustomersCustomerTaxIdsParameters where
  parseJSON :: Value -> Parser GetCustomersCustomerTaxIdsParameters
parseJSON = String
-> (Object -> Parser GetCustomersCustomerTaxIdsParameters)
-> Value
-> Parser GetCustomersCustomerTaxIdsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCustomersCustomerTaxIdsParameters" (\Object
obj -> (((((Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> GetCustomersCustomerTaxIdsParameters)
-> Parser
     (Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetCustomersCustomerTaxIdsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCustomersCustomerTaxIdsParameters
GetCustomersCustomerTaxIdsParameters Parser
  (Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetCustomersCustomerTaxIdsParameters)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetCustomersCustomerTaxIdsParameters)
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
   -> GetCustomersCustomerTaxIdsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int -> Maybe Text -> GetCustomersCustomerTaxIdsParameters)
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 -> GetCustomersCustomerTaxIdsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int -> Maybe Text -> GetCustomersCustomerTaxIdsParameters)
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 -> GetCustomersCustomerTaxIdsParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetCustomersCustomerTaxIdsParameters)
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 -> GetCustomersCustomerTaxIdsParameters)
-> Parser (Maybe Text)
-> Parser GetCustomersCustomerTaxIdsParameters
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 'GetCustomersCustomerTaxIdsParameters' with all required fields.
mkGetCustomersCustomerTaxIdsParameters ::
  -- | 'getCustomersCustomerTaxIdsParametersPathCustomer'
  Data.Text.Internal.Text ->
  GetCustomersCustomerTaxIdsParameters
mkGetCustomersCustomerTaxIdsParameters :: Text -> GetCustomersCustomerTaxIdsParameters
mkGetCustomersCustomerTaxIdsParameters Text
getCustomersCustomerTaxIdsParametersPathCustomer =
  GetCustomersCustomerTaxIdsParameters :: Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCustomersCustomerTaxIdsParameters
GetCustomersCustomerTaxIdsParameters
    { getCustomersCustomerTaxIdsParametersPathCustomer :: Text
getCustomersCustomerTaxIdsParametersPathCustomer = Text
getCustomersCustomerTaxIdsParametersPathCustomer,
      getCustomersCustomerTaxIdsParametersQueryEndingBefore :: Maybe Text
getCustomersCustomerTaxIdsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerTaxIdsParametersQueryExpand :: Maybe [Text]
getCustomersCustomerTaxIdsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerTaxIdsParametersQueryLimit :: Maybe Int
getCustomersCustomerTaxIdsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersCustomerTaxIdsParametersQueryStartingAfter :: Maybe Text
getCustomersCustomerTaxIdsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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