Documentation
¶
Overview ¶
Package notification provides a portable notification API with cross-cutting concerns.
Index ¶
- type Notification
- func (n *Notification) CreateTopic(ctx context.Context, config driver.TopicConfig) (*driver.TopicInfo, error)
- func (n *Notification) DeleteTopic(ctx context.Context, id string) error
- func (n *Notification) GetTopic(ctx context.Context, id string) (*driver.TopicInfo, error)
- func (n *Notification) ListSubscriptions(ctx context.Context, topicID string) ([]driver.SubscriptionInfo, error)
- func (n *Notification) ListTopics(ctx context.Context) ([]driver.TopicInfo, error)
- func (n *Notification) Publish(ctx context.Context, input driver.PublishInput) (*driver.PublishOutput, error)
- func (n *Notification) Subscribe(ctx context.Context, config driver.SubscriptionConfig) (*driver.SubscriptionInfo, error)
- func (n *Notification) Unsubscribe(ctx context.Context, subscriptionID string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶
type Notification struct {
// contains filtered or unexported fields
}
Notification is the portable notification type wrapping a driver with cross-cutting concerns.
func NewNotification ¶
func NewNotification(d driver.Notification, opts ...Option) *Notification
NewNotification creates a new portable Notification wrapping the given driver.
func (*Notification) CreateTopic ¶
func (n *Notification) CreateTopic(ctx context.Context, config driver.TopicConfig) (*driver.TopicInfo, error)
CreateTopic creates a new notification topic.
func (*Notification) DeleteTopic ¶
func (n *Notification) DeleteTopic(ctx context.Context, id string) error
DeleteTopic deletes a notification topic.
func (*Notification) ListSubscriptions ¶
func (n *Notification) ListSubscriptions(ctx context.Context, topicID string) ([]driver.SubscriptionInfo, error)
ListSubscriptions lists all subscriptions for a topic.
func (*Notification) ListTopics ¶
ListTopics lists all topics.
func (*Notification) Publish ¶
func (n *Notification) Publish(ctx context.Context, input driver.PublishInput) (*driver.PublishOutput, error)
Publish publishes a message to a topic.
func (*Notification) Subscribe ¶
func (n *Notification) Subscribe(ctx context.Context, config driver.SubscriptionConfig) (*driver.SubscriptionInfo, error)
Subscribe creates a subscription to a topic.
func (*Notification) Unsubscribe ¶
func (n *Notification) Unsubscribe(ctx context.Context, subscriptionID string) error
Unsubscribe removes a subscription.
type Option ¶
type Option func(*Notification)
Option configures a portable Notification.
func WithErrorInjection ¶
WithErrorInjection sets the error injector.
func WithMetrics ¶
WithMetrics sets the metrics collector.
func WithRateLimiter ¶
WithRateLimiter sets the rate limiter.