webhook

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SecretKey        = "secret"
	AuthorizationKey = "authorization"
	Origin           = "hoist.ketch.com"
)

Variables

View Source
var (
	Accepted              = errors.New("accepted")
	BackoffError          = newRetryableWebhookError("too many requests")
	NotAllowedError       = newPermanentWebhookError("not allowed")
	GoneError             = newPermanentWebhookError("webhook no longer exists")
	UnsupportedMediaError = newPermanentWebhookError("webhook does not support this content type")
	Unauthorized          = newPermanentWebhookError("unauthorized")
)

Functions

func IsRetryable

func IsRetryable(err error) bool

Types

type Client

type Client struct {
	Headers http.Header
	// contains filtered or unexported fields
}

Client is a client for sending requests to Webhooks

func NewClient

func NewClient(ctx context.Context, mode Mode, url string, maxQPS uint64, tls orlop.TLSConfig, auth orlop.KeyConfig,
	secret orlop.KeyConfig, vault orlop.VaultConfig) (*Client, error)

NewClient returns a new Webhook Client

func (*Client) MaxQPS

func (s *Client) MaxQPS() uint64

MaxQPS returns the current maximum QPS setting

func (*Client) Send

func (s *Client) Send(ctx context.Context, event *cloudevents.Event) error

Send an event to the webhook

func (*Client) Validate

func (s *Client) Validate(ctx context.Context) error

Validate a webhook target

type Error

type Error interface {
	Retryable() bool
}

type Mode

type Mode int
const (
	Binary Mode = iota
	Structured
)

Jump to

Keyboard shortcuts

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