1
1
Library webhooks
2
2
================
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 )
5
5
[ ![ 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 )
7
7
[ ![ 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 )
9
9
![ License] ( https://img.shields.io/dub/l/vibe-d.svg )
10
10
11
11
Library webhooks allows for easy recieving and parsing of GitHub & Bitbucket Webhook Events
@@ -24,20 +24,18 @@ Installation
24
24
25
25
Use go get.
26
26
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
+ ```
32
30
33
31
Then import the validator package into your own code.
34
32
35
- import "gopkg.in/go-playground/webhooks.v1 "
33
+ import "gopkg.in/go-playground/webhooks.v2 "
36
34
37
35
Usage and documentation
38
36
------
39
37
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.
41
39
42
40
##### Examples:
43
41
@@ -49,8 +47,8 @@ import (
49
47
" fmt"
50
48
" strconv"
51
49
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"
54
52
)
55
53
56
54
const (
@@ -59,6 +57,7 @@ const (
59
57
)
60
58
61
59
func main () {
60
+
62
61
hook := github.New (&github.Config {Secret: " MyGitHubSuperSecretSecrect...?" })
63
62
hook.RegisterEvents (HandleRelease, github.ReleaseEvent )
64
63
hook.RegisterEvents (HandlePullRequest, github.PullRequestEvent )
@@ -95,6 +94,7 @@ func HandlePullRequest(payload interface{}, header webhooks.Header) {
95
94
// Do whatever you want from here...
96
95
fmt.Printf (" %+v " , pl)
97
96
}
97
+
98
98
```
99
99
100
100
Single receiver for events you subscribe to
@@ -105,8 +105,8 @@ import (
105
105
" fmt"
106
106
" strconv"
107
107
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"
110
110
)
111
111
112
112
const (
@@ -115,6 +115,7 @@ const (
115
115
)
116
116
117
117
func main () {
118
+
118
119
hook := github.New (&github.Config {Secret: " MyGitHubSuperSecretSecrect...?" })
119
120
hook.RegisterEvents (HandleMultiple, github.ReleaseEvent , github.PullRequestEvent ) // Add as many as you want
120
121
0 commit comments