webhook

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package webhook handles the management of webhooks and webhook deliveries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeliveryTask

type DeliveryTask struct {
	Event   models.WebhookEvent
	Payload any
}

DeliveryTask represents a webhook delivery task

type Manager

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

Manager handles webhook-related operations.

func New

func New(opts Opts) (*Manager, error)

New creates and returns a new instance of the Manager.

func (*Manager) Close

func (m *Manager) Close()

Close signals the manager to stop processing and waits for all workers to finish.

func (*Manager) Create

func (m *Manager) Create(webhook models.Webhook) (models.Webhook, error)

Create creates a new webhook.

func (*Manager) Delete

func (m *Manager) Delete(id int) error

Delete deletes a webhook by ID.

func (*Manager) Get

func (m *Manager) Get(id int) (models.Webhook, error)

Get retrieves a webhook by ID.

func (*Manager) GetAll

func (m *Manager) GetAll() ([]models.Webhook, error)

GetAll retrieves all webhooks.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run starts the webhook delivery worker pool.

func (*Manager) SendTestWebhook

func (m *Manager) SendTestWebhook(id int) error

SendTestWebhook sends a test webhook to the specified webhook ID.

func (*Manager) Toggle

func (m *Manager) Toggle(id int) (models.Webhook, error)

Toggle toggles the active status of a webhook by ID.

func (*Manager) TriggerEvent

func (m *Manager) TriggerEvent(event models.WebhookEvent, data any)

TriggerEvent triggers webhooks for a specific event with the provided data.

func (*Manager) Update

func (m *Manager) Update(id int, webhook models.Webhook) (models.Webhook, error)

Update updates a webhook by ID.

type Opts

type Opts struct {
	DB            *sqlx.DB
	Lo            *logf.Logger
	I18n          *i18n.I18n
	Workers       int
	QueueSize     int
	Timeout       time.Duration
	EncryptionKey string
}

Opts contains options for initializing the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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