{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.GetCoupons 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
getCoupons ::
forall m.
StripeAPI.Common.MonadHTTP m =>
GetCouponsParameters ->
StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetCouponsResponse)
getCoupons :: GetCouponsParameters -> ClientT m (Response GetCouponsResponse)
getCoupons GetCouponsParameters
parameters =
(Response ByteString -> Response GetCouponsResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response GetCouponsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> GetCouponsResponse)
-> Response ByteString -> Response GetCouponsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> GetCouponsResponse)
-> (GetCouponsResponse -> GetCouponsResponse)
-> Either String GetCouponsResponse
-> GetCouponsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetCouponsResponse
GetCouponsResponseError GetCouponsResponse -> GetCouponsResponse
forall a. a -> a
GHC.Base.id
(Either String GetCouponsResponse -> GetCouponsResponse)
-> (ByteString -> Either String GetCouponsResponse)
-> ByteString
-> GetCouponsResponse
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) ->
GetCouponsResponseBody200 -> GetCouponsResponse
GetCouponsResponse200
(GetCouponsResponseBody200 -> GetCouponsResponse)
-> Either String GetCouponsResponseBody200
-> Either String GetCouponsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetCouponsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
GetCouponsResponseBody200
)
| 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 -> GetCouponsResponse
GetCouponsResponseDefault
(Error -> GetCouponsResponse)
-> Either String Error -> Either String GetCouponsResponse
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 GetCouponsResponse
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/coupons")
[ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"created") (GetCouponsParametersQueryCreated'Variants -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetCouponsParametersQueryCreated'Variants -> Value)
-> Maybe GetCouponsParametersQueryCreated'Variants -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetCouponsParameters
-> Maybe GetCouponsParametersQueryCreated'Variants
getCouponsParametersQueryCreated GetCouponsParameters
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.<$> GetCouponsParameters -> Maybe Text
getCouponsParametersQueryEndingBefore GetCouponsParameters
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.<$> GetCouponsParameters -> Maybe [Text]
getCouponsParametersQueryExpand GetCouponsParameters
parameters) (String -> Text
Data.Text.pack String
"deepObject") Bool
GHC.Types.True,
Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"limit") (Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Int -> Value) -> Maybe Int -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetCouponsParameters -> Maybe Int
getCouponsParametersQueryLimit GetCouponsParameters
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.<$> GetCouponsParameters -> Maybe Text
getCouponsParametersQueryStartingAfter GetCouponsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
]
)
data GetCouponsParameters = GetCouponsParameters
{
GetCouponsParameters
-> Maybe GetCouponsParametersQueryCreated'Variants
getCouponsParametersQueryCreated :: (GHC.Maybe.Maybe GetCouponsParametersQueryCreated'Variants),
GetCouponsParameters -> Maybe Text
getCouponsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
GetCouponsParameters -> Maybe [Text]
getCouponsParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
GetCouponsParameters -> Maybe Int
getCouponsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
GetCouponsParameters -> Maybe Text
getCouponsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> GetCouponsParameters -> ShowS
[GetCouponsParameters] -> ShowS
GetCouponsParameters -> String
(Int -> GetCouponsParameters -> ShowS)
-> (GetCouponsParameters -> String)
-> ([GetCouponsParameters] -> ShowS)
-> Show GetCouponsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCouponsParameters] -> ShowS
$cshowList :: [GetCouponsParameters] -> ShowS
show :: GetCouponsParameters -> String
$cshow :: GetCouponsParameters -> String
showsPrec :: Int -> GetCouponsParameters -> ShowS
$cshowsPrec :: Int -> GetCouponsParameters -> ShowS
GHC.Show.Show,
GetCouponsParameters -> GetCouponsParameters -> Bool
(GetCouponsParameters -> GetCouponsParameters -> Bool)
-> (GetCouponsParameters -> GetCouponsParameters -> Bool)
-> Eq GetCouponsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCouponsParameters -> GetCouponsParameters -> Bool
$c/= :: GetCouponsParameters -> GetCouponsParameters -> Bool
== :: GetCouponsParameters -> GetCouponsParameters -> Bool
$c== :: GetCouponsParameters -> GetCouponsParameters -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON GetCouponsParameters where
toJSON :: GetCouponsParameters -> Value
toJSON GetCouponsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryCreated" Text -> Maybe GetCouponsParametersQueryCreated'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCouponsParameters
-> Maybe GetCouponsParametersQueryCreated'Variants
getCouponsParametersQueryCreated GetCouponsParameters
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..= GetCouponsParameters -> Maybe Text
getCouponsParametersQueryEndingBefore GetCouponsParameters
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..= GetCouponsParameters -> Maybe [Text]
getCouponsParametersQueryExpand GetCouponsParameters
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..= GetCouponsParameters -> Maybe Int
getCouponsParametersQueryLimit GetCouponsParameters
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..= GetCouponsParameters -> Maybe Text
getCouponsParametersQueryStartingAfter GetCouponsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: GetCouponsParameters -> Encoding
toEncoding GetCouponsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryCreated" Text -> Maybe GetCouponsParametersQueryCreated'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCouponsParameters
-> Maybe GetCouponsParametersQueryCreated'Variants
getCouponsParametersQueryCreated GetCouponsParameters
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..= GetCouponsParameters -> Maybe Text
getCouponsParametersQueryEndingBefore GetCouponsParameters
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..= GetCouponsParameters -> Maybe [Text]
getCouponsParametersQueryExpand GetCouponsParameters
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..= GetCouponsParameters -> Maybe Int
getCouponsParametersQueryLimit GetCouponsParameters
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..= GetCouponsParameters -> Maybe Text
getCouponsParametersQueryStartingAfter GetCouponsParameters
obj)))))
instance Data.Aeson.Types.FromJSON.FromJSON GetCouponsParameters where
parseJSON :: Value -> Parser GetCouponsParameters
parseJSON = String
-> (Object -> Parser GetCouponsParameters)
-> Value
-> Parser GetCouponsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCouponsParameters" (\Object
obj -> (((((Maybe GetCouponsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCouponsParameters)
-> Parser
(Maybe GetCouponsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCouponsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe GetCouponsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCouponsParameters
GetCouponsParameters Parser
(Maybe GetCouponsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCouponsParameters)
-> Parser (Maybe GetCouponsParametersQueryCreated'Variants)
-> Parser
(Maybe Text
-> Maybe [Text] -> Maybe Int -> Maybe Text -> GetCouponsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe GetCouponsParametersQueryCreated'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCreated")) Parser
(Maybe Text
-> Maybe [Text] -> Maybe Int -> Maybe Text -> GetCouponsParameters)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text] -> Maybe Int -> Maybe Text -> GetCouponsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryEnding_before")) Parser
(Maybe [Text] -> Maybe Int -> Maybe Text -> GetCouponsParameters)
-> Parser (Maybe [Text])
-> Parser (Maybe Int -> Maybe Text -> GetCouponsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryExpand")) Parser (Maybe Int -> Maybe Text -> GetCouponsParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetCouponsParameters)
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 -> GetCouponsParameters)
-> Parser (Maybe Text) -> Parser GetCouponsParameters
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"))
mkGetCouponsParameters :: GetCouponsParameters
mkGetCouponsParameters :: GetCouponsParameters
mkGetCouponsParameters =
GetCouponsParameters :: Maybe GetCouponsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCouponsParameters
GetCouponsParameters
{ getCouponsParametersQueryCreated :: Maybe GetCouponsParametersQueryCreated'Variants
getCouponsParametersQueryCreated = Maybe GetCouponsParametersQueryCreated'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryEndingBefore :: Maybe Text
getCouponsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryExpand :: Maybe [Text]
getCouponsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryLimit :: Maybe Int
getCouponsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryStartingAfter :: Maybe Text
getCouponsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data GetCouponsParametersQueryCreated'OneOf1 = GetCouponsParametersQueryCreated'OneOf1
{
GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gt :: (GHC.Maybe.Maybe GHC.Types.Int),
GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gte :: (GHC.Maybe.Maybe GHC.Types.Int),
GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lt :: (GHC.Maybe.Maybe GHC.Types.Int),
GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lte :: (GHC.Maybe.Maybe GHC.Types.Int)
}
deriving
( Int -> GetCouponsParametersQueryCreated'OneOf1 -> ShowS
[GetCouponsParametersQueryCreated'OneOf1] -> ShowS
GetCouponsParametersQueryCreated'OneOf1 -> String
(Int -> GetCouponsParametersQueryCreated'OneOf1 -> ShowS)
-> (GetCouponsParametersQueryCreated'OneOf1 -> String)
-> ([GetCouponsParametersQueryCreated'OneOf1] -> ShowS)
-> Show GetCouponsParametersQueryCreated'OneOf1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCouponsParametersQueryCreated'OneOf1] -> ShowS
$cshowList :: [GetCouponsParametersQueryCreated'OneOf1] -> ShowS
show :: GetCouponsParametersQueryCreated'OneOf1 -> String
$cshow :: GetCouponsParametersQueryCreated'OneOf1 -> String
showsPrec :: Int -> GetCouponsParametersQueryCreated'OneOf1 -> ShowS
$cshowsPrec :: Int -> GetCouponsParametersQueryCreated'OneOf1 -> ShowS
GHC.Show.Show,
GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool
(GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool)
-> (GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool)
-> Eq GetCouponsParametersQueryCreated'OneOf1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool
$c/= :: GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool
== :: GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool
$c== :: GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'OneOf1 -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON GetCouponsParametersQueryCreated'OneOf1 where
toJSON :: GetCouponsParametersQueryCreated'OneOf1 -> Value
toJSON GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gt GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gte GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lt GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lte GetCouponsParametersQueryCreated'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: GetCouponsParametersQueryCreated'OneOf1 -> Encoding
toEncoding GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gt GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Gte GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lt GetCouponsParametersQueryCreated'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..= GetCouponsParametersQueryCreated'OneOf1 -> Maybe Int
getCouponsParametersQueryCreated'OneOf1Lte GetCouponsParametersQueryCreated'OneOf1
obj))))
instance Data.Aeson.Types.FromJSON.FromJSON GetCouponsParametersQueryCreated'OneOf1 where
parseJSON :: Value -> Parser GetCouponsParametersQueryCreated'OneOf1
parseJSON = String
-> (Object -> Parser GetCouponsParametersQueryCreated'OneOf1)
-> Value
-> Parser GetCouponsParametersQueryCreated'OneOf1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCouponsParametersQueryCreated'OneOf1" (\Object
obj -> ((((Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'OneOf1)
-> Parser
(Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'OneOf1)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'OneOf1
GetCouponsParametersQueryCreated'OneOf1 Parser
(Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'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
-> GetCouponsParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser
(Maybe Int -> Maybe Int -> GetCouponsParametersQueryCreated'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 -> GetCouponsParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> GetCouponsParametersQueryCreated'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 -> GetCouponsParametersQueryCreated'OneOf1)
-> Parser (Maybe Int)
-> Parser GetCouponsParametersQueryCreated'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"))
mkGetCouponsParametersQueryCreated'OneOf1 :: GetCouponsParametersQueryCreated'OneOf1
mkGetCouponsParametersQueryCreated'OneOf1 :: GetCouponsParametersQueryCreated'OneOf1
mkGetCouponsParametersQueryCreated'OneOf1 =
GetCouponsParametersQueryCreated'OneOf1 :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> GetCouponsParametersQueryCreated'OneOf1
GetCouponsParametersQueryCreated'OneOf1
{ getCouponsParametersQueryCreated'OneOf1Gt :: Maybe Int
getCouponsParametersQueryCreated'OneOf1Gt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryCreated'OneOf1Gte :: Maybe Int
getCouponsParametersQueryCreated'OneOf1Gte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryCreated'OneOf1Lt :: Maybe Int
getCouponsParametersQueryCreated'OneOf1Lt = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
getCouponsParametersQueryCreated'OneOf1Lte :: Maybe Int
getCouponsParametersQueryCreated'OneOf1Lte = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
}
data GetCouponsParametersQueryCreated'Variants
= GetCouponsParametersQueryCreated'GetCouponsParametersQueryCreated'OneOf1 GetCouponsParametersQueryCreated'OneOf1
| GetCouponsParametersQueryCreated'Int GHC.Types.Int
deriving (Int -> GetCouponsParametersQueryCreated'Variants -> ShowS
[GetCouponsParametersQueryCreated'Variants] -> ShowS
GetCouponsParametersQueryCreated'Variants -> String
(Int -> GetCouponsParametersQueryCreated'Variants -> ShowS)
-> (GetCouponsParametersQueryCreated'Variants -> String)
-> ([GetCouponsParametersQueryCreated'Variants] -> ShowS)
-> Show GetCouponsParametersQueryCreated'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCouponsParametersQueryCreated'Variants] -> ShowS
$cshowList :: [GetCouponsParametersQueryCreated'Variants] -> ShowS
show :: GetCouponsParametersQueryCreated'Variants -> String
$cshow :: GetCouponsParametersQueryCreated'Variants -> String
showsPrec :: Int -> GetCouponsParametersQueryCreated'Variants -> ShowS
$cshowsPrec :: Int -> GetCouponsParametersQueryCreated'Variants -> ShowS
GHC.Show.Show, GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool
(GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool)
-> (GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool)
-> Eq GetCouponsParametersQueryCreated'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool
$c/= :: GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool
== :: GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool
$c== :: GetCouponsParametersQueryCreated'Variants
-> GetCouponsParametersQueryCreated'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON GetCouponsParametersQueryCreated'Variants where
toJSON :: GetCouponsParametersQueryCreated'Variants -> Value
toJSON (GetCouponsParametersQueryCreated'GetCouponsParametersQueryCreated'OneOf1 GetCouponsParametersQueryCreated'OneOf1
a) = GetCouponsParametersQueryCreated'OneOf1 -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON GetCouponsParametersQueryCreated'OneOf1
a
toJSON (GetCouponsParametersQueryCreated'Int Int
a) = Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Int
a
instance Data.Aeson.Types.FromJSON.FromJSON GetCouponsParametersQueryCreated'Variants where
parseJSON :: Value -> Parser GetCouponsParametersQueryCreated'Variants
parseJSON Value
val = case (GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'Variants
GetCouponsParametersQueryCreated'GetCouponsParametersQueryCreated'OneOf1 (GetCouponsParametersQueryCreated'OneOf1
-> GetCouponsParametersQueryCreated'Variants)
-> Result GetCouponsParametersQueryCreated'OneOf1
-> Result GetCouponsParametersQueryCreated'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result GetCouponsParametersQueryCreated'OneOf1
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result GetCouponsParametersQueryCreated'Variants
-> Result GetCouponsParametersQueryCreated'Variants
-> Result GetCouponsParametersQueryCreated'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Int -> GetCouponsParametersQueryCreated'Variants
GetCouponsParametersQueryCreated'Int (Int -> GetCouponsParametersQueryCreated'Variants)
-> Result Int -> Result GetCouponsParametersQueryCreated'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 GetCouponsParametersQueryCreated'Variants
-> Result GetCouponsParametersQueryCreated'Variants
-> Result GetCouponsParametersQueryCreated'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result GetCouponsParametersQueryCreated'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success GetCouponsParametersQueryCreated'Variants
a -> GetCouponsParametersQueryCreated'Variants
-> Parser GetCouponsParametersQueryCreated'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure GetCouponsParametersQueryCreated'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser GetCouponsParametersQueryCreated'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data GetCouponsResponse
=
GetCouponsResponseError GHC.Base.String
|
GetCouponsResponse200 GetCouponsResponseBody200
|
GetCouponsResponseDefault Error
deriving (Int -> GetCouponsResponse -> ShowS
[GetCouponsResponse] -> ShowS
GetCouponsResponse -> String
(Int -> GetCouponsResponse -> ShowS)
-> (GetCouponsResponse -> String)
-> ([GetCouponsResponse] -> ShowS)
-> Show GetCouponsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCouponsResponse] -> ShowS
$cshowList :: [GetCouponsResponse] -> ShowS
show :: GetCouponsResponse -> String
$cshow :: GetCouponsResponse -> String
showsPrec :: Int -> GetCouponsResponse -> ShowS
$cshowsPrec :: Int -> GetCouponsResponse -> ShowS
GHC.Show.Show, GetCouponsResponse -> GetCouponsResponse -> Bool
(GetCouponsResponse -> GetCouponsResponse -> Bool)
-> (GetCouponsResponse -> GetCouponsResponse -> Bool)
-> Eq GetCouponsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCouponsResponse -> GetCouponsResponse -> Bool
$c/= :: GetCouponsResponse -> GetCouponsResponse -> Bool
== :: GetCouponsResponse -> GetCouponsResponse -> Bool
$c== :: GetCouponsResponse -> GetCouponsResponse -> Bool
GHC.Classes.Eq)
data GetCouponsResponseBody200 = GetCouponsResponseBody200
{
GetCouponsResponseBody200 -> [Coupon]
getCouponsResponseBody200Data :: ([Coupon]),
GetCouponsResponseBody200 -> Bool
getCouponsResponseBody200HasMore :: GHC.Types.Bool,
GetCouponsResponseBody200 -> Text
getCouponsResponseBody200Url :: Data.Text.Internal.Text
}
deriving
( Int -> GetCouponsResponseBody200 -> ShowS
[GetCouponsResponseBody200] -> ShowS
GetCouponsResponseBody200 -> String
(Int -> GetCouponsResponseBody200 -> ShowS)
-> (GetCouponsResponseBody200 -> String)
-> ([GetCouponsResponseBody200] -> ShowS)
-> Show GetCouponsResponseBody200
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCouponsResponseBody200] -> ShowS
$cshowList :: [GetCouponsResponseBody200] -> ShowS
show :: GetCouponsResponseBody200 -> String
$cshow :: GetCouponsResponseBody200 -> String
showsPrec :: Int -> GetCouponsResponseBody200 -> ShowS
$cshowsPrec :: Int -> GetCouponsResponseBody200 -> ShowS
GHC.Show.Show,
GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool
(GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool)
-> (GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool)
-> Eq GetCouponsResponseBody200
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool
$c/= :: GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool
== :: GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool
$c== :: GetCouponsResponseBody200 -> GetCouponsResponseBody200 -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON GetCouponsResponseBody200 where
toJSON :: GetCouponsResponseBody200 -> Value
toJSON GetCouponsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [Coupon] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCouponsResponseBody200 -> [Coupon]
getCouponsResponseBody200Data GetCouponsResponseBody200
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..= GetCouponsResponseBody200 -> Bool
getCouponsResponseBody200HasMore GetCouponsResponseBody200
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..= GetCouponsResponseBody200 -> Text
getCouponsResponseBody200Url GetCouponsResponseBody200
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 :: GetCouponsResponseBody200 -> Encoding
toEncoding GetCouponsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [Coupon] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCouponsResponseBody200 -> [Coupon]
getCouponsResponseBody200Data GetCouponsResponseBody200
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..= GetCouponsResponseBody200 -> Bool
getCouponsResponseBody200HasMore GetCouponsResponseBody200
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..= GetCouponsResponseBody200 -> Text
getCouponsResponseBody200Url GetCouponsResponseBody200
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 GetCouponsResponseBody200 where
parseJSON :: Value -> Parser GetCouponsResponseBody200
parseJSON = String
-> (Object -> Parser GetCouponsResponseBody200)
-> Value
-> Parser GetCouponsResponseBody200
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCouponsResponseBody200" (\Object
obj -> ((([Coupon] -> Bool -> Text -> GetCouponsResponseBody200)
-> Parser ([Coupon] -> Bool -> Text -> GetCouponsResponseBody200)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [Coupon] -> Bool -> Text -> GetCouponsResponseBody200
GetCouponsResponseBody200 Parser ([Coupon] -> Bool -> Text -> GetCouponsResponseBody200)
-> Parser [Coupon]
-> Parser (Bool -> Text -> GetCouponsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [Coupon]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser (Bool -> Text -> GetCouponsResponseBody200)
-> Parser Bool -> Parser (Text -> GetCouponsResponseBody200)
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 -> GetCouponsResponseBody200)
-> Parser Text -> Parser GetCouponsResponseBody200
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"))
mkGetCouponsResponseBody200 ::
[Coupon] ->
GHC.Types.Bool ->
Data.Text.Internal.Text ->
GetCouponsResponseBody200
mkGetCouponsResponseBody200 :: [Coupon] -> Bool -> Text -> GetCouponsResponseBody200
mkGetCouponsResponseBody200 [Coupon]
getCouponsResponseBody200Data Bool
getCouponsResponseBody200HasMore Text
getCouponsResponseBody200Url =
GetCouponsResponseBody200 :: [Coupon] -> Bool -> Text -> GetCouponsResponseBody200
GetCouponsResponseBody200
{ getCouponsResponseBody200Data :: [Coupon]
getCouponsResponseBody200Data = [Coupon]
getCouponsResponseBody200Data,
getCouponsResponseBody200HasMore :: Bool
getCouponsResponseBody200HasMore = Bool
getCouponsResponseBody200HasMore,
getCouponsResponseBody200Url :: Text
getCouponsResponseBody200Url = Text
getCouponsResponseBody200Url
}