notification

package
v0.0.0-...-e082e2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllNotificationsFailedError = errors.New("all notifications failed")

Functions

This section is empty.

Types

type ChannelRegistry

type ChannelRegistry struct {
	// contains filtered or unexported fields
}

func NewChannelRegistry

func NewChannelRegistry() *ChannelRegistry

func (*ChannelRegistry) Register

func (r *ChannelRegistry) Register(channel NotificationChannel)

func (*ChannelRegistry) SendNotification

func (r *ChannelRegistry) SendNotification(ctx context.Context, sentNotif *model.SentNotification, offer *model.Offer) (*model.SentNotification, error)

type NotificationChannel

type NotificationChannel interface {

	// SendNotification sends notification to the user and returns error if any
	SendNotification(ctx context.Context, sentNotif *model.SentNotification, offer *model.Offer) error

	// GetName returns name of the channel for identification
	GetName() string
}

NotificationChannel is an interface for sending notifications by single channel

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier(d db.DB, conditionRegistry *condition.Registry, senderRegistry *ChannelRegistry) *Notifier

func (*Notifier) TrySendNotification

func (n *Notifier) TrySendNotification(ctx context.Context, offer *model.Offer, action model.OfferAction) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL