{-# 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 getWebhookEndpoints
module StripeAPI.Operations.GetWebhookEndpoints 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/webhook_endpoints
--
-- \<p>Returns a list of your webhook endpoints.\<\/p>
getWebhookEndpoints ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetWebhookEndpointsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetWebhookEndpointsResponse)
getWebhookEndpoints :: GetWebhookEndpointsParameters
-> StripeT m (Response GetWebhookEndpointsResponse)
getWebhookEndpoints GetWebhookEndpointsParameters
parameters =
  (Response ByteString -> Response GetWebhookEndpointsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetWebhookEndpointsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetWebhookEndpointsResponse)
-> Response ByteString -> Response GetWebhookEndpointsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetWebhookEndpointsResponse)
-> (GetWebhookEndpointsResponse -> GetWebhookEndpointsResponse)
-> Either String GetWebhookEndpointsResponse
-> GetWebhookEndpointsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetWebhookEndpointsResponse
GetWebhookEndpointsResponseError GetWebhookEndpointsResponse -> GetWebhookEndpointsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetWebhookEndpointsResponse
 -> GetWebhookEndpointsResponse)
-> (ByteString -> Either String GetWebhookEndpointsResponse)
-> ByteString
-> GetWebhookEndpointsResponse
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) ->
                                   GetWebhookEndpointsResponseBody200 -> GetWebhookEndpointsResponse
GetWebhookEndpointsResponse200
                                     (GetWebhookEndpointsResponseBody200 -> GetWebhookEndpointsResponse)
-> Either String GetWebhookEndpointsResponseBody200
-> Either String GetWebhookEndpointsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetWebhookEndpointsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetWebhookEndpointsResponseBody200
                                                      )
                                 | 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 -> GetWebhookEndpointsResponse
GetWebhookEndpointsResponseDefault
                                     (Error -> GetWebhookEndpointsResponse)
-> Either String Error -> Either String GetWebhookEndpointsResponse
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 GetWebhookEndpointsResponse
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/webhook_endpoints")
        [ 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.<$> GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryEndingBefore GetWebhookEndpointsParameters
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.<$> GetWebhookEndpointsParameters -> Maybe [Text]
getWebhookEndpointsParametersQueryExpand GetWebhookEndpointsParameters
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.<$> GetWebhookEndpointsParameters -> Maybe Int
getWebhookEndpointsParametersQueryLimit GetWebhookEndpointsParameters
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.<$> GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryStartingAfter GetWebhookEndpointsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/webhook_endpoints.GET.parameters@ in the specification.
data GetWebhookEndpointsParameters = GetWebhookEndpointsParameters
  { -- | 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
    GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetWebhookEndpointsParameters -> Maybe [Text]
getWebhookEndpointsParametersQueryExpand :: (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.
    GetWebhookEndpointsParameters -> Maybe Int
getWebhookEndpointsParametersQueryLimit :: (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
    GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetWebhookEndpointsParameters -> ShowS
[GetWebhookEndpointsParameters] -> ShowS
GetWebhookEndpointsParameters -> String
(Int -> GetWebhookEndpointsParameters -> ShowS)
-> (GetWebhookEndpointsParameters -> String)
-> ([GetWebhookEndpointsParameters] -> ShowS)
-> Show GetWebhookEndpointsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWebhookEndpointsParameters] -> ShowS
$cshowList :: [GetWebhookEndpointsParameters] -> ShowS
show :: GetWebhookEndpointsParameters -> String
$cshow :: GetWebhookEndpointsParameters -> String
showsPrec :: Int -> GetWebhookEndpointsParameters -> ShowS
$cshowsPrec :: Int -> GetWebhookEndpointsParameters -> ShowS
GHC.Show.Show,
      GetWebhookEndpointsParameters
-> GetWebhookEndpointsParameters -> Bool
(GetWebhookEndpointsParameters
 -> GetWebhookEndpointsParameters -> Bool)
-> (GetWebhookEndpointsParameters
    -> GetWebhookEndpointsParameters -> Bool)
-> Eq GetWebhookEndpointsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWebhookEndpointsParameters
-> GetWebhookEndpointsParameters -> Bool
$c/= :: GetWebhookEndpointsParameters
-> GetWebhookEndpointsParameters -> Bool
== :: GetWebhookEndpointsParameters
-> GetWebhookEndpointsParameters -> Bool
$c== :: GetWebhookEndpointsParameters
-> GetWebhookEndpointsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetWebhookEndpointsParameters where
  toJSON :: GetWebhookEndpointsParameters -> Value
toJSON GetWebhookEndpointsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryEnding_before" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryEndingBefore GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe [Text]
getWebhookEndpointsParametersQueryExpand GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe Int
getWebhookEndpointsParametersQueryLimit GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryStartingAfter GetWebhookEndpointsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetWebhookEndpointsParameters -> Encoding
toEncoding GetWebhookEndpointsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryEnding_before" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryEndingBefore GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe [Text]
getWebhookEndpointsParametersQueryExpand GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe Int
getWebhookEndpointsParametersQueryLimit GetWebhookEndpointsParameters
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..= GetWebhookEndpointsParameters -> Maybe Text
getWebhookEndpointsParametersQueryStartingAfter GetWebhookEndpointsParameters
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GetWebhookEndpointsParameters where
  parseJSON :: Value -> Parser GetWebhookEndpointsParameters
parseJSON = String
-> (Object -> Parser GetWebhookEndpointsParameters)
-> Value
-> Parser GetWebhookEndpointsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetWebhookEndpointsParameters" (\Object
obj -> ((((Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> GetWebhookEndpointsParameters)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetWebhookEndpointsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetWebhookEndpointsParameters
GetWebhookEndpointsParameters Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetWebhookEndpointsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int -> Maybe Text -> GetWebhookEndpointsParameters)
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 -> GetWebhookEndpointsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int -> Maybe Text -> GetWebhookEndpointsParameters)
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 -> GetWebhookEndpointsParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetWebhookEndpointsParameters)
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 -> GetWebhookEndpointsParameters)
-> Parser (Maybe Text) -> Parser GetWebhookEndpointsParameters
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 'GetWebhookEndpointsParameters' with all required fields.
mkGetWebhookEndpointsParameters :: GetWebhookEndpointsParameters
mkGetWebhookEndpointsParameters :: GetWebhookEndpointsParameters
mkGetWebhookEndpointsParameters =
  GetWebhookEndpointsParameters :: Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetWebhookEndpointsParameters
GetWebhookEndpointsParameters
    { getWebhookEndpointsParametersQueryEndingBefore :: Maybe Text
getWebhookEndpointsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getWebhookEndpointsParametersQueryExpand :: Maybe [Text]
getWebhookEndpointsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getWebhookEndpointsParametersQueryLimit :: Maybe Int
getWebhookEndpointsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getWebhookEndpointsParametersQueryStartingAfter :: Maybe Text
getWebhookEndpointsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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