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 = 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 ¶
func Push(inst *instance.Instance, perm *permission.Permission, n *notification.Notification) error
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.
Click to show internal directories.
Click to hide internal directories.