notify

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppData

type AppData = config.AppData

AppData contains application links exposed to notification templates.

type Data

type Data struct {
	IncidentID     string
	NotificationID string
	CheckInName    string
	LastCheckIn    time.Time
	ExpectedBy     time.Time
	OverdueSince   time.Time
	AlertingAt     time.Time
	Now            time.Time
	Phase          monitor.Phase
	Status         monitor.EventStatus
	Resolved       bool
	Title          string
	Text           string
	App            AppData
	Receiver       string
	CustomData     map[string]string
}

Data is the template context for check-in notifications.

func NewData

func NewData(event monitor.Event, receiver string, vars map[string]any, title string) Data

NewData builds template data from a monitor event and notifykit receiver vars.

type Event

type Event struct {
	MonitorEvent monitor.Event
	Receivers    []kit.ReceiverID
}

Event wraps a monitor event as a notifykit notification.

func NewEvent

func NewEvent(monitorEvent monitor.Event, receivers []kit.ReceiverID) *Event

NewEvent constructs an Event notification.

func (*Event) Data

func (e *Event) Data(receiver string, vars map[string]any, title string) any

Data returns the receiver-scoped template data.

func (*Event) ID

func (e *Event) ID() string

ID returns the stable notification id.

func (*Event) ReceiverIDs

func (e *Event) ReceiverIDs() []kit.ReceiverID

ReceiverIDs returns explicit receiver routing.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router owns notification receiver routing rules.

func NewRouter

func NewRouter(resolvedReceivers []kit.ReceiverID) *Router

NewRouter creates a notification router.

func ReceiversFromConfig

func ReceiversFromConfig(templateFS fs.FS, cfg config.Notifications, logger *slog.Logger) (kit.Receivers, *Router, error)

ReceiversFromConfig builds notifykit receivers and routing policy from Overdue notification config.

func (*Router) ReceiverIDsForEvent

func (r *Router) ReceiverIDsForEvent(event monitor.Event) ([]kit.ReceiverID, bool)

ReceiverIDsForEvent returns explicit receiver routing for an event.

Jump to

Keyboard shortcuts

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