{-# 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 getBillingPortalConfigurations
module StripeAPI.Operations.GetBillingPortalConfigurations where

import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Either
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | > GET /v1/billing_portal/configurations
--
-- \<p>Returns a list of configurations that describe the functionality of the customer portal.\<\/p>
getBillingPortalConfigurations ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetBillingPortalConfigurationsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetBillingPortalConfigurationsResponse)
getBillingPortalConfigurations :: GetBillingPortalConfigurationsParameters
-> StripeT m (Response GetBillingPortalConfigurationsResponse)
getBillingPortalConfigurations GetBillingPortalConfigurationsParameters
parameters =
  (Response ByteString
 -> Response GetBillingPortalConfigurationsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetBillingPortalConfigurationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetBillingPortalConfigurationsResponse)
-> Response ByteString
-> Response GetBillingPortalConfigurationsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetBillingPortalConfigurationsResponse)
-> (GetBillingPortalConfigurationsResponse
    -> GetBillingPortalConfigurationsResponse)
-> Either String GetBillingPortalConfigurationsResponse
-> GetBillingPortalConfigurationsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetBillingPortalConfigurationsResponse
GetBillingPortalConfigurationsResponseError GetBillingPortalConfigurationsResponse
-> GetBillingPortalConfigurationsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetBillingPortalConfigurationsResponse
 -> GetBillingPortalConfigurationsResponse)
-> (ByteString
    -> Either String GetBillingPortalConfigurationsResponse)
-> ByteString
-> GetBillingPortalConfigurationsResponse
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) ->
                                   GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponse
GetBillingPortalConfigurationsResponse200
                                     (GetBillingPortalConfigurationsResponseBody200
 -> GetBillingPortalConfigurationsResponse)
-> Either String GetBillingPortalConfigurationsResponseBody200
-> Either String GetBillingPortalConfigurationsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString
-> Either String GetBillingPortalConfigurationsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetBillingPortalConfigurationsResponseBody200
                                                      )
                                 | 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 -> GetBillingPortalConfigurationsResponse
GetBillingPortalConfigurationsResponseDefault
                                     (Error -> GetBillingPortalConfigurationsResponse)
-> Either String Error
-> Either String GetBillingPortalConfigurationsResponse
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 GetBillingPortalConfigurationsResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                         )
                Response ByteString
response_0
          )
          Response ByteString
