{-# 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 list_credit_payments
module RecurlyClient.Operations.List_credit_payments 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
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.ByteString as Data.ByteString.Internal.Type
import qualified Data.Either
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as 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 RecurlyClient.Common
import RecurlyClient.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

{- | > GET /credit_payments

See the [Pagination Guide](\/developers\/guides\/pagination.html) to learn how to use pagination in the API and Client Libraries.
-}
list_credit_payments ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_credit_paymentsParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response List_credit_paymentsResponse)
list_credit_payments :: forall (m :: * -> *).
MonadHTTP m =>
List_credit_paymentsParameters
-> ClientT m (Response List_credit_paymentsResponse)
list_credit_payments List_credit_paymentsParameters
parameters =
    (Response ByteString -> Response List_credit_paymentsResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response List_credit_paymentsResponse)
forall a b. (a -> b) -> ClientT m a -> ClientT m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
        ( \Response ByteString
response_0 ->
            (ByteString -> List_credit_paymentsResponse)
-> Response ByteString -> Response List_credit_paymentsResponse
forall a b. (a -> b) -> Response a -> Response b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
                ( (String -> List_credit_paymentsResponse)
-> (List_credit_paymentsResponse -> List_credit_paymentsResponse)
-> Either String List_credit_paymentsResponse
-> List_credit_paymentsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_credit_paymentsResponse
List_credit_paymentsResponseError List_credit_paymentsResponse -> List_credit_paymentsResponse
forall a. a -> a
GHC.Base.id
                    (Either String List_credit_paymentsResponse
 -> List_credit_paymentsResponse)
-> (ByteString -> Either String List_credit_paymentsResponse)
-> ByteString
-> List_credit_paymentsResponse
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) ->
                                            CreditPaymentList -> List_credit_paymentsResponse
List_credit_paymentsResponse200
                                                (CreditPaymentList -> List_credit_paymentsResponse)
-> Either String CreditPaymentList
-> Either String List_credit_paymentsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String CreditPaymentList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                    Data.Either.Either
                                                                        GHC.Base.String
                                                                        CreditPaymentList
                                                                 )
                                        | (\Status
status_2 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_2 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
400) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                            Error -> List_credit_paymentsResponse
List_credit_paymentsResponse400
                                                (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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
                                                                 )
                                        | (\Status
status_3 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_3 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
404) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                            Error -> List_credit_paymentsResponse
List_credit_paymentsResponse404
                                                (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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 -> 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 -> List_credit_paymentsResponse
List_credit_paymentsResponseDefault
                                                (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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 List_credit_paymentsResponse
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)
RecurlyClient.Common.doCallWithConfigurationM
            (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.Internal.pack String
"GET")
            Text
"/credit_payments"
            [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.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.<$> List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"order") (List_credit_paymentsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQueryOrder -> Value)
-> Maybe List_credit_paymentsParametersQueryOrder -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"sort") (List_credit_paymentsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQuerySort -> Value)
-> Maybe List_credit_paymentsParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"begin_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"end_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

