{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.WebhookEndpoint where
import qualified Control.Monad.Fail
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.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 GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified StripeAPI.Common
import StripeAPI.TypeAlias
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data WebhookEndpoint = WebhookEndpoint
{
WebhookEndpoint -> Maybe Text
webhookEndpointApiVersion :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
WebhookEndpoint -> Maybe Text
webhookEndpointApplication :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
WebhookEndpoint -> Int
webhookEndpointCreated :: GHC.Types.Int,
WebhookEndpoint -> Maybe Text
webhookEndpointDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
WebhookEndpoint -> [Text]
webhookEndpointEnabledEvents :: ([Data.Text.Internal.Text]),
WebhookEndpoint -> Text
webhookEndpointId :: Data.Text.Internal.Text,
WebhookEndpoint -> Bool
webhookEndpointLivemode :: GHC.Types.Bool,
WebhookEndpoint -> Object
webhookEndpointMetadata :: Data.Aeson.Types.Internal.Object,
WebhookEndpoint -> Maybe Text
webhookEndpointSecret :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
WebhookEndpoint -> Text
webhookEndpointStatus :: Data.Text.Internal.Text,
WebhookEndpoint -> Text
webhookEndpointUrl :: Data.Text.Internal.Text
}
deriving
( Int -> WebhookEndpoint -> ShowS
[WebhookEndpoint] -> ShowS
WebhookEndpoint -> String
(Int -> WebhookEndpoint -> ShowS)
-> (WebhookEndpoint -> String)
-> ([WebhookEndpoint] -> ShowS)
-> Show WebhookEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebhookEndpoint] -> ShowS
$cshowList :: [WebhookEndpoint] -> ShowS
show :: WebhookEndpoint -> String
$cshow :: WebhookEndpoint -> String
showsPrec :: Int -> WebhookEndpoint -> ShowS
$cshowsPrec :: Int -> WebhookEndpoint -> ShowS
GHC.Show.Show,
WebhookEndpoint -> WebhookEndpoint -> Bool
(WebhookEndpoint -> WebhookEndpoint -> Bool)
-> (WebhookEndpoint -> WebhookEndpoint -> Bool)
-> Eq WebhookEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebhookEndpoint -> WebhookEndpoint -> Bool
$c/= :: WebhookEndpoint -> WebhookEndpoint -> Bool
== :: WebhookEndpoint -> WebhookEndpoint -> Bool
$c== :: WebhookEndpoint -> WebhookEndpoint -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON WebhookEndpoint where
toJSON :: WebhookEndpoint -> Value
toJSON WebhookEndpoint
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"api_version" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointApiVersion WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"application" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointApplication WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Int
webhookEndpointCreated WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointDescription WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"enabled_events" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> [Text]
webhookEndpointEnabledEvents WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Text
webhookEndpointId WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Bool
webhookEndpointLivemode WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Object
webhookEndpointMetadata WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"secret" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointSecret WebhookEndpoint
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Text
webhookEndpointStatus WebhookEndpoint
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..= WebhookEndpoint -> Text
webhookEndpointUrl WebhookEndpoint
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
"webhook_endpoint" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: WebhookEndpoint -> Encoding
toEncoding WebhookEndpoint
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"api_version" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointApiVersion WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"application" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointApplication WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Int
webhookEndpointCreated WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointDescription WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"enabled_events" Text -> [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> [Text]
webhookEndpointEnabledEvents WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Text
webhookEndpointId WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Bool
webhookEndpointLivemode WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Object
webhookEndpointMetadata WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"secret" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Maybe Text
webhookEndpointSecret WebhookEndpoint
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= WebhookEndpoint -> Text
webhookEndpointStatus WebhookEndpoint
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..= WebhookEndpoint -> Text
webhookEndpointUrl WebhookEndpoint
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
"webhook_endpoint"))))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON WebhookEndpoint where
parseJSON :: Value -> Parser WebhookEndpoint
parseJSON = String
-> (Object -> Parser WebhookEndpoint)
-> Value
-> Parser WebhookEndpoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"WebhookEndpoint" (\Object
obj -> (((((((((((Maybe Text
-> Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser
(Maybe Text
-> Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint
WebhookEndpoint Parser
(Maybe Text
-> Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
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
"api_version")) Parser
(Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser (Maybe Text)
-> Parser
(Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
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
"application")) Parser
(Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser Int
-> Parser
(Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"created")) Parser
(Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser (Maybe Text)
-> Parser
([Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"description")) Parser
([Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint)
-> Parser [Text]
-> Parser
(Text
-> Bool -> Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
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
"enabled_events")) Parser
(Text
-> Bool -> Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
-> Parser Text
-> Parser
(Bool -> Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
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
"id")) Parser
(Bool -> Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
-> Parser Bool
-> Parser (Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
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
"livemode")) Parser (Object -> Maybe Text -> Text -> Text -> WebhookEndpoint)
-> Parser Object
-> Parser (Maybe Text -> Text -> Text -> WebhookEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Object
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"metadata")) Parser (Maybe Text -> Text -> Text -> WebhookEndpoint)
-> Parser (Maybe Text) -> Parser (Text -> Text -> WebhookEndpoint)
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
"secret")) Parser (Text -> Text -> WebhookEndpoint)
-> Parser Text -> Parser (Text -> WebhookEndpoint)
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
"status")) Parser (Text -> WebhookEndpoint)
-> Parser Text -> Parser WebhookEndpoint
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"))
mkWebhookEndpoint ::
GHC.Types.Int ->
[Data.Text.Internal.Text] ->
Data.Text.Internal.Text ->
GHC.Types.Bool ->
Data.Aeson.Types.Internal.Object ->
Data.Text.Internal.Text ->
Data.Text.Internal.Text ->
WebhookEndpoint
mkWebhookEndpoint :: Int
-> [Text]
-> Text
-> Bool
-> Object
-> Text
-> Text
-> WebhookEndpoint
mkWebhookEndpoint Int
webhookEndpointCreated [Text]
webhookEndpointEnabledEvents Text
webhookEndpointId Bool
webhookEndpointLivemode Object
webhookEndpointMetadata Text
webhookEndpointStatus Text
webhookEndpointUrl =
WebhookEndpoint :: Maybe Text
-> Maybe Text
-> Int
-> Maybe Text
-> [Text]
-> Text
-> Bool
-> Object
-> Maybe Text
-> Text
-> Text
-> WebhookEndpoint
WebhookEndpoint
{ webhookEndpointApiVersion :: Maybe Text
webhookEndpointApiVersion = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
webhookEndpointApplication :: Maybe Text
webhookEndpointApplication = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
webhookEndpointCreated :: Int
webhookEndpointCreated = Int
webhookEndpointCreated,
webhookEndpointDescription :: Maybe Text
webhookEndpointDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
webhookEndpointEnabledEvents :: [Text]
webhookEndpointEnabledEvents = [Text]
webhookEndpointEnabledEvents,
webhookEndpointId :: Text
webhookEndpointId = Text
webhookEndpointId,
webhookEndpointLivemode :: Bool
webhookEndpointLivemode = Bool
webhookEndpointLivemode,
webhookEndpointMetadata :: Object
webhookEndpointMetadata = Object
webhookEndpointMetadata,
webhookEndpointSecret :: Maybe Text
webhookEndpointSecret = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
webhookEndpointStatus :: Text
webhookEndpointStatus = Text
webhookEndpointStatus,
webhookEndpointUrl :: Text
webhookEndpointUrl = Text
webhookEndpointUrl
}