Documentation
¶
Overview ¶
hooks is the entrypoint for this project: it handles the GitHub webhooks and funnels the data into the various action functions registered to it.
Index ¶
- type EventHandler
- type EventHandlerMap
- type EventType
- type GlobalHandler
- func (h *GlobalHandler) AcceptedEventTypes() []EventType
- func (h *GlobalHandler) FireHandlers(handlers []EventHandler, eventType string, payload []byte) int
- func (h *GlobalHandler) HandlePayload(w http.ResponseWriter, r *http.Request, payload []byte)
- func (h *GlobalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type HookHandler
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
EventHandler is An event handler takes in a given event and operates on it.
type EventHandlerMap ¶
type EventHandlerMap map[EventType][]EventHandler
func (EventHandlerMap) AddHandler ¶
func (m EventHandlerMap) AddHandler(eventType EventType, handler EventHandler)
type EventType ¶
type EventType string
var ( CommitCommentEvent EventType = "commit_comment" CreateEvent EventType = "create" DeleteEvent EventType = "delete" DeploymentEvent EventType = "deployment" DeploymentStatusEvent EventType = "deployment_status" ForkEvent EventType = "fork" GollumEvent EventType = "gollum" IssueCommentEvent EventType = "issue_comment" IssuesEvent EventType = "issues" MemberEvent EventType = "member" MembershipEvent EventType = "membership" PageBuildEvent EventType = "page_build" PublicEvent EventType = "public" PullRequestEvent EventType = "pull_request" PullRequestReviewEvent EventType = "pull_request_review" PullRequestReviewCommentEvent EventType = "pull_request_review_comment" PushEvent EventType = "push" ReleaseEvent EventType = "release" RepositoryEvent EventType = "repository" StatusEvent EventType = "status" TeamAddEvent EventType = "team_add" WatchEvent EventType = "watch" )
type GlobalHandler ¶
type GlobalHandler struct { Context *ctx.Context EventHandlers EventHandlerMap // contains filtered or unexported fields }
GlobalHandler is a handy handler which can take in every event, choose which handlers to fire, and fires them.
func (*GlobalHandler) AcceptedEventTypes ¶
func (h *GlobalHandler) AcceptedEventTypes() []EventType
AcceptedEventTypes returns an array of all event types the GlobalHandler can accept.
func (*GlobalHandler) FireHandlers ¶
func (h *GlobalHandler) FireHandlers(handlers []EventHandler, eventType string, payload []byte) int
func (*GlobalHandler) HandlePayload ¶
func (h *GlobalHandler) HandlePayload(w http.ResponseWriter, r *http.Request, payload []byte)
HandlePayload handles the actual unpacking of the payload and firing of the proper handlers. It will never respond with anything but a 200.
func (*GlobalHandler) ServeHTTP ¶
func (h *GlobalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles the incoming HTTP request, validates the payload and fires
type HookHandler ¶
type HookHandler interface {
HandlePayload(w http.ResponseWriter, r *http.Request, payload []byte)
}
HookHandler describes the interface for any type which can handle a webhook payload.