notifications

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package notifications provides helpers to send notifications

Package notifications provides helpers to send notifications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendNotification

func SendNotification(message string) error

Send a notification using all configured notifiers

func TestNotifiers

func TestNotifiers() error

Test all enabled notifiers

Types

type AllNotifiers

type AllNotifiers struct {
	Telegram Telegram // Each notifier type embeds a Notifier struct
	// contains filtered or unexported fields
}

Structure listing all notifiers

type Flag

type Flag struct {
	Long      string      // Long name of the flag, required
	Short     string      // Short name
	Help      string      // Help message, required
	ValueType string      // Type of the value: "string", "int" or "bool" are supported
	Value     interface{} // Interface to hold the flag value
}

Structure describing a flag to pass notifiers parameters in the CLI

type Notifier

type Notifier struct {
	Name  string           // Notifier name
	Flags map[string]*Flag // Slice of all flags used to pass parameters
}

Structure describing a notifier

func InitNotifiers

func InitNotifiers() []*Notifier

Initialize all the notifiers and return them

func (Notifier) IsConfigured

func (notifier Notifier) IsConfigured() bool

Send a notification using all configured notifiers

type Telegram

type Telegram struct {
	Notifier *Notifier
}

Structure storing the parameters required to send notifications with Telegram

func TelegramInit

func TelegramInit(notifier *Notifier) Telegram

Telegram notifier specification

func (Telegram) Send

func (tg Telegram) Send(message string) error

Implement the sending of a notification to a Telegram user

Jump to

Keyboard shortcuts

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