center

package
v0.0.0-...-4b98c26 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NotificationDiskQuota category for sending alert when reaching 90% of disk
	// usage quota.
	NotificationDiskQuota = "disk-quota"
)

Variables

View Source
var (
	// ErrBadNotification is used when the notification request is not valid.
	ErrBadNotification = errors.New("Notification is not valid")
	// ErrUnauthorized is used when the notification creator is not authorized to do so.
	ErrUnauthorized = errors.New("Not authorized to send notification")
	// ErrNoCategory is used when no category is declared for this application
	ErrNoCategory = errors.New("No category for this app")
	// ErrCategoryNotFound is used when sending a notification from an unknown
	// category.
	ErrCategoryNotFound = errors.New("Notification category does not exist")
)

Functions

func Push

Push creates and sends a new notification in database. This method verifies the permissions associated with this creation in order to check that it is granted to create a notification and to extract its source.

func PushStack

func PushStack(domain string, category string, n *notification.Notification) error

PushStack creates and sends a new notification where the source is the stack.

Types

type PushMessage

type PushMessage struct {
	NotificationID string `json:"notification_id"`
	Source         string `json:"source"`
	Title          string `json:"title,omitempty"`
	Message        string `json:"message,omitempty"`
	Priority       string `json:"priority,omitempty"`
	Sound          string `json:"sound,omitempty"`
	Collapsible    bool   `json:"collapsible,omitempty"`

	Data map[string]interface{} `json:"data,omitempty"`

	MailFallback *mail.Options `json:"mail_fallback,omitempty"`
}

PushMessage contains a push notification request.

func (*PushMessage) Slug

func (pm *PushMessage) Slug() string

Slug returns the slug of the app that wants to send this push message.

type SMS

type SMS struct {
	NotificationID string        `json:"notification_id"`
	Message        string        `json:"message,omitempty"`
	MailFallback   *mail.Options `json:"mail_fallback,omitempty"`
}

SMS contains a notification request for sending a SMS.

Jump to

Keyboard shortcuts

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