{-# 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 getSkus
module StripeAPI.Operations.GetSkus 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/skus
--
-- \<p>Returns a list of your SKUs. The SKUs are returned sorted by creation date, with the most recently created SKUs appearing first.\<\/p>
getSkus ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetSkusParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetSkusResponse)
getSkus :: GetSkusParameters -> StripeT m (Response GetSkusResponse)
getSkus GetSkusParameters
parameters =
  (Response ByteString -> Response GetSkusResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetSkusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetSkusResponse)
-> Response ByteString -> Response GetSkusResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetSkusResponse)
-> (GetSkusResponse -> GetSkusResponse)
-> Either String GetSkusResponse
-> GetSkusResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetSkusResponse
GetSkusResponseError GetSkusResponse -> GetSkusResponse
forall a. a -> a
GHC.Base.id
              (Either String GetSkusResponse -> GetSkusResponse)
-> (ByteString -> Either String GetSkusResponse)
-> ByteString
-> GetSkusResponse
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) ->
                                   GetSkusResponseBody200 -> GetSkusResponse
GetSkusResponse200
                                     (GetSkusResponseBody200 -> GetSkusResponse)
-> Either String GetSkusResponseBody200
-> Either String GetSkusResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetSkusResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetSkusResponseBody200
                                                      )
                                 | 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 -> GetSkusResponse
GetSkusResponseDefault
                                     (Error -> GetSkusResponse)
-> Either String Error -> Either String GetSkusResponse
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 GetSkusResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                         )
                Response ByteString
response_0
          )
          Response ByteString
