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 ¶
EncodeHooks encodes a list of WebHooks as a byte array in protobuf format.
func EncodeHooksJSON ¶
EncodeHooksJSON encodes a list of WebHooks as JSON.
func Invoke ¶
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 ¶
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) ProtoMessage ¶
func (*HeaderPb) ProtoMessage()
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 ¶
DecodeHooks turns the input of EncodeHooks into a list of WebHook objects.
func DecodeHooksJSON ¶
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 (*WebHookPb) ProtoMessage ¶
func (*WebHookPb) ProtoMessage()