webhook

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package webhook implements a generic gateway.NotificationAdapter that receives arbitrary JSON payloads via HTTP POST.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter implements gateway.NotificationAdapter for generic webhooks.

func New

func New() *Adapter

New creates a new generic webhook adapter with the default name "webhook".

func NewNamed

func NewNamed(name string) *Adapter

NewNamed creates a named webhook adapter (e.g. "webhook:deploy").

func NewWithSecret

func NewWithSecret(name, secret string) *Adapter

NewWithSecret creates a named webhook adapter with shared-secret auth. The secret is validated against Authorization: Bearer <secret> or X-Webhook-Secret: <secret> headers.

func (*Adapter) Channels

func (a *Adapter) Channels() []gateway.ChannelInfo

Channels returns the adapter name as a single channel.

func (*Adapter) HTTPHandler

func (a *Adapter) HTTPHandler() http.Handler

HTTPHandler returns an http.Handler that receives and processes generic webhook payloads.

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) Start

func (a *Adapter) Start(_ context.Context, handler func(gateway.Notification)) error

Start stores the handler. Webhook adapters do not maintain a connection.

func (*Adapter) Status

func (a *Adapter) Status() gateway.AdapterStatus

Status returns the adapter's connection state.

func (*Adapter) Stop

func (a *Adapter) Stop() error

Stop is a no-op for webhook adapters.

func (*Adapter) Type

func (a *Adapter) Type() gateway.AdapterType

Type returns AdapterWebhook.

Jump to

Keyboard shortcuts

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