Documentation
¶
Index ¶
Constants ¶
View Source
const ( KeyInsecureMode = weque.KeyInsecureMode KeySecretToken = weque.KeySecretToken )
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(h Handler, events chan<- *Context) http.HandlerFunc
Types ¶
type Context ¶
type Context struct {
Webhook *Webhook
WebhookProvider WebhookProvider
}
type Handler ¶
type Handler interface {
/*
* Return the requiest ID string
*/
RequestID(r *http.Request) string
/*
* Return nil if the request is acceptable.
*/
Verify(r *http.Request, body []byte) error
/*
* Returns true if the request is just a ping but not actual webhook.
*/
IsPing(r *http.Request, body []byte) bool
/*
* Returns a Webhook for the given response body.
*/
Unmarshal(r *http.Request, body []byte) (*Webhook, error)
/** */
WebhookProvider() WebhookProvider
}
type Webhook ¶
type Webhook struct {
Repository struct {
Name string `json:"name"`
Owner struct {
Name string `json:"name"`
} `json:"owner"`
} `json:"repository"`
Event string `json:"event"`
Delivery string `json:"delivery"`
Ref string `json:"ref"`
After string `json:"after"`
Before string `json:"before"`
Created bool `json:"created"`
Deleted bool `json:"deleted"`
//Head_commit map[string]interface{} `json:"head_commit,omitempty"`
Pusher struct {
Name string `json:"name"`
} `json:"pusher,omitempty"`
}
* Normalized webhook payload. * * This structure is for GitHub webhook. * https://developer.github.com/webhooks/ * * This doesn't contain all fields of GitHub webhook payload * because it's designed to propagate event into other KVS, queue, pub/sub, etc. * which event payload max size is not so much, for example, consul is 512 bytes.
Click to show internal directories.
Click to hide internal directories.