Documentation
¶
Index ¶
- type Dispatcher
- func (d *Dispatcher) Delete(ctx context.Context, id string) error
- func (d *Dispatcher) Get(ctx context.Context, id string) (*Webhook, error)
- func (d *Dispatcher) List(ctx context.Context) ([]Webhook, error)
- func (d *Dispatcher) Register(ctx context.Context, id, url string, patterns []string, secret string) (*Webhook, error)
- func (d *Dispatcher) Start()
- func (d *Dispatcher) Stop()
- func (d *Dispatcher) TestFire(ctx context.Context, id string) error
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher manages webhooks and dispatches events to matching URLs.
func (*Dispatcher) Delete ¶
func (d *Dispatcher) Delete(ctx context.Context, id string) error
Delete removes a webhook by ID.
func (*Dispatcher) List ¶
func (d *Dispatcher) List(ctx context.Context) ([]Webhook, error)
List returns all webhooks.
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(ctx context.Context, id, url string, patterns []string, secret string) (*Webhook, error)
Register adds a new webhook. Returns the created webhook.
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start()
Start subscribes to all events and dispatches to matching webhooks.
type Webhook ¶
type Webhook struct {
ID string `json:"id"`
URL string `json:"url"`
Patterns []string `json:"patterns"`
Secret string `json:"secret,omitempty"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
LastFired time.Time `json:"last_fired,omitempty"`
FailCount int `json:"fail_count"`
}
Webhook represents a registered webhook.
Click to show internal directories.
Click to hide internal directories.