webhook

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package webhook delivers librarr event notifications to configured webhook endpoints such as Discord.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID      int64  `json:"id"`
	Name    string `json:"name"`
	URL     string `json:"url"`
	Type    string `json:"type"` // "discord" or "generic"
	Enabled bool   `json:"enabled"`
	Events  string `json:"events"` // comma-separated event types, or "*" for all
}

Config represents a webhook endpoint configuration.

type EventType

type EventType string

EventType represents the type of webhook event.

const (
	EventDownloadComplete EventType = "download_complete"
	EventDownloadFailed   EventType = "download_failed"
	EventRequestApproved  EventType = "request_approved"
	EventRequestCompleted EventType = "request_completed"
	EventRequestFailed    EventType = "request_failed"
	EventSchedulerMatch   EventType = "scheduler_match"
	EventSeriesMissing    EventType = "series_missing"
	EventInfo             EventType = "info"
)

type Payload

type Payload struct {
	Event     EventType              `json:"event"`
	Title     string                 `json:"title"`
	Message   string                 `json:"message"`
	Status    string                 `json:"status"` // completed, failed, info
	Timestamp string                 `json:"timestamp"`
	Extra     map[string]interface{} `json:"extra,omitempty"`
}

Payload is the data sent to webhooks.

type Sender

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

Sender manages sending webhook notifications.

func NewSender

func NewSender() *Sender

NewSender creates a new webhook sender.

func (*Sender) GetConfigs

func (s *Sender) GetConfigs() []Config

GetConfigs returns a copy of current configurations.

func (*Sender) Send

func (s *Sender) Send(payload Payload)

Send dispatches a webhook payload asynchronously to all matching configs.

func (*Sender) SetConfigs

func (s *Sender) SetConfigs(configs []Config)

SetConfigs replaces the current webhook configurations.

func (*Sender) Test

func (s *Sender) Test(url, webhookType string) error

Test sends a test payload to a specific webhook URL.

Jump to

Keyboard shortcuts

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