{-# 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 getSetupAttempts
module StripeAPI.Operations.GetSetupAttempts 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/setup_attempts
--
-- \<p>Returns a list of SetupAttempts associated with a provided SetupIntent.\<\/p>
getSetupAttempts ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetSetupAttemptsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetSetupAttemptsResponse)
getSetupAttempts :: GetSetupAttemptsParameters
-> StripeT m (Response GetSetupAttemptsResponse)
getSetupAttempts GetSetupAttemptsParameters
parameters =
  (Response ByteString -> Response GetSetupAttemptsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetSetupAttemptsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetSetupAttemptsResponse)
-> Response ByteString -> Response GetSetupAttemptsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetSetupAttemptsResponse)
-> (GetSetupAttemptsResponse -> GetSetupAttemptsResponse)
-> Either String GetSetupAttemptsResponse
-> GetSetupAttemptsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetSetupAttemptsResponse
GetSetupAttemptsResponseError GetSetupAttemptsResponse -> GetSetupAttemptsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetSetupAttemptsResponse
 -> GetSetupAttemptsResponse)
-> (ByteString -> Either String GetSetupAttemptsResponse)
-> ByteString
-> GetSetupAttemptsResponse
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) ->
                                   GetSetupAttemptsResponseBody200 -> GetSetupAttemptsResponse
GetSetupAttemptsResponse200
                                     (GetSetupAttemptsResponseBody200 -> GetSetupAttemptsResponse)
-> Either String GetSetupAttemptsResponseBody200
-> Either String GetSetupAttemptsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetSetupAttemptsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetSetupAttemptsResponseBody200
                                                      )
                                 | 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 -> GetSetupAttemptsResponse
GetSetupAttemptsResponseDefault
                                     (Error -> GetSetupAttemptsResponse)