response_0
    )
    ( Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
StripeAPI.Common.doCallWithConfigurationM
        (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"GET")
        (String -> Text
Data.Text.pack String
"/v1/skus")
        [ 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.<$> GetSkusParameters -> Maybe Bool
getSkusParametersQueryActive GetSkusParameters
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
"attributes") (Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Object -> Value) -> Maybe Object -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetSkusParameters -> Maybe Object
getSkusParametersQueryAttributes GetSkusParameters
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.<$> GetSkusParameters -> Maybe Text
getSkusParametersQueryEndingBefore GetSkusParameters
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.<$> GetSkusParameters -> Maybe [Text]
getSkusParametersQueryExpand GetSkusParameters
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
"ids") ([Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ([Text] -> Value) -> Maybe [Text] -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetSkusParameters -> Maybe [Text]
getSkusParametersQueryIds GetSkusParameters
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
"in_stock") (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.<$> GetSkusParameters -> Maybe Bool
getSkusParametersQueryInStock GetSkusParameters
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.<$> GetSkusParameters -> Maybe Int
getSkusParametersQueryLimit GetSkusParameters
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
"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.<$> GetSkusParameters -> Maybe Text
getSkusParametersQueryProduct GetSkusParameters
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.<$> GetSkusParameters -> Maybe Text
getSkusParametersQueryStartingAfter GetSkusParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/skus.GET.parameters@ in the specification.
data GetSkusParameters = GetSkusParameters
  { -- | queryActive: Represents the parameter named \'active\'
    --
    -- Only return SKUs that are active or inactive (e.g., pass \`false\` to list all inactive products).
    GetSkusParameters -> Maybe Bool
getSkusParametersQueryActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | queryAttributes: Represents the parameter named \'attributes\'
    --
    -- Only return SKUs that have the specified key-value pairs in this partially constructed dictionary. Can be specified only if \`product\` is also supplied. For instance, if the associated product has attributes \`[\"color\", \"size\"]\`, passing in \`attributes[color]=red\` returns all the SKUs for this product that have \`color\` set to \`red\`.
    GetSkusParameters -> Maybe Object
getSkusParametersQueryAttributes :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | 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
    GetSkusParameters -> Maybe Text
getSkusParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetSkusParameters -> Maybe [Text]
getSkusParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryIds: Represents the parameter named \'ids\'
    --
    -- Only return SKUs with the given IDs.
    GetSkusParameters -> Maybe [Text]
getSkusParametersQueryIds :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryIn_stock: Represents the parameter named \'in_stock\'
    --
    -- Only return SKUs that are either in stock or out of stock (e.g., pass \`false\` to list all SKUs that are out of stock). If no value is provided, all SKUs are returned.
    GetSkusParameters -> Maybe Bool
getSkusParametersQueryInStock :: (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.
    GetSkusParameters -> Maybe Int
getSkusParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryProduct: Represents the parameter named \'product\'
    --
    -- The ID of the product whose SKUs will be retrieved. Must be a product with type \`good\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetSkusParameters -> Maybe Text
getSkusParametersQueryProduct :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | 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
    GetSkusParameters -> Maybe Text
getSkusParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetSkusParameters -> ShowS
[GetSkusParameters] -> ShowS
GetSkusParameters -> String
(Int -> GetSkusParameters -> ShowS)
-> (GetSkusParameters -> String)
-> ([GetSkusParameters] -> ShowS)
-> Show GetSkusParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSkusParameters] -> ShowS
$cshowList :: [GetSkusParameters] -> ShowS
show :: GetSkusParameters -> String
$cshow :: GetSkusParameters -> String
showsPrec :: Int -> GetSkusParameters -> ShowS
$cshowsPrec :: Int -> GetSkusParameters -> ShowS
GHC.Show.Show,
      GetSkusParameters -> GetSkusParameters -> Bool
(GetSkusParameters -> GetSkusParameters -> Bool)
-> (GetSkusParameters -> GetSkusParameters -> Bool)
-> Eq GetSkusParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSkusParameters -> GetSkusParameters -> Bool
$c/= :: GetSkusParameters -> GetSkusParameters -> Bool
== :: GetSkusParameters -> GetSkusParameters -> Bool
$c== :: GetSkusParameters -> GetSkusParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetSkusParameters where
  toJSON :: GetSkusParameters -> Value
toJSON GetSkusParameters
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..= GetSkusParameters -> Maybe Bool
getSkusParametersQueryActive GetSkusParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryAttributes" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe Object
getSkusParametersQueryAttributes GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryEndingBefore GetSkusParameters
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..= GetSkusParameters -> Maybe [Text]
getSkusParametersQueryExpand GetSkusParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryIds" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe [Text]
getSkusParametersQueryIds GetSkusParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryIn_stock" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe Bool
getSkusParametersQueryInStock GetSkusParameters
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..= GetSkusParameters -> Maybe Int
getSkusParametersQueryLimit GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryProduct GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryStartingAfter GetSkusParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetSkusParameters -> Encoding
toEncoding GetSkusParameters
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..= GetSkusParameters -> Maybe Bool
getSkusParametersQueryActive GetSkusParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryAttributes" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe Object
getSkusParametersQueryAttributes GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryEndingBefore GetSkusParameters
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..= GetSkusParameters -> Maybe [Text]
getSkusParametersQueryExpand GetSkusParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryIds" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe [Text]
getSkusParametersQueryIds GetSkusParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryIn_stock" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSkusParameters -> Maybe Bool
getSkusParametersQueryInStock GetSkusParameters
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..= GetSkusParameters -> Maybe Int
getSkusParametersQueryLimit GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryProduct GetSkusParameters
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..= GetSkusParameters -> Maybe Text
getSkusParametersQueryStartingAfter GetSkusParameters
obj)))))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetSkusParameters where
  parseJSON :: Value -> Parser GetSkusParameters
parseJSON = String
-> (Object -> Parser GetSkusParameters)
-> Value
-> Parser GetSkusParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetSkusParameters" (\Object
obj -> (((((((((Maybe Bool
 -> Maybe Object
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> GetSkusParameters)
-> Parser
     (Maybe Bool
      -> Maybe Object
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetSkusParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Object
-> Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> GetSkusParameters
GetSkusParameters Parser
  (Maybe Bool
   -> Maybe Object
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetSkusParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Object
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetSkusParameters)
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 Object
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetSkusParameters)
-> Parser (Maybe Object)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetSkusParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryAttributes")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetSkusParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetSkusParameters)
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 [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetSkusParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetSkusParameters)
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 [Text]
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetSkusParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe Int -> Maybe Text -> Maybe Text -> GetSkusParameters)
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
"queryIds")) Parser
  (Maybe Bool
   -> Maybe Int -> Maybe Text -> Maybe Text -> GetSkusParameters)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Int -> Maybe Text -> Maybe Text -> GetSkusParameters)
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
"queryIn_stock")) Parser (Maybe Int -> Maybe Text -> Maybe Text -> GetSkusParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> GetSkusParameters)
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 -> GetSkusParameters)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GetSkusParameters)
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 Text -> GetSkusParameters)
-> Parser (Maybe Text) -> Parser GetSkusParameters
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 'GetSkusParameters' with all required fields.
mkGetSkusParameters :: GetSkusParameters
mkGetSkusParameters :: GetSkusParameters
mkGetSkusParameters =
  GetSkusParameters :: Maybe Bool
-> Maybe Object
-> Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> GetSkusParameters
GetSkusParameters
    { getSkusParametersQueryActive :: Maybe Bool
getSkusParametersQueryActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryAttributes :: Maybe Object
getSkusParametersQueryAttributes = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryEndingBefore :: Maybe Text
getSkusParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryExpand :: Maybe [Text]
getSkusParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryIds :: Maybe [Text]
getSkusParametersQueryIds = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryInStock :: Maybe Bool
getSkusParametersQueryInStock = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryLimit :: Maybe Int
getSkusParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryProduct :: Maybe Text
getSkusParametersQueryProduct = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getSkusParametersQueryStartingAfter :: Maybe Text
getSkusParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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