{-# 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_account_subscriptions
module RecurlyClient.Operations.List_account_subscriptions 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 /accounts/{account_id}/subscriptions

See the [Pagination Guide](\/developers\/guides\/pagination.html) to learn how to use pagination in the API and Client Libraries.
-}
list_account_subscriptions ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_account_subscriptionsParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response List_account_subscriptionsResponse)
list_account_subscriptions :: forall (m :: * -> *).
MonadHTTP m =>
List_account_subscriptionsParameters
-> ClientT m (Response List_account_subscriptionsResponse)
list_account_subscriptions List_account_subscriptionsParameters
parameters =
    (Response ByteString
 -> Response List_account_subscriptionsResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response List_account_subscriptionsResponse)
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_account_subscriptionsResponse)
-> Response ByteString
-> Response List_account_subscriptionsResponse
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_account_subscriptionsResponse)
-> (List_account_subscriptionsResponse
    -> List_account_subscriptionsResponse)
-> Either String List_account_subscriptionsResponse
-> List_account_subscriptionsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_account_subscriptionsResponse
List_account_subscriptionsResponseError List_account_subscriptionsResponse
-> List_account_subscriptionsResponse
forall a. a -> a
GHC.Base.id
                    (Either String List_account_subscriptionsResponse
 -> List_account_subscriptionsResponse)
-> (ByteString -> Either String List_account_subscriptionsResponse)
-> ByteString
-> List_account_subscriptionsResponse
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) ->
                                            SubscriptionList -> List_account_subscriptionsResponse
List_account_subscriptionsResponse200
                                                (SubscriptionList -> List_account_subscriptionsResponse)
