{-# 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_unique_coupon_codes
module RecurlyClient.Operations.List_unique_coupon_codes 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 /coupons/{coupon_id}/unique_coupon_codes

See the [Pagination Guide](\/developers\/guides\/pagination.html) to learn how to use pagination in the API and Client Libraries.
-}
list_unique_coupon_codes ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_unique_coupon_codesParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response List_unique_coupon_codesResponse)
list_unique_coupon_codes :: forall (m :: * -> *).
MonadHTTP m =>
List_unique_coupon_codesParameters
-> ClientT m (Response List_unique_coupon_codesResponse)
list_unique_coupon_codes List_unique_coupon_codesParameters
parameters =
    (Response ByteString -> Response List_unique_coupon_codesResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response List_unique_coupon_codesResponse)
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_unique_coupon_codesResponse)
-> Response ByteString -> Response List_unique_coupon_codesResponse
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_unique_coupon_codesResponse)
-> (List_unique_coupon_codesResponse
    -> List_unique_coupon_codesResponse)
-> Either String List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponseError List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse
forall a. a -> a
GHC.Base.id
                    (Either String List_unique_coupon_codesResponse
 -> List_unique_coupon_codesResponse)
-> (ByteString -> Either String List_unique_coupon_codesResponse)
-> ByteString
-> List_unique_coupon_codesResponse
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) ->
                                            UniqueCouponCodeList -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponse200
                                                (UniqueCouponCodeList -> List_unique_coupon_codesResponse)
-> Either String UniqueCouponCodeList
-> Either String List_unique_coupon_codesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String UniqueCouponCodeList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                    Data.Either.Either
                                                                        GHC.Base.String
                                                                        UniqueCouponCodeList
                                                                 )
                                        | (\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
404) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                            Error -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponse404
                                                (Error -> List_unique_coupon_codesResponse)
-> Either String Error
-> Either String List_unique_coupon_codesResponse
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_unique_coupon_codesResponse
List_unique_coupon_codesResponseDefault
                                                (Error -> List_unique_coupon_codesResponse)
