Documentation
¶
Index ¶
- Constants
- Variables
- func NewSigningSecret(size int) (string, error)
- func NewSigningSecretWithDefaultSize() (string, error)
- func ValidateSigningSecret(secret string) error
- type Config
- type CreateWebhookInput
- type DeleteWebhookInput
- type EventType
- type GetWebhookInput
- type Handler
- type ListWebhooksInput
- type Message
- type RegisterEventTypesInputs
- type SendMessageInput
- type SvixConfig
- type UpdateWebhookChannelsInput
- type UpdateWebhookInput
- type ValidationError
- type Webhook
Constants ¶
View Source
const ( EntitlementsEventGroupName = "entitlements" EntitlementsBalanceThresholdType = "entitlements.balance.threshold" EntitlementsBalanceThresholdDescription = "Notification event for entitlements balance threshold violations" )
View Source
const DefaultSigningSecretSize = 32
View Source
const ( // NullChannel is an internal channel type which should receive no messages at any time. // Channels and EventTypes are used as message filters in Svix // which means that a webhook without any filtering will receive all messages // sent to the application the webhook belongs to. In order to prevent this we // use the NoMessageChannel as a dummy filter, so it is possible to set up webhook endpoint // prior knowing what type of messages are going to be routed to it. NullChannel = "__null_channel" )
View Source
const (
SigningSecretPrefix = "whsec_"
)
Variables ¶
View Source
var EntitlementsBalanceThresholdEventType = EventType{ Name: EntitlementsBalanceThresholdType, Description: EntitlementsBalanceThresholdDescription, GroupName: EntitlementsEventGroupName, }
View Source
var NotificationEventTypes = []EventType{ EntitlementsBalanceThresholdEventType, }
Functions ¶
func NewSigningSecret ¶
func ValidateSigningSecret ¶
Types ¶
type Config ¶
type Config struct {
SvixConfig
RegisterEvenTypes []EventType
}
type CreateWebhookInput ¶
type CreateWebhookInput struct {
Namespace string
ID *string
URL string
CustomHeaders map[string]string
Disabled bool
Secret *string
RateLimit *int32
Description *string
EventTypes []string
Channels []string
Metadata map[string]string
}
func (CreateWebhookInput) Validate ¶
func (i CreateWebhookInput) Validate() error
type DeleteWebhookInput ¶
type DeleteWebhookInput = GetWebhookInput
type GetWebhookInput ¶
func (GetWebhookInput) Validate ¶
func (i GetWebhookInput) Validate() error
type Handler ¶
type Handler interface {
RegisterEventTypes(ctx context.Context, params RegisterEventTypesInputs) error
ListWebhooks(ctx context.Context, params ListWebhooksInput) ([]Webhook, error)
CreateWebhook(ctx context.Context, params CreateWebhookInput) (*Webhook, error)
UpdateWebhook(ctx context.Context, params UpdateWebhookInput) (*Webhook, error)
UpdateWebhookChannels(ctx context.Context, params UpdateWebhookChannelsInput) (*Webhook, error)
GetWebhook(ctx context.Context, params GetWebhookInput) (*Webhook, error)
DeleteWebhook(ctx context.Context, params DeleteWebhookInput) error
SendMessage(ctx context.Context, params SendMessageInput) (*Message, error)
}
type ListWebhooksInput ¶
type ListWebhooksInput struct {
Namespace string
IDs []string
EventTypes []string
Channels []string
}
func (ListWebhooksInput) Validate ¶
func (i ListWebhooksInput) Validate() error
type SendMessageInput ¶
type SendMessageInput struct {
Namespace string
EventID string
EventType string
Channels []string
Payload map[string]interface{}
}
func (SendMessageInput) Validate ¶
func (i SendMessageInput) Validate() error
type SvixConfig ¶
func (SvixConfig) Validate ¶
func (c SvixConfig) Validate() error
type UpdateWebhookChannelsInput ¶
type UpdateWebhookChannelsInput struct {
Namespace string
ID string
AddChannels []string
RemoveChannels []string
}
func (UpdateWebhookChannelsInput) Validate ¶
func (i UpdateWebhookChannelsInput) Validate() error
type UpdateWebhookInput ¶
type UpdateWebhookInput struct {
Namespace string
ID string
URL string
CustomHeaders map[string]string
Disabled bool
Secret *string
RateLimit *int32
Description *string
EventTypes []string
Channels []string
Metadata map[string]string
}
func (UpdateWebhookInput) Validate ¶
func (i UpdateWebhookInput) Validate() error
type ValidationError ¶
type ValidationError genericError
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (e ValidationError) Unwrap() error
type Webhook ¶
type Webhook struct {
Namespace string
ID string
URL string
Secret string
CustomHeaders map[string]string
Disabled bool
RateLimit *int32
Description string
EventTypes []string
Channels []string
CreatedAt time.Time
UpdatedAt time.Time
}
func WebhookFromSvixEndpointOut ¶
func WebhookFromSvixEndpointOut(e *svix.EndpointOut) *Webhook
Click to show internal directories.
Click to hide internal directories.