11Library webhooks
22================
3- <img align =" right " src =" https://raw.githubusercontent.com/go-playground/webhooks/v1 /logo.png " >
4- ![ Project status] ( https://img.shields.io/badge/version-1 .0-green.svg )
3+ <img align =" right " src =" https://raw.githubusercontent.com/go-playground/webhooks/v2 /logo.png " >
4+ ![ Project status] ( https://img.shields.io/badge/version-2.0 .0-green.svg )
55[ ![ Build Status] ( https://semaphoreci.com/api/v1/projects/5b9e2eda-8f8d-40aa-8cb4-e3f6120171fe/587820/badge.svg )] ( https://semaphoreci.com/joeybloggs/webhooks )
6- [ ![ Coverage Status] ( https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v1 &service=github )] ( https://coveralls.io/github/go-playground/webhooks?branch=v1 )
6+ [ ![ Coverage Status] ( https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v2 &service=github )] ( https://coveralls.io/github/go-playground/webhooks?branch=v2 )
77[ ![ Go Report Card] ( https://goreportcard.com/badge/go-playground/webhooks )] ( https://goreportcard.com/report/go-playground/webhooks )
8- [ ![ GoDoc] ( https://godoc.org/gopkg.in/go-playground/webhooks.v1 ?status.svg )] ( https://godoc.org/gopkg.in/go-playground/webhooks.v1 )
8+ [ ![ GoDoc] ( https://godoc.org/gopkg.in/go-playground/webhooks.v2 ?status.svg )] ( https://godoc.org/gopkg.in/go-playground/webhooks.v2 )
99![ License] ( https://img.shields.io/dub/l/vibe-d.svg )
1010
1111Library webhooks allows for easy recieving and parsing of GitHub & Bitbucket Webhook Events
@@ -24,20 +24,18 @@ Installation
2424
2525Use go get.
2626
27- go get gopkg.in/go-playground/webhooks.v1
28-
29- or to update
30-
31- go get -u gopkg.in/go-playground/webhooks.v1
27+ ``` shell
28+ go get -u gopkg.in/go-playground/webhooks.v2
29+ ```
3230
3331Then import the validator package into your own code.
3432
35- import "gopkg.in/go-playground/webhooks.v1 "
33+ import "gopkg.in/go-playground/webhooks.v2 "
3634
3735Usage and documentation
3836------
3937
40- Please see http://godoc.org/gopkg.in/go-playground/webhooks.v1 for detailed usage docs.
38+ Please see http://godoc.org/gopkg.in/go-playground/webhooks.v2 for detailed usage docs.
4139
4240##### Examples:
4341
@@ -49,8 +47,8 @@ import (
4947 " fmt"
5048 " strconv"
5149
52- " gopkg.in/go-playground/webhooks.v1 "
53- " gopkg.in/go-playground/webhooks.v1 /github"
50+ " gopkg.in/go-playground/webhooks.v2 "
51+ " gopkg.in/go-playground/webhooks.v2 /github"
5452)
5553
5654const (
@@ -59,6 +57,7 @@ const (
5957)
6058
6159func main () {
60+
6261 hook := github.New (&github.Config {Secret: " MyGitHubSuperSecretSecrect...?" })
6362 hook.RegisterEvents (HandleRelease, github.ReleaseEvent )
6463 hook.RegisterEvents (HandlePullRequest, github.PullRequestEvent )
@@ -95,6 +94,7 @@ func HandlePullRequest(payload interface{}, header webhooks.Header) {
9594 // Do whatever you want from here...
9695 fmt.Printf (" %+v " , pl)
9796}
97+
9898```
9999
100100Single receiver for events you subscribe to
@@ -105,8 +105,8 @@ import (
105105 " fmt"
106106 " strconv"
107107
108- " gopkg.in/go-playground/webhooks.v1 "
109- " gopkg.in/go-playground/webhooks.v1 /github"
108+ " gopkg.in/go-playground/webhooks.v2 "
109+ " gopkg.in/go-playground/webhooks.v2 /github"
110110)
111111
112112const (
@@ -115,6 +115,7 @@ const (
115115)
116116
117117func main () {
118+
118119 hook := github.New (&github.Config {Secret: " MyGitHubSuperSecretSecrect...?" })
119120 hook.RegisterEvents (HandleMultiple, github.ReleaseEvent , github.PullRequestEvent ) // Add as many as you want
120121
0 commit comments