notification

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

LoginAuth returns an authentication type that is not supported by the standard smtp package.

Types

type Config

type Config struct {
	Mail          MailConfig       `yaml:"mail,omitempty"`
	Notifications []Notification   `yaml:"notifications,omitempty"`
	RocketChat    RocketChatConfig `yaml:"rocketchat,omitempty"`
	Slack         SlackConfig      `yaml:"slack,omitempty"`
	Telegram      TelegramConfig   `yaml:"telegram,omitempty"`
}

Config contains notifications and messaging services configurations.

type MailConfig

type MailConfig struct {
	SenderAddress     string   `yaml:"senderAddress,omitempty"`
	SenderPassword    string   `yaml:"senderPassword,omitempty"`
	SMTPHostAddress   string   `yaml:"smtpHostAddress,omitempty"`
	SMTPHostPort      string   `yaml:"smtpHostPort,omitempty"`
	ReceiverAddresses []string `yaml:"receiverAddresses,omitempty"`
}

MailConfig contains a mail's configuration.

type Notification

type Notification struct {
	// TODO: change to Notifiers?
	Services []string      `yaml:"services,omitempty"`
	Delta    time.Duration `yaml:"delta,omitempty"`
}

Notification ..

type Notifier

type Notifier interface {
	Notify(event *event.Event) error
}

Notifier is the interface that wraps the Notify method used to send notifications.

func GetNotifiers

func GetNotifiers(config Config, services []string) ([]Notifier, error)

GetNotifiers returns the notifiers the user had set up.

func NewDesktopNotifier

func NewDesktopNotifier(config Config) (Notifier, error)

NewDesktopNotifier returns a notifier for desktop notifications.

func NewJoinNotifier

func NewJoinNotifier(config Config) (Notifier, error)

NewJoinNotifier returns a notifier that displays a question dialog asking to join an online event or not.

func NewMailNotifier

func NewMailNotifier(config MailConfig) (Notifier, error)

NewMailNotifier returns a notifier that sends mails.

func NewRocketChatNotifier

func NewRocketChatNotifier(config RocketChatConfig) (Notifier, error)

NewRocketChatNotifier returns a notifier that sends rocket chat messages.

func NewSlackNotifier

func NewSlackNotifier(config SlackConfig) (Notifier, error)

NewSlackNotifier returns a notifier that sends messages thorugh slack channels.

func NewTelegramNotifier

func NewTelegramNotifier(config TelegramConfig) (Notifier, error)

NewTelegramNotifier returns a notifier that sends telegram messages.

type RocketChatConfig

type RocketChatConfig struct {
	ServerURL string   `yaml:"serverURL,omitempty"`
	UserID    string   `yaml:"userID,omitempty"`
	Token     string   `yaml:"token,omitempty"`
	RoomIDs   []string `yaml:"roomIDs,omitempty"`
}

RocketChatConfig contains rocket chat's configuration.

type SlackConfig

type SlackConfig struct {
	BotAccessToken string   `yaml:"botAccessToken,omitempty"`
	ChannelIDs     []string `yaml:"channelIDs,omitempty"`
}

SlackConfig contains slack's configuration.

type TelegramConfig

type TelegramConfig struct {
	BotAPIToken string  `yaml:"botAPIToken"`
	ChatIDs     []int64 `yaml:"chatID"`
}

TelegramConfig contains telegram's configuration.

Jump to

Keyboard shortcuts

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