-> Either String Error -> Either String GetSetupAttemptsResponse
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 GetSetupAttemptsResponse
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/setup_attempts")
        [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"created") (GetSetupAttemptsParametersQueryCreated'Variants -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetSetupAttemptsParametersQueryCreated'Variants -> Value)
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetSetupAttemptsParameters
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants
getSetupAttemptsParametersQueryCreated GetSetupAttemptsParameters
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.<$> GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryEndingBefore GetSetupAttemptsParameters
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.<$> GetSetupAttemptsParameters -> Maybe [Text]
getSetupAttemptsParametersQueryExpand GetSetupAttemptsParameters
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.<$> GetSetupAttemptsParameters -> Maybe Int
getSetupAttemptsParametersQueryLimit GetSetupAttemptsParameters
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
"setup_intent") (Value -> Maybe Value
forall a. a -> Maybe a
GHC.Maybe.Just (Value -> Maybe Value) -> Value -> Maybe Value
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetSetupAttemptsParameters -> Text
getSetupAttemptsParametersQuerySetupIntent GetSetupAttemptsParameters
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.<$> GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryStartingAfter GetSetupAttemptsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/setup_attempts.GET.parameters@ in the specification.
data GetSetupAttemptsParameters = GetSetupAttemptsParameters
  { -- | queryCreated: Represents the parameter named \'created\'
    --
    -- A filter on the list, based on the object \`created\` field. The value
    -- can be a string with an integer Unix timestamp, or it can be a
    -- dictionary with a number of different query options.
    GetSetupAttemptsParameters
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants
getSetupAttemptsParametersQueryCreated :: (GHC.Maybe.Maybe GetSetupAttemptsParametersQueryCreated'Variants),
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetSetupAttemptsParameters -> Maybe [Text]
getSetupAttemptsParametersQueryExpand :: (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.
    GetSetupAttemptsParameters -> Maybe Int
getSetupAttemptsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | querySetup_intent: Represents the parameter named \'setup_intent\'
    --
    -- Only return SetupAttempts created by the SetupIntent specified by
    -- this ID.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetSetupAttemptsParameters -> Text
getSetupAttemptsParametersQuerySetupIntent :: Data.Text.Internal.Text,
    -- | queryStarting_after: Represents the parameter named \'starting_after\'
    --
    -- A cursor for use in pagination. \`starting_after\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with \`obj_foo\`, your subsequent call can include \`starting_after=obj_foo\` in order to fetch the next page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetSetupAttemptsParameters -> ShowS
[GetSetupAttemptsParameters] -> ShowS
GetSetupAttemptsParameters -> String
(Int -> GetSetupAttemptsParameters -> ShowS)
-> (GetSetupAttemptsParameters -> String)
-> ([GetSetupAttemptsParameters] -> ShowS)
-> Show GetSetupAttemptsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSetupAttemptsParameters] -> ShowS
$cshowList :: [GetSetupAttemptsParameters] -> ShowS
show :: GetSetupAttemptsParameters -> String
$cshow :: GetSetupAttemptsParameters -> String
showsPrec :: Int -> GetSetupAttemptsParameters -> ShowS
$cshowsPrec :: Int -> GetSetupAttemptsParameters -> ShowS
GHC.Show.Show,
      GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool
(GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool)
-> (GetSetupAttemptsParameters
    -> GetSetupAttemptsParameters -> Bool)
-> Eq GetSetupAttemptsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool
$c/= :: GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool
== :: GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool
$c== :: GetSetupAttemptsParameters -> GetSetupAttemptsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetSetupAttemptsParameters where
  toJSON :: GetSetupAttemptsParameters -> Value
toJSON GetSetupAttemptsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryCreated" Text
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSetupAttemptsParameters
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants
getSetupAttemptsParametersQueryCreated GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryEndingBefore GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe [Text]
getSetupAttemptsParametersQueryExpand GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Int
getSetupAttemptsParametersQueryLimit GetSetupAttemptsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"querySetup_intent" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSetupAttemptsParameters -> Text
getSetupAttemptsParametersQuerySetupIntent GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryStartingAfter GetSetupAttemptsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetSetupAttemptsParameters -> Encoding
toEncoding GetSetupAttemptsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryCreated" Text
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSetupAttemptsParameters
-> Maybe GetSetupAttemptsParametersQueryCreated'Variants
getSetupAttemptsParametersQueryCreated GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryEndingBefore GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe [Text]
getSetupAttemptsParametersQueryExpand GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Int
getSetupAttemptsParametersQueryLimit GetSetupAttemptsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"querySetup_intent" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetSetupAttemptsParameters -> Text
getSetupAttemptsParametersQuerySetupIntent GetSetupAttemptsParameters
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..= GetSetupAttemptsParameters -> Maybe Text
getSetupAttemptsParametersQueryStartingAfter GetSetupAttemptsParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetSetupAttemptsParameters where
  parseJSON :: Value -> Parser GetSetupAttemptsParameters
parseJSON = String
-> (Object -> Parser GetSetupAttemptsParameters)
-> Value
-> Parser GetSetupAttemptsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetSetupAttemptsParameters" (\Object
obj -> ((((((Maybe GetSetupAttemptsParametersQueryCreated'Variants
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Text
 -> Maybe Text
 -> GetSetupAttemptsParameters)
-> Parser
     (Maybe GetSetupAttemptsParametersQueryCreated'Variants
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Text
      -> Maybe Text
      -> GetSetupAttemptsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe GetSetupAttemptsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Text
-> Maybe Text
-> GetSetupAttemptsParameters
GetSetupAttemptsParameters Parser
  (Maybe GetSetupAttemptsParametersQueryCreated'Variants
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Text
   -> Maybe Text
   -> GetSetupAttemptsParameters)
-> Parser (Maybe GetSetupAttemptsParametersQueryCreated'Variants)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Text
      -> Maybe Text
      -> GetSetupAttemptsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe GetSetupAttemptsParametersQueryCreated'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCreated")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Text
   -> Maybe Text
   -> GetSetupAttemptsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int -> Text -> Maybe Text -> GetSetupAttemptsParameters)
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 -> Text -> Maybe Text -> GetSetupAttemptsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int -> Text -> Maybe Text -> GetSetupAttemptsParameters)
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 -> Text -> Maybe Text -> GetSetupAttemptsParameters)
-> Parser (Maybe Int)
-> Parser (Text -> Maybe Text -> GetSetupAttemptsParameters)
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 (Text -> Maybe Text -> GetSetupAttemptsParameters)
-> Parser Text -> Parser (Maybe Text -> GetSetupAttemptsParameters)
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
"querySetup_intent")) Parser (Maybe Text -> GetSetupAttemptsParameters)
-> Parser (Maybe Text) -> Parser GetSetupAttemptsParameters
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 'GetSetupAttemptsParameters' with all required fields.
mkGetSetupAttemptsParameters ::
  -- | 'getSetupAttemptsParametersQuerySetupIntent'
  Data.Text.Internal.Text ->
  GetSetupAttemptsParameters
mkGetSetupAttemptsParameters :: Text -> GetSetupAttemptsParameters
mkGetSetupAttemptsParameters Text
getSetupAttemptsParametersQuerySetupIntent =
  GetSetupAttemptsParameters :: Maybe GetSetupAttemptsParametersQueryCreated'Variants
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Text
-> Maybe Text
-> GetSetupAttemptsParameters
GetSetupAttemptsParameters
    { getSetupAttemptsParametersQueryCreated :: Maybe GetSetupAttemptsParametersQueryCreated'Variants
getSetupAttemptsParametersQueryCreated = Maybe GetSetupAttemptsParametersQueryCreated'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      getSetupAttemptsParametersQueryEndingBefore :: Maybe Text
getSetupAttemptsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getSetupAttemptsParametersQueryExpand :: Maybe [Text]
getSetupAttemptsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getSetupAttemptsParametersQueryLimit :: Maybe Int
getSetupAttemptsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getSetupAttemptsParametersQuerySetupIntent :: Text
getSetupAttemptsParametersQuerySetupIntent = Text
getSetupAttemptsParametersQuerySetupIntent,
      getSetupAttemptsParametersQueryStartingAfter :: Maybe Text
getSetupAttemptsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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

-- | Defines the oneOf schema located at @paths.\/v1\/setup_attempts.GET.parameters.properties.queryCreated.anyOf@ in the specification.
--
-- Represents the parameter named \'created\'
--
-- A filter on the list, based on the object \`created\` field. The value
-- can be a string with an integer Unix timestamp, or it can be a
-- dictionary with a number of different query options.
data GetSetupAttemptsParametersQueryCreated'Variants
  = GetSetupAttemptsParametersQueryCreated'GetSetupAttemptsParametersQueryCreated'OneOf1 GetSetupAttemptsParametersQueryCreated'OneOf1
  | GetSetupAttemptsParametersQueryCreated'Int GHC.Types.Int
  deriving (Int -> GetSetupAttemptsParametersQueryCreated'Variants -> ShowS
[GetSetupAttemptsParametersQueryCreated'Variants] -> ShowS
GetSetupAttemptsParametersQueryCreated'Variants -> String
(Int -> GetSetupAttemptsParametersQueryCreated'Variants -> ShowS)
-> (GetSetupAttemptsParametersQueryCreated'Variants -> String)
-> ([GetSetupAttemptsParametersQueryCreated'Variants] -> ShowS)
-> Show GetSetupAttemptsParametersQueryCreated'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSetupAttemptsParametersQueryCreated'Variants] -> ShowS
$cshowList :: [GetSetupAttemptsParametersQueryCreated'Variants] -> ShowS
show :: GetSetupAttemptsParametersQueryCreated'Variants -> String
$cshow :: GetSetupAttemptsParametersQueryCreated'Variants -> String
showsPrec :: Int -> GetSetupAttemptsParametersQueryCreated'Variants -> ShowS
$cshowsPrec :: Int -> GetSetupAttemptsParametersQueryCreated'Variants -> ShowS
GHC.Show.Show, GetSetupAttemptsParametersQueryCreated'Variants
-> GetSetupAttemptsParametersQueryCreated'Variants -> Bool
(GetSetupAttemptsParametersQueryCreated'Variants
 -> GetSetupAttemptsParametersQueryCreated'Variants -> Bool)
-> (GetSetupAttemptsParametersQueryCreated'Variants
    -> GetSetupAttemptsParametersQueryCreated'Variants -> Bool)
-> Eq GetSetupAttemptsParametersQueryCreated'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSetupAttemptsParametersQueryCreated'Variants
-> GetSetupAttemptsParametersQueryCreated'Variants -> Bool
$c/= :: GetSetupAttemptsParametersQueryCreated'Variants
-> GetSetupAttemptsParametersQueryCreated'Variants -> Bool
== :: GetSetupAttemptsParametersQueryCreated'Variants
-> GetSetupAttemptsParametersQueryCreated'Variants -> Bool
$c== :: GetSetupAttemptsParametersQueryCreated'Variants
-> GetSetupAttemptsParametersQueryCreated'Variants -> Bool
GHC.Classes.Eq)

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

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

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

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

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