-> Either String SubscriptionList
-> Either String List_account_subscriptionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String SubscriptionList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                    Data.Either.Either
                                                                        GHC.Base.String
                                                                        SubscriptionList
                                                                 )
                                        | (\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_account_subscriptionsResponse
List_account_subscriptionsResponse400
                                                (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
List_account_subscriptionsResponse404
                                                (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
List_account_subscriptionsResponseDefault
                                                (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
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
"/accounts/" 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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/subscriptions"))
            [ 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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
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_account_subscriptionsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryOrder -> Value)
-> Maybe List_account_subscriptionsParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
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_account_subscriptionsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQuerySort -> Value)
-> Maybe List_account_subscriptionsParametersQuerySort
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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
"state") (List_account_subscriptionsParametersQueryState -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryState -> Value)
-> Maybe List_account_subscriptionsParametersQueryState
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

-- | Defines the object schema located at @paths.\/accounts\/{account_id}\/subscriptions.GET.parameters@ in the specification.
data List_account_subscriptionsParameters = List_account_subscriptionsParameters
    { List_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id :: Data.Text.Internal.Text
    -- ^ pathAccount_id: Represents the parameter named \'account_id\'
    --
    -- Account ID or code. For ID no prefix is used e.g. \`e28zov4fw0v2\`. For code use prefix \`code-\`, e.g. \`code-bob\`.
    , List_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds :: (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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit :: (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_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder :: (GHC.Maybe.Maybe List_account_subscriptionsParametersQueryOrder)
    -- ^ queryOrder: Represents the parameter named \'order\'
    --
    -- Sort order.
    , List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort :: (GHC.Maybe.Maybe List_account_subscriptionsParametersQuerySort)
    -- ^ 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.
    , List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState :: (GHC.Maybe.Maybe List_account_subscriptionsParametersQueryState)
    -- ^ queryState: Represents the parameter named \'state\'
    --
    -- Filter by state.
    --
    -- - When \`state=active\`, \`state=canceled\`, \`state=expired\`, or \`state=future\`, subscriptions with states that match the query and only those subscriptions will be returned.
    -- - When \`state=in_trial\`, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.
    -- - When \`state=live\`, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
    }
    deriving
        ( Int -> List_account_subscriptionsParameters -> ShowS
[List_account_subscriptionsParameters] -> ShowS
List_account_subscriptionsParameters -> String
(Int -> List_account_subscriptionsParameters -> ShowS)
-> (List_account_subscriptionsParameters -> String)
-> ([List_account_subscriptionsParameters] -> ShowS)
-> Show List_account_subscriptionsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_account_subscriptionsParameters -> ShowS
showsPrec :: Int -> List_account_subscriptionsParameters -> ShowS
$cshow :: List_account_subscriptionsParameters -> String
show :: List_account_subscriptionsParameters -> String
$cshowList :: [List_account_subscriptionsParameters] -> ShowS
showList :: [List_account_subscriptionsParameters] -> ShowS
GHC.Show.Show
        , List_account_subscriptionsParameters
-> List_account_subscriptionsParameters -> Bool
(List_account_subscriptionsParameters
 -> List_account_subscriptionsParameters -> Bool)
-> (List_account_subscriptionsParameters
    -> List_account_subscriptionsParameters -> Bool)
-> Eq List_account_subscriptionsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_account_subscriptionsParameters
-> List_account_subscriptionsParameters -> Bool
== :: List_account_subscriptionsParameters
-> List_account_subscriptionsParameters -> Bool
$c/= :: List_account_subscriptionsParameters
-> List_account_subscriptionsParameters -> Bool
/= :: List_account_subscriptionsParameters
-> List_account_subscriptionsParameters -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON List_account_subscriptionsParameters where
    toJSON :: List_account_subscriptionsParameters -> Value
toJSON List_account_subscriptionsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Key
"pathAccount_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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_account_subscriptionsParametersQueryOrder -> [Pair])
-> Maybe List_account_subscriptionsParametersQueryOrder
-> [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_account_subscriptionsParametersQueryOrder -> Pair)
-> List_account_subscriptionsParametersQueryOrder
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_account_subscriptionsParametersQueryOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_account_subscriptionsParametersQuerySort -> [Pair])
-> Maybe List_account_subscriptionsParametersQuerySort
-> [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_account_subscriptionsParametersQuerySort -> Pair)
-> List_account_subscriptionsParametersQuerySort
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_account_subscriptionsParametersQuerySort -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (List_account_subscriptionsParametersQueryState -> [Pair])
-> Maybe List_account_subscriptionsParametersQueryState
-> [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_account_subscriptionsParametersQueryState -> Pair)
-> List_account_subscriptionsParametersQueryState
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryState" Key -> List_account_subscriptionsParametersQueryState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: List_account_subscriptionsParameters -> Encoding
toEncoding List_account_subscriptionsParameters
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
"pathAccount_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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_account_subscriptionsParametersQueryOrder -> [Series])
-> Maybe List_account_subscriptionsParametersQueryOrder
-> [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_account_subscriptionsParametersQueryOrder -> Series)
-> List_account_subscriptionsParametersQueryOrder
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryOrder" Key -> List_account_subscriptionsParametersQueryOrder -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_account_subscriptionsParametersQuerySort -> [Series])
-> Maybe List_account_subscriptionsParametersQuerySort
-> [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_account_subscriptionsParametersQuerySort -> Series)
-> List_account_subscriptionsParametersQuerySort
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"querySort" Key -> List_account_subscriptionsParametersQuerySort -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (List_account_subscriptionsParametersQueryState -> [Series])
-> Maybe List_account_subscriptionsParametersQueryState
-> [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_account_subscriptionsParametersQueryState -> Series)
-> List_account_subscriptionsParametersQueryState
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"queryState" Key -> List_account_subscriptionsParametersQueryState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
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_account_subscriptionsParameters where
    parseJSON :: Value -> Parser List_account_subscriptionsParameters
parseJSON = String
-> (Object -> Parser List_account_subscriptionsParameters)
-> Value
-> Parser List_account_subscriptionsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"List_account_subscriptionsParameters" (\Object
obj -> ((((((((Text
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe List_account_subscriptionsParametersQueryOrder
 -> Maybe List_account_subscriptionsParametersQuerySort
 -> Maybe List_account_subscriptionsParametersQueryState
 -> List_account_subscriptionsParameters)
-> Parser
     (Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder
-> Maybe List_account_subscriptionsParametersQuerySort
-> Maybe List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParameters
List_account_subscriptionsParameters Parser
  (Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe List_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser Text
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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
"pathAccount_id")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe List_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe List_account_subscriptionsParametersQueryOrder
      -> Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder
   -> Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe List_account_subscriptionsParametersQueryOrder)
-> Parser
     (Maybe List_account_subscriptionsParametersQuerySort
      -> Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQueryOrder)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryOrder")) Parser
  (Maybe List_account_subscriptionsParametersQuerySort
   -> Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe List_account_subscriptionsParametersQuerySort)
-> Parser
     (Maybe List_account_subscriptionsParametersQueryState
      -> List_account_subscriptionsParameters)
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_account_subscriptionsParametersQuerySort)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"querySort")) Parser
  (Maybe List_account_subscriptionsParametersQueryState
   -> List_account_subscriptionsParameters)
-> Parser (Maybe List_account_subscriptionsParametersQueryState)
-> Parser List_account_subscriptionsParameters
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_account_subscriptionsParametersQueryState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"queryState"))

-- | Create a new 'List_account_subscriptionsParameters' with all required fields.
mkList_account_subscriptionsParameters ::
    -- | 'list_account_subscriptionsParametersPathAccount_id'
    Data.Text.Internal.Text ->
    List_account_subscriptionsParameters
mkList_account_subscriptionsParameters :: Text -> List_account_subscriptionsParameters
mkList_account_subscriptionsParameters Text
list_account_subscriptionsParametersPathAccount_id =
    List_account_subscriptionsParameters
        { list_account_subscriptionsParametersPathAccount_id :: Text
list_account_subscriptionsParametersPathAccount_id = Text
list_account_subscriptionsParametersPathAccount_id
        , list_account_subscriptionsParametersQueryBegin_time :: Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQueryEnd_time :: Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQueryIds :: Maybe [Text]
list_account_subscriptionsParametersQueryIds = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQueryLimit :: Maybe Int
list_account_subscriptionsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQueryOrder :: Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder = Maybe List_account_subscriptionsParametersQueryOrder
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQuerySort :: Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort = Maybe List_account_subscriptionsParametersQuerySort
forall a. Maybe a
GHC.Maybe.Nothing
        , list_account_subscriptionsParametersQueryState :: Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState = Maybe List_account_subscriptionsParametersQueryState
forall a. Maybe a
GHC.Maybe.Nothing
        }

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

Represents the parameter named \'order\'

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

instance Data.Aeson.Types.ToJSON.ToJSON List_account_subscriptionsParametersQueryOrder where
    toJSON :: List_account_subscriptionsParametersQueryOrder -> Value
toJSON (List_account_subscriptionsParametersQueryOrderOther Value
val) = Value
val
    toJSON (List_account_subscriptionsParametersQueryOrderTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_account_subscriptionsParametersQueryOrder
List_account_subscriptionsParametersQueryOrderEnumAsc) = Value
"asc"
    toJSON (List_account_subscriptionsParametersQueryOrder
List_account_subscriptionsParametersQueryOrderEnumDesc) = Value
"desc"
instance Data.Aeson.Types.FromJSON.FromJSON List_account_subscriptionsParametersQueryOrder where
    parseJSON :: Value -> Parser List_account_subscriptionsParametersQueryOrder
parseJSON Value
val =
        List_account_subscriptionsParametersQueryOrder
-> Parser List_account_subscriptionsParametersQueryOrder
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_account_subscriptionsParametersQueryOrder
List_account_subscriptionsParametersQueryOrderEnumAsc
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"desc" -> List_account_subscriptionsParametersQueryOrder
List_account_subscriptionsParametersQueryOrderEnumDesc
                | Bool
GHC.Base.otherwise -> Value -> List_account_subscriptionsParametersQueryOrder
List_account_subscriptionsParametersQueryOrderOther Value
val
            )

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

instance Data.Aeson.Types.ToJSON.ToJSON List_account_subscriptionsParametersQuerySort where
    toJSON :: List_account_subscriptionsParametersQuerySort -> Value
toJSON (List_account_subscriptionsParametersQuerySortOther Value
val) = Value
val
    toJSON (List_account_subscriptionsParametersQuerySortTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_account_subscriptionsParametersQuerySort
List_account_subscriptionsParametersQuerySortEnumCreated_at) = Value
"created_at"
    toJSON (List_account_subscriptionsParametersQuerySort
List_account_subscriptionsParametersQuerySortEnumUpdated_at) = Value
"updated_at"
instance Data.Aeson.Types.FromJSON.FromJSON List_account_subscriptionsParametersQuerySort where
    parseJSON :: Value -> Parser List_account_subscriptionsParametersQuerySort
parseJSON Value
val =
        List_account_subscriptionsParametersQuerySort
-> Parser List_account_subscriptionsParametersQuerySort
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_account_subscriptionsParametersQuerySort
List_account_subscriptionsParametersQuerySortEnumCreated_at
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"updated_at" -> List_account_subscriptionsParametersQuerySort
List_account_subscriptionsParametersQuerySortEnumUpdated_at
                | Bool
GHC.Base.otherwise -> Value -> List_account_subscriptionsParametersQuerySort
List_account_subscriptionsParametersQuerySortOther Value
val
            )

{- | Defines the enum schema located at @paths.\/accounts\/{account_id}\/subscriptions.GET.parameters.properties.queryState@ in the specification.

Represents the parameter named \'state\'

Filter by state.

- When \`state=active\`, \`state=canceled\`, \`state=expired\`, or \`state=future\`, subscriptions with states that match the query and only those subscriptions will be returned.
- When \`state=in_trial\`, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.
- When \`state=live\`, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
-}
data List_account_subscriptionsParametersQueryState
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      List_account_subscriptionsParametersQueryStateOther 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_account_subscriptionsParametersQueryStateTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"active"@
      List_account_subscriptionsParametersQueryStateEnumActive
    | -- | Represents the JSON value @"canceled"@
      List_account_subscriptionsParametersQueryStateEnumCanceled
    | -- | Represents the JSON value @"expired"@
      List_account_subscriptionsParametersQueryStateEnumExpired
    | -- | Represents the JSON value @"future"@
      List_account_subscriptionsParametersQueryStateEnumFuture
    | -- | Represents the JSON value @"in_trial"@
      List_account_subscriptionsParametersQueryStateEnumIn_trial
    | -- | Represents the JSON value @"live"@
      List_account_subscriptionsParametersQueryStateEnumLive
    deriving (Int -> List_account_subscriptionsParametersQueryState -> ShowS
[List_account_subscriptionsParametersQueryState] -> ShowS
List_account_subscriptionsParametersQueryState -> String
(Int -> List_account_subscriptionsParametersQueryState -> ShowS)
-> (List_account_subscriptionsParametersQueryState -> String)
-> ([List_account_subscriptionsParametersQueryState] -> ShowS)
-> Show List_account_subscriptionsParametersQueryState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_account_subscriptionsParametersQueryState -> ShowS
showsPrec :: Int -> List_account_subscriptionsParametersQueryState -> ShowS
$cshow :: List_account_subscriptionsParametersQueryState -> String
show :: List_account_subscriptionsParametersQueryState -> String
$cshowList :: [List_account_subscriptionsParametersQueryState] -> ShowS
showList :: [List_account_subscriptionsParametersQueryState] -> ShowS
GHC.Show.Show, List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParametersQueryState -> Bool
(List_account_subscriptionsParametersQueryState
 -> List_account_subscriptionsParametersQueryState -> Bool)
-> (List_account_subscriptionsParametersQueryState
    -> List_account_subscriptionsParametersQueryState -> Bool)
-> Eq List_account_subscriptionsParametersQueryState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParametersQueryState -> Bool
== :: List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParametersQueryState -> Bool
$c/= :: List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParametersQueryState -> Bool
/= :: List_account_subscriptionsParametersQueryState
-> List_account_subscriptionsParametersQueryState -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON List_account_subscriptionsParametersQueryState where
    toJSON :: List_account_subscriptionsParametersQueryState -> Value
toJSON (List_account_subscriptionsParametersQueryStateOther Value
val) = Value
val
    toJSON (List_account_subscriptionsParametersQueryStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumActive) = Value
"active"
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumCanceled) = Value
"canceled"
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumExpired) = Value
"expired"
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumFuture) = Value
"future"
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumIn_trial) = Value
"in_trial"
    toJSON (List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumLive) = Value
"live"
instance Data.Aeson.Types.FromJSON.FromJSON List_account_subscriptionsParametersQueryState where
    parseJSON :: Value -> Parser List_account_subscriptionsParametersQueryState
parseJSON Value
val =
        List_account_subscriptionsParametersQueryState
-> Parser List_account_subscriptionsParametersQueryState
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
"active" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumActive
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"canceled" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumCanceled
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"expired" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumExpired
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"future" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumFuture
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"in_trial" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumIn_trial
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"live" -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateEnumLive
                | Bool
GHC.Base.otherwise -> Value -> List_account_subscriptionsParametersQueryState
List_account_subscriptionsParametersQueryStateOther Value
val
            )

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

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_account_subscriptionsResponseError' is used.
-}
data List_account_subscriptionsResponse
    = -- | Means either no matching case available or a parse error
      List_account_subscriptionsResponseError GHC.Base.String
    | -- | A list of the account\'s subscriptions.
      List_account_subscriptionsResponse200 SubscriptionList
    | -- | Invalid or unpermitted parameter.
      List_account_subscriptionsResponse400 Error
    | -- | Incorrect site or account ID.
      List_account_subscriptionsResponse404 Error
    | -- | Unexpected error.
      List_account_subscriptionsResponseDefault Error
    deriving (Int -> List_account_subscriptionsResponse -> ShowS
[List_account_subscriptionsResponse] -> ShowS
List_account_subscriptionsResponse -> String
(Int -> List_account_subscriptionsResponse -> ShowS)
-> (List_account_subscriptionsResponse -> String)
-> ([List_account_subscriptionsResponse] -> ShowS)
-> Show List_account_subscriptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> List_account_subscriptionsResponse -> ShowS
showsPrec :: Int -> List_account_subscriptionsResponse -> ShowS
$cshow :: List_account_subscriptionsResponse -> String
show :: List_account_subscriptionsResponse -> String
$cshowList :: [List_account_subscriptionsResponse] -> ShowS
showList :: [List_account_subscriptionsResponse] -> ShowS
GHC.Show.Show, List_account_subscriptionsResponse
-> List_account_subscriptionsResponse -> Bool
(List_account_subscriptionsResponse
 -> List_account_subscriptionsResponse -> Bool)
-> (List_account_subscriptionsResponse
    -> List_account_subscriptionsResponse -> Bool)
-> Eq List_account_subscriptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: List_account_subscriptionsResponse
-> List_account_subscriptionsResponse -> Bool
== :: List_account_subscriptionsResponse
-> List_account_subscriptionsResponse -> Bool
$c/= :: List_account_subscriptionsResponse
-> List_account_subscriptionsResponse -> Bool
/= :: List_account_subscriptionsResponse
-> List_account_subscriptionsResponse -> Bool
GHC.Classes.Eq)

{- | > GET /accounts/{account_id}/subscriptions

The same as 'list_account_subscriptions' but accepts an explicit configuration.
-}
list_account_subscriptionsWithConfiguration ::
    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_account_subscriptionsParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response List_account_subscriptionsResponse)
list_account_subscriptionsWithConfiguration :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_account_subscriptionsParameters
-> m (Response List_account_subscriptionsResponse)
list_account_subscriptionsWithConfiguration
    Configuration
config
    List_account_subscriptionsParameters
parameters =
        (Response ByteString
 -> Response List_account_subscriptionsResponse)
-> m (Response ByteString)
-> m (Response List_account_subscriptionsResponse)
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_account_subscriptionsResponse)
-> Response ByteString
-> Response List_account_subscriptionsResponse
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_account_subscriptionsResponse)
-> (List_account_subscriptionsResponse
    -> List_account_subscriptionsResponse)
-> Either String List_account_subscriptionsResponse
-> List_account_subscriptionsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> List_account_subscriptionsResponse
List_account_subscriptionsResponseError List_account_subscriptionsResponse
-> List_account_subscriptionsResponse
forall a. a -> a
GHC.Base.id
                        (Either String List_account_subscriptionsResponse
 -> List_account_subscriptionsResponse)
-> (ByteString -> Either String List_account_subscriptionsResponse)
-> ByteString
-> List_account_subscriptionsResponse
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) ->
                                                SubscriptionList -> List_account_subscriptionsResponse
List_account_subscriptionsResponse200
                                                    (SubscriptionList -> List_account_subscriptionsResponse)
-> Either String SubscriptionList
-> Either String List_account_subscriptionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String SubscriptionList
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                                        Data.Either.Either
                                                                            GHC.Base.String
                                                                            SubscriptionList
                                                                     )
                                            | (\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_account_subscriptionsResponse
List_account_subscriptionsResponse400
                                                    (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
List_account_subscriptionsResponse404
                                                    (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
List_account_subscriptionsResponseDefault
                                                    (Error -> List_account_subscriptionsResponse)
-> Either String Error
-> Either String List_account_subscriptionsResponse
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_account_subscriptionsResponse
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
"/accounts/" 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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/subscriptions"))
                [ 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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
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_account_subscriptionsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryOrder -> Value)
-> Maybe List_account_subscriptionsParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
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_account_subscriptionsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQuerySort -> Value)
-> Maybe List_account_subscriptionsParametersQuerySort
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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
"state") (List_account_subscriptionsParametersQueryState -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryState -> Value)
-> Maybe List_account_subscriptionsParametersQueryState
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )

{- | > GET /accounts/{account_id}/subscriptions

The same as 'list_account_subscriptions' but returns the raw 'Data.ByteString.ByteString'.
-}
list_account_subscriptionsRaw ::
    forall m.
    (RecurlyClient.Common.MonadHTTP m) =>
    -- | Contains all available parameters of this operation (query and path parameters)
    List_account_subscriptionsParameters ->
    -- | Monadic computation which returns the result of the operation
    RecurlyClient.Common.ClientT m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_account_subscriptionsRaw :: forall (m :: * -> *).
MonadHTTP m =>
List_account_subscriptionsParameters
-> ClientT m (Response ByteString)
list_account_subscriptionsRaw List_account_subscriptionsParameters
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
"/accounts/" 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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/subscriptions"))
            [ 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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
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_account_subscriptionsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryOrder -> Value)
-> Maybe List_account_subscriptionsParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
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_account_subscriptionsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQuerySort -> Value)
-> Maybe List_account_subscriptionsParametersQuerySort
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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
"state") (List_account_subscriptionsParametersQueryState -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryState -> Value)
-> Maybe List_account_subscriptionsParametersQueryState
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
            ]
        )

{- | > GET /accounts/{account_id}/subscriptions

The same as 'list_account_subscriptions' but accepts an explicit configuration and returns the raw 'Data.ByteString.ByteString'.
-}
list_account_subscriptionsWithConfigurationRaw ::
    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_account_subscriptionsParameters ->
    -- | Monadic computation which returns the result of the operation
    m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString)
list_account_subscriptionsWithConfigurationRaw :: forall (m :: * -> *).
MonadHTTP m =>
Configuration
-> List_account_subscriptionsParameters -> m (Response ByteString)
list_account_subscriptionsWithConfigurationRaw
    Configuration
config
    List_account_subscriptionsParameters
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
"/accounts/" 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_account_subscriptionsParameters -> Text
list_account_subscriptionsParametersPathAccount_id List_account_subscriptionsParameters
parameters))) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
GHC.Base.<> Text
"/subscriptions"))
                [ 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_account_subscriptionsParameters -> Maybe [Text]
list_account_subscriptionsParametersQueryIds List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe Int
list_account_subscriptionsParametersQueryLimit List_account_subscriptionsParameters
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_account_subscriptionsParametersQueryOrder -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryOrder -> Value)
-> Maybe List_account_subscriptionsParametersQueryOrder
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryOrder
list_account_subscriptionsParametersQueryOrder List_account_subscriptionsParameters
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_account_subscriptionsParametersQuerySort -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQuerySort -> Value)
-> Maybe List_account_subscriptionsParametersQuerySort
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQuerySort
list_account_subscriptionsParametersQuerySort List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryBegin_time List_account_subscriptionsParameters
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_account_subscriptionsParameters -> Maybe JsonDateTime
list_account_subscriptionsParametersQueryEnd_time List_account_subscriptionsParameters
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
"state") (List_account_subscriptionsParametersQueryState -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (List_account_subscriptionsParametersQueryState -> Value)
-> Maybe List_account_subscriptionsParametersQueryState
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> List_account_subscriptionsParameters
-> Maybe List_account_subscriptionsParametersQueryState
list_account_subscriptionsParametersQueryState List_account_subscriptionsParameters
parameters) (String -> Text
Data.Text.Internal.pack String
"form") Bool
GHC.Types.False
                ]
            )