{-# 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 getTaxRates
module StripeAPI.Operations.GetTaxRates 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/tax_rates
--
-- \<p>Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first.\<\/p>
getTaxRates ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetTaxRatesParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetTaxRatesResponse)
getTaxRates :: GetTaxRatesParameters -> ClientT m (Response GetTaxRatesResponse)
getTaxRates GetTaxRatesParameters
parameters =
  (Response ByteString -> Response GetTaxRatesResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response GetTaxRatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetTaxRatesResponse)
-> Response ByteString -> Response GetTaxRatesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetTaxRatesResponse)
-> (GetTaxRatesResponse -> GetTaxRatesResponse)
-> Either String GetTaxRatesResponse
-> GetTaxRatesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetTaxRatesResponse
GetTaxRatesResponseError GetTaxRatesResponse -> GetTaxRatesResponse
forall a. a -> a
GHC.Base.id
              (Either String GetTaxRatesResponse -> GetTaxRatesResponse)
-> (ByteString -> Either String GetTaxRatesResponse)
-> ByteString
-> GetTaxRatesResponse
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) ->
                                   GetTaxRatesResponseBody200 -> GetTaxRatesResponse
GetTaxRatesResponse200
                                     (GetTaxRatesResponseBody200 -> GetTaxRatesResponse)
-> Either String GetTaxRatesResponseBody200
-> Either String GetTaxRatesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetTaxRatesResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetTaxRatesResponseBody200
                                                      )
                                 | 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 -> GetTaxRatesResponse
GetTaxRatesResponseDefault
                                     (Error -> GetTaxRatesResponse)
