Skip to content

Commit

Permalink
move to v6 respecting go modules release guidelines (#91)
Browse files Browse the repository at this point in the history
* move to v6 respecting go modules release guidelines

* Update UPGRADING.md

* set ClientVersion to 6.0.0

* update badge

Co-authored-by: Sarath Pillai <[email protected]>
  • Loading branch information
sarathsp06 and Sarath Pillai committed Aug 18, 2020
1 parent 23b045e commit 1f4ec5f
Show file tree
Hide file tree
Showing 45 changed files with 68 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: go
go_import_path: github.com/messagebird/go-rest-api
go_import_path: github.com/messagebird/go-rest-api/v6
go:
- "1.13"
- "1.14"
- "1.15"
- stable
- master
matrix:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MessageBird's REST API for Go
=============================
This repository contains the open source Go client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com.

[![Build Status](https://travis-ci.org/messagebird/go-rest-api.svg?branch=master)](https://travis-ci.org/messagebird/go-rest-api) [![GoDoc](https://godoc.org/github.com/messagebird/go-rest-api?status.svg)](https://godoc.org/github.com/messagebird/go-rest-api)
[![Build Status](https://travis-ci.org/messagebird/go-rest-api.svg?branch=master)](https://travis-ci.org/messagebird/go-rest-api) [![PkgGoDev](https://pkg.go.dev/badge/github.com/messagebird/go-rest-api)](https://pkg.go.dev/github.com/messagebird/go-rest-api)

Requirements
------------
Expand All @@ -15,15 +15,15 @@ Installation
The easiest way to use the MessageBird API in your Go project is to install it using *go get*:

```
$ go get github.com/messagebird/go-rest-api
$ go get github.com/messagebird/go-rest-api/v6
```

Examples
--------
Here is a quick example on how to get started. Assuming the **go get** installation worked, you can import the messagebird package like this:

```go
import "github.com/messagebird/go-rest-api"
import "github.com/messagebird/go-rest-api/v6"
```

Then, create an instance of **messagebird.Client**. It can be used to access the MessageBird APIs.
Expand Down Expand Up @@ -69,8 +69,8 @@ For this reason, errors returned by the `voice` package are of type `voice.Error
An example of "simple" error handling is shown in the example above. Let's look how we can gain more in-depth insight in what exactly went wrong:

```go
import "github.com/messagebird/go-rest-api"
import "github.com/messagebird/go-rest-api/sms"
import "github.com/messagebird/go-rest-api/v6"
import "github.com/messagebird/go-rest-api/v6/sms"

// ...

Expand All @@ -91,7 +91,7 @@ if err != nil {
`voice.ErrorResponse` is very similar, except that it holds `voice.Error` structs - those contain only `Code` and `Message` (not description!) fields:

```go
import "github.com/messagebird/go-rest-api/voice"
import "github.com/messagebird/go-rest-api/v6/voice"

// ...

Expand Down
9 changes: 9 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,12 @@ if err != nil {

### Other improvements
Although those are all breaking changes, it's worth mentioning this new version brings a number of other improvements. An example is that the client now supports contacts and groups - enjoy!


## `v5.5.0` -> `v6.0.0`
### Version suffix
To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element.

So all imports of `go-rest-api` are replaced as `go-rest-api/v6`.


2 changes: 1 addition & 1 deletion balance/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package balance
import (
"net/http"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// Balance describes your balance information.
Expand Down
4 changes: 2 additions & 2 deletions balance/balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"testing"

messagebird "github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/internal/mbtest"
messagebird "github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

const Epsilon float32 = 0.001
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

const (
// ClientVersion is used in User-Agent request header to provide server with API level.
ClientVersion = "5.5.0"
ClientVersion = "6.0.0"

// Endpoint points you to MessageBird REST API.
Endpoint = "https://rest.messagebird.com"
Expand Down
2 changes: 1 addition & 1 deletion contact/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// Contact gets returned by the API.
Expand Down
2 changes: 1 addition & 1 deletion contact/contact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion conversation/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion conversation/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/http"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// ListOptions can be used to set pagination options in List().
Expand Down
2 changes: 1 addition & 1 deletion conversation/conversation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion conversation/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/http"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

type MessageCreateRequest struct {
Expand Down
2 changes: 1 addition & 1 deletion conversation/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"testing"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestCreateMessage(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion conversation/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package conversation
import (
"net/http"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

type WebhookCreateRequest struct {
Expand Down
2 changes: 1 addition & 1 deletion conversation/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"testing"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestCreateWebhook(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/messagebird/go-rest-api
module github.com/messagebird/go-rest-api/v6

go 1.13
go 1.14
4 changes: 2 additions & 2 deletions group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"strings"
"time"

messagebird "github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/contact"
messagebird "github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/contact"
)

// Group gets returned by the API.
Expand Down
2 changes: 1 addition & 1 deletion group/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion hlr/hlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// HLR stands for Home Location Register. Contains information about the
Expand Down
4 changes: 2 additions & 2 deletions hlr/hlr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion internal/mbtest/test_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"testing"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// testWriter can be used to have the client write to the tests's error log.
Expand Down
4 changes: 2 additions & 2 deletions lookup/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"net/url"

messagebird "github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/hlr"
messagebird "github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/hlr"
)

// Formats represents phone number in multiple formats.
Expand Down
4 changes: 2 additions & 2 deletions lookup/lookup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strconv"
"testing"

"github.com/messagebird/go-rest-api/hlr"
"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/hlr"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion mms/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// Message represents a MMS Message.
Expand Down
4 changes: 2 additions & 2 deletions mms/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

messagebird "github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/internal/mbtest"
messagebird "github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion number/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"strconv"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion number/number_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion sms/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// TypeDetails is a hash with extra information.
Expand Down
4 changes: 2 additions & 2 deletions sms/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

messagebird "github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/internal/mbtest"
messagebird "github.com/messagebird/go-rest-api/v6"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// Verify object represents MessageBird server response.
Expand Down
2 changes: 1 addition & 1 deletion verify/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion voice/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// CallStatus enumerates all valid values for a call status.
Expand Down
2 changes: 1 addition & 1 deletion voice/callflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"time"

"github.com/messagebird/go-rest-api"
"github.com/messagebird/go-rest-api/v6"
)

// A CallFlow describes the flow of operations (steps) to be executed when
Expand Down
2 changes: 1 addition & 1 deletion voice/leg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// LegStatus enumerates all valid values for a leg status.
Expand Down
2 changes: 1 addition & 1 deletion voice/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"testing"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

func testRequest(status int, body []byte) (*messagebird.Client, func()) {
Expand Down
2 changes: 1 addition & 1 deletion voice/paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"reflect"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// A Paginator is used to stream the contents of a collection of some type from
Expand Down
2 changes: 1 addition & 1 deletion voice/recording.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"runtime"
"time"

messagebird "github.com/messagebird/go-rest-api"
messagebird "github.com/messagebird/go-rest-api/v6"
)

// RecordingStatus enumerates all valid values for the status of a recording.
Expand Down
2 changes: 1 addition & 1 deletion voice/recording_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"testing"

"github.com/messagebird/go-rest-api/internal/mbtest"
"github.com/messagebird/go-rest-api/v6/internal/mbtest"
)

func TestRecordingGetFile(t *testing.T) {
Expand Down
Loading

0 comments on commit 1f4ec5f

Please sign in to comment.