webhook

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Event     string    `json:"event"`
	Timestamp time.Time `json:"timestamp"`
	Detail    any       `json:"detail,omitempty"`
}

Event is the JSON payload sent to the webhook endpoint.

type Notifier

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

Notifier sends webhook notifications for configured events. It is a no-op when WebhookURL is empty or the event is not in WebhookEvents.

func New

func New(url string, events []string, log zerolog.Logger) *Notifier

New creates a Notifier. If url is empty, all calls to Fire are no-ops. events is the list of event names to deliver (empty = all events).

func (*Notifier) Fire

func (n *Notifier) Fire(ctx context.Context, event string, detail any)

Fire delivers an event to the configured webhook URL. If the URL is empty or the event name is not in the allowed set, it is a no-op. HTTP errors are logged as warnings and never returned.

Jump to

Keyboard shortcuts

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