{-# 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 getPrices
module StripeAPI.Operations.GetPrices 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/prices
--
-- \<p>Returns a list of your prices.\<\/p>
getPrices ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetPricesParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetPricesResponse)
getPrices :: GetPricesParameters -> ClientT m (Response GetPricesResponse)
getPrices GetPricesParameters
parameters =
  (Response ByteString -> Response GetPricesResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response GetPricesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetPricesResponse)
-> Response ByteString -> Response GetPricesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetPricesResponse)
-> (GetPricesResponse -> GetPricesResponse)
-> Either String GetPricesResponse
-> GetPricesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetPricesResponse
GetPricesResponseError GetPricesResponse -> GetPricesResponse
forall a. a -> a
GHC.Base.id
              (Either String GetPricesResponse -> GetPricesResponse)
-> (ByteString -> Either String GetPricesResponse)
-> ByteString
-> GetPricesResponse
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) ->
                                   GetPricesResponseBody200 -> GetPricesResponse
GetPricesResponse200
                                     (GetPricesResponseBody200 -> GetPricesResponse)
-> Either String GetPricesResponseBody200
-> Either String GetPricesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetPricesResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetPricesResponseBody200
                                                      )
                                 | 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 -> GetPricesResponse
GetPricesResponseDefault
                                     (Error -> GetPricesResponse)
