hook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2015 License: Apache-2.0, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

this is gutted/extended from https://github.com/phayes/hookserve/ TODO(jesse): could clean this up alot

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidEventFormat = errors.New("Unable to parse event string. Invalid Format.")

Functions

This section is empty.

Types

type Event

type Event struct {
	Owner      string // The username of the owner of the repository
	Repo       string // The name of the repository
	Ref        string // The ref on the event
	Branch     string // The branch the event took place on
	Commit     string // The head commit hash attached to the event
	Type       string // Can be either "pull_request", "push", "create_tag", "create_branch"
	BaseOwner  string // For Pull Requests, contains the base owner
	BaseRepo   string // For Pull Requests, contains the base repo
	BaseBranch string // For Pull Requests, contains the base branch
}

func (*Event) String

func (e *Event) String() (output string)

type Server

type Server struct {
	Port   int        // Port to listen on. Defaults to 80
	Path   string     // Path to receive on. Defaults to "/postreceive"
	Secret string     // Option secret key for authenticating via HMAC
	Events chan Event // Channel of events. Read from this channel to get push events as they happen.
}

func NewServer

func NewServer() *Server

Create a new server with sensible defaults. By default the Port is set to 80 and the Path is set to `/postreceive`

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

Satisfies the http.Handler interface. Instead of calling Server.ListenAndServe you can integrate hookserve.Server inside your own http server. If you are using hookserve.Server in his way Server.Path should be set to match your mux pattern and Server.Port will be ignored.

func (*Server) ServeHTTPRouter

func (s *Server) ServeHTTPRouter(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

Satisfies the extended httpRouter handler interface which has a paramater

Jump to

Keyboard shortcuts

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