repository

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Shorten

func Shorten(s string, n int) string

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.

func (*Webhook) Env

func (wh *Webhook) Env() []string

type WebhookProvider

type WebhookProvider interface {
	Name() string
	IconURL() string
	RepositoryURL(w *Webhook) string
	CommitURL(w *Webhook) string
	CompareURL(w *Webhook) string
	RefURL(w *Webhook) string
	PusherURL(w *Webhook) string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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