Skip to content

Commit

Permalink
cleanup imports + README for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Karn authored and Dean Karn committed Oct 20, 2016
1 parent 60d6ca1 commit 1e0ece4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 23 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Library webhooks
================
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v1/logo.png">
![Project status](https://img.shields.io/badge/version-1.0-green.svg)
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v2/logo.png">
![Project status](https://img.shields.io/badge/version-2.0.0-green.svg)
[![Build Status](https://semaphoreci.com/api/v1/projects/5b9e2eda-8f8d-40aa-8cb4-e3f6120171fe/587820/badge.svg)](https://semaphoreci.com/joeybloggs/webhooks)
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v1&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v1)
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v2&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v2)
[![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks)
[![GoDoc](https://godoc.org/gopkg.in/go-playground/webhooks.v1?status.svg)](https://godoc.org/gopkg.in/go-playground/webhooks.v1)
[![GoDoc](https://godoc.org/gopkg.in/go-playground/webhooks.v2?status.svg)](https://godoc.org/gopkg.in/go-playground/webhooks.v2)
![License](https://img.shields.io/dub/l/vibe-d.svg)

Library webhooks allows for easy recieving and parsing of GitHub & Bitbucket Webhook Events
Expand All @@ -24,20 +24,18 @@ Installation

Use go get.

go get gopkg.in/go-playground/webhooks.v1

or to update

go get -u gopkg.in/go-playground/webhooks.v1
```shell
go get -u gopkg.in/go-playground/webhooks.v2
```

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
------

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:

Expand All @@ -49,8 +47,8 @@ import (
"fmt"
"strconv"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v1/github"
"gopkg.in/go-playground/webhooks.v2"
"gopkg.in/go-playground/webhooks.v2/github"
)

const (
Expand All @@ -59,6 +57,7 @@ const (
)

func main() {

hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
Expand Down Expand Up @@ -95,6 +94,7 @@ func HandlePullRequest(payload interface{}, header webhooks.Header) {
// Do whatever you want from here...
fmt.Printf("%+v", pl)
}

```

Single receiver for events you subscribe to
Expand All @@ -105,8 +105,8 @@ import (
"fmt"
"strconv"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v1/github"
"gopkg.in/go-playground/webhooks.v2"
"gopkg.in/go-playground/webhooks.v2/github"
)

const (
Expand All @@ -115,6 +115,7 @@ const (
)

func main() {

hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want

Expand Down
2 changes: 1 addition & 1 deletion bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"net/http"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v2"
)

// Webhook instance contains all methods needed to process events
Expand Down
2 changes: 1 addition & 1 deletion bitbucket/bitbucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

. "gopkg.in/go-playground/assert.v1"
"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v2"
)

// NOTES:
Expand Down
5 changes: 3 additions & 2 deletions examples/multiple-handlers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strconv"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v1/github"
"gopkg.in/go-playground/webhooks.v2"
"gopkg.in/go-playground/webhooks.v2/github"
)

const (
Expand All @@ -14,6 +14,7 @@ const (
)

func main() {

hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
hook.RegisterEvents(HandleRelease, github.ReleaseEvent)
hook.RegisterEvents(HandlePullRequest, github.PullRequestEvent)
Expand Down
5 changes: 3 additions & 2 deletions examples/single-handler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strconv"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v1/github"
"gopkg.in/go-playground/webhooks.v2"
"gopkg.in/go-playground/webhooks.v2/github"
)

const (
Expand All @@ -14,6 +14,7 @@ const (
)

func main() {

hook := github.New(&github.Config{Secret: "MyGitHubSuperSecretSecrect...?"})
hook.RegisterEvents(HandleMultiple, github.ReleaseEvent, github.PullRequestEvent) // Add as many as you want

Expand Down
2 changes: 1 addition & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"io/ioutil"
"net/http"

"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v2"
)

// Webhook instance contains all methods needed to process events
Expand Down
2 changes: 1 addition & 1 deletion github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

. "gopkg.in/go-playground/assert.v1"
"gopkg.in/go-playground/webhooks.v1"
"gopkg.in/go-playground/webhooks.v2"
)

// NOTES:
Expand Down

0 comments on commit 1e0ece4

Please sign in to comment.