webhook

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

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