{-# 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 getCustomers
module StripeAPI.Operations.GetCustomers 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/customers
--
-- \<p>Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.\<\/p>
getCustomers ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetCustomersParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetCustomersResponse)
getCustomers :: GetCustomersParameters -> StripeT m (Response GetCustomersResponse)
getCustomers GetCustomersParameters
parameters =
  (Response ByteString -> Response GetCustomersResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetCustomersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetCustomersResponse)
-> Response ByteString -> Response GetCustomersResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetCustomersResponse)
-> (GetCustomersResponse -> GetCustomersResponse)
-> Either String GetCustomersResponse
-> GetCustomersResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetCustomersResponse
GetCustomersResponseError GetCustomersResponse -> GetCustomersResponse
forall a. a -> a
GHC.Base.id
              (Either String GetCustomersResponse -> GetCustomersResponse)
-> (ByteString -> Either String GetCustomersResponse)
-> ByteString
-> GetCustomersResponse
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) ->
                                   GetCustomersResponseBody200 -> GetCustomersResponse
GetCustomersResponse200
                                     (GetCustomersResponseBody200 -> GetCustomersResponse)
-> Either String GetCustomersResponseBody200
-> Either String GetCustomersResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetCustomersResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetCustomersResponseBody200
                                                      )
                                 | 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 -> GetCustomersResponse
GetCustomersResponseDefault
                                     (Error -> GetCustomersResponse)
-> Either String Error -> Either String GetCustomersResponse
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 GetCustomersResponse
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/customers")
        [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"created") (GetCustomersParametersQueryCreated'Variants -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetCustomersParametersQueryCreated'Variants -> Value)