-> Either String Error -> Either String GetTaxRatesResponse
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 GetTaxRatesResponse
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/tax_rates")
        [ 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.<$> GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryActive GetTaxRatesParameters
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") (GetTaxRatesParametersQueryCreated'Variants -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetTaxRatesParametersQueryCreated'Variants -> Value)
-> Maybe GetTaxRatesParametersQueryCreated'Variants -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetTaxRatesParameters
-> Maybe GetTaxRatesParametersQueryCreated'Variants
getTaxRatesParametersQueryCreated GetTaxRatesParameters
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
"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.<$> GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryEndingBefore GetTaxRatesParameters
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.<$> GetTaxRatesParameters -> Maybe [Text]
getTaxRatesParametersQueryExpand GetTaxRatesParameters
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
"inclusive") (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.<$> GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryInclusive GetTaxRatesParameters
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.<$> GetTaxRatesParameters -> Maybe Int
getTaxRatesParametersQueryLimit GetTaxRatesParameters
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.<$> GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryStartingAfter GetTaxRatesParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/tax_rates.GET.parameters@ in the specification.
data GetTaxRatesParameters = GetTaxRatesParameters
  { -- | queryActive: Represents the parameter named \'active\'
    --
    -- Optional flag to filter by tax rates that are either active or inactive (archived).
    GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | queryCreated: Represents the parameter named \'created\'
    --
    -- Optional range for filtering created date.
    GetTaxRatesParameters
-> Maybe GetTaxRatesParametersQueryCreated'Variants
getTaxRatesParametersQueryCreated :: (GHC.Maybe.Maybe GetTaxRatesParametersQueryCreated'Variants),
    -- | 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
    GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetTaxRatesParameters -> Maybe [Text]
getTaxRatesParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryInclusive: Represents the parameter named \'inclusive\'
    --
    -- Optional flag to filter by tax rates that are inclusive (or those that are not inclusive).
    GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryInclusive :: (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.
    GetTaxRatesParameters -> Maybe Int
getTaxRatesParametersQueryLimit :: (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
    GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetTaxRatesParameters -> ShowS
[GetTaxRatesParameters] -> ShowS
GetTaxRatesParameters -> String
(Int -> GetTaxRatesParameters -> ShowS)
-> (GetTaxRatesParameters -> String)
-> ([GetTaxRatesParameters] -> ShowS)
-> Show GetTaxRatesParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTaxRatesParameters] -> ShowS
$cshowList :: [GetTaxRatesParameters] -> ShowS
show :: GetTaxRatesParameters -> String
$cshow :: GetTaxRatesParameters -> String
showsPrec :: Int -> GetTaxRatesParameters -> ShowS
$cshowsPrec :: Int -> GetTaxRatesParameters -> ShowS
GHC.Show.Show,
      GetTaxRatesParameters -> GetTaxRatesParameters -> Bool
(GetTaxRatesParameters -> GetTaxRatesParameters -> Bool)
-> (GetTaxRatesParameters -> GetTaxRatesParameters -> Bool)
-> Eq GetTaxRatesParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTaxRatesParameters -> GetTaxRatesParameters -> Bool
$c/= :: GetTaxRatesParameters -> GetTaxRatesParameters -> Bool
== :: GetTaxRatesParameters -> GetTaxRatesParameters -> Bool
$c== :: GetTaxRatesParameters -> GetTaxRatesParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetTaxRatesParameters where
  toJSON :: GetTaxRatesParameters -> Value
toJSON GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryActive GetTaxRatesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryCreated" Text -> Maybe GetTaxRatesParametersQueryCreated'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTaxRatesParameters
-> Maybe GetTaxRatesParametersQueryCreated'Variants
getTaxRatesParametersQueryCreated GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryEndingBefore GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe [Text]
getTaxRatesParametersQueryExpand GetTaxRatesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryInclusive" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryInclusive GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Int
getTaxRatesParametersQueryLimit GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryStartingAfter GetTaxRatesParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetTaxRatesParameters -> Encoding
toEncoding GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryActive GetTaxRatesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryCreated" Text -> Maybe GetTaxRatesParametersQueryCreated'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTaxRatesParameters
-> Maybe GetTaxRatesParametersQueryCreated'Variants
getTaxRatesParametersQueryCreated GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryEndingBefore GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe [Text]
getTaxRatesParametersQueryExpand GetTaxRatesParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryInclusive" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTaxRatesParameters -> Maybe Bool
getTaxRatesParametersQueryInclusive GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Int
getTaxRatesParametersQueryLimit GetTaxRatesParameters
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..= GetTaxRatesParameters -> Maybe Text
getTaxRatesParametersQueryStartingAfter GetTaxRatesParameters
obj)))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetTaxRatesParameters where
  parseJSON :: Value -> Parser GetTaxRatesParameters
parseJSON = String
-> (Object -> Parser GetTaxRatesParameters)
-> Value
-> Parser GetTaxRatesParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetTaxRatesParameters" (\Object
obj -> (((((((Maybe Bool
 -> Maybe GetTaxRatesParametersQueryCreated'Variants
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Text
 -> GetTaxRatesParameters)
-> Parser
     (Maybe Bool
      -> Maybe GetTaxRatesParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetTaxRatesParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe GetTaxRatesParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> GetTaxRatesParameters
GetTaxRatesParameters Parser
  (Maybe Bool
   -> Maybe GetTaxRatesParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetTaxRatesParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe GetTaxRatesParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetTaxRatesParameters)
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 GetTaxRatesParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetTaxRatesParameters)
-> Parser (Maybe GetTaxRatesParametersQueryCreated'Variants)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> GetTaxRatesParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe GetTaxRatesParametersQueryCreated'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCreated")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> GetTaxRatesParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Bool -> Maybe Int -> Maybe Text -> GetTaxRatesParameters)
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 -> GetTaxRatesParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool -> Maybe Int -> Maybe Text -> GetTaxRatesParameters)
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 -> GetTaxRatesParameters)
-> Parser (Maybe Bool)
-> Parser (Maybe Int -> Maybe Text -> GetTaxRatesParameters)
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
"queryInclusive")) Parser (Maybe Int -> Maybe Text -> GetTaxRatesParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetTaxRatesParameters)
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 -> GetTaxRatesParameters)
-> Parser (Maybe Text) -> Parser GetTaxRatesParameters
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 'GetTaxRatesParameters' with all required fields.
mkGetTaxRatesParameters :: GetTaxRatesParameters
mkGetTaxRatesParameters :: GetTaxRatesParameters
mkGetTaxRatesParameters =
  GetTaxRatesParameters :: Maybe Bool
-> Maybe GetTaxRatesParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> GetTaxRatesParameters
GetTaxRatesParameters
    { getTaxRatesParametersQueryActive :: Maybe Bool
getTaxRatesParametersQueryActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryCreated :: Maybe GetTaxRatesParametersQueryCreated'Variants
getTaxRatesParametersQueryCreated = Maybe GetTaxRatesParametersQueryCreated'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryEndingBefore :: Maybe Text
getTaxRatesParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryExpand :: Maybe [Text]
getTaxRatesParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryInclusive :: Maybe Bool
getTaxRatesParametersQueryInclusive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryLimit :: Maybe Int
getTaxRatesParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryStartingAfter :: Maybe Text
getTaxRatesParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

instance Data.Aeson.Types.ToJSON.ToJSON GetTaxRatesParametersQueryCreated'OneOf1 where
  toJSON :: GetTaxRatesParametersQueryCreated'OneOf1 -> Value
toJSON GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gt GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gte GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lt GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lte GetTaxRatesParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetTaxRatesParametersQueryCreated'OneOf1 -> Encoding
toEncoding GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gt GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gte GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lt GetTaxRatesParametersQueryCreated'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..= GetTaxRatesParametersQueryCreated'OneOf1 -> Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lte GetTaxRatesParametersQueryCreated'OneOf1
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GetTaxRatesParametersQueryCreated'OneOf1 where
  parseJSON :: Value -> Parser GetTaxRatesParametersQueryCreated'OneOf1
parseJSON = String
-> (Object -> Parser GetTaxRatesParametersQueryCreated'OneOf1)
-> Value
-> Parser GetTaxRatesParametersQueryCreated'OneOf1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetTaxRatesParametersQueryCreated'OneOf1" (\Object
obj -> ((((Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> GetTaxRatesParametersQueryCreated'OneOf1)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> GetTaxRatesParametersQueryCreated'OneOf1)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetTaxRatesParametersQueryCreated'OneOf1
GetTaxRatesParametersQueryCreated'OneOf1 Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> GetTaxRatesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> GetTaxRatesParametersQueryCreated'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
   -> GetTaxRatesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int -> GetTaxRatesParametersQueryCreated'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 -> GetTaxRatesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> GetTaxRatesParametersQueryCreated'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 -> GetTaxRatesParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser GetTaxRatesParametersQueryCreated'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 'GetTaxRatesParametersQueryCreated'OneOf1' with all required fields.
mkGetTaxRatesParametersQueryCreated'OneOf1 :: GetTaxRatesParametersQueryCreated'OneOf1
mkGetTaxRatesParametersQueryCreated'OneOf1 :: GetTaxRatesParametersQueryCreated'OneOf1
mkGetTaxRatesParametersQueryCreated'OneOf1 =
  GetTaxRatesParametersQueryCreated'OneOf1 :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetTaxRatesParametersQueryCreated'OneOf1
GetTaxRatesParametersQueryCreated'OneOf1
    { getTaxRatesParametersQueryCreated'OneOf1Gt :: Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryCreated'OneOf1Gte :: Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Gte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryCreated'OneOf1Lt :: Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getTaxRatesParametersQueryCreated'OneOf1Lte :: Maybe Int
getTaxRatesParametersQueryCreated'OneOf1Lte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @paths.\/v1\/tax_rates.GET.parameters.properties.queryCreated.anyOf@ in the specification.
--
-- Represents the parameter named \'created\'
--
-- Optional range for filtering created date.
data GetTaxRatesParametersQueryCreated'Variants
  = GetTaxRatesParametersQueryCreated'GetTaxRatesParametersQueryCreated'OneOf1 GetTaxRatesParametersQueryCreated'OneOf1
  | GetTaxRatesParametersQueryCreated'Int GHC.Types.Int
  deriving (Int -> GetTaxRatesParametersQueryCreated'Variants -> ShowS
[GetTaxRatesParametersQueryCreated'Variants] -> ShowS
GetTaxRatesParametersQueryCreated'Variants -> String
(Int -> GetTaxRatesParametersQueryCreated'Variants -> ShowS)
-> (GetTaxRatesParametersQueryCreated'Variants -> String)
-> ([GetTaxRatesParametersQueryCreated'Variants] -> ShowS)
-> Show GetTaxRatesParametersQueryCreated'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTaxRatesParametersQueryCreated'Variants] -> ShowS
$cshowList :: [GetTaxRatesParametersQueryCreated'Variants] -> ShowS
show :: GetTaxRatesParametersQueryCreated'Variants -> String
$cshow :: GetTaxRatesParametersQueryCreated'Variants -> String
showsPrec :: Int -> GetTaxRatesParametersQueryCreated'Variants -> ShowS
$cshowsPrec :: Int -> GetTaxRatesParametersQueryCreated'Variants -> ShowS
GHC.Show.Show, GetTaxRatesParametersQueryCreated'Variants
-> GetTaxRatesParametersQueryCreated'Variants -> Bool
(GetTaxRatesParametersQueryCreated'Variants
 -> GetTaxRatesParametersQueryCreated'Variants -> Bool)
-> (GetTaxRatesParametersQueryCreated'Variants
    -> GetTaxRatesParametersQueryCreated'Variants -> Bool)
-> Eq GetTaxRatesParametersQueryCreated'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTaxRatesParametersQueryCreated'Variants
-> GetTaxRatesParametersQueryCreated'Variants -> Bool
$c/= :: GetTaxRatesParametersQueryCreated'Variants
-> GetTaxRatesParametersQueryCreated'Variants -> Bool
== :: GetTaxRatesParametersQueryCreated'Variants
-> GetTaxRatesParametersQueryCreated'Variants -> Bool
$c== :: GetTaxRatesParametersQueryCreated'Variants
-> GetTaxRatesParametersQueryCreated'Variants -> Bool
GHC.Classes.Eq)

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

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

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

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

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