notification

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notification manages notification channel configurations and dispatches test events to verify connectivity.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("notification not found")

ErrNotFound is returned when a notification config does not exist.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID        string
	Name      string
	Kind      string // "webhook", "discord", "email"
	Enabled   bool
	Settings  json.RawMessage
	OnEvents  []string // event types this notification fires for
	CreatedAt time.Time
	UpdatedAt time.Time
}

Config is the domain representation of a stored notification configuration.

type CreateRequest

type CreateRequest struct {
	Name     string
	Kind     string
	Enabled  bool
	Settings json.RawMessage
	OnEvents []string
}

CreateRequest carries the fields needed to create a notification config.

type Service

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

Service manages notification configurations.

func NewService

func NewService(q db.Querier, reg *registry.Registry) *Service

NewService creates a new Service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (Config, error)

Create persists a new notification configuration.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete removes a notification config. Returns ErrNotFound if absent.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Config, error)

Get returns a notification config by ID. Returns ErrNotFound if absent.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Config, error)

List returns all notification configs ordered by name.

func (*Service) Test

func (s *Service) Test(ctx context.Context, id string) error

Test instantiates the notifier and sends a test event. Returns ErrNotFound if the config does not exist.

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Config, error)

Update replaces the mutable fields of a notification config. Returns ErrNotFound if the config does not exist.

type UpdateRequest

type UpdateRequest = CreateRequest

UpdateRequest carries the fields needed to update a notification config.

Jump to

Keyboard shortcuts

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