-> Maybe GetCustomersParametersQueryCreated'Variants -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetCustomersParameters
-> Maybe GetCustomersParametersQueryCreated'Variants
getCustomersParametersQueryCreated GetCustomersParameters
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
"email") (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.<$> GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEmail GetCustomersParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"ending_before") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEndingBefore GetCustomersParameters
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.<$> GetCustomersParameters -> Maybe [Text]
getCustomersParametersQueryExpand GetCustomersParameters
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.<$> GetCustomersParameters -> Maybe Int
getCustomersParametersQueryLimit GetCustomersParameters
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.<$> GetCustomersParameters -> Maybe Text
getCustomersParametersQueryStartingAfter GetCustomersParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/customers.GET.parameters@ in the specification.
data GetCustomersParameters = GetCustomersParameters
  { -- | queryCreated: Represents the parameter named \'created\'
    GetCustomersParameters
-> Maybe GetCustomersParametersQueryCreated'Variants
getCustomersParametersQueryCreated :: (GHC.Maybe.Maybe GetCustomersParametersQueryCreated'Variants),
    -- | queryEmail: Represents the parameter named \'email\'
    --
    -- A case-sensitive filter on the list based on the customer\'s \`email\` field. The value must be a string.
    --
    -- Constraints:
    --
    -- * Maximum length of 512
    GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEmail :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetCustomersParameters -> Maybe [Text]
getCustomersParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryLimit: Represents the parameter named \'limit\'
    --
    -- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
    GetCustomersParameters -> Maybe Int
getCustomersParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryStarting_after: Represents the parameter named \'starting_after\'
    --
    -- A cursor for use in pagination. \`starting_after\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with \`obj_foo\`, your subsequent call can include \`starting_after=obj_foo\` in order to fetch the next page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetCustomersParameters -> Maybe Text
getCustomersParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetCustomersParameters -> ShowS
[GetCustomersParameters] -> ShowS
GetCustomersParameters -> String
(Int -> GetCustomersParameters -> ShowS)
-> (GetCustomersParameters -> String)
-> ([GetCustomersParameters] -> ShowS)
-> Show GetCustomersParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCustomersParameters] -> ShowS
$cshowList :: [GetCustomersParameters] -> ShowS
show :: GetCustomersParameters -> String
$cshow :: GetCustomersParameters -> String
showsPrec :: Int -> GetCustomersParameters -> ShowS
$cshowsPrec :: Int -> GetCustomersParameters -> ShowS
GHC.Show.Show,
      GetCustomersParameters -> GetCustomersParameters -> Bool
(GetCustomersParameters -> GetCustomersParameters -> Bool)
-> (GetCustomersParameters -> GetCustomersParameters -> Bool)
-> Eq GetCustomersParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCustomersParameters -> GetCustomersParameters -> Bool
$c/= :: GetCustomersParameters -> GetCustomersParameters -> Bool
== :: GetCustomersParameters -> GetCustomersParameters -> Bool
$c== :: GetCustomersParameters -> GetCustomersParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetCustomersParameters where
  toJSON :: GetCustomersParameters -> Value
toJSON GetCustomersParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryCreated" Text -> Maybe GetCustomersParametersQueryCreated'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersParameters
-> Maybe GetCustomersParametersQueryCreated'Variants
getCustomersParametersQueryCreated GetCustomersParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryEmail" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEmail GetCustomersParameters
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..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEndingBefore GetCustomersParameters
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..= GetCustomersParameters -> Maybe [Text]
getCustomersParametersQueryExpand GetCustomersParameters
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..= GetCustomersParameters -> Maybe Int
getCustomersParametersQueryLimit GetCustomersParameters
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..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryStartingAfter GetCustomersParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetCustomersParameters -> Encoding
toEncoding GetCustomersParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryCreated" Text -> Maybe GetCustomersParametersQueryCreated'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersParameters
-> Maybe GetCustomersParametersQueryCreated'Variants
getCustomersParametersQueryCreated GetCustomersParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryEmail" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEmail GetCustomersParameters
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..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryEndingBefore GetCustomersParameters
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..= GetCustomersParameters -> Maybe [Text]
getCustomersParametersQueryExpand GetCustomersParameters
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..= GetCustomersParameters -> Maybe Int
getCustomersParametersQueryLimit GetCustomersParameters
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..= GetCustomersParameters -> Maybe Text
getCustomersParametersQueryStartingAfter GetCustomersParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetCustomersParameters where
  parseJSON :: Value -> Parser GetCustomersParameters
parseJSON = String
-> (Object -> Parser GetCustomersParameters)
-> Value
-> Parser GetCustomersParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetCustomersParameters" (\Object
obj -> ((((((Maybe GetCustomersParametersQueryCreated'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> GetCustomersParameters)
-> Parser
     (Maybe GetCustomersParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetCustomersParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe GetCustomersParametersQueryCreated'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCustomersParameters
GetCustomersParameters Parser
  (Maybe GetCustomersParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetCustomersParameters)
-> Parser (Maybe GetCustomersParametersQueryCreated'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetCustomersParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe GetCustomersParametersQueryCreated'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCreated")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetCustomersParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetCustomersParameters)
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
"queryEmail")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetCustomersParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text] -> Maybe Int -> Maybe Text -> GetCustomersParameters)
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 -> GetCustomersParameters)
-> Parser (Maybe [Text])
-> Parser (Maybe Int -> Maybe Text -> GetCustomersParameters)
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 -> GetCustomersParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetCustomersParameters)
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 -> GetCustomersParameters)
-> Parser (Maybe Text) -> Parser GetCustomersParameters
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 'GetCustomersParameters' with all required fields.
mkGetCustomersParameters :: GetCustomersParameters
mkGetCustomersParameters :: GetCustomersParameters
mkGetCustomersParameters =
  GetCustomersParameters :: Maybe GetCustomersParametersQueryCreated'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetCustomersParameters
GetCustomersParameters
    { getCustomersParametersQueryCreated :: Maybe GetCustomersParametersQueryCreated'Variants
getCustomersParametersQueryCreated = Maybe GetCustomersParametersQueryCreated'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersParametersQueryEmail :: Maybe Text
getCustomersParametersQueryEmail = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersParametersQueryEndingBefore :: Maybe Text
getCustomersParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersParametersQueryExpand :: Maybe [Text]
getCustomersParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersParametersQueryLimit :: Maybe Int
getCustomersParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getCustomersParametersQueryStartingAfter :: Maybe Text
getCustomersParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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

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

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

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

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

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

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

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