-> Either String Error
-> Either String List_unique_coupon_codesResponse
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_unique_coupon_codesResponse
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
"/coupons/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (ByteString -> Text
RecurlyClient.Common.byteToText (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.$ (Text -> ByteString
RecurlyClient.Common.textToByte (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Text
forall a. ToJSON a => a -> Text
RecurlyClient.Common.stringifyModel (List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/unique_coupon_codes"))
            [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"ids") ([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.<$> List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryOrder -> Value)
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQuerySort -> Value)
-> Maybe List_unique_coupon_codesParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
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
"redeemed") (List_unique_coupon_codesParametersQueryRedeemed -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryRedeemed -> Value)
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

-- | Defines the object schema located at @paths.\/coupons\/{coupon_id}\/unique_coupon_codes.GET.parameters@ in the specification.
data List_unique_coupon_codesParameters = List_unique_coupon_codesParameters
    { List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id :: Data.Text.Internal.Text
    -- ^ pathCoupon_id: Represents the parameter named \'coupon_id\'
    --
    -- Coupon ID or code. For ID no prefix is used e.g. \`e28zov4fw0v2\`. For code use prefix \`code-\`, e.g. \`code-10off\`.
    , List_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_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_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds :: (GHC.Maybe.Maybe [Data.Text.Internal.Text])
    -- ^ queryIds: Represents the parameter named \'ids\'
    --
    -- Filter results by their IDs. Up to 200 IDs can be passed at once using
    -- commas as separators, e.g. \`ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6\`.
    --
    -- **Important notes:**
    --
    -- * The \`ids\` parameter cannot be used with any other ordering or filtering
    --   parameters (\`limit\`, \`order\`, \`sort\`, \`begin_time\`, \`end_time\`, etc)
    -- * Invalid or unknown IDs will be ignored, so you should check that the
    --   results correspond to your request.
    -- * Records are returned in an arbitrary order. Since results are all
    --   returned at once you can sort the records yourself.
    , List_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit :: (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_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder :: (GHC.Maybe.Maybe List_unique_coupon_codesParametersQueryOrder)
    -- ^ queryOrder: Represents the parameter named \'order\'
    --
    -- Sort order.
    , List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed :: (GHC.Maybe.Maybe List_unique_coupon_codesParametersQueryRedeemed)
    -- ^ queryRedeemed: Represents the parameter named \'redeemed\'
    --
    -- Filter unique coupon codes by redemption status. \`true\` for redeemed, \`false\` for not redeemed.
    , List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort :: (GHC.Maybe.Maybe List_unique_coupon_codesParametersQuerySort)
    -- ^ 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_unique_coupon_codesParameters -> ShowS
[List_unique_coupon_codesParameters] -> ShowS
List_unique_coupon_codesParameters -> String
(Int -> List_unique_coupon_codesParameters -> ShowS)
-> (List_unique_coupon_codesParameters -> String)
-> ([List_unique_coupon_codesParameters] -> ShowS)
-> Show List_unique_coupon_codesParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_unique_coupon_codesParameters -> ShowS
showsPrec :: Int -> List_unique_coupon_codesParameters -> ShowS
$cshow :: List_unique_coupon_codesParameters -> String
show :: List_unique_coupon_codesParameters -> String
$cshowList :: [List_unique_coupon_codesParameters] -> ShowS
showList :: [List_unique_coupon_codesParameters] -> ShowS
GHC.Show.Show
        , List_unique_coupon_codesParameters
-> List_unique_coupon_codesParameters -> Bool
(List_unique_coupon_codesParameters
 -> List_unique_coupon_codesParameters -> Bool)
-> (List_unique_coupon_codesParameters
    -> List_unique_coupon_codesParameters -> Bool)
-> Eq List_unique_coupon_codesParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_unique_coupon_codesParameters
-> List_unique_coupon_codesParameters -> Bool
== :: List_unique_coupon_codesParameters
-> List_unique_coupon_codesParameters -> Bool
$c/= :: List_unique_coupon_codesParameters
-> List_unique_coupon_codesParameters -> Bool
/= :: List_unique_coupon_codesParameters
-> List_unique_coupon_codesParameters -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON List_unique_coupon_codesParameters where
    toJSON :: List_unique_coupon_codesParameters -> Value
toJSON List_unique_coupon_codesParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Key
"pathCoupon_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..= List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> ([Text] -> [Pair]) -> Maybe [Text] -> [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]) -> ([Text] -> Pair) -> [Text] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryIds" Key -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_unique_coupon_codesParametersQueryOrder -> [Pair])
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> [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_unique_coupon_codesParametersQueryOrder -> Pair)
-> List_unique_coupon_codesParametersQueryOrder
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_unique_coupon_codesParametersQueryOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_unique_coupon_codesParametersQueryRedeemed -> [Pair])
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> [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_unique_coupon_codesParametersQueryRedeemed -> Pair)
-> List_unique_coupon_codesParametersQueryRedeemed
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryRedeemed" Key -> List_unique_coupon_codesParametersQueryRedeemed -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_unique_coupon_codesParametersQuerySort -> [Pair])
-> Maybe List_unique_coupon_codesParametersQuerySort
-> [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_unique_coupon_codesParametersQuerySort -> Pair)
-> List_unique_coupon_codesParametersQuerySort
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_unique_coupon_codesParametersQuerySort -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: List_unique_coupon_codesParameters -> Encoding
toEncoding List_unique_coupon_codesParameters
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 ([Key
"pathCoupon_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..= List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> ([Text] -> [Series]) -> Maybe [Text] -> [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]) -> ([Text] -> Series) -> [Text] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryIds" Key -> [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_unique_coupon_codesParametersQueryOrder -> [Series])
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> [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_unique_coupon_codesParametersQueryOrder -> Series)
-> List_unique_coupon_codesParametersQueryOrder
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_unique_coupon_codesParametersQueryOrder -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_unique_coupon_codesParametersQueryRedeemed -> [Series])
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> [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_unique_coupon_codesParametersQueryRedeemed -> Series)
-> List_unique_coupon_codesParametersQueryRedeemed
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryRedeemed" Key -> List_unique_coupon_codesParametersQueryRedeemed -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_unique_coupon_codesParametersQuerySort -> [Series])
-> Maybe List_unique_coupon_codesParametersQuerySort
-> [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_unique_coupon_codesParametersQuerySort -> Series)
-> List_unique_coupon_codesParametersQuerySort
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_unique_coupon_codesParametersQuerySort -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
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_unique_coupon_codesParameters where
    parseJSON :: Value -> Parser List_unique_coupon_codesParameters
parseJSON = String
-> (Object -> Parser List_unique_coupon_codesParameters)
-> Value
-> Parser List_unique_coupon_codesParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"List_unique_coupon_codesParameters" (\Object
obj -> ((((((((Text
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe List_unique_coupon_codesParametersQueryOrder
 -> Maybe List_unique_coupon_codesParametersQueryRedeemed
 -> Maybe List_unique_coupon_codesParametersQuerySort
 -> List_unique_coupon_codesParameters)
-> Parser
     (Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe [Text]
-> Maybe Int
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> Maybe List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParameters
List_unique_coupon_codesParameters Parser
  (Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe List_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser Text
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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 Text
forall a. FromJSON a => Object -> Key -> Parser a
Data.Aeson.Types.FromJSON..: Key
"pathCoupon_id")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe List_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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 [Text]
   -> Maybe Int
   -> Maybe List_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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 [Text]
   -> Maybe Int
   -> Maybe List_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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 [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryIds")) Parser
  (Maybe Int
   -> Maybe List_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe List_unique_coupon_codesParametersQueryOrder
      -> Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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_unique_coupon_codesParametersQueryOrder
   -> Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe List_unique_coupon_codesParametersQueryOrder)
-> Parser
     (Maybe List_unique_coupon_codesParametersQueryRedeemed
      -> Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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_unique_coupon_codesParametersQueryOrder)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryOrder")) Parser
  (Maybe List_unique_coupon_codesParametersQueryRedeemed
   -> Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe List_unique_coupon_codesParametersQueryRedeemed)
-> Parser
     (Maybe List_unique_coupon_codesParametersQuerySort
      -> List_unique_coupon_codesParameters)
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_unique_coupon_codesParametersQueryRedeemed)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryRedeemed")) Parser
  (Maybe List_unique_coupon_codesParametersQuerySort
   -> List_unique_coupon_codesParameters)
-> Parser (Maybe List_unique_coupon_codesParametersQuerySort)
-> Parser List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQuerySort)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"querySort"))

-- | Create a new 'List_unique_coupon_codesParameters' with all required fields.
mkList_unique_coupon_codesParameters ::
    -- | 'list_unique_coupon_codesParametersPathCoupon_id'
    Data.Text.Internal.Text ->
    List_unique_coupon_codesParameters
mkList_unique_coupon_codesParameters :: Text -> List_unique_coupon_codesParameters
mkList_unique_coupon_codesParameters Text
list_unique_coupon_codesParametersPathCoupon_id =
    List_unique_coupon_codesParameters
        { list_unique_coupon_codesParametersPathCoupon_id :: Text
list_unique_coupon_codesParametersPathCoupon_id = Text
list_unique_coupon_codesParametersPathCoupon_id
        , list_unique_coupon_codesParametersQueryBegin_time :: Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQueryEnd_time :: Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQueryIds :: Maybe [Text]
list_unique_coupon_codesParametersQueryIds = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQueryLimit :: Maybe Int
list_unique_coupon_codesParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQueryOrder :: Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder = Maybe List_unique_coupon_codesParametersQueryOrder
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQueryRedeemed :: Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed = Maybe List_unique_coupon_codesParametersQueryRedeemed
forall a. Maybe a
GHC.Maybe.Nothing
        , list_unique_coupon_codesParametersQuerySort :: Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort = Maybe List_unique_coupon_codesParametersQuerySort
forall a. Maybe a
GHC.Maybe.Nothing
        }

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

Represents the parameter named \'order\'

Sort order.
-}
data List_unique_coupon_codesParametersQueryOrder
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_unique_coupon_codesParametersQueryOrderOther 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_unique_coupon_codesParametersQueryOrderTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"asc"@
      List_unique_coupon_codesParametersQueryOrderEnumAsc
    | -- | Represents the JSON value @"desc"@
      List_unique_coupon_codesParametersQueryOrderEnumDesc
    deriving (Int -> List_unique_coupon_codesParametersQueryOrder -> ShowS
[List_unique_coupon_codesParametersQueryOrder] -> ShowS
List_unique_coupon_codesParametersQueryOrder -> String
(Int -> List_unique_coupon_codesParametersQueryOrder -> ShowS)
-> (List_unique_coupon_codesParametersQueryOrder -> String)
-> ([List_unique_coupon_codesParametersQueryOrder] -> ShowS)
-> Show List_unique_coupon_codesParametersQueryOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_unique_coupon_codesParametersQueryOrder -> ShowS
showsPrec :: Int -> List_unique_coupon_codesParametersQueryOrder -> ShowS
$cshow :: List_unique_coupon_codesParametersQueryOrder -> String
show :: List_unique_coupon_codesParametersQueryOrder -> String
$cshowList :: [List_unique_coupon_codesParametersQueryOrder] -> ShowS
showList :: [List_unique_coupon_codesParametersQueryOrder] -> ShowS
GHC.Show.Show, List_unique_coupon_codesParametersQueryOrder
-> List_unique_coupon_codesParametersQueryOrder -> Bool
(List_unique_coupon_codesParametersQueryOrder
 -> List_unique_coupon_codesParametersQueryOrder -> Bool)
-> (List_unique_coupon_codesParametersQueryOrder
    -> List_unique_coupon_codesParametersQueryOrder -> Bool)
-> Eq List_unique_coupon_codesParametersQueryOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_unique_coupon_codesParametersQueryOrder
-> List_unique_coupon_codesParametersQueryOrder -> Bool
== :: List_unique_coupon_codesParametersQueryOrder
-> List_unique_coupon_codesParametersQueryOrder -> Bool
$c/= :: List_unique_coupon_codesParametersQueryOrder
-> List_unique_coupon_codesParametersQueryOrder -> Bool
/= :: List_unique_coupon_codesParametersQueryOrder
-> List_unique_coupon_codesParametersQueryOrder -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_unique_coupon_codesParametersQueryOrder where
    toJSON :: List_unique_coupon_codesParametersQueryOrder -> Value
toJSON (List_unique_coupon_codesParametersQueryOrderOther Value
val) = Value
val
    toJSON (List_unique_coupon_codesParametersQueryOrderTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_unique_coupon_codesParametersQueryOrder
List_unique_coupon_codesParametersQueryOrderEnumAsc) = Value
"asc"
    toJSON (List_unique_coupon_codesParametersQueryOrder
List_unique_coupon_codesParametersQueryOrderEnumDesc) = Value
"desc"
instance Data.Aeson.Types.FromJSON.FromJSON List_unique_coupon_codesParametersQueryOrder where
    parseJSON :: Value -> Parser List_unique_coupon_codesParametersQueryOrder
parseJSON Value
val =
        List_unique_coupon_codesParametersQueryOrder
-> Parser List_unique_coupon_codesParametersQueryOrder
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_unique_coupon_codesParametersQueryOrder
List_unique_coupon_codesParametersQueryOrderEnumAsc
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"desc" -> List_unique_coupon_codesParametersQueryOrder
List_unique_coupon_codesParametersQueryOrderEnumDesc
                | Bool
GHC.Base.otherwise -> Value -> List_unique_coupon_codesParametersQueryOrder
List_unique_coupon_codesParametersQueryOrderOther Value
val
            )

{- | Defines the enum schema located at @paths.\/coupons\/{coupon_id}\/unique_coupon_codes.GET.parameters.properties.queryRedeemed@ in the specification.

Represents the parameter named \'redeemed\'

Filter unique coupon codes by redemption status. \`true\` for redeemed, \`false\` for not redeemed.
-}
data List_unique_coupon_codesParametersQueryRedeemed
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_unique_coupon_codesParametersQueryRedeemedOther 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_unique_coupon_codesParametersQueryRedeemedTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @true@
      List_unique_coupon_codesParametersQueryRedeemedEnumTrue
    | -- | Represents the JSON value @false@
      List_unique_coupon_codesParametersQueryRedeemedEnumFalse
    deriving (Int -> List_unique_coupon_codesParametersQueryRedeemed -> ShowS
[List_unique_coupon_codesParametersQueryRedeemed] -> ShowS
List_unique_coupon_codesParametersQueryRedeemed -> String
(Int -> List_unique_coupon_codesParametersQueryRedeemed -> ShowS)
-> (List_unique_coupon_codesParametersQueryRedeemed -> String)
-> ([List_unique_coupon_codesParametersQueryRedeemed] -> ShowS)
-> Show List_unique_coupon_codesParametersQueryRedeemed
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_unique_coupon_codesParametersQueryRedeemed -> ShowS
showsPrec :: Int -> List_unique_coupon_codesParametersQueryRedeemed -> ShowS
$cshow :: List_unique_coupon_codesParametersQueryRedeemed -> String
show :: List_unique_coupon_codesParametersQueryRedeemed -> String
$cshowList :: [List_unique_coupon_codesParametersQueryRedeemed] -> ShowS
showList :: [List_unique_coupon_codesParametersQueryRedeemed] -> ShowS
GHC.Show.Show, List_unique_coupon_codesParametersQueryRedeemed
-> List_unique_coupon_codesParametersQueryRedeemed -> Bool
(List_unique_coupon_codesParametersQueryRedeemed
 -> List_unique_coupon_codesParametersQueryRedeemed -> Bool)
-> (List_unique_coupon_codesParametersQueryRedeemed
    -> List_unique_coupon_codesParametersQueryRedeemed -> Bool)
-> Eq List_unique_coupon_codesParametersQueryRedeemed
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_unique_coupon_codesParametersQueryRedeemed
-> List_unique_coupon_codesParametersQueryRedeemed -> Bool
== :: List_unique_coupon_codesParametersQueryRedeemed
-> List_unique_coupon_codesParametersQueryRedeemed -> Bool
$c/= :: List_unique_coupon_codesParametersQueryRedeemed
-> List_unique_coupon_codesParametersQueryRedeemed -> Bool
/= :: List_unique_coupon_codesParametersQueryRedeemed
-> List_unique_coupon_codesParametersQueryRedeemed -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_unique_coupon_codesParametersQueryRedeemed where
    toJSON :: List_unique_coupon_codesParametersQueryRedeemed -> Value
toJSON (List_unique_coupon_codesParametersQueryRedeemedOther Value
val) = Value
val
    toJSON (List_unique_coupon_codesParametersQueryRedeemedTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_unique_coupon_codesParametersQueryRedeemed
List_unique_coupon_codesParametersQueryRedeemedEnumTrue) = Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.True
    toJSON (List_unique_coupon_codesParametersQueryRedeemed
List_unique_coupon_codesParametersQueryRedeemedEnumFalse) = Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.False
instance Data.Aeson.Types.FromJSON.FromJSON List_unique_coupon_codesParametersQueryRedeemed where
    parseJSON :: Value -> Parser List_unique_coupon_codesParametersQueryRedeemed
parseJSON Value
val =
        List_unique_coupon_codesParametersQueryRedeemed
-> Parser List_unique_coupon_codesParametersQueryRedeemed
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.== Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.True -> List_unique_coupon_codesParametersQueryRedeemed
List_unique_coupon_codesParametersQueryRedeemedEnumTrue
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.False -> List_unique_coupon_codesParametersQueryRedeemed
List_unique_coupon_codesParametersQueryRedeemedEnumFalse
                | Bool
GHC.Base.otherwise -> Value -> List_unique_coupon_codesParametersQueryRedeemed
List_unique_coupon_codesParametersQueryRedeemedOther Value
val
            )

{- | Defines the enum schema located at @paths.\/coupons\/{coupon_id}\/unique_coupon_codes.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_unique_coupon_codesParametersQuerySort
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_unique_coupon_codesParametersQuerySortOther 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_unique_coupon_codesParametersQuerySortTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"created_at"@
      List_unique_coupon_codesParametersQuerySortEnumCreated_at
    | -- | Represents the JSON value @"updated_at"@
      List_unique_coupon_codesParametersQuerySortEnumUpdated_at
    deriving (Int -> List_unique_coupon_codesParametersQuerySort -> ShowS
[List_unique_coupon_codesParametersQuerySort] -> ShowS
List_unique_coupon_codesParametersQuerySort -> String
(Int -> List_unique_coupon_codesParametersQuerySort -> ShowS)
-> (List_unique_coupon_codesParametersQuerySort -> String)
-> ([List_unique_coupon_codesParametersQuerySort] -> ShowS)
-> Show List_unique_coupon_codesParametersQuerySort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_unique_coupon_codesParametersQuerySort -> ShowS
showsPrec :: Int -> List_unique_coupon_codesParametersQuerySort -> ShowS
$cshow :: List_unique_coupon_codesParametersQuerySort -> String
show :: List_unique_coupon_codesParametersQuerySort -> String
$cshowList :: [List_unique_coupon_codesParametersQuerySort] -> ShowS
showList :: [List_unique_coupon_codesParametersQuerySort] -> ShowS
GHC.Show.Show, List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParametersQuerySort -> Bool
(List_unique_coupon_codesParametersQuerySort
 -> List_unique_coupon_codesParametersQuerySort -> Bool)
-> (List_unique_coupon_codesParametersQuerySort
    -> List_unique_coupon_codesParametersQuerySort -> Bool)
-> Eq List_unique_coupon_codesParametersQuerySort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParametersQuerySort -> Bool
== :: List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParametersQuerySort -> Bool
$c/= :: List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParametersQuerySort -> Bool
/= :: List_unique_coupon_codesParametersQuerySort
-> List_unique_coupon_codesParametersQuerySort -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_unique_coupon_codesParametersQuerySort where
    toJSON :: List_unique_coupon_codesParametersQuerySort -> Value
toJSON (List_unique_coupon_codesParametersQuerySortOther Value
val) = Value
val
    toJSON (List_unique_coupon_codesParametersQuerySortTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_unique_coupon_codesParametersQuerySort
List_unique_coupon_codesParametersQuerySortEnumCreated_at) = Value
"created_at"
    toJSON (List_unique_coupon_codesParametersQuerySort
List_unique_coupon_codesParametersQuerySortEnumUpdated_at) = Value
"updated_at"
instance Data.Aeson.Types.FromJSON.FromJSON List_unique_coupon_codesParametersQuerySort where
    parseJSON :: Value -> Parser List_unique_coupon_codesParametersQuerySort
parseJSON Value
val =
        List_unique_coupon_codesParametersQuerySort
-> Parser List_unique_coupon_codesParametersQuerySort
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_unique_coupon_codesParametersQuerySort
List_unique_coupon_codesParametersQuerySortEnumCreated_at
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"updated_at" -> List_unique_coupon_codesParametersQuerySort
List_unique_coupon_codesParametersQuerySortEnumUpdated_at
                | Bool
GHC.Base.otherwise -> Value -> List_unique_coupon_codesParametersQuerySort
List_unique_coupon_codesParametersQuerySortOther Value
val
            )

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

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_unique_coupon_codesResponseError' is used.
-}
data List_unique_coupon_codesResponse
    = -- | Means either no matching case available or a parse error
      List_unique_coupon_codesResponseError GHC.Base.String
    | -- | A list of unique coupon codes that were generated
      List_unique_coupon_codesResponse200 UniqueCouponCodeList
    | -- | Incorrect site or coupon ID.
      List_unique_coupon_codesResponse404 Error
    | -- | Unexpected error.
      List_unique_coupon_codesResponseDefault Error
    deriving (Int -> List_unique_coupon_codesResponse -> ShowS
[List_unique_coupon_codesResponse] -> ShowS
List_unique_coupon_codesResponse -> String
(Int -> List_unique_coupon_codesResponse -> ShowS)
-> (List_unique_coupon_codesResponse -> String)
-> ([List_unique_coupon_codesResponse] -> ShowS)
-> Show List_unique_coupon_codesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_unique_coupon_codesResponse -> ShowS
showsPrec :: Int -> List_unique_coupon_codesResponse -> ShowS
$cshow :: List_unique_coupon_codesResponse -> String
show :: List_unique_coupon_codesResponse -> String
$cshowList :: [List_unique_coupon_codesResponse] -> ShowS
showList :: [List_unique_coupon_codesResponse] -> ShowS
GHC.Show.Show, List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse -> Bool
(List_unique_coupon_codesResponse
 -> List_unique_coupon_codesResponse -> Bool)
-> (List_unique_coupon_codesResponse
    -> List_unique_coupon_codesResponse -> Bool)
-> Eq List_unique_coupon_codesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse -> Bool
== :: List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse -> Bool
$c/= :: List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse -> Bool
/= :: List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse -> Bool
GHC.Classes.Eq)

{- | > GET /coupons/{coupon_id}/unique_coupon_codes

The same as 'list_unique_coupon_codes' but accepts an explicit configuration.
-}
list_unique_coupon_codesWithConfiguration ::
    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_unique_coupon_codesParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response List_unique_coupon_codesResponse)
list_unique_coupon_codesWithConfiguration :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_unique_coupon_codesParameters
-> m (Response List_unique_coupon_codesResponse)
list_unique_coupon_codesWithConfiguration
    Configuration
config
    List_unique_coupon_codesParameters
parameters =
        (Response ByteString -> Response List_unique_coupon_codesResponse)
-> m (Response ByteString)
-> m (Response List_unique_coupon_codesResponse)
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_3 ->
                (ByteString -> List_unique_coupon_codesResponse)
-> Response ByteString -> Response List_unique_coupon_codesResponse
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_unique_coupon_codesResponse)
-> (List_unique_coupon_codesResponse
    -> List_unique_coupon_codesResponse)
-> Either String List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponseError List_unique_coupon_codesResponse
-> List_unique_coupon_codesResponse
forall a. a -> a
GHC.Base.id
                        (Either String List_unique_coupon_codesResponse
 -> List_unique_coupon_codesResponse)
-> (ByteString -> Either String List_unique_coupon_codesResponse)
-> ByteString
-> List_unique_coupon_codesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                                        if
                                            | (\Status
status_4 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_4 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) ->
                                                UniqueCouponCodeList -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponse200
                                                    (UniqueCouponCodeList -> List_unique_coupon_codesResponse)
-> Either String UniqueCouponCodeList
-> Either String List_unique_coupon_codesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String UniqueCouponCodeList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                        Data.Either.Either
                                                                            GHC.Base.String
                                                                            UniqueCouponCodeList
                                                                     )
                                            | (\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
404) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                                Error -> List_unique_coupon_codesResponse
List_unique_coupon_codesResponse404
                                                    (Error -> List_unique_coupon_codesResponse)
-> Either String Error
-> Either String List_unique_coupon_codesResponse
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_unique_coupon_codesResponse
List_unique_coupon_codesResponseDefault
                                                    (Error -> List_unique_coupon_codesResponse)
-> Either String Error
-> Either String List_unique_coupon_codesResponse
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_unique_coupon_codesResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                                   )
                            Response ByteString
response_3
                    )
                    Response ByteString
response_3
            )
            ( 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
"/coupons/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (ByteString -> Text
RecurlyClient.Common.byteToText (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.$ (Text -> ByteString
RecurlyClient.Common.textToByte (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Text
forall a. ToJSON a => a -> Text
RecurlyClient.Common.stringifyModel (List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/unique_coupon_codes"))
                [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"ids") ([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.<$> List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryOrder -> Value)
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQuerySort -> Value)
-> Maybe List_unique_coupon_codesParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
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
"redeemed") (List_unique_coupon_codesParametersQueryRedeemed -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryRedeemed -> Value)
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )

{- | > GET /coupons/{coupon_id}/unique_coupon_codes

The same as 'list_unique_coupon_codes' but returns the raw 'Data.ByteString.ByteString'.
-}
list_unique_coupon_codesRaw ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_unique_coupon_codesParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_unique_coupon_codesRaw :: forall (m :: * -> *).
MonadHTTP m =>
List_unique_coupon_codesParameters
-> ClientT m (Response ByteString)
list_unique_coupon_codesRaw List_unique_coupon_codesParameters
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
"/coupons/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (ByteString -> Text
RecurlyClient.Common.byteToText (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.$ (Text -> ByteString
RecurlyClient.Common.textToByte (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Text
forall a. ToJSON a => a -> Text
RecurlyClient.Common.stringifyModel (List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/unique_coupon_codes"))
            [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"ids") ([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.<$> List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryOrder -> Value)
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQuerySort -> Value)
-> Maybe List_unique_coupon_codesParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
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
"redeemed") (List_unique_coupon_codesParametersQueryRedeemed -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryRedeemed -> Value)
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

{- | > GET /coupons/{coupon_id}/unique_coupon_codes

The same as 'list_unique_coupon_codes' but accepts an explicit configuration and returns the raw 'Data.ByteString.ByteString'.
-}
list_unique_coupon_codesWithConfigurationRaw ::
    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_unique_coupon_codesParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_unique_coupon_codesWithConfigurationRaw :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_unique_coupon_codesParameters -> m (Response ByteString)
list_unique_coupon_codesWithConfigurationRaw
    Configuration
config
    List_unique_coupon_codesParameters
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
"/coupons/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (ByteString -> Text
RecurlyClient.Common.byteToText (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.$ (Text -> ByteString
RecurlyClient.Common.textToByte (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Text
forall a. ToJSON a => a -> Text
RecurlyClient.Common.stringifyModel (List_unique_coupon_codesParameters -> Text
list_unique_coupon_codesParametersPathCoupon_id List_unique_coupon_codesParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/unique_coupon_codes"))
                [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
RecurlyClient.Common.QueryParameter (String -> Text
Data.Text.Internal.pack String
"ids") ([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.<$> List_unique_coupon_codesParameters -> Maybe [Text]
list_unique_coupon_codesParametersQueryIds List_unique_coupon_codesParameters
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
"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_unique_coupon_codesParameters -> Maybe Int
list_unique_coupon_codesParametersQueryLimit List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryOrder -> Value)
-> Maybe List_unique_coupon_codesParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryOrder
list_unique_coupon_codesParametersQueryOrder List_unique_coupon_codesParameters
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_unique_coupon_codesParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQuerySort -> Value)
-> Maybe List_unique_coupon_codesParametersQuerySort -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQuerySort
list_unique_coupon_codesParametersQuerySort List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryBegin_time List_unique_coupon_codesParameters
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_unique_coupon_codesParameters -> Maybe JsonDateTime
list_unique_coupon_codesParametersQueryEnd_time List_unique_coupon_codesParameters
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
"redeemed") (List_unique_coupon_codesParametersQueryRedeemed -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_unique_coupon_codesParametersQueryRedeemed -> Value)
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_unique_coupon_codesParameters
-> Maybe List_unique_coupon_codesParametersQueryRedeemed
list_unique_coupon_codesParametersQueryRedeemed List_unique_coupon_codesParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )