hooks

package
v0.5.3 Latest Latest
Warning

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

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

Documentation

Overview

Package hooks is a generated protocol buffer package.

It is generated from these files:

webhookconfig.proto

It has these top-level messages:

HeaderPb
WebHookPb
WebHookConfigPb

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeHooks

func EncodeHooks(hooks []WebHook) []byte

EncodeHooks encodes a list of WebHooks as a byte array in protobuf format.

func EncodeHooksJSON

func EncodeHooksJSON(hooks []WebHook) []byte

EncodeHooksJSON encodes a list of WebHooks as JSON.

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"`
	Value string `json:"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 HeaderPb

type HeaderPb struct {
	Name             *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
	Value            *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*HeaderPb) GetName

func (m *HeaderPb) GetName() string

func (*HeaderPb) GetValue

func (m *HeaderPb) GetValue() string

func (*HeaderPb) ProtoMessage

func (*HeaderPb) ProtoMessage()

func (*HeaderPb) Reset

func (m *HeaderPb) Reset()

func (*HeaderPb) String

func (m *HeaderPb) String() string

type WebHook

type WebHook struct {
	URI     string            `json:"uri"`
	Headers map[string]string `json:"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.

func DecodeHooks

func DecodeHooks(buf []byte) ([]WebHook, error)

DecodeHooks turns the input of EncodeHooks into a list of WebHook objects.

func DecodeHooksJSON

func DecodeHooksJSON(buf []byte) ([]WebHook, error)

DecodeHooksJSON turns the JSON representation of the hooks into a list of WebHook objects.

type WebHookConfigPb

type WebHookConfigPb struct {
	Hooks            []*WebHookPb `protobuf:"bytes,1,rep,name=hooks" json:"hooks,omitempty"`
	XXX_unrecognized []byte       `json:"-"`
}

func (*WebHookConfigPb) GetHooks

func (m *WebHookConfigPb) GetHooks() []*WebHookPb

func (*WebHookConfigPb) ProtoMessage

func (*WebHookConfigPb) ProtoMessage()

func (*WebHookConfigPb) Reset

func (m *WebHookConfigPb) Reset()

func (*WebHookConfigPb) String

func (m *WebHookConfigPb) String() string

type WebHookPb

type WebHookPb struct {
	Url              *string     `protobuf:"bytes,1,req,name=url" json:"url,omitempty"`
	Headers          []*HeaderPb `protobuf:"bytes,2,rep,name=headers" json:"headers,omitempty"`
	XXX_unrecognized []byte      `json:"-"`
}

func (*WebHookPb) GetHeaders

func (m *WebHookPb) GetHeaders() []*HeaderPb

func (*WebHookPb) GetUrl

func (m *WebHookPb) GetUrl() string

func (*WebHookPb) ProtoMessage

func (*WebHookPb) ProtoMessage()

func (*WebHookPb) Reset

func (m *WebHookPb) Reset()

func (*WebHookPb) String

func (m *WebHookPb) String() string

Jump to

Keyboard shortcuts

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