Documentation
¶
Index ¶
- Constants
- Variables
- func IgnoreNotImplemented(err error) error
- func IsMessageNotReadyError(err error) bool
- func IsNotFoundError(err error) bool
- func IsNotImplemented(err error) bool
- func IsRetryableError(err error) bool
- func IsUnrecoverableError(err error) bool
- func IsValidationError(err error) bool
- func NewMessageNotReadyError(namespace string, eventID string) error
- func NewNotFoundError(err error) error
- func NewRetryableError(err error, after time.Duration) error
- func NewUnrecoverableError(err error) error
- func NewValidationError(err error) error
- type CreateWebhookInput
- type DeleteWebhookInput
- type EvenTypeSchemaVersion
- type EventType
- type EventTypeHandler
- type EventTypeSchema
- type ExpandParams
- type GetMessageInput
- type GetWebhookInput
- type Handler
- type ListWebhooksInput
- type Message
- type MessageDeliveryStatus
- type MessageHandler
- type MessageNotReadyError
- type NotFoundError
- type Payload
- type RegisterEventTypesInputs
- type ResendMessageInput
- type RetryableError
- type SendMessageInput
- type UnrecoverableError
- 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 DefaultRetryAfter = 15 * time.Second
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 IsMessageNotReadyError ¶
func IsNotFoundError ¶
func IsNotImplemented ¶
func IsRetryableError ¶
func IsUnrecoverableError ¶
func IsValidationError ¶
func NewMessageNotReadyError ¶
func NewNotFoundError ¶
func NewUnrecoverableError ¶
func NewValidationError ¶
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 ExpandParams ¶
type GetMessageInput ¶
type GetMessageInput struct {
Namespace string
ID string
EventID string
Expand ExpandParams
}
func (GetMessageInput) Validate ¶
func (i GetMessageInput) Validate() error
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 Message ¶
type Message struct {
Namespace string
ID string
EventID string
EventType string
Channels []string
Annotations models.Annotations
// Payload stores the message payload if it was requested.
Payload *Payload
// DeliveryStatuses stores the message delivery status if it was requested.
DeliveryStatuses *[]MessageDeliveryStatus
}
type MessageDeliveryStatus ¶
type MessageDeliveryStatus struct {
NextAttempt *time.Time `json:"nextAttempt"`
State notification.EventDeliveryStatusState `json:"state"`
ChannelID string `json:"channel_id"`
Attempts []notification.EventDeliveryAttempt `json:"attempts"`
}
type MessageHandler ¶
type MessageHandler interface {
SendMessage(ctx context.Context, params SendMessageInput) (*Message, error)
GetMessage(ctx context.Context, params GetMessageInput) (*Message, error)
ResendMessage(ctx context.Context, params ResendMessageInput) error
}
type MessageNotReadyError ¶
type MessageNotReadyError struct {
// contains filtered or unexported fields
}
func (MessageNotReadyError) Error ¶
func (e MessageNotReadyError) Error() string
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 ResendMessageInput ¶
func (ResendMessageInput) Validate ¶
func (i ResendMessageInput) Validate() error
type RetryableError ¶
type RetryableError struct {
// contains filtered or unexported fields
}
func (RetryableError) Error ¶
func (e RetryableError) Error() string
func (RetryableError) RetryAfter ¶
func (e RetryableError) RetryAfter() time.Duration
func (RetryableError) Unwrap ¶
func (e RetryableError) Unwrap() error
type SendMessageInput ¶
type SendMessageInput struct {
Namespace string
EventID string
EventType string
Channels []string
Payload Payload
}
func (SendMessageInput) Validate ¶
func (i SendMessageInput) Validate() error
type UnrecoverableError ¶
type UnrecoverableError struct {
// contains filtered or unexported fields
}
func (UnrecoverableError) Error ¶
func (e UnrecoverableError) Error() string
func (UnrecoverableError) Unwrap ¶
func (e UnrecoverableError) Unwrap() 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.