-- | Defines the object schema located at @paths.\/credit_payments.GET.parameters@ in the specification.
data List_credit_paymentsParameters = List_credit_paymentsParameters
    { List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ queryBegin_time: Represents the parameter named \'begin_time\'
    --
    -- Inclusively filter by begin_time when \`sort=created_at\` or \`sort=updated_at\`.
    -- **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
    , List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ queryEnd_time: Represents the parameter named \'end_time\'
    --
    -- Inclusively filter by end_time when \`sort=created_at\` or \`sort=updated_at\`.
    -- **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
    , List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ queryLimit: Represents the parameter named \'limit\'
    --
    -- Limit number of records 1-200.
    --
    -- Constraints:
    --
    -- * Maxium  of 200.0
    -- * Minimum  of 1.0
    , List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder :: (GHC.Maybe.Maybe List_credit_paymentsParametersQueryOrder)
    -- ^ queryOrder: Represents the parameter named \'order\'
    --
    -- Sort order.
    , List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort :: (GHC.Maybe.Maybe List_credit_paymentsParametersQuerySort)
    -- ^ querySort: Represents the parameter named \'sort\'
    --
    -- Sort field. You *really* only want to sort by \`updated_at\` in ascending
    -- order. In descending order updated records will move behind the cursor and could
    -- prevent some records from being returned.
    }
    deriving
        ( Int -> List_credit_paymentsParameters -> ShowS
[List_credit_paymentsParameters] -> ShowS
List_credit_paymentsParameters -> String
(Int -> List_credit_paymentsParameters -> ShowS)
-> (List_credit_paymentsParameters -> String)
-> ([List_credit_paymentsParameters] -> ShowS)
-> Show List_credit_paymentsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_credit_paymentsParameters -> ShowS
showsPrec :: Int -> List_credit_paymentsParameters -> ShowS
$cshow :: List_credit_paymentsParameters -> String
show :: List_credit_paymentsParameters -> String
$cshowList :: [List_credit_paymentsParameters] -> ShowS
showList :: [List_credit_paymentsParameters] -> ShowS
GHC.Show.Show
        , List_credit_paymentsParameters
-> List_credit_paymentsParameters -> Bool
(List_credit_paymentsParameters
 -> List_credit_paymentsParameters -> Bool)
-> (List_credit_paymentsParameters
    -> List_credit_paymentsParameters -> Bool)
-> Eq List_credit_paymentsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_credit_paymentsParameters
-> List_credit_paymentsParameters -> Bool
== :: List_credit_paymentsParameters
-> List_credit_paymentsParameters -> Bool
$c/= :: List_credit_paymentsParameters
-> List_credit_paymentsParameters -> Bool
/= :: List_credit_paymentsParameters
-> List_credit_paymentsParameters -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON List_credit_paymentsParameters where
    toJSON :: List_credit_paymentsParameters -> Value
toJSON List_credit_paymentsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryBegin_time" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryEnd_time" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryLimit" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_credit_paymentsParametersQueryOrder -> [Pair])
-> Maybe List_credit_paymentsParametersQueryOrder
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (List_credit_paymentsParametersQueryOrder -> Pair)
-> List_credit_paymentsParametersQueryOrder
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_credit_paymentsParametersQueryOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_credit_paymentsParametersQuerySort -> [Pair])
-> Maybe List_credit_paymentsParametersQuerySort
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (List_credit_paymentsParametersQuerySort -> Pair)
-> List_credit_paymentsParametersQuerySort
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_credit_paymentsParametersQuerySort -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: List_credit_paymentsParameters -> Encoding
toEncoding List_credit_paymentsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryBegin_time" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryEnd_time" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryLimit" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_credit_paymentsParametersQueryOrder -> [Series])
-> Maybe List_credit_paymentsParametersQueryOrder
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (List_credit_paymentsParametersQueryOrder -> Series)
-> List_credit_paymentsParametersQueryOrder
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_credit_paymentsParametersQueryOrder -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_credit_paymentsParametersQuerySort -> [Series])
-> Maybe List_credit_paymentsParametersQuerySort
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (List_credit_paymentsParametersQuerySort -> Series)
-> List_credit_paymentsParametersQuerySort
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_credit_paymentsParametersQuerySort -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON List_credit_paymentsParameters where
    parseJSON :: Value -> Parser List_credit_paymentsParameters
parseJSON = String
-> (Object -> Parser List_credit_paymentsParameters)
-> Value
-> Parser List_credit_paymentsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"List_credit_paymentsParameters" (\Object
obj -> (((((Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe Int
 -> Maybe List_credit_paymentsParametersQueryOrder
 -> Maybe List_credit_paymentsParametersQuerySort
 -> List_credit_paymentsParameters)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe List_credit_paymentsParametersQueryOrder
      -> Maybe List_credit_paymentsParametersQuerySort
      -> List_credit_paymentsParameters)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe List_credit_paymentsParametersQueryOrder
-> Maybe List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParameters
List_credit_paymentsParameters Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe List_credit_paymentsParametersQueryOrder
   -> Maybe List_credit_paymentsParametersQuerySort
   -> List_credit_paymentsParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Int
      -> Maybe List_credit_paymentsParametersQueryOrder
      -> Maybe List_credit_paymentsParametersQuerySort
      -> List_credit_paymentsParameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryBegin_time")) Parser
  (Maybe JsonDateTime
   -> Maybe Int
   -> Maybe List_credit_paymentsParametersQueryOrder
   -> Maybe List_credit_paymentsParametersQuerySort
   -> List_credit_paymentsParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Int
      -> Maybe List_credit_paymentsParametersQueryOrder
      -> Maybe List_credit_paymentsParametersQuerySort
      -> List_credit_paymentsParameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryEnd_time")) Parser
  (Maybe Int
   -> Maybe List_credit_paymentsParametersQueryOrder
   -> Maybe List_credit_paymentsParametersQuerySort
   -> List_credit_paymentsParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe List_credit_paymentsParametersQueryOrder
      -> Maybe List_credit_paymentsParametersQuerySort
      -> List_credit_paymentsParameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryLimit")) Parser
  (Maybe List_credit_paymentsParametersQueryOrder
   -> Maybe List_credit_paymentsParametersQuerySort
   -> List_credit_paymentsParameters)
-> Parser (Maybe List_credit_paymentsParametersQueryOrder)
-> Parser
     (Maybe List_credit_paymentsParametersQuerySort
      -> List_credit_paymentsParameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Key -> Parser (Maybe List_credit_paymentsParametersQueryOrder)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryOrder")) Parser
  (Maybe List_credit_paymentsParametersQuerySort
   -> List_credit_paymentsParameters)
-> Parser (Maybe List_credit_paymentsParametersQuerySort)
-> Parser List_credit_paymentsParameters
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Key -> Parser (Maybe List_credit_paymentsParametersQuerySort)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"querySort"))

-- | Create a new 'List_credit_paymentsParameters' with all required fields.
mkList_credit_paymentsParameters :: List_credit_paymentsParameters
mkList_credit_paymentsParameters :: List_credit_paymentsParameters
mkList_credit_paymentsParameters =
    List_credit_paymentsParameters
        { list_credit_paymentsParametersQueryBegin_time :: Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_credit_paymentsParametersQueryEnd_time :: Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_credit_paymentsParametersQueryLimit :: Maybe Int
list_credit_paymentsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , list_credit_paymentsParametersQueryOrder :: Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder = Maybe List_credit_paymentsParametersQueryOrder
forall a. Maybe a
GHC.Maybe.Nothing
        , list_credit_paymentsParametersQuerySort :: Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort = Maybe List_credit_paymentsParametersQuerySort
forall a. Maybe a
GHC.Maybe.Nothing
        }

{- | Defines the enum schema located at @paths.\/credit_payments.GET.parameters.properties.queryOrder@ in the specification.

Represents the parameter named \'order\'

Sort order.
-}
data List_credit_paymentsParametersQueryOrder
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_credit_paymentsParametersQueryOrderOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      List_credit_paymentsParametersQueryOrderTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"asc"@
      List_credit_paymentsParametersQueryOrderEnumAsc
    | -- | Represents the JSON value @"desc"@
      List_credit_paymentsParametersQueryOrderEnumDesc
    deriving (Int -> List_credit_paymentsParametersQueryOrder -> ShowS
[List_credit_paymentsParametersQueryOrder] -> ShowS
List_credit_paymentsParametersQueryOrder -> String
(Int -> List_credit_paymentsParametersQueryOrder -> ShowS)
-> (List_credit_paymentsParametersQueryOrder -> String)
-> ([List_credit_paymentsParametersQueryOrder] -> ShowS)
-> Show List_credit_paymentsParametersQueryOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_credit_paymentsParametersQueryOrder -> ShowS
showsPrec :: Int -> List_credit_paymentsParametersQueryOrder -> ShowS
$cshow :: List_credit_paymentsParametersQueryOrder -> String
show :: List_credit_paymentsParametersQueryOrder -> String
$cshowList :: [List_credit_paymentsParametersQueryOrder] -> ShowS
showList :: [List_credit_paymentsParametersQueryOrder] -> ShowS
GHC.Show.Show, List_credit_paymentsParametersQueryOrder
-> List_credit_paymentsParametersQueryOrder -> Bool
(List_credit_paymentsParametersQueryOrder
 -> List_credit_paymentsParametersQueryOrder -> Bool)
-> (List_credit_paymentsParametersQueryOrder
    -> List_credit_paymentsParametersQueryOrder -> Bool)
-> Eq List_credit_paymentsParametersQueryOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_credit_paymentsParametersQueryOrder
-> List_credit_paymentsParametersQueryOrder -> Bool
== :: List_credit_paymentsParametersQueryOrder
-> List_credit_paymentsParametersQueryOrder -> Bool
$c/= :: List_credit_paymentsParametersQueryOrder
-> List_credit_paymentsParametersQueryOrder -> Bool
/= :: List_credit_paymentsParametersQueryOrder
-> List_credit_paymentsParametersQueryOrder -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_credit_paymentsParametersQueryOrder where
    toJSON :: List_credit_paymentsParametersQueryOrder -> Value
toJSON (List_credit_paymentsParametersQueryOrderOther Value
val) = Value
val
    toJSON (List_credit_paymentsParametersQueryOrderTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_credit_paymentsParametersQueryOrder
List_credit_paymentsParametersQueryOrderEnumAsc) = Value
"asc"
    toJSON (List_credit_paymentsParametersQueryOrder
List_credit_paymentsParametersQueryOrderEnumDesc) = Value
"desc"
instance Data.Aeson.Types.FromJSON.FromJSON List_credit_paymentsParametersQueryOrder where
    parseJSON :: Value -> Parser List_credit_paymentsParametersQueryOrder
parseJSON Value
val =
        List_credit_paymentsParametersQueryOrder
-> Parser List_credit_paymentsParametersQueryOrder
forall a. a -> Parser a
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
"asc" -> List_credit_paymentsParametersQueryOrder
List_credit_paymentsParametersQueryOrderEnumAsc
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"desc" -> List_credit_paymentsParametersQueryOrder
List_credit_paymentsParametersQueryOrderEnumDesc
                | Bool
GHC.Base.otherwise -> Value -> List_credit_paymentsParametersQueryOrder
List_credit_paymentsParametersQueryOrderOther Value
val
            )

{- | Defines the enum schema located at @paths.\/credit_payments.GET.parameters.properties.querySort@ in the specification.

Represents the parameter named \'sort\'

Sort field. You *really* only want to sort by \`updated_at\` in ascending
order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.
-}
data List_credit_paymentsParametersQuerySort
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_credit_paymentsParametersQuerySortOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      List_credit_paymentsParametersQuerySortTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"created_at"@
      List_credit_paymentsParametersQuerySortEnumCreated_at
    | -- | Represents the JSON value @"updated_at"@
      List_credit_paymentsParametersQuerySortEnumUpdated_at
    deriving (Int -> List_credit_paymentsParametersQuerySort -> ShowS
[List_credit_paymentsParametersQuerySort] -> ShowS
List_credit_paymentsParametersQuerySort -> String
(Int -> List_credit_paymentsParametersQuerySort -> ShowS)
-> (List_credit_paymentsParametersQuerySort -> String)
-> ([List_credit_paymentsParametersQuerySort] -> ShowS)
-> Show List_credit_paymentsParametersQuerySort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_credit_paymentsParametersQuerySort -> ShowS
showsPrec :: Int -> List_credit_paymentsParametersQuerySort -> ShowS
$cshow :: List_credit_paymentsParametersQuerySort -> String
show :: List_credit_paymentsParametersQuerySort -> String
$cshowList :: [List_credit_paymentsParametersQuerySort] -> ShowS
showList :: [List_credit_paymentsParametersQuerySort] -> ShowS
GHC.Show.Show, List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParametersQuerySort -> Bool
(List_credit_paymentsParametersQuerySort
 -> List_credit_paymentsParametersQuerySort -> Bool)
-> (List_credit_paymentsParametersQuerySort
    -> List_credit_paymentsParametersQuerySort -> Bool)
-> Eq List_credit_paymentsParametersQuerySort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParametersQuerySort -> Bool
== :: List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParametersQuerySort -> Bool
$c/= :: List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParametersQuerySort -> Bool
/= :: List_credit_paymentsParametersQuerySort
-> List_credit_paymentsParametersQuerySort -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_credit_paymentsParametersQuerySort where
    toJSON :: List_credit_paymentsParametersQuerySort -> Value
toJSON (List_credit_paymentsParametersQuerySortOther Value
val) = Value
val
    toJSON (List_credit_paymentsParametersQuerySortTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_credit_paymentsParametersQuerySort
List_credit_paymentsParametersQuerySortEnumCreated_at) = Value
"created_at"
    toJSON (List_credit_paymentsParametersQuerySort
List_credit_paymentsParametersQuerySortEnumUpdated_at) = Value
"updated_at"
instance Data.Aeson.Types.FromJSON.FromJSON List_credit_paymentsParametersQuerySort where
    parseJSON :: Value -> Parser List_credit_paymentsParametersQuerySort
parseJSON Value
val =
        List_credit_paymentsParametersQuerySort
-> Parser List_credit_paymentsParametersQuerySort
forall a. a -> Parser a
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
"created_at" -> List_credit_paymentsParametersQuerySort
List_credit_paymentsParametersQuerySortEnumCreated_at
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"updated_at" -> List_credit_paymentsParametersQuerySort
List_credit_paymentsParametersQuerySortEnumUpdated_at
                | Bool
GHC.Base.otherwise -> Value -> List_credit_paymentsParametersQuerySort
List_credit_paymentsParametersQuerySortOther Value
val
            )

{- | Represents a response of the operation 'list_credit_payments'.

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), 'List_credit_paymentsResponseError' is used.
-}
data List_credit_paymentsResponse
    = -- | Means either no matching case available or a parse error
      List_credit_paymentsResponseError GHC.Base.String
    | -- | A list of the site\'s credit payments.
      List_credit_paymentsResponse200 CreditPaymentList
    | -- | Invalid or unpermitted parameter.
      List_credit_paymentsResponse400 Error
    | -- | Incorrect site or account ID.
      List_credit_paymentsResponse404 Error
    | -- | Unexpected error.
      List_credit_paymentsResponseDefault Error
    deriving (Int -> List_credit_paymentsResponse -> ShowS
[List_credit_paymentsResponse] -> ShowS
List_credit_paymentsResponse -> String
(Int -> List_credit_paymentsResponse -> ShowS)
-> (List_credit_paymentsResponse -> String)
-> ([List_credit_paymentsResponse] -> ShowS)
-> Show List_credit_paymentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_credit_paymentsResponse -> ShowS
showsPrec :: Int -> List_credit_paymentsResponse -> ShowS
$cshow :: List_credit_paymentsResponse -> String
show :: List_credit_paymentsResponse -> String
$cshowList :: [List_credit_paymentsResponse] -> ShowS
showList :: [List_credit_paymentsResponse] -> ShowS
GHC.Show.Show, List_credit_paymentsResponse
-> List_credit_paymentsResponse -> Bool
(List_credit_paymentsResponse
 -> List_credit_paymentsResponse -> Bool)
-> (List_credit_paymentsResponse
    -> List_credit_paymentsResponse -> Bool)
-> Eq List_credit_paymentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_credit_paymentsResponse
-> List_credit_paymentsResponse -> Bool
== :: List_credit_paymentsResponse
-> List_credit_paymentsResponse -> Bool
$c/= :: List_credit_paymentsResponse
-> List_credit_paymentsResponse -> Bool
/= :: List_credit_paymentsResponse
-> List_credit_paymentsResponse -> Bool
GHC.Classes.Eq)

{- | > GET /credit_payments

The same as 'list_credit_payments' but accepts an explicit configuration.
-}
list_credit_paymentsWithConfiguration ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | The configuration to use in the request
    RecurlyClient.Common.Configuration ->
    -- | Contains all available parameters of this operation (query and path parameters)
    List_credit_paymentsParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response List_credit_paymentsResponse)
list_credit_paymentsWithConfiguration :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_credit_paymentsParameters
-> m (Response List_credit_paymentsResponse)
list_credit_paymentsWithConfiguration
    Configuration
config
    List_credit_paymentsParameters
parameters =
        (Response ByteString -> Response List_credit_paymentsResponse)
-> m (Response ByteString)
-> m (Response List_credit_paymentsResponse)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
            ( \Response ByteString
response_4 ->
                (ByteString -> List_credit_paymentsResponse)
-> Response ByteString -> Response List_credit_paymentsResponse
forall a b. (a -> b) -> Response a -> Response b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
                    ( (String -> List_credit_paymentsResponse)
-> (List_credit_paymentsResponse -> List_credit_paymentsResponse)
-> Either String List_credit_paymentsResponse
-> List_credit_paymentsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_credit_paymentsResponse
List_credit_paymentsResponseError List_credit_paymentsResponse -> List_credit_paymentsResponse
forall a. a -> a
GHC.Base.id
                        (Either String List_credit_paymentsResponse
 -> List_credit_paymentsResponse)
-> (ByteString -> Either String List_credit_paymentsResponse)
-> ByteString
-> List_credit_paymentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                                        if
                                            | (\Status
status_5 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_5 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) ->
                                                CreditPaymentList -> List_credit_paymentsResponse
List_credit_paymentsResponse200
                                                    (CreditPaymentList -> List_credit_paymentsResponse)
-> Either String CreditPaymentList
-> Either String List_credit_paymentsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String CreditPaymentList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                        Data.Either.Either
                                                                            GHC.Base.String
                                                                            CreditPaymentList
                                                                     )
                                            | (\Status
status_6 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_6 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
400) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                                Error -> List_credit_paymentsResponse
List_credit_paymentsResponse400
                                                    (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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
                                                                     )
                                            | (\Status
status_7 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_7 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
404) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                                Error -> List_credit_paymentsResponse
List_credit_paymentsResponse404
                                                    (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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 -> 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 -> List_credit_paymentsResponse
List_credit_paymentsResponseDefault
                                                    (Error -> List_credit_paymentsResponse)
-> Either String Error
-> Either String List_credit_paymentsResponse
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 List_credit_paymentsResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                                   )
                            Response ByteString
response_4
                    )
                    Response ByteString
response_4
            )
            ( Configuration
-> Text -> Text -> [QueryParameter] -> m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> Text -> Text -> [QueryParameter] -> m (Response ByteString)
RecurlyClient.Common.doCallWithConfiguration
                Configuration
config
                (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.Internal.pack String
"GET")
                Text
"/credit_payments"
                [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.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.<$> List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"order") (List_credit_paymentsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQueryOrder -> Value)
-> Maybe List_credit_paymentsParametersQueryOrder -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"sort") (List_credit_paymentsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQuerySort -> Value)
-> Maybe List_credit_paymentsParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"begin_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"end_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )

{- | > GET /credit_payments

The same as 'list_credit_payments' but returns the raw 'Data.ByteString.ByteString'.
-}
list_credit_paymentsRaw ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_credit_paymentsParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_credit_paymentsRaw :: forall (m :: * -> *).
MonadHTTP m =>
List_credit_paymentsParameters -> ClientT m (Response ByteString)
list_credit_paymentsRaw List_credit_paymentsParameters
parameters =
    ClientT m (Response ByteString) -> ClientT m (Response ByteString)
forall a. a -> a
GHC.Base.id
        ( Text -> Text -> [QueryParameter] -> ClientT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> ClientT m (Response ByteString)
RecurlyClient.Common.doCallWithConfigurationM
            (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.Internal.pack String
"GET")
            Text
"/credit_payments"
            [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.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.<$> List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"order") (List_credit_paymentsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQueryOrder -> Value)
-> Maybe List_credit_paymentsParametersQueryOrder -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"sort") (List_credit_paymentsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQuerySort -> Value)
-> Maybe List_credit_paymentsParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"begin_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"end_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

{- | > GET /credit_payments

The same as 'list_credit_payments' but accepts an explicit configuration and returns the raw 'Data.ByteString.ByteString'.
-}
list_credit_paymentsWithConfigurationRaw ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | The configuration to use in the request
    RecurlyClient.Common.Configuration ->
    -- | Contains all available parameters of this operation (query and path parameters)
    List_credit_paymentsParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_credit_paymentsWithConfigurationRaw :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_credit_paymentsParameters -> m (Response ByteString)
list_credit_paymentsWithConfigurationRaw
    Configuration
config
    List_credit_paymentsParameters
parameters =
        m (Response ByteString) -> m (Response ByteString)
forall a. a -> a
GHC.Base.id
            ( Configuration
-> Text -> Text -> [QueryParameter] -> m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> Text -> Text -> [QueryParameter] -> m (Response ByteString)
RecurlyClient.Common.doCallWithConfiguration
                Configuration
config
                (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.Internal.pack String
"GET")
                Text
"/credit_payments"
                [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.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.<$> List_credit_paymentsParameters -> Maybe Int
list_credit_paymentsParametersQueryLimit List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"order") (List_credit_paymentsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQueryOrder -> Value)
-> Maybe List_credit_paymentsParametersQueryOrder -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQueryOrder
list_credit_paymentsParametersQueryOrder List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"sort") (List_credit_paymentsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_credit_paymentsParametersQuerySort -> Value)
-> Maybe List_credit_paymentsParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters
-> Maybe List_credit_paymentsParametersQuerySort
list_credit_paymentsParametersQuerySort List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"begin_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryBegin_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                , Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"end_time") (JsonDateTime -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (JsonDateTime -> Value) -> Maybe JsonDateTime -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_credit_paymentsParameters -> Maybe JsonDateTime
list_credit_paymentsParametersQueryEnd_time List_credit_paymentsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )