backend

package
v0.0.0-...-a1e463d Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2015 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PriorityMap map[string]Priority = map[string]Priority{
	"low":    LowPriority,
	"normal": NormalPriority,
	"urgent": UrgentPriority,
}

Functions

func ClearAllNotifiers

func ClearAllNotifiers()

func RegisterBackend

func RegisterBackend(backend NotificationBackend)

func RegisterNotifier

func RegisterNotifier(n Notifier)

func UnregisterNotifier

func UnregisterNotifier(name string)

Types

type ChannelNotFound

type ChannelNotFound struct {
	ChannelName string
}

func (ChannelNotFound) Error

func (err ChannelNotFound) Error() string

type EmailViaSMTPConfig

type EmailViaSMTPConfig struct {
	Username  string
	Password  string
	SelfEmail string
	DoNotSend bool
}

func (EmailViaSMTPConfig) ToNotifier

func (c EmailViaSMTPConfig) ToNotifier() *EmailViaSMTPNotifier

type EmailViaSMTPNotifier

type EmailViaSMTPNotifier struct {
	Hostname      string
	Port          int
	SelfEmailAddr string
	Authenticator smtp.Auth
	// contains filtered or unexported fields
}

func NewEmailViaGmailNotifier

func NewEmailViaGmailNotifier(username string, password string, selfEmail string) *EmailViaSMTPNotifier

func NewEmailViaSMTPNotifier

func NewEmailViaSMTPNotifier(hostname string, port int, authenticator smtp.Auth, selfEmail string) *EmailViaSMTPNotifier

func (*EmailViaSMTPNotifier) Name

func (n *EmailViaSMTPNotifier) Name() string

func (*EmailViaSMTPNotifier) Send

func (n *EmailViaSMTPNotifier) Send(notifications []Notification, subscriber Subscriber) error

func (*EmailViaSMTPNotifier) SendMany

func (n *EmailViaSMTPNotifier) SendMany(notifications []Notification, subscriber Subscriber) error

func (*EmailViaSMTPNotifier) SendOne

func (n *EmailViaSMTPNotifier) SendOne(notification Notification, subscriber Subscriber) error

type Notification

type Notification struct {
	Subject   string
	Content   string
	Channel   string
	Origin    string
	Tags      []string
	Priority  Priority
	CreatedAt int64 // UnixNano
	UpdatedAt int64 // UnixNano
}

type NotificationBackend

type NotificationBackend interface {
	Name() string
	QueueNotification(notification Notification) error
	Initialize(openString string) error
	Start(wg *sync.WaitGroup)
	BlockUntilReady()
	Shutdown()
}

func GetBackend

func GetBackend(name string) NotificationBackend

func InitializeNotificationBackend

func InitializeNotificationBackend(name, openString string) (NotificationBackend, error)

type Notifier

type Notifier interface {
	Name() string
	Send(notifications []Notification, subscriber Subscriber) error
}

func GetNotifier

func GetNotifier(name string) Notifier

type Priority

type Priority int64
const (
	LowPriority    Priority = 1   // reserved for future use
	NormalPriority Priority = 2   // regular stuff
	UrgentPriority Priority = 100 // notify now
)

type Subscriber

type Subscriber struct {
	UniqueName  string
	Name        string
	Email       string
	PhoneNumber string
}

Jump to

Keyboard shortcuts

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