webhook

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(context.Context, Request)
}

Handler can handle a Webhook.

type HandlerFunc

type HandlerFunc func(context.Context, Request)

HandlerFunc implements Handler interface using a single function.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, req Request)

Handle process the Webhook by invoking the underlying function.

type HandlerRegistrar

type HandlerRegistrar interface {
	// Register the given handler to the webhook server.
	WithHandler(h Handler)
}

type Request

type Request struct {
	Event interface{}
}

type Server

type Server struct {
	Addr string

	Path string

	Secret string
	// contains filtered or unexported fields
}

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) WithHandler

func (s *Server) WithHandler(h Handler)

type Webhook

type Webhook struct {
	Handler Handler

	GetSecretFn func() ([]byte, error)
}

func WebhookFor

func WebhookFor(handler Handler) *Webhook

func (*Webhook) Handle

func (wh *Webhook) Handle(ctx context.Context, req Request)

func (*Webhook) ServeHTTP

func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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