notification

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidChannel      = errors.New("invalid notification channel")
	ErrChannelNameConflict = errors.New("channel name conflict")
	ErrInvalidPolicy       = errors.New("invalid notification policy")
	ErrPolicyNameConflict  = errors.New("policy name conflict")
)

Functions

This section is empty.

Types

type CreateChannelRequest

type CreateChannelRequest struct {
	Name    string             `json:"name"`
	Type    models.ChannelType `json:"type"`
	Config  map[string]any     `json:"config"`
	Enabled *bool              `json:"enabled,omitempty"`
}

type CreatePolicyRequest

type CreatePolicyRequest struct {
	Name       string         `json:"name"`
	ChannelID  uuid.UUID      `json:"channel_id"`
	EventTypes []string       `json:"event_types"`
	Filters    map[string]any `json:"filters,omitempty"`
	Enabled    *bool          `json:"enabled,omitempty"`
}

type ListRequest

type ListRequest struct {
	Limit   uint64
	Offset  uint64
	OrderBy []string
}

type Service

type Service interface {
	// Channels
	ListChannels(req *ListRequest) ([]models.NotificationChannel, error)
	GetChannel(id uuid.UUID) (*models.NotificationChannel, error)
	CreateChannel(req *CreateChannelRequest) (*models.NotificationChannel, error)
	UpdateChannel(id uuid.UUID, req *UpdateChannelRequest) (*models.NotificationChannel, error)
	DeleteChannel(id uuid.UUID) error

	// Policies
	ListPolicies(req *ListRequest) ([]models.NotificationPolicy, error)
	GetPolicy(id uuid.UUID) (*models.NotificationPolicy, error)
	CreatePolicy(req *CreatePolicyRequest) (*models.NotificationPolicy, error)
	UpdatePolicy(id uuid.UUID, req *UpdatePolicyRequest) (*models.NotificationPolicy, error)
	DeletePolicy(id uuid.UUID) error
}

Service manages notification channels and policies.

func New

func New(ctx context.Context) Service

New returns a new notification service.

type UpdateChannelRequest

type UpdateChannelRequest struct {
	Name    *string        `json:"name,omitempty"`
	Config  map[string]any `json:"config,omitempty"`
	Enabled *bool          `json:"enabled,omitempty"`
}

type UpdatePolicyRequest

type UpdatePolicyRequest struct {
	Name       *string        `json:"name,omitempty"`
	ChannelID  *uuid.UUID     `json:"channel_id,omitempty"`
	EventTypes []string       `json:"event_types,omitempty"`
	Filters    map[string]any `json:"filters,omitempty"`
	Enabled    *bool          `json:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

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