https://github.com/easysoft/gitfox-webhooks
Library webhooks allows for easy receiving and parsing of GitFox Webhook Events
https://github.com/easysoft/gitfox-webhooks
git
Last synced: 19 days ago
JSON representation
Library webhooks allows for easy receiving and parsing of GitFox Webhook Events
- Host: GitHub
- URL: https://github.com/easysoft/gitfox-webhooks
- Owner: easysoft
- Created: 2024-06-11T15:18:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-01T07:17:33.000Z (11 months ago)
- Last Synced: 2025-07-01T08:25:30.240Z (11 months ago)
- Topics: git
- Language: Go
- Homepage: https://www.gitfox.cc
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitFox Library Webhooks
Library webhooks allows for easy receiving and parsing of GitFox Webhook Events
## Installation
Use go get.
```go
go get -u github.com/easysoft/gitfox-webhooks
```
Then import the package into your own code.
```go
import "github.com/easysoft/gitfox-webhooks"
```
## Usage
```go
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)
}
```