response_0
    )
    ( Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
StripeAPI.Common.doCallWithConfigurationM
        (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"GET")
        (String -> Text
Data.Text.pack String
"/v1/billing_portal/configurations")
        [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"active") (Bool -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Bool -> Value) -> Maybe Bool -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryActive GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"ending_before") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryEndingBefore GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"expand") ([Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ([Text] -> Value) -> Maybe [Text] -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBillingPortalConfigurationsParameters -> Maybe [Text]
getBillingPortalConfigurationsParametersQueryExpand GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"deepObject") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"is_default") (Bool -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Bool -> Value) -> Maybe Bool -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryIsDefault GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"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.<$> GetBillingPortalConfigurationsParameters -> Maybe Int
getBillingPortalConfigurationsParametersQueryLimit GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"starting_after") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryStartingAfter GetBillingPortalConfigurationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/billing_portal\/configurations.GET.parameters@ in the specification.
data GetBillingPortalConfigurationsParameters = GetBillingPortalConfigurationsParameters
  { -- | queryActive: Represents the parameter named \'active\'
    --
    -- Only return configurations that are active or inactive (e.g., pass \`true\` to only list active configurations).
    GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetBillingPortalConfigurationsParameters -> Maybe [Text]
getBillingPortalConfigurationsParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryIs_default: Represents the parameter named \'is_default\'
    --
    -- Only return the default or non-default configurations (e.g., pass \`true\` to only list the default configuration).
    GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryIsDefault :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | queryLimit: Represents the parameter named \'limit\'
    --
    -- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
    GetBillingPortalConfigurationsParameters -> Maybe Int
getBillingPortalConfigurationsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryStarting_after: Represents the parameter named \'starting_after\'
    --
    -- A cursor for use in pagination. \`starting_after\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with \`obj_foo\`, your subsequent call can include \`starting_after=obj_foo\` in order to fetch the next page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetBillingPortalConfigurationsParameters -> ShowS
[GetBillingPortalConfigurationsParameters] -> ShowS
GetBillingPortalConfigurationsParameters -> String
(Int -> GetBillingPortalConfigurationsParameters -> ShowS)
-> (GetBillingPortalConfigurationsParameters -> String)
-> ([GetBillingPortalConfigurationsParameters] -> ShowS)
-> Show GetBillingPortalConfigurationsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBillingPortalConfigurationsParameters] -> ShowS
$cshowList :: [GetBillingPortalConfigurationsParameters] -> ShowS
show :: GetBillingPortalConfigurationsParameters -> String
$cshow :: GetBillingPortalConfigurationsParameters -> String
showsPrec :: Int -> GetBillingPortalConfigurationsParameters -> ShowS
$cshowsPrec :: Int -> GetBillingPortalConfigurationsParameters -> ShowS
GHC.Show.Show,
      GetBillingPortalConfigurationsParameters
-> GetBillingPortalConfigurationsParameters -> Bool
(GetBillingPortalConfigurationsParameters
 -> GetBillingPortalConfigurationsParameters -> Bool)
-> (GetBillingPortalConfigurationsParameters
    -> GetBillingPortalConfigurationsParameters -> Bool)
-> Eq GetBillingPortalConfigurationsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBillingPortalConfigurationsParameters
-> GetBillingPortalConfigurationsParameters -> Bool
$c/= :: GetBillingPortalConfigurationsParameters
-> GetBillingPortalConfigurationsParameters -> Bool
== :: GetBillingPortalConfigurationsParameters
-> GetBillingPortalConfigurationsParameters -> Bool
$c== :: GetBillingPortalConfigurationsParameters
-> GetBillingPortalConfigurationsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetBillingPortalConfigurationsParameters where
  toJSON :: GetBillingPortalConfigurationsParameters -> Value
toJSON GetBillingPortalConfigurationsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryActive" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryActive GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryEnding_before" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryEndingBefore GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryExpand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe [Text]
getBillingPortalConfigurationsParametersQueryExpand GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryIs_default" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryIsDefault GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryLimit" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Int
getBillingPortalConfigurationsParametersQueryLimit GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryStarting_after" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryStartingAfter GetBillingPortalConfigurationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetBillingPortalConfigurationsParameters -> Encoding
toEncoding GetBillingPortalConfigurationsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryActive" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryActive GetBillingPortalConfigurationsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryEnding_before" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryEndingBefore GetBillingPortalConfigurationsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryExpand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe [Text]
getBillingPortalConfigurationsParametersQueryExpand GetBillingPortalConfigurationsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryIs_default" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Bool
getBillingPortalConfigurationsParametersQueryIsDefault GetBillingPortalConfigurationsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryLimit" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Int
getBillingPortalConfigurationsParametersQueryLimit GetBillingPortalConfigurationsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"queryStarting_after" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsParameters -> Maybe Text
getBillingPortalConfigurationsParametersQueryStartingAfter GetBillingPortalConfigurationsParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetBillingPortalConfigurationsParameters where
  parseJSON :: Value -> Parser GetBillingPortalConfigurationsParameters
parseJSON = String
-> (Object -> Parser GetBillingPortalConfigurationsParameters)
-> Value
-> Parser GetBillingPortalConfigurationsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetBillingPortalConfigurationsParameters" (\Object
obj -> ((((((Maybe Bool
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Text
 -> GetBillingPortalConfigurationsParameters)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> GetBillingPortalConfigurationsParameters
GetBillingPortalConfigurationsParameters Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryActive")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryEnding_before")) Parser
  (Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryExpand")) Parser
  (Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Int
      -> Maybe Text -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryIs_default")) Parser
  (Maybe Int
   -> Maybe Text -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetBillingPortalConfigurationsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryLimit")) Parser (Maybe Text -> GetBillingPortalConfigurationsParameters)
-> Parser (Maybe Text)
-> Parser GetBillingPortalConfigurationsParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryStarting_after"))

-- | Create a new 'GetBillingPortalConfigurationsParameters' with all required fields.
mkGetBillingPortalConfigurationsParameters :: GetBillingPortalConfigurationsParameters
mkGetBillingPortalConfigurationsParameters :: GetBillingPortalConfigurationsParameters
mkGetBillingPortalConfigurationsParameters =
  GetBillingPortalConfigurationsParameters :: Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> GetBillingPortalConfigurationsParameters
GetBillingPortalConfigurationsParameters
    { getBillingPortalConfigurationsParametersQueryActive :: Maybe Bool
getBillingPortalConfigurationsParametersQueryActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getBillingPortalConfigurationsParametersQueryEndingBefore :: Maybe Text
getBillingPortalConfigurationsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getBillingPortalConfigurationsParametersQueryExpand :: Maybe [Text]
getBillingPortalConfigurationsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getBillingPortalConfigurationsParametersQueryIsDefault :: Maybe Bool
getBillingPortalConfigurationsParametersQueryIsDefault = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getBillingPortalConfigurationsParametersQueryLimit :: Maybe Int
getBillingPortalConfigurationsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getBillingPortalConfigurationsParametersQueryStartingAfter :: Maybe Text
getBillingPortalConfigurationsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

-- | Defines the object schema located at @paths.\/v1\/billing_portal\/configurations.GET.responses.200.content.application\/json.schema@ in the specification.
data GetBillingPortalConfigurationsResponseBody200 = GetBillingPortalConfigurationsResponseBody200
  { -- | data
    GetBillingPortalConfigurationsResponseBody200
-> [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data :: ([BillingPortal'configuration]),
    -- | has_more: True if this list has another page of items after this one that can be fetched.
    GetBillingPortalConfigurationsResponseBody200 -> Bool
getBillingPortalConfigurationsResponseBody200HasMore :: GHC.Types.Bool,
    -- | url: The URL where this list can be accessed.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    -- * Must match pattern \'^\/v1\/billing_portal\/configurations\'
    GetBillingPortalConfigurationsResponseBody200 -> Text
getBillingPortalConfigurationsResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> GetBillingPortalConfigurationsResponseBody200 -> ShowS
[GetBillingPortalConfigurationsResponseBody200] -> ShowS
GetBillingPortalConfigurationsResponseBody200 -> String
(Int -> GetBillingPortalConfigurationsResponseBody200 -> ShowS)
-> (GetBillingPortalConfigurationsResponseBody200 -> String)
-> ([GetBillingPortalConfigurationsResponseBody200] -> ShowS)
-> Show GetBillingPortalConfigurationsResponseBody200
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBillingPortalConfigurationsResponseBody200] -> ShowS
$cshowList :: [GetBillingPortalConfigurationsResponseBody200] -> ShowS
show :: GetBillingPortalConfigurationsResponseBody200 -> String
$cshow :: GetBillingPortalConfigurationsResponseBody200 -> String
showsPrec :: Int -> GetBillingPortalConfigurationsResponseBody200 -> ShowS
$cshowsPrec :: Int -> GetBillingPortalConfigurationsResponseBody200 -> ShowS
GHC.Show.Show,
      GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponseBody200 -> Bool
(GetBillingPortalConfigurationsResponseBody200
 -> GetBillingPortalConfigurationsResponseBody200 -> Bool)
-> (GetBillingPortalConfigurationsResponseBody200
    -> GetBillingPortalConfigurationsResponseBody200 -> Bool)
-> Eq GetBillingPortalConfigurationsResponseBody200
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponseBody200 -> Bool
$c/= :: GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponseBody200 -> Bool
== :: GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponseBody200 -> Bool
$c== :: GetBillingPortalConfigurationsResponseBody200
-> GetBillingPortalConfigurationsResponseBody200 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetBillingPortalConfigurationsResponseBody200 where
  toJSON :: GetBillingPortalConfigurationsResponseBody200 -> Value
toJSON GetBillingPortalConfigurationsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [BillingPortal'configuration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200
-> [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data GetBillingPortalConfigurationsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"has_more" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200 -> Bool
getBillingPortalConfigurationsResponseBody200HasMore GetBillingPortalConfigurationsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200 -> Text
getBillingPortalConfigurationsResponseBody200Url GetBillingPortalConfigurationsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetBillingPortalConfigurationsResponseBody200 -> Encoding
toEncoding GetBillingPortalConfigurationsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [BillingPortal'configuration] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200
-> [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data GetBillingPortalConfigurationsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"has_more" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200 -> Bool
getBillingPortalConfigurationsResponseBody200HasMore GetBillingPortalConfigurationsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBillingPortalConfigurationsResponseBody200 -> Text
getBillingPortalConfigurationsResponseBody200Url GetBillingPortalConfigurationsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list"))))

instance Data.Aeson.Types.FromJSON.FromJSON GetBillingPortalConfigurationsResponseBody200 where
  parseJSON :: Value -> Parser GetBillingPortalConfigurationsResponseBody200
parseJSON = String
-> (Object -> Parser GetBillingPortalConfigurationsResponseBody200)
-> Value
-> Parser GetBillingPortalConfigurationsResponseBody200
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetBillingPortalConfigurationsResponseBody200" (\Object
obj -> ((([BillingPortal'configuration]
 -> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200)
-> Parser
     ([BillingPortal'configuration]
      -> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [BillingPortal'configuration]
-> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200
GetBillingPortalConfigurationsResponseBody200 Parser
  ([BillingPortal'configuration]
   -> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200)
-> Parser [BillingPortal'configuration]
-> Parser
     (Bool -> Text -> GetBillingPortalConfigurationsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [BillingPortal'configuration]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser
  (Bool -> Text -> GetBillingPortalConfigurationsResponseBody200)
-> Parser Bool
-> Parser (Text -> GetBillingPortalConfigurationsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"has_more")) Parser (Text -> GetBillingPortalConfigurationsResponseBody200)
-> Parser Text
-> Parser GetBillingPortalConfigurationsResponseBody200
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"url"))

-- | Create a new 'GetBillingPortalConfigurationsResponseBody200' with all required fields.
mkGetBillingPortalConfigurationsResponseBody200 ::
  -- | 'getBillingPortalConfigurationsResponseBody200Data'
  [BillingPortal'configuration] ->
  -- | 'getBillingPortalConfigurationsResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getBillingPortalConfigurationsResponseBody200Url'
  Data.Text.Internal.Text ->
  GetBillingPortalConfigurationsResponseBody200
mkGetBillingPortalConfigurationsResponseBody200 :: [BillingPortal'configuration]
-> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200
mkGetBillingPortalConfigurationsResponseBody200 [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data Bool
getBillingPortalConfigurationsResponseBody200HasMore Text
getBillingPortalConfigurationsResponseBody200Url =
  GetBillingPortalConfigurationsResponseBody200 :: [BillingPortal'configuration]
-> Bool -> Text -> GetBillingPortalConfigurationsResponseBody200
GetBillingPortalConfigurationsResponseBody200
    { getBillingPortalConfigurationsResponseBody200Data :: [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data = [BillingPortal'configuration]
getBillingPortalConfigurationsResponseBody200Data,
      getBillingPortalConfigurationsResponseBody200HasMore :: Bool
getBillingPortalConfigurationsResponseBody200HasMore = Bool
getBillingPortalConfigurationsResponseBody200HasMore,
      getBillingPortalConfigurationsResponseBody200Url :: Text
getBillingPortalConfigurationsResponseBody200Url = Text
getBillingPortalConfigurationsResponseBody200Url
    }