hooks

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invoke

func Invoke(hooks []WebHook, payload []byte, contentType string) error

Invoke invokes all the web hooks stored in the configuration, in parallel. It will block the calling goroutine. When it has a response from each of the configured targets, it will return either nil to indicate that the hooks all succeeded, or an error to indicate that at least one of the hooks failed.

Types

type Header struct {
	Name  string `json:"name",yaml:"name"`
	Value string `json:"value",yaml:"value"`
}

A Header is simply a key-value pair. Each web hook can optionally specify a set of headers that it will send on each request.

type WebHook

type WebHook struct {
	URI     string            `json:"uri",yaml:"uri"`
	Headers map[string]string `json:"headers,omitempty",yaml:"headers,omitempty"`
}

A WebHook defines a single hook. The URL describes what we will call. A WebHook will be implemented as an HTTP (or HTTPS) POST to the specified URI, with content type and content defined by the user of this package. The target must return a status code in the "200" to indicate that the hook succeeded. Anything else will be interpreted as an error.

Jump to

Keyboard shortcuts

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