Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

easysoft/gitfox-webhooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

11 Commits

Repository files navigation

GitFox Library Webhooks

Library webhooks allows for easy receiving and parsing of GitFox Webhook Events

Installation

Use go get.

go get -u github.com/easysoft/gitfox-webhooks

Then import the package into your own code.

import "github.com/easysoft/gitfox-webhooks"

Usage

package main
import (
 "net/http"
 "github.com/easysoft/gitfox-webhooks/gitfox"
)
func main() {
 hook, _ := gitfox.New(gitfox.Options.Secret("MyGitFoxSecret...?"))
 http.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
 payload, err := hook.Parse(r, gitfox.BranchUpdatedEvent)
 if err != nil {
 if err == gitfox.ErrEventNotFound {
 // ok event wasn't one of the ones asked to be parsed
 }
 }
 switch payload.(type) {
 case gitfox.BranchUpdatedPayload:
 push := payload.(gitfox.BranchUpdatedPayload)
 // Do whatever you want from here...
 fmt.Printf("%+v", push)
 })
 http.ListenAndServe(":3000", nil)
}

About

Library webhooks allows for easy receiving and parsing of GitFox Webhook Events

Topics

Resources

Security policy

Stars

Watchers

Forks

AltStyle によって変換されたページ (->オリジナル) /