{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostProducts 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
postProducts ::
forall m.
StripeAPI.Common.MonadHTTP m =>
PostProductsRequestBody ->
StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostProductsResponse)
postProducts :: PostProductsRequestBody
-> StripeT m (Response PostProductsResponse)
postProducts PostProductsRequestBody
body =
(Response ByteString -> Response PostProductsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostProductsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostProductsResponse)
-> Response ByteString -> Response PostProductsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostProductsResponse)
-> (PostProductsResponse -> PostProductsResponse)
-> Either String PostProductsResponse
-> PostProductsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostProductsResponse
PostProductsResponseError PostProductsResponse -> PostProductsResponse
forall a. a -> a
GHC.Base.id
(Either String PostProductsResponse -> PostProductsResponse)
-> (ByteString -> Either String PostProductsResponse)
-> ByteString
-> PostProductsResponse
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) ->
Product -> PostProductsResponse
PostProductsResponse200
(Product -> PostProductsResponse)
-> Either String Product -> Either String PostProductsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Product
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
Product
)
| 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 -> PostProductsResponse
PostProductsResponseDefault
(Error -> PostProductsResponse)
-> Either String Error -> Either String PostProductsResponse
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 PostProductsResponse
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]
-> Maybe PostProductsRequestBody
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack String
"/v1/products") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty (PostProductsRequestBody -> Maybe PostProductsRequestBody
forall a. a -> Maybe a
GHC.Maybe.Just PostProductsRequestBody
body) RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostProductsRequestBody = PostProductsRequestBody
{
PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyId :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyImages :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostProductsRequestBody -> Maybe Object
postProductsRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
PostProductsRequestBody -> Text
postProductsRequestBodyName :: Data.Text.Internal.Text,
PostProductsRequestBody
-> Maybe PostProductsRequestBodyPackageDimensions'
postProductsRequestBodyPackageDimensions :: (GHC.Maybe.Maybe PostProductsRequestBodyPackageDimensions'),
PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyShippable :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyTaxCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUnitLabel :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUrl :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> PostProductsRequestBody -> ShowS
[PostProductsRequestBody] -> ShowS
PostProductsRequestBody -> String
(Int -> PostProductsRequestBody -> ShowS)
-> (PostProductsRequestBody -> String)
-> ([PostProductsRequestBody] -> ShowS)
-> Show PostProductsRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostProductsRequestBody] -> ShowS
$cshowList :: [PostProductsRequestBody] -> ShowS
show :: PostProductsRequestBody -> String
$cshow :: PostProductsRequestBody -> String
showsPrec :: Int -> PostProductsRequestBody -> ShowS
$cshowsPrec :: Int -> PostProductsRequestBody -> ShowS
GHC.Show.Show,
PostProductsRequestBody -> PostProductsRequestBody -> Bool
(PostProductsRequestBody -> PostProductsRequestBody -> Bool)
-> (PostProductsRequestBody -> PostProductsRequestBody -> Bool)
-> Eq PostProductsRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostProductsRequestBody -> PostProductsRequestBody -> Bool
$c/= :: PostProductsRequestBody -> PostProductsRequestBody -> Bool
== :: PostProductsRequestBody -> PostProductsRequestBody -> Bool
$c== :: PostProductsRequestBody -> PostProductsRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostProductsRequestBody where
toJSON :: PostProductsRequestBody -> Value
toJSON PostProductsRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"active" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyActive PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyDescription PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyExpand PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyId PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"images" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyImages PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Object
postProductsRequestBodyMetadata PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Text
postProductsRequestBodyName PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"package_dimensions" Text -> Maybe PostProductsRequestBodyPackageDimensions' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody
-> Maybe PostProductsRequestBodyPackageDimensions'
postProductsRequestBodyPackageDimensions PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"shippable" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyShippable PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyStatementDescriptor PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_code" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyTaxCode PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_label" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUnitLabel PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUrl PostProductsRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostProductsRequestBody -> Encoding
toEncoding PostProductsRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"active" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyActive PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyDescription PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyExpand PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyId PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"images" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe [Text]
postProductsRequestBodyImages PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Object
postProductsRequestBodyMetadata PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"name" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Text
postProductsRequestBodyName PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"package_dimensions" Text -> Maybe PostProductsRequestBodyPackageDimensions' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody
-> Maybe PostProductsRequestBodyPackageDimensions'
postProductsRequestBodyPackageDimensions PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"shippable" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Bool
postProductsRequestBodyShippable PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyStatementDescriptor PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_code" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyTaxCode PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_label" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUnitLabel PostProductsRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"url" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBody -> Maybe Text
postProductsRequestBodyUrl PostProductsRequestBody
obj)))))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostProductsRequestBody where
parseJSON :: Value -> Parser PostProductsRequestBody
parseJSON = String
-> (Object -> Parser PostProductsRequestBody)
-> Value
-> Parser PostProductsRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostProductsRequestBody" (\Object
obj -> (((((((((((((Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody
PostProductsRequestBody Parser
(Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"active")) Parser
(Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"description")) Parser
(Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"expand")) Parser
(Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"id")) Parser
(Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"images")) Parser
(Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Object)
-> Parser
(Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"metadata")) Parser
(Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser Text
-> Parser
(Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"name")) Parser
(Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe PostProductsRequestBodyPackageDimensions')
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostProductsRequestBodyPackageDimensions')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"package_dimensions")) Parser
(Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
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
"shippable")) Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> PostProductsRequestBody)
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
"statement_descriptor")) Parser
(Maybe Text -> Maybe Text -> Maybe Text -> PostProductsRequestBody)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> PostProductsRequestBody)
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
"tax_code")) Parser (Maybe Text -> Maybe Text -> PostProductsRequestBody)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PostProductsRequestBody)
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
"unit_label")) Parser (Maybe Text -> PostProductsRequestBody)
-> Parser (Maybe Text) -> Parser PostProductsRequestBody
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
"url"))
mkPostProductsRequestBody ::
Data.Text.Internal.Text ->
PostProductsRequestBody
mkPostProductsRequestBody :: Text -> PostProductsRequestBody
mkPostProductsRequestBody Text
postProductsRequestBodyName =
PostProductsRequestBody :: Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Object
-> Text
-> Maybe PostProductsRequestBodyPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostProductsRequestBody
PostProductsRequestBody
{ postProductsRequestBodyActive :: Maybe Bool
postProductsRequestBodyActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyDescription :: Maybe Text
postProductsRequestBodyDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyExpand :: Maybe [Text]
postProductsRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyId :: Maybe Text
postProductsRequestBodyId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyImages :: Maybe [Text]
postProductsRequestBodyImages = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyMetadata :: Maybe Object
postProductsRequestBodyMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyName :: Text
postProductsRequestBodyName = Text
postProductsRequestBodyName,
postProductsRequestBodyPackageDimensions :: Maybe PostProductsRequestBodyPackageDimensions'
postProductsRequestBodyPackageDimensions = Maybe PostProductsRequestBodyPackageDimensions'
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyShippable :: Maybe Bool
postProductsRequestBodyShippable = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyStatementDescriptor :: Maybe Text
postProductsRequestBodyStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyTaxCode :: Maybe Text
postProductsRequestBodyTaxCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyUnitLabel :: Maybe Text
postProductsRequestBodyUnitLabel = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postProductsRequestBodyUrl :: Maybe Text
postProductsRequestBodyUrl = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostProductsRequestBodyPackageDimensions' = PostProductsRequestBodyPackageDimensions'
{
PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Height :: GHC.Types.Double,
PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Length :: GHC.Types.Double,
PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Weight :: GHC.Types.Double,
PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Width :: GHC.Types.Double
}
deriving
( Int -> PostProductsRequestBodyPackageDimensions' -> ShowS
[PostProductsRequestBodyPackageDimensions'] -> ShowS
PostProductsRequestBodyPackageDimensions' -> String
(Int -> PostProductsRequestBodyPackageDimensions' -> ShowS)
-> (PostProductsRequestBodyPackageDimensions' -> String)
-> ([PostProductsRequestBodyPackageDimensions'] -> ShowS)
-> Show PostProductsRequestBodyPackageDimensions'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostProductsRequestBodyPackageDimensions'] -> ShowS
$cshowList :: [PostProductsRequestBodyPackageDimensions'] -> ShowS
show :: PostProductsRequestBodyPackageDimensions' -> String
$cshow :: PostProductsRequestBodyPackageDimensions' -> String
showsPrec :: Int -> PostProductsRequestBodyPackageDimensions' -> ShowS
$cshowsPrec :: Int -> PostProductsRequestBodyPackageDimensions' -> ShowS
GHC.Show.Show,
PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool
(PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool)
-> (PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool)
-> Eq PostProductsRequestBodyPackageDimensions'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool
$c/= :: PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool
== :: PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool
$c== :: PostProductsRequestBodyPackageDimensions'
-> PostProductsRequestBodyPackageDimensions' -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostProductsRequestBodyPackageDimensions' where
toJSON :: PostProductsRequestBodyPackageDimensions' -> Value
toJSON PostProductsRequestBodyPackageDimensions'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"height" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Height PostProductsRequestBodyPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"length" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Length PostProductsRequestBodyPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"weight" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Weight PostProductsRequestBodyPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"width" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Width PostProductsRequestBodyPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostProductsRequestBodyPackageDimensions' -> Encoding
toEncoding PostProductsRequestBodyPackageDimensions'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"height" Text -> Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Height PostProductsRequestBodyPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"length" Text -> Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Length PostProductsRequestBodyPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"weight" Text -> Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Weight PostProductsRequestBodyPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"width" Text -> Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostProductsRequestBodyPackageDimensions' -> Double
postProductsRequestBodyPackageDimensions'Width PostProductsRequestBodyPackageDimensions'
obj))))
instance Data.Aeson.Types.FromJSON.FromJSON PostProductsRequestBodyPackageDimensions' where
parseJSON :: Value -> Parser PostProductsRequestBodyPackageDimensions'
parseJSON = String
-> (Object -> Parser PostProductsRequestBodyPackageDimensions')
-> Value
-> Parser PostProductsRequestBodyPackageDimensions'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostProductsRequestBodyPackageDimensions'" (\Object
obj -> ((((Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions')
-> Parser
(Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions'
PostProductsRequestBodyPackageDimensions' Parser
(Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions')
-> Parser Double
-> Parser
(Double
-> Double -> Double -> PostProductsRequestBodyPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"height")) Parser
(Double
-> Double -> Double -> PostProductsRequestBodyPackageDimensions')
-> Parser Double
-> Parser
(Double -> Double -> PostProductsRequestBodyPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"length")) Parser
(Double -> Double -> PostProductsRequestBodyPackageDimensions')
-> Parser Double
-> Parser (Double -> PostProductsRequestBodyPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"weight")) Parser (Double -> PostProductsRequestBodyPackageDimensions')
-> Parser Double
-> Parser PostProductsRequestBodyPackageDimensions'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"width"))
mkPostProductsRequestBodyPackageDimensions' ::
GHC.Types.Double ->
GHC.Types.Double ->
GHC.Types.Double ->
GHC.Types.Double ->
PostProductsRequestBodyPackageDimensions'
mkPostProductsRequestBodyPackageDimensions' :: Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions'
mkPostProductsRequestBodyPackageDimensions' Double
postProductsRequestBodyPackageDimensions'Height Double
postProductsRequestBodyPackageDimensions'Length Double
postProductsRequestBodyPackageDimensions'Weight Double
postProductsRequestBodyPackageDimensions'Width =
PostProductsRequestBodyPackageDimensions' :: Double
-> Double
-> Double
-> Double
-> PostProductsRequestBodyPackageDimensions'
PostProductsRequestBodyPackageDimensions'
{ postProductsRequestBodyPackageDimensions'Height :: Double
postProductsRequestBodyPackageDimensions'Height = Double
postProductsRequestBodyPackageDimensions'Height,
postProductsRequestBodyPackageDimensions'Length :: Double
postProductsRequestBodyPackageDimensions'Length = Double
postProductsRequestBodyPackageDimensions'Length,
postProductsRequestBodyPackageDimensions'Weight :: Double
postProductsRequestBodyPackageDimensions'Weight = Double
postProductsRequestBodyPackageDimensions'Weight,
postProductsRequestBodyPackageDimensions'Width :: Double
postProductsRequestBodyPackageDimensions'Width = Double
postProductsRequestBodyPackageDimensions'Width
}
data PostProductsResponse
=
PostProductsResponseError GHC.Base.String
|
PostProductsResponse200 Product
|
PostProductsResponseDefault Error
deriving (Int -> PostProductsResponse -> ShowS
[PostProductsResponse] -> ShowS
PostProductsResponse -> String
(Int -> PostProductsResponse -> ShowS)
-> (PostProductsResponse -> String)
-> ([PostProductsResponse] -> ShowS)
-> Show PostProductsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostProductsResponse] -> ShowS
$cshowList :: [PostProductsResponse] -> ShowS
show :: PostProductsResponse -> String
$cshow :: PostProductsResponse -> String
showsPrec :: Int -> PostProductsResponse -> ShowS
$cshowsPrec :: Int -> PostProductsResponse -> ShowS
GHC.Show.Show, PostProductsResponse -> PostProductsResponse -> Bool
(PostProductsResponse -> PostProductsResponse -> Bool)
-> (PostProductsResponse -> PostProductsResponse -> Bool)
-> Eq PostProductsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostProductsResponse -> PostProductsResponse -> Bool
$c/= :: PostProductsResponse -> PostProductsResponse -> Bool
== :: PostProductsResponse -> PostProductsResponse -> Bool
$c== :: PostProductsResponse -> PostProductsResponse -> Bool
GHC.Classes.Eq)