-> Either String Error -> Either String GetPricesResponse
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 GetPricesResponse
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)
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/prices")
        [ 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.<$> GetPricesParameters -> Maybe Bool
getPricesParametersQueryActive GetPricesParameters
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
"created") (GetPricesParametersQueryCreated'Variants -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetPricesParametersQueryCreated'Variants -> Value)
-> Maybe GetPricesParametersQueryCreated'Variants -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPricesParameters
-> Maybe GetPricesParametersQueryCreated'Variants
getPricesParametersQueryCreated GetPricesParameters
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
"currency") (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.<$> GetPricesParameters -> Maybe Text
getPricesParametersQueryCurrency GetPricesParameters
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.<$> GetPricesParameters -> Maybe Text
getPricesParametersQueryEndingBefore GetPricesParameters
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.<$> GetPricesParameters -> Maybe [Text]
getPricesParametersQueryExpand GetPricesParameters
parameters) (String -> Text
Data.Text.pack String
"deepObject") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"limit") (Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Int -> Value) -> Maybe Int -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPricesParameters -> Maybe Int
getPricesParametersQueryLimit GetPricesParameters
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
"lookup_keys") ([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.<$> GetPricesParameters -> Maybe [Text]
getPricesParametersQueryLookupKeys GetPricesParameters
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
"product") (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.<$> GetPricesParameters -> Maybe Text
getPricesParametersQueryProduct GetPricesParameters
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
"recurring") (GetPricesParametersQueryRecurring' -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetPricesParametersQueryRecurring' -> Value)
-> Maybe GetPricesParametersQueryRecurring' -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPricesParameters -> Maybe GetPricesParametersQueryRecurring'
getPricesParametersQueryRecurring GetPricesParameters
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
"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.<$> GetPricesParameters -> Maybe Text
getPricesParametersQueryStartingAfter GetPricesParameters
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
"type") (GetPricesParametersQueryType' -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetPricesParametersQueryType' -> Value)
-> Maybe GetPricesParametersQueryType' -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetPricesParameters -> Maybe GetPricesParametersQueryType'
getPricesParametersQueryType GetPricesParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/prices.GET.parameters@ in the specification.
data GetPricesParameters = GetPricesParameters
  { -- | queryActive: Represents the parameter named \'active\'
    --
    -- Only return prices that are active or inactive (e.g., pass \`false\` to list all inactive prices).
    GetPricesParameters -> Maybe Bool
getPricesParametersQueryActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | queryCreated: Represents the parameter named \'created\'
    --
    -- A filter on the list, based on the object \`created\` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
    GetPricesParameters
-> Maybe GetPricesParametersQueryCreated'Variants
getPricesParametersQueryCreated :: (GHC.Maybe.Maybe GetPricesParametersQueryCreated'Variants),
    -- | queryCurrency: Represents the parameter named \'currency\'
    --
    -- Only return prices for the given currency.
    GetPricesParameters -> Maybe Text
getPricesParametersQueryCurrency :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetPricesParameters -> Maybe Text
getPricesParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetPricesParameters -> Maybe [Text]
getPricesParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryLimit: Represents the parameter named \'limit\'
    --
    -- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
    GetPricesParameters -> Maybe Int
getPricesParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryLookup_keys: Represents the parameter named \'lookup_keys\'
    --
    -- Only return the price with these lookup_keys, if any exist.
    GetPricesParameters -> Maybe [Text]
getPricesParametersQueryLookupKeys :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryProduct: Represents the parameter named \'product\'
    --
    -- Only return prices for the given product.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetPricesParameters -> Maybe Text
getPricesParametersQueryProduct :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryRecurring: Represents the parameter named \'recurring\'
    --
    -- Only return prices with these recurring fields.
    GetPricesParameters -> Maybe GetPricesParametersQueryRecurring'
getPricesParametersQueryRecurring :: (GHC.Maybe.Maybe GetPricesParametersQueryRecurring'),
    -- | 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
    GetPricesParameters -> Maybe Text
getPricesParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryType: Represents the parameter named \'type\'
    --
    -- Only return prices of type \`recurring\` or \`one_time\`.
    GetPricesParameters -> Maybe GetPricesParametersQueryType'
getPricesParametersQueryType :: (GHC.Maybe.Maybe GetPricesParametersQueryType')
  }
  deriving
    ( Int -> GetPricesParameters -> ShowS
[GetPricesParameters] -> ShowS
GetPricesParameters -> String
(Int -> GetPricesParameters -> ShowS)
-> (GetPricesParameters -> String)
-> ([GetPricesParameters] -> ShowS)
-> Show GetPricesParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParameters] -> ShowS
$cshowList :: [GetPricesParameters] -> ShowS
show :: GetPricesParameters -> String
$cshow :: GetPricesParameters -> String
showsPrec :: Int -> GetPricesParameters -> ShowS
$cshowsPrec :: Int -> GetPricesParameters -> ShowS
GHC.Show.Show,
      GetPricesParameters -> GetPricesParameters -> Bool
(GetPricesParameters -> GetPricesParameters -> Bool)
-> (GetPricesParameters -> GetPricesParameters -> Bool)
-> Eq GetPricesParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParameters -> GetPricesParameters -> Bool
$c/= :: GetPricesParameters -> GetPricesParameters -> Bool
== :: GetPricesParameters -> GetPricesParameters -> Bool
$c== :: GetPricesParameters -> GetPricesParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParameters where
  toJSON :: GetPricesParameters -> Value
toJSON GetPricesParameters
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..= GetPricesParameters -> Maybe Bool
getPricesParametersQueryActive GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryCreated" Text -> Maybe GetPricesParametersQueryCreated'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters
-> Maybe GetPricesParametersQueryCreated'Variants
getPricesParametersQueryCreated GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryCurrency" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe Text
getPricesParametersQueryCurrency GetPricesParameters
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..= GetPricesParameters -> Maybe Text
getPricesParametersQueryEndingBefore GetPricesParameters
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..= GetPricesParameters -> Maybe [Text]
getPricesParametersQueryExpand GetPricesParameters
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..= GetPricesParameters -> Maybe Int
getPricesParametersQueryLimit GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryLookup_keys" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe [Text]
getPricesParametersQueryLookupKeys GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryProduct" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe Text
getPricesParametersQueryProduct GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryRecurring" Text -> Maybe GetPricesParametersQueryRecurring' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe GetPricesParametersQueryRecurring'
getPricesParametersQueryRecurring GetPricesParameters
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..= GetPricesParameters -> Maybe Text
getPricesParametersQueryStartingAfter GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryType" Text -> Maybe GetPricesParametersQueryType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe GetPricesParametersQueryType'
getPricesParametersQueryType GetPricesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetPricesParameters -> Encoding
toEncoding GetPricesParameters
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..= GetPricesParameters -> Maybe Bool
getPricesParametersQueryActive GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryCreated" Text -> Maybe GetPricesParametersQueryCreated'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters
-> Maybe GetPricesParametersQueryCreated'Variants
getPricesParametersQueryCreated GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryCurrency" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe Text
getPricesParametersQueryCurrency GetPricesParameters
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..= GetPricesParameters -> Maybe Text
getPricesParametersQueryEndingBefore GetPricesParameters
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..= GetPricesParameters -> Maybe [Text]
getPricesParametersQueryExpand GetPricesParameters
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..= GetPricesParameters -> Maybe Int
getPricesParametersQueryLimit GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryLookup_keys" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe [Text]
getPricesParametersQueryLookupKeys GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryProduct" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe Text
getPricesParametersQueryProduct GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryRecurring" Text -> Maybe GetPricesParametersQueryRecurring' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe GetPricesParametersQueryRecurring'
getPricesParametersQueryRecurring GetPricesParameters
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..= GetPricesParameters -> Maybe Text
getPricesParametersQueryStartingAfter GetPricesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"queryType" Text -> Maybe GetPricesParametersQueryType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParameters -> Maybe GetPricesParametersQueryType'
getPricesParametersQueryType GetPricesParameters
obj)))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParameters where
  parseJSON :: Value -> Parser GetPricesParameters
parseJSON = String
-> (Object -> Parser GetPricesParameters)
-> Value
-> Parser GetPricesParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetPricesParameters" (\Object
obj -> (((((((((((Maybe Bool
 -> Maybe GetPricesParametersQueryCreated'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe GetPricesParametersQueryRecurring'
 -> Maybe Text
 -> Maybe GetPricesParametersQueryType'
 -> GetPricesParameters)
-> Parser
     (Maybe Bool
      -> Maybe GetPricesParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe GetPricesParametersQueryCreated'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe [Text]
-> Maybe Text
-> Maybe GetPricesParametersQueryRecurring'
-> Maybe Text
-> Maybe GetPricesParametersQueryType'
-> GetPricesParameters
GetPricesParameters Parser
  (Maybe Bool
   -> Maybe GetPricesParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe GetPricesParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
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 GetPricesParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe GetPricesParametersQueryCreated'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe GetPricesParametersQueryCreated'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCreated")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
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
"queryCurrency")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryEnding_before")) Parser
  (Maybe [Text]
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryExpand")) Parser
  (Maybe Int
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
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]
   -> Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
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
"queryLookup_keys")) Parser
  (Maybe Text
   -> Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe GetPricesParametersQueryRecurring'
      -> Maybe Text
      -> Maybe GetPricesParametersQueryType'
      -> GetPricesParameters)
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
"queryProduct")) Parser
  (Maybe GetPricesParametersQueryRecurring'
   -> Maybe Text
   -> Maybe GetPricesParametersQueryType'
   -> GetPricesParameters)
-> Parser (Maybe GetPricesParametersQueryRecurring')
-> Parser
     (Maybe Text
      -> Maybe GetPricesParametersQueryType' -> GetPricesParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe GetPricesParametersQueryRecurring')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryRecurring")) Parser
  (Maybe Text
   -> Maybe GetPricesParametersQueryType' -> GetPricesParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe GetPricesParametersQueryType' -> GetPricesParameters)
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")) Parser (Maybe GetPricesParametersQueryType' -> GetPricesParameters)
-> Parser (Maybe GetPricesParametersQueryType')
-> Parser GetPricesParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe GetPricesParametersQueryType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryType"))

-- | Create a new 'GetPricesParameters' with all required fields.
mkGetPricesParameters :: GetPricesParameters
mkGetPricesParameters :: GetPricesParameters
mkGetPricesParameters =
  GetPricesParameters :: Maybe Bool
-> Maybe GetPricesParametersQueryCreated'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe [Text]
-> Maybe Text
-> Maybe GetPricesParametersQueryRecurring'
-> Maybe Text
-> Maybe GetPricesParametersQueryType'
-> GetPricesParameters
GetPricesParameters
    { getPricesParametersQueryActive :: Maybe Bool
getPricesParametersQueryActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryCreated :: Maybe GetPricesParametersQueryCreated'Variants
getPricesParametersQueryCreated = Maybe GetPricesParametersQueryCreated'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryCurrency :: Maybe Text
getPricesParametersQueryCurrency = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryEndingBefore :: Maybe Text
getPricesParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryExpand :: Maybe [Text]
getPricesParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryLimit :: Maybe Int
getPricesParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryLookupKeys :: Maybe [Text]
getPricesParametersQueryLookupKeys = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryProduct :: Maybe Text
getPricesParametersQueryProduct = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryRecurring :: Maybe GetPricesParametersQueryRecurring'
getPricesParametersQueryRecurring = Maybe GetPricesParametersQueryRecurring'
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryStartingAfter :: Maybe Text
getPricesParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryType :: Maybe GetPricesParametersQueryType'
getPricesParametersQueryType = Maybe GetPricesParametersQueryType'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/prices.GET.parameters.properties.queryCreated.anyOf@ in the specification.
data GetPricesParametersQueryCreated'OneOf1 = GetPricesParametersQueryCreated'OneOf1
  { -- | gt
    GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gt :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | gte
    GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gte :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | lt
    GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lt :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | lte
    GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lte :: (GHC.Maybe.Maybe GHC.Types.Int)
  }
  deriving
    ( Int -> GetPricesParametersQueryCreated'OneOf1 -> ShowS
[GetPricesParametersQueryCreated'OneOf1] -> ShowS
GetPricesParametersQueryCreated'OneOf1 -> String
(Int -> GetPricesParametersQueryCreated'OneOf1 -> ShowS)
-> (GetPricesParametersQueryCreated'OneOf1 -> String)
-> ([GetPricesParametersQueryCreated'OneOf1] -> ShowS)
-> Show GetPricesParametersQueryCreated'OneOf1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryCreated'OneOf1] -> ShowS
$cshowList :: [GetPricesParametersQueryCreated'OneOf1] -> ShowS
show :: GetPricesParametersQueryCreated'OneOf1 -> String
$cshow :: GetPricesParametersQueryCreated'OneOf1 -> String
showsPrec :: Int -> GetPricesParametersQueryCreated'OneOf1 -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryCreated'OneOf1 -> ShowS
GHC.Show.Show,
      GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'OneOf1 -> Bool
(GetPricesParametersQueryCreated'OneOf1
 -> GetPricesParametersQueryCreated'OneOf1 -> Bool)
-> (GetPricesParametersQueryCreated'OneOf1
    -> GetPricesParametersQueryCreated'OneOf1 -> Bool)
-> Eq GetPricesParametersQueryCreated'OneOf1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'OneOf1 -> Bool
$c/= :: GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'OneOf1 -> Bool
== :: GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'OneOf1 -> Bool
$c== :: GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'OneOf1 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryCreated'OneOf1 where
  toJSON :: GetPricesParametersQueryCreated'OneOf1 -> Value
toJSON GetPricesParametersQueryCreated'OneOf1
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"gt" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gt GetPricesParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"gte" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gte GetPricesParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"lt" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lt GetPricesParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"lte" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lte GetPricesParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetPricesParametersQueryCreated'OneOf1 -> Encoding
toEncoding GetPricesParametersQueryCreated'OneOf1
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"gt" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gt GetPricesParametersQueryCreated'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"gte" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Gte GetPricesParametersQueryCreated'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"lt" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lt GetPricesParametersQueryCreated'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"lte" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryCreated'OneOf1 -> Maybe Int
getPricesParametersQueryCreated'OneOf1Lte GetPricesParametersQueryCreated'OneOf1
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryCreated'OneOf1 where
  parseJSON :: Value -> Parser GetPricesParametersQueryCreated'OneOf1
parseJSON = String
-> (Object -> Parser GetPricesParametersQueryCreated'OneOf1)
-> Value
-> Parser GetPricesParametersQueryCreated'OneOf1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetPricesParametersQueryCreated'OneOf1" (\Object
obj -> ((((Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> GetPricesParametersQueryCreated'OneOf1)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> GetPricesParametersQueryCreated'OneOf1)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetPricesParametersQueryCreated'OneOf1
GetPricesParametersQueryCreated'OneOf1 Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> GetPricesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> GetPricesParametersQueryCreated'OneOf1)
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
"gt")) Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> GetPricesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int -> Maybe Int -> GetPricesParametersQueryCreated'OneOf1)
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
"gte")) Parser
  (Maybe Int -> Maybe Int -> GetPricesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> GetPricesParametersQueryCreated'OneOf1)
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
"lt")) Parser (Maybe Int -> GetPricesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser GetPricesParametersQueryCreated'OneOf1
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
"lte"))

-- | Create a new 'GetPricesParametersQueryCreated'OneOf1' with all required fields.
mkGetPricesParametersQueryCreated'OneOf1 :: GetPricesParametersQueryCreated'OneOf1
mkGetPricesParametersQueryCreated'OneOf1 :: GetPricesParametersQueryCreated'OneOf1
mkGetPricesParametersQueryCreated'OneOf1 =
  GetPricesParametersQueryCreated'OneOf1 :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetPricesParametersQueryCreated'OneOf1
GetPricesParametersQueryCreated'OneOf1
    { getPricesParametersQueryCreated'OneOf1Gt :: Maybe Int
getPricesParametersQueryCreated'OneOf1Gt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryCreated'OneOf1Gte :: Maybe Int
getPricesParametersQueryCreated'OneOf1Gte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryCreated'OneOf1Lt :: Maybe Int
getPricesParametersQueryCreated'OneOf1Lt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryCreated'OneOf1Lte :: Maybe Int
getPricesParametersQueryCreated'OneOf1Lte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @paths.\/v1\/prices.GET.parameters.properties.queryCreated.anyOf@ in the specification.
--
-- Represents the parameter named \'created\'
--
-- A filter on the list, based on the object \`created\` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
data GetPricesParametersQueryCreated'Variants
  = GetPricesParametersQueryCreated'GetPricesParametersQueryCreated'OneOf1 GetPricesParametersQueryCreated'OneOf1
  | GetPricesParametersQueryCreated'Int GHC.Types.Int
  deriving (Int -> GetPricesParametersQueryCreated'Variants -> ShowS
[GetPricesParametersQueryCreated'Variants] -> ShowS
GetPricesParametersQueryCreated'Variants -> String
(Int -> GetPricesParametersQueryCreated'Variants -> ShowS)
-> (GetPricesParametersQueryCreated'Variants -> String)
-> ([GetPricesParametersQueryCreated'Variants] -> ShowS)
-> Show GetPricesParametersQueryCreated'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryCreated'Variants] -> ShowS
$cshowList :: [GetPricesParametersQueryCreated'Variants] -> ShowS
show :: GetPricesParametersQueryCreated'Variants -> String
$cshow :: GetPricesParametersQueryCreated'Variants -> String
showsPrec :: Int -> GetPricesParametersQueryCreated'Variants -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryCreated'Variants -> ShowS
GHC.Show.Show, GetPricesParametersQueryCreated'Variants
-> GetPricesParametersQueryCreated'Variants -> Bool
(GetPricesParametersQueryCreated'Variants
 -> GetPricesParametersQueryCreated'Variants -> Bool)
-> (GetPricesParametersQueryCreated'Variants
    -> GetPricesParametersQueryCreated'Variants -> Bool)
-> Eq GetPricesParametersQueryCreated'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryCreated'Variants
-> GetPricesParametersQueryCreated'Variants -> Bool
$c/= :: GetPricesParametersQueryCreated'Variants
-> GetPricesParametersQueryCreated'Variants -> Bool
== :: GetPricesParametersQueryCreated'Variants
-> GetPricesParametersQueryCreated'Variants -> Bool
$c== :: GetPricesParametersQueryCreated'Variants
-> GetPricesParametersQueryCreated'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryCreated'Variants where
  toJSON :: GetPricesParametersQueryCreated'Variants -> Value
toJSON (GetPricesParametersQueryCreated'GetPricesParametersQueryCreated'OneOf1 GetPricesParametersQueryCreated'OneOf1
a) = GetPricesParametersQueryCreated'OneOf1 -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON GetPricesParametersQueryCreated'OneOf1
a
  toJSON (GetPricesParametersQueryCreated'Int Int
a) = Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Int
a

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryCreated'Variants where
  parseJSON :: Value -> Parser GetPricesParametersQueryCreated'Variants
parseJSON Value
val = case (GetPricesParametersQueryCreated'OneOf1
-> GetPricesParametersQueryCreated'Variants
GetPricesParametersQueryCreated'GetPricesParametersQueryCreated'OneOf1 (GetPricesParametersQueryCreated'OneOf1
 -> GetPricesParametersQueryCreated'Variants)
-> Result GetPricesParametersQueryCreated'OneOf1
-> Result GetPricesParametersQueryCreated'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result GetPricesParametersQueryCreated'OneOf1
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result GetPricesParametersQueryCreated'Variants
-> Result GetPricesParametersQueryCreated'Variants
-> Result GetPricesParametersQueryCreated'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Int -> GetPricesParametersQueryCreated'Variants
GetPricesParametersQueryCreated'Int (Int -> GetPricesParametersQueryCreated'Variants)
-> Result Int -> Result GetPricesParametersQueryCreated'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Int
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result GetPricesParametersQueryCreated'Variants
-> Result GetPricesParametersQueryCreated'Variants
-> Result GetPricesParametersQueryCreated'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result GetPricesParametersQueryCreated'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success GetPricesParametersQueryCreated'Variants
a -> GetPricesParametersQueryCreated'Variants
-> Parser GetPricesParametersQueryCreated'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure GetPricesParametersQueryCreated'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser GetPricesParametersQueryCreated'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the object schema located at @paths.\/v1\/prices.GET.parameters.properties.queryRecurring@ in the specification.
--
-- Represents the parameter named \'recurring\'
--
-- Only return prices with these recurring fields.
data GetPricesParametersQueryRecurring' = GetPricesParametersQueryRecurring'
  { -- | interval
    GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'Interval'
getPricesParametersQueryRecurring'Interval :: (GHC.Maybe.Maybe GetPricesParametersQueryRecurring'Interval'),
    -- | usage_type
    GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'UsageType'
getPricesParametersQueryRecurring'UsageType :: (GHC.Maybe.Maybe GetPricesParametersQueryRecurring'UsageType')
  }
  deriving
    ( Int -> GetPricesParametersQueryRecurring' -> ShowS
[GetPricesParametersQueryRecurring'] -> ShowS
GetPricesParametersQueryRecurring' -> String
(Int -> GetPricesParametersQueryRecurring' -> ShowS)
-> (GetPricesParametersQueryRecurring' -> String)
-> ([GetPricesParametersQueryRecurring'] -> ShowS)
-> Show GetPricesParametersQueryRecurring'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryRecurring'] -> ShowS
$cshowList :: [GetPricesParametersQueryRecurring'] -> ShowS
show :: GetPricesParametersQueryRecurring' -> String
$cshow :: GetPricesParametersQueryRecurring' -> String
showsPrec :: Int -> GetPricesParametersQueryRecurring' -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryRecurring' -> ShowS
GHC.Show.Show,
      GetPricesParametersQueryRecurring'
-> GetPricesParametersQueryRecurring' -> Bool
(GetPricesParametersQueryRecurring'
 -> GetPricesParametersQueryRecurring' -> Bool)
-> (GetPricesParametersQueryRecurring'
    -> GetPricesParametersQueryRecurring' -> Bool)
-> Eq GetPricesParametersQueryRecurring'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryRecurring'
-> GetPricesParametersQueryRecurring' -> Bool
$c/= :: GetPricesParametersQueryRecurring'
-> GetPricesParametersQueryRecurring' -> Bool
== :: GetPricesParametersQueryRecurring'
-> GetPricesParametersQueryRecurring' -> Bool
$c== :: GetPricesParametersQueryRecurring'
-> GetPricesParametersQueryRecurring' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryRecurring' where
  toJSON :: GetPricesParametersQueryRecurring' -> Value
toJSON GetPricesParametersQueryRecurring'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"interval" Text -> Maybe GetPricesParametersQueryRecurring'Interval' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'Interval'
getPricesParametersQueryRecurring'Interval GetPricesParametersQueryRecurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"usage_type" Text -> Maybe GetPricesParametersQueryRecurring'UsageType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'UsageType'
getPricesParametersQueryRecurring'UsageType GetPricesParametersQueryRecurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetPricesParametersQueryRecurring' -> Encoding
toEncoding GetPricesParametersQueryRecurring'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"interval" Text -> Maybe GetPricesParametersQueryRecurring'Interval' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'Interval'
getPricesParametersQueryRecurring'Interval GetPricesParametersQueryRecurring'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"usage_type" Text
-> Maybe GetPricesParametersQueryRecurring'UsageType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetPricesParametersQueryRecurring'
-> Maybe GetPricesParametersQueryRecurring'UsageType'
getPricesParametersQueryRecurring'UsageType GetPricesParametersQueryRecurring'
obj))

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryRecurring' where
  parseJSON :: Value -> Parser GetPricesParametersQueryRecurring'
parseJSON = String
-> (Object -> Parser GetPricesParametersQueryRecurring')
-> Value
-> Parser GetPricesParametersQueryRecurring'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetPricesParametersQueryRecurring'" (\Object
obj -> ((Maybe GetPricesParametersQueryRecurring'Interval'
 -> Maybe GetPricesParametersQueryRecurring'UsageType'
 -> GetPricesParametersQueryRecurring')
-> Parser
     (Maybe GetPricesParametersQueryRecurring'Interval'
      -> Maybe GetPricesParametersQueryRecurring'UsageType'
      -> GetPricesParametersQueryRecurring')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe GetPricesParametersQueryRecurring'Interval'
-> Maybe GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'
GetPricesParametersQueryRecurring' Parser
  (Maybe GetPricesParametersQueryRecurring'Interval'
   -> Maybe GetPricesParametersQueryRecurring'UsageType'
   -> GetPricesParametersQueryRecurring')
-> Parser (Maybe GetPricesParametersQueryRecurring'Interval')
-> Parser
     (Maybe GetPricesParametersQueryRecurring'UsageType'
      -> GetPricesParametersQueryRecurring')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe GetPricesParametersQueryRecurring'Interval')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"interval")) Parser
  (Maybe GetPricesParametersQueryRecurring'UsageType'
   -> GetPricesParametersQueryRecurring')
-> Parser (Maybe GetPricesParametersQueryRecurring'UsageType')
-> Parser GetPricesParametersQueryRecurring'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe GetPricesParametersQueryRecurring'UsageType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"usage_type"))

-- | Create a new 'GetPricesParametersQueryRecurring'' with all required fields.
mkGetPricesParametersQueryRecurring' :: GetPricesParametersQueryRecurring'
mkGetPricesParametersQueryRecurring' :: GetPricesParametersQueryRecurring'
mkGetPricesParametersQueryRecurring' =
  GetPricesParametersQueryRecurring' :: Maybe GetPricesParametersQueryRecurring'Interval'
-> Maybe GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'
GetPricesParametersQueryRecurring'
    { getPricesParametersQueryRecurring'Interval :: Maybe GetPricesParametersQueryRecurring'Interval'
getPricesParametersQueryRecurring'Interval = Maybe GetPricesParametersQueryRecurring'Interval'
forall a. Maybe a
GHC.Maybe.Nothing,
      getPricesParametersQueryRecurring'UsageType :: Maybe GetPricesParametersQueryRecurring'UsageType'
getPricesParametersQueryRecurring'UsageType = Maybe GetPricesParametersQueryRecurring'UsageType'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/prices.GET.parameters.properties.queryRecurring.properties.interval@ in the specification.
data GetPricesParametersQueryRecurring'Interval'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    GetPricesParametersQueryRecurring'Interval'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    GetPricesParametersQueryRecurring'Interval'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"day"@
    GetPricesParametersQueryRecurring'Interval'EnumDay
  | -- | Represents the JSON value @"month"@
    GetPricesParametersQueryRecurring'Interval'EnumMonth
  | -- | Represents the JSON value @"week"@
    GetPricesParametersQueryRecurring'Interval'EnumWeek
  | -- | Represents the JSON value @"year"@
    GetPricesParametersQueryRecurring'Interval'EnumYear
  deriving (Int -> GetPricesParametersQueryRecurring'Interval' -> ShowS
[GetPricesParametersQueryRecurring'Interval'] -> ShowS
GetPricesParametersQueryRecurring'Interval' -> String
(Int -> GetPricesParametersQueryRecurring'Interval' -> ShowS)
-> (GetPricesParametersQueryRecurring'Interval' -> String)
-> ([GetPricesParametersQueryRecurring'Interval'] -> ShowS)
-> Show GetPricesParametersQueryRecurring'Interval'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryRecurring'Interval'] -> ShowS
$cshowList :: [GetPricesParametersQueryRecurring'Interval'] -> ShowS
show :: GetPricesParametersQueryRecurring'Interval' -> String
$cshow :: GetPricesParametersQueryRecurring'Interval' -> String
showsPrec :: Int -> GetPricesParametersQueryRecurring'Interval' -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryRecurring'Interval' -> ShowS
GHC.Show.Show, GetPricesParametersQueryRecurring'Interval'
-> GetPricesParametersQueryRecurring'Interval' -> Bool
(GetPricesParametersQueryRecurring'Interval'
 -> GetPricesParametersQueryRecurring'Interval' -> Bool)
-> (GetPricesParametersQueryRecurring'Interval'
    -> GetPricesParametersQueryRecurring'Interval' -> Bool)
-> Eq GetPricesParametersQueryRecurring'Interval'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryRecurring'Interval'
-> GetPricesParametersQueryRecurring'Interval' -> Bool
$c/= :: GetPricesParametersQueryRecurring'Interval'
-> GetPricesParametersQueryRecurring'Interval' -> Bool
== :: GetPricesParametersQueryRecurring'Interval'
-> GetPricesParametersQueryRecurring'Interval' -> Bool
$c== :: GetPricesParametersQueryRecurring'Interval'
-> GetPricesParametersQueryRecurring'Interval' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryRecurring'Interval' where
  toJSON :: GetPricesParametersQueryRecurring'Interval' -> Value
toJSON (GetPricesParametersQueryRecurring'Interval'Other Value
val) = Value
val
  toJSON (GetPricesParametersQueryRecurring'Interval'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumDay) = Value
"day"
  toJSON (GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumMonth) = Value
"month"
  toJSON (GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumWeek) = Value
"week"
  toJSON (GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumYear) = Value
"year"

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryRecurring'Interval' where
  parseJSON :: Value -> Parser GetPricesParametersQueryRecurring'Interval'
parseJSON Value
val =
    GetPricesParametersQueryRecurring'Interval'
-> Parser GetPricesParametersQueryRecurring'Interval'
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
"day" -> GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumDay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumMonth
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumWeek
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"year" -> GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'EnumYear
            | Bool
GHC.Base.otherwise -> Value -> GetPricesParametersQueryRecurring'Interval'
GetPricesParametersQueryRecurring'Interval'Other Value
val
      )

-- | Defines the enum schema located at @paths.\/v1\/prices.GET.parameters.properties.queryRecurring.properties.usage_type@ in the specification.
data GetPricesParametersQueryRecurring'UsageType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    GetPricesParametersQueryRecurring'UsageType'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    GetPricesParametersQueryRecurring'UsageType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"licensed"@
    GetPricesParametersQueryRecurring'UsageType'EnumLicensed
  | -- | Represents the JSON value @"metered"@
    GetPricesParametersQueryRecurring'UsageType'EnumMetered
  deriving (Int -> GetPricesParametersQueryRecurring'UsageType' -> ShowS
[GetPricesParametersQueryRecurring'UsageType'] -> ShowS
GetPricesParametersQueryRecurring'UsageType' -> String
(Int -> GetPricesParametersQueryRecurring'UsageType' -> ShowS)
-> (GetPricesParametersQueryRecurring'UsageType' -> String)
-> ([GetPricesParametersQueryRecurring'UsageType'] -> ShowS)
-> Show GetPricesParametersQueryRecurring'UsageType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryRecurring'UsageType'] -> ShowS
$cshowList :: [GetPricesParametersQueryRecurring'UsageType'] -> ShowS
show :: GetPricesParametersQueryRecurring'UsageType' -> String
$cshow :: GetPricesParametersQueryRecurring'UsageType' -> String
showsPrec :: Int -> GetPricesParametersQueryRecurring'UsageType' -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryRecurring'UsageType' -> ShowS
GHC.Show.Show, GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'UsageType' -> Bool
(GetPricesParametersQueryRecurring'UsageType'
 -> GetPricesParametersQueryRecurring'UsageType' -> Bool)
-> (GetPricesParametersQueryRecurring'UsageType'
    -> GetPricesParametersQueryRecurring'UsageType' -> Bool)
-> Eq GetPricesParametersQueryRecurring'UsageType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'UsageType' -> Bool
$c/= :: GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'UsageType' -> Bool
== :: GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'UsageType' -> Bool
$c== :: GetPricesParametersQueryRecurring'UsageType'
-> GetPricesParametersQueryRecurring'UsageType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryRecurring'UsageType' where
  toJSON :: GetPricesParametersQueryRecurring'UsageType' -> Value
toJSON (GetPricesParametersQueryRecurring'UsageType'Other Value
val) = Value
val
  toJSON (GetPricesParametersQueryRecurring'UsageType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (GetPricesParametersQueryRecurring'UsageType'
GetPricesParametersQueryRecurring'UsageType'EnumLicensed) = Value
"licensed"
  toJSON (GetPricesParametersQueryRecurring'UsageType'
GetPricesParametersQueryRecurring'UsageType'EnumMetered) = Value
"metered"

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryRecurring'UsageType' where
  parseJSON :: Value -> Parser GetPricesParametersQueryRecurring'UsageType'
parseJSON Value
val =
    GetPricesParametersQueryRecurring'UsageType'
-> Parser GetPricesParametersQueryRecurring'UsageType'
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
"licensed" -> GetPricesParametersQueryRecurring'UsageType'
GetPricesParametersQueryRecurring'UsageType'EnumLicensed
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"metered" -> GetPricesParametersQueryRecurring'UsageType'
GetPricesParametersQueryRecurring'UsageType'EnumMetered
            | Bool
GHC.Base.otherwise -> Value -> GetPricesParametersQueryRecurring'UsageType'
GetPricesParametersQueryRecurring'UsageType'Other Value
val
      )

-- | Defines the enum schema located at @paths.\/v1\/prices.GET.parameters.properties.queryType@ in the specification.
--
-- Represents the parameter named \'type\'
--
-- Only return prices of type \`recurring\` or \`one_time\`.
data GetPricesParametersQueryType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    GetPricesParametersQueryType'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    GetPricesParametersQueryType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"one_time"@
    GetPricesParametersQueryType'EnumOneTime
  | -- | Represents the JSON value @"recurring"@
    GetPricesParametersQueryType'EnumRecurring
  deriving (Int -> GetPricesParametersQueryType' -> ShowS
[GetPricesParametersQueryType'] -> ShowS
GetPricesParametersQueryType' -> String
(Int -> GetPricesParametersQueryType' -> ShowS)
-> (GetPricesParametersQueryType' -> String)
-> ([GetPricesParametersQueryType'] -> ShowS)
-> Show GetPricesParametersQueryType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricesParametersQueryType'] -> ShowS
$cshowList :: [GetPricesParametersQueryType'] -> ShowS
show :: GetPricesParametersQueryType' -> String
$cshow :: GetPricesParametersQueryType' -> String
showsPrec :: Int -> GetPricesParametersQueryType' -> ShowS
$cshowsPrec :: Int -> GetPricesParametersQueryType' -> ShowS
GHC.Show.Show, GetPricesParametersQueryType'
-> GetPricesParametersQueryType' -> Bool
(GetPricesParametersQueryType'
 -> GetPricesParametersQueryType' -> Bool)
-> (GetPricesParametersQueryType'
    -> GetPricesParametersQueryType' -> Bool)
-> Eq GetPricesParametersQueryType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricesParametersQueryType'
-> GetPricesParametersQueryType' -> Bool
$c/= :: GetPricesParametersQueryType'
-> GetPricesParametersQueryType' -> Bool
== :: GetPricesParametersQueryType'
-> GetPricesParametersQueryType' -> Bool
$c== :: GetPricesParametersQueryType'
-> GetPricesParametersQueryType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GetPricesParametersQueryType' where
  toJSON :: GetPricesParametersQueryType' -> Value
toJSON (GetPricesParametersQueryType'Other Value
val) = Value
val
  toJSON (GetPricesParametersQueryType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (GetPricesParametersQueryType'
GetPricesParametersQueryType'EnumOneTime) = Value
"one_time"
  toJSON (GetPricesParametersQueryType'
GetPricesParametersQueryType'EnumRecurring) = Value
"recurring"

instance Data.Aeson.Types.FromJSON.FromJSON GetPricesParametersQueryType' where
  parseJSON :: Value -> Parser GetPricesParametersQueryType'
parseJSON Value
val =
    GetPricesParametersQueryType'
-> Parser GetPricesParametersQueryType'
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
"one_time" -> GetPricesParametersQueryType'
GetPricesParametersQueryType'EnumOneTime
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"recurring" -> GetPricesParametersQueryType'
GetPricesParametersQueryType'EnumRecurring
            | Bool
GHC.Base.otherwise -> Value -> GetPricesParametersQueryType'
GetPricesParametersQueryType'Other Value
val
      )

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

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

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