Documentation
¶
Index ¶
- Constants
- Variables
- func IgnoreNotImplemented(err error) error
- func IsNotFoundError(err error) bool
- func IsNotImplemented(err error) bool
- func IsValidationError(err error) bool
- func NewNotFoundError(err error) error
- func NewSigningSecret(size int) (string, error)
- func NewSigningSecretWithDefaultSize() (string, error)
- func NewValidationError(err error) error
- func ValidateSigningSecret(secret string) error
- type CreateWebhookInput
- type DeleteWebhookInput
- type EvenTypeSchemaVersion
- type EventType
- type EventTypeHandler
- type EventTypeSchema
- type GetWebhookInput
- type Handler
- type ListWebhooksInput
- type Message
- type MessageHandler
- type NotFoundError
- type RegisterEventTypesInputs
- type SendMessageInput
- type UpdateWebhookChannelsInput
- type UpdateWebhookInput
- type ValidationError
- type Webhook
- type WebhookHandler
Constants ¶
View Source
const ( EntitlementsEventGroupName = "entitlements" EntitlementsBalanceThresholdType = "entitlements.balance.threshold" EntitlementsBalanceThresholdDescription = "Notification event for entitlements balance threshold violations" EntitlementResetType = "entitlements.reset" EntitlementResetDescription = "Notification event for entitlement reset events." )
View Source
const ( InvoiceEventGroupName = "invoice" InvoiceCreatedType = "invoice.created" InvoiceCreatedDescription = "Notification event for new invoice created." InvoiceUpdatedType = "invoice.updated" InvoiceUpdatedDescription = "Notification event for new invoice updated." )
View Source
const (
DefaultRegistrationTimeout = 30 * time.Second
)
View Source
const DefaultSigningSecretSize = 32
View Source
const (
SigningSecretPrefix = "whsec_"
)
Variables ¶
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var EventTypeEntitlementsBalanceThreshold = EventType{ Name: EntitlementsBalanceThresholdType, Description: EntitlementsBalanceThresholdDescription, GroupName: EntitlementsEventGroupName, }
View Source
var EventTypeEntitlementsReset = EventType{ Name: EntitlementResetType, Description: EntitlementResetDescription, GroupName: EntitlementsEventGroupName, }
View Source
var EventTypeInvoiceCreated = EventType{ Name: InvoiceCreatedType, Description: InvoiceCreatedDescription, GroupName: InvoiceEventGroupName, }
View Source
var EventTypeInvoiceUpdated = EventType{ Name: InvoiceUpdatedType, Description: InvoiceUpdatedDescription, GroupName: InvoiceEventGroupName, }
View Source
var NotificationEventTypes = []EventType{ EventTypeEntitlementsBalanceThreshold, EventTypeEntitlementsReset, EventTypeInvoiceCreated, EventTypeInvoiceUpdated, }
FIXME: add JSON schema for events FIXME: refactor notifications to keep these in one place
Functions ¶
func IgnoreNotImplemented ¶
func IsNotFoundError ¶
func IsNotImplemented ¶
func IsValidationError ¶
func NewNotFoundError ¶
func NewSigningSecret ¶
func NewValidationError ¶
func ValidateSigningSecret ¶
Types ¶
type CreateWebhookInput ¶
type CreateWebhookInput struct {
Namespace string
ID *string
URL string
CustomHeaders map[string]string
Disabled bool
Secret *string
RateLimit *uint16
Description *string
EventTypes []string
Channels []string
Metadata map[string]string
}
func (CreateWebhookInput) Validate ¶
func (i CreateWebhookInput) Validate() error
type DeleteWebhookInput ¶
type DeleteWebhookInput = GetWebhookInput
type EvenTypeSchemaVersion ¶
type EvenTypeSchemaVersion = string
type EventType ¶
type EventType struct {
Name string
Description string
GroupName string
// Schemas defines the list of schemas for each event type version
Schemas map[EvenTypeSchemaVersion]EventTypeSchema
Deprecated bool
}
type EventTypeHandler ¶
type EventTypeHandler interface {
RegisterEventTypes(ctx context.Context, params RegisterEventTypesInputs) error
}
type EventTypeSchema ¶
type EventTypeSchema = interface{}
type GetWebhookInput ¶
func (GetWebhookInput) Validate ¶
func (i GetWebhookInput) Validate() error
type Handler ¶
type Handler interface {
WebhookHandler
MessageHandler
EventTypeHandler
}
type ListWebhooksInput ¶
type ListWebhooksInput struct {
Namespace string
IDs []string
EventTypes []string
Channels []string
}
func (ListWebhooksInput) Validate ¶
func (i ListWebhooksInput) Validate() error
type MessageHandler ¶
type MessageHandler interface {
SendMessage(ctx context.Context, params SendMessageInput) (*Message, error)
}
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
func (NotFoundError) Unwrap ¶
func (e NotFoundError) Unwrap() 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 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 *uint16
Description *string
EventTypes []string
Channels []string
Metadata map[string]string
}
func (UpdateWebhookInput) Validate ¶
func (i UpdateWebhookInput) Validate() error
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (e ValidationError) Unwrap() error
type WebhookHandler ¶
type WebhookHandler interface {
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
}
Click to show internal directories.
Click to hide internal directories.