notifications

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 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 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"`
	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
	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