cleanup imports + README for v2
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
Library webhooks
|
Library webhooks
|
||||||
================
|
================
|
||||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v1/logo.png">
|
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v2/logo.png">
|
||||||

|

|
||||||
[](https://semaphoreci.com/joeybloggs/webhooks)
|
[](https://semaphoreci.com/joeybloggs/webhooks)
|
||||||
[](https://coveralls.io/github/go-playground/webhooks?branch=v1)
|
[](https://coveralls.io/github/go-playground/webhooks?branch=v2)
|
||||||
[](https://goreportcard.com/report/go-playground/webhooks)
|
[](https://goreportcard.com/report/go-playground/webhooks)
|
||||||
[](https://godoc.org/gopkg.in/go-playground/webhooks.v1)
|
[](https://godoc.org/gopkg.in/go-playground/webhooks.v2)
|
||||||

|

|
||||||
|
|
||||||
Library webhooks allows for easy recieving and parsing of GitHub & Bitbucket Webhook Events
|
Library webhooks allows for easy recieving and parsing of GitHub & Bitbucket Webhook Events
|
||||||
@@ -24,20 +24,18 @@ Installation
|
|||||||
|
|
||||||
Use go get.
|
Use go get.
|
||||||
|
|
||||||
go get gopkg.in/go-playground/webhooks.v1
|
```shell
|
||||||
|
go get -u gopkg.in/go-playground/webhooks.v2
|
||||||
or to update
|
```
|
||||||
|
|
||||||
go get -u gopkg.in/go-playground/webhooks.v1
|
|
||||||
|
|
||||||
Then import the validator package into your own code.
|
Then import the validator package into your own code.
|
||||||
|
|
||||||
import "gopkg.in/go-playground/webhooks.v1"
|
import "gopkg.in/go-playground/webhooks.v2"
|
||||||
|
|
||||||
Usage and documentation
|
Usage and documentation
|
||||||
------
|
------
|
||||||
|
|
||||||
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v1 for detailed usage docs.
|
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v2 for detailed usage docs.
|
||||||
|
|
||||||
##### Examples:
|
##### Examples:
|
||||||
|
|
||||||
@@ -49,8 +47,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
"gopkg.in/go-playground/webhooks.v1/github"
|
"gopkg.in/go-playground/webhooks.v2/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -59,6 +57,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
||||||
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
|
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
|
||||||
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
|
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
|
||||||
@@ -95,6 +94,7 @@ func HandlePullRequest(payload interface{}, header webhooks.Header) {
|
|||||||
// Do whatever you want from here...
|
// Do whatever you want from here...
|
||||||
fmt.Printf("%+v", pl)
|
fmt.Printf("%+v", pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Single receiver for events you subscribe to
|
Single receiver for events you subscribe to
|
||||||
@@ -105,8 +105,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
"gopkg.in/go-playground/webhooks.v1/github"
|
"gopkg.in/go-playground/webhooks.v2/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -115,6 +115,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
||||||
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want
|
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "gopkg.in/go-playground/assert.v1"
|
. "gopkg.in/go-playground/assert.v1"
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
"gopkg.in/go-playground/webhooks.v1/github"
|
"gopkg.in/go-playground/webhooks.v2/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -14,6 +14,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
||||||
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
|
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
|
||||||
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
|
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
"gopkg.in/go-playground/webhooks.v1/github"
|
"gopkg.in/go-playground/webhooks.v2/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -14,6 +14,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
|
||||||
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want
|
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "gopkg.in/go-playground/assert.v1"
|
. "gopkg.in/go-playground/assert.v1"
|
||||||
"gopkg.in/go-playground/webhooks.v1"
|
"gopkg.in/go-playground/webhooks.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
|
|||||||
Reference in New Issue
Block a user