Help us shape the future of Go! Take the 2026 Go Developer Survey

notifications

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllEventTypeStrings

func AllEventTypeStrings() []string

func BuildNotifiarrTestPayload added in v1.29.0

func BuildNotifiarrTestPayload(event Event) (json.RawMessage, error)

BuildNotifiarrTestPayload formats a synthetic event for the manual payload generator. It uses no stores or network services and returns nil for events with no title or message.

func IsValidEventType

func IsValidEventType(value string) bool

func NormalizeEventTypes

func NormalizeEventTypes(input []string) ([]string, error)

func ValidateNotifiarrAPIKey

func ValidateNotifiarrAPIKey(ctx context.Context, rawURL string) error

func ValidateURL

func ValidateURL(rawURL string) error

Types

type AutomationActionSummary

type AutomationActionSummary struct {
	Action  string `json:"action"`
	Label   string `json:"label"`
	Applied int    `json:"applied"`
	Failed  int    `json:"failed"`
}

type AutomationRuleSummary

type AutomationRuleSummary struct {
	RuleID   int                       `json:"rule_id,omitempty"`
	RuleName string                    `json:"rule_name"`
	Applied  int                       `json:"applied"`
	Failed   int                       `json:"failed"`
	Actions  []AutomationActionSummary `json:"actions,omitempty"`
}

type AutomationsEventData

type AutomationsEventData struct {
	Applied int                     `json:"applied"`
	Failed  int                     `json:"failed"`
	Rules   []AutomationRuleSummary `json:"rules,omitempty"`
	Samples []string                `json:"samples,omitempty"`
}

type CrossSeedEventData

type CrossSeedEventData struct {
	RunID      int64  `json:"run_id,omitempty"`
	Mode       string `json:"mode,omitempty"`
	Status     string `json:"status,omitempty"`
	FeedItems  int    `json:"feed_items,omitempty"`
	Candidates int    `json:"candidates,omitempty"`
	Processed  int    `json:"processed,omitempty"`
	Total      int    `json:"total,omitempty"`
	Matches    int    `json:"matches,omitempty"`
	Complete   int    `json:"complete,omitempty"`
	Pending    int    `json:"pending,omitempty"`
	Added      int    `json:"added,omitempty"`
	// TorrentsWithCrossSeeds is set for seeded search runs only: the number of
	// search candidates that produced at least one cross-seed.
	TorrentsWithCrossSeeds int      `json:"torrents_with_cross_seeds,omitzero"`
	Failed                 int      `json:"failed,omitempty"`
	Skipped                int      `json:"skipped,omitempty"`
	Recommendation         string   `json:"recommendation,omitempty"`
	Samples                []string `json:"samples,omitempty"`
}

type Event

type Event struct {
	Type                     EventType
	Title                    string
	Message                  string
	StartedAt                *time.Time
	CompletedAt              *time.Time
	CrossSeed                *CrossSeedEventData
	Automations              *AutomationsEventData
	InstanceID               int
	InstanceName             string
	TorrentName              string
	TorrentHash              string
	TorrentAddedOn           int64
	TorrentETASeconds        int64
	TorrentState             string
	TorrentProgress          float64
	TorrentRatio             float64
	TorrentTotalSizeBytes    int64
	TorrentDownloadedBytes   int64
	TorrentAmountLeftBytes   int64
	TorrentDlSpeedBps        int64
	TorrentUpSpeedBps        int64
	TorrentNumSeeds          int64
	TorrentNumLeechs         int64
	TrackerDomain            string
	Category                 string
	Tags                     []string
	BackupKind               models.BackupRunKind
	BackupRunID              int64
	BackupTorrentCount       int
	DirScanRunID             int64
	DirScanMatchesFound      int
	DirScanTorrentsAdded     int
	OrphanScanRunID          int64
	OrphanScanPartial        bool
	OrphanScanFilesFound     int
	OrphanScanFilesDeleted   int
	OrphanScanFoldersDeleted int
	ErrorMessage             string
	ErrorMessages            []string
}

type EventDefinition

type EventDefinition struct {
	Type        EventType `json:"type"`
	Label       string    `json:"label"`
	Description string    `json:"description"`
}

func EventDefinitions

func EventDefinitions() []EventDefinition

type EventType

type EventType string
const (
	EventTorrentAdded                 EventType = "torrent_added"
	EventTorrentCompleted             EventType = "torrent_completed"
	EventBackupSucceeded              EventType = "backup_succeeded"
	EventBackupFailed                 EventType = "backup_failed"
	EventDirScanCompleted             EventType = "dir_scan_completed"
	EventDirScanFailed                EventType = "dir_scan_failed"
	EventOrphanScanCompleted          EventType = "orphan_scan_completed"
	EventOrphanScanFailed             EventType = "orphan_scan_failed"
	EventCrossSeedAutomationSucceeded EventType = "cross_seed_automation_succeeded"
	EventCrossSeedAutomationFailed    EventType = "cross_seed_automation_failed"
	EventCrossSeedSearchSucceeded     EventType = "cross_seed_search_succeeded"
	EventCrossSeedSearchFailed        EventType = "cross_seed_search_failed"
	EventCrossSeedCompletionSucceeded EventType = "cross_seed_completion_succeeded"
	EventCrossSeedCompletionFailed    EventType = "cross_seed_completion_failed"
	EventCrossSeedWebhookSucceeded    EventType = "cross_seed_webhook_succeeded"
	EventCrossSeedWebhookFailed       EventType = "cross_seed_webhook_failed"
	EventAutomationsActionsApplied    EventType = "automations_actions_applied"
	EventAutomationsRunFailed         EventType = "automations_run_failed"
)

type LabelCount

type LabelCount struct {
	Label string `json:"label"`
	Count int    `json:"count"`
}

type Notifier

type Notifier interface {
	Notify(ctx context.Context, event Event)
}

type Service

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

func NewService

func NewService(store *models.NotificationTargetStore, instanceStore *models.InstanceStore, logger zerolog.Logger) *Service

func (*Service) Notify

func (s *Service) Notify(ctx context.Context, event Event)

func (*Service) SendTest

func (s *Service) SendTest(ctx context.Context, target *models.NotificationTarget, title, message string) error

func (*Service) Start

func (s *Service) Start(ctx context.Context)

Jump to

Keyboard shortcuts

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