webhook

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Registry = map[string]*Def{}

Registry of all outgoing webhook provider

Functions

func Register

func Register(name string, def *Def)

Register add webhook provider definition to the registry

Types

type Creator

type Creator func(srv model.OutgoingWebhook, conf config.Config) (Provider, error)

Creator function for create an webhook provider

type Def

type Def struct {
	Name   string
	Desc   string
	Create Creator
}

Def is a webhook provider definition

type Provider

type Provider interface {
	Send(ctx context.Context, article model.Article) (*Result, error)
}

Provider outgoing webhook provider interface

func NewOutgoingWebhookProvider

func NewOutgoingWebhookProvider(webhook model.OutgoingWebhook, conf config.Config) (Provider, error)

NewOutgoingWebhookProvider create new outgoing webhook provider

type Result

type Result struct {
	URL  *string                 `json:"url,omitempty"`
	Text *string                 `json:"text,omitempty"`
	JSON *map[string]interface{} `json:"json,omitempty"`
}

Result of an outgoing webhook call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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