From 1f4ec5fe404d4c680211e9164f93e6f756874c67 Mon Sep 17 00:00:00 2001 From: Sarath Sadasivan Pillai Date: Tue, 18 Aug 2020 16:24:16 +0200 Subject: [PATCH] move to v6 respecting go modules release guidelines (#91) * move to v6 respecting go modules release guidelines * Update UPGRADING.md * set ClientVersion to 6.0.0 * update badge Co-authored-by: Sarath Pillai --- .travis.yml | 4 ++-- README.md | 12 ++++++------ UPGRADING.md | 9 +++++++++ balance/balance.go | 2 +- balance/balance_test.go | 4 ++-- client.go | 2 +- contact/contact.go | 2 +- contact/contact_test.go | 2 +- conversation/api.go | 2 +- conversation/conversation.go | 2 +- conversation/conversation_test.go | 2 +- conversation/message.go | 2 +- conversation/message_test.go | 2 +- conversation/webhook.go | 2 +- conversation/webhook_test.go | 2 +- go.mod | 4 ++-- group/group.go | 4 ++-- group/group_test.go | 2 +- hlr/hlr.go | 2 +- hlr/hlr_test.go | 4 ++-- internal/mbtest/test_client.go | 2 +- lookup/lookup.go | 4 ++-- lookup/lookup_test.go | 4 ++-- mms/message.go | 2 +- mms/message_test.go | 4 ++-- number/number.go | 2 +- number/number_test.go | 2 +- sms/message.go | 2 +- sms/message_test.go | 4 ++-- verify/verify.go | 2 +- verify/verify_test.go | 2 +- voice/call.go | 2 +- voice/callflow.go | 2 +- voice/leg.go | 2 +- voice/main_test.go | 2 +- voice/paginator.go | 2 +- voice/recording.go | 2 +- voice/recording_test.go | 2 +- voice/transcription.go | 2 +- voice/transcription_test.go | 2 +- voice/voice.go | 2 +- voice/voice_test.go | 2 +- voice/webhook.go | 2 +- voicemessage/voice_message.go | 2 +- voicemessage/voice_message_test.go | 4 ++-- 45 files changed, 68 insertions(+), 59 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60717d0..5026229 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/README.md b/README.md index 92d85e5..28be91b 100644 --- a/README.md +++ b/README.md @@ -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 ------------ @@ -15,7 +15,7 @@ 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 @@ -23,7 +23,7 @@ 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. @@ -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" // ... @@ -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" // ... diff --git a/UPGRADING.md b/UPGRADING.md index c96a639..26ab17f 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -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`. + + diff --git a/balance/balance.go b/balance/balance.go index fa234a7..9db1088 100644 --- a/balance/balance.go +++ b/balance/balance.go @@ -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. diff --git a/balance/balance_test.go b/balance/balance_test.go index 6ea10a9..15f9143 100644 --- a/balance/balance_test.go +++ b/balance/balance_test.go @@ -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 diff --git a/client.go b/client.go index 9c339a7..9c96462 100644 --- a/client.go +++ b/client.go @@ -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" diff --git a/contact/contact.go b/contact/contact.go index 4de1f76..9d40c7e 100644 --- a/contact/contact.go +++ b/contact/contact.go @@ -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. diff --git a/contact/contact_test.go b/contact/contact_test.go index 75265db..2960175 100644 --- a/contact/contact_test.go +++ b/contact/contact_test.go @@ -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) { diff --git a/conversation/api.go b/conversation/api.go index 65c4d84..4bc5fe8 100644 --- a/conversation/api.go +++ b/conversation/api.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) const ( diff --git a/conversation/conversation.go b/conversation/conversation.go index d1e2a97..95826b5 100644 --- a/conversation/conversation.go +++ b/conversation/conversation.go @@ -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(). diff --git a/conversation/conversation_test.go b/conversation/conversation_test.go index 3afa6c2..565e5c8 100644 --- a/conversation/conversation_test.go +++ b/conversation/conversation_test.go @@ -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) { diff --git a/conversation/message.go b/conversation/message.go index 9f27e52..10ad7e6 100644 --- a/conversation/message.go +++ b/conversation/message.go @@ -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 { diff --git a/conversation/message_test.go b/conversation/message_test.go index a3df427..5186610 100644 --- a/conversation/message_test.go +++ b/conversation/message_test.go @@ -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) { diff --git a/conversation/webhook.go b/conversation/webhook.go index e746238..64c3224 100644 --- a/conversation/webhook.go +++ b/conversation/webhook.go @@ -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 { diff --git a/conversation/webhook_test.go b/conversation/webhook_test.go index cf15345..f183895 100644 --- a/conversation/webhook_test.go +++ b/conversation/webhook_test.go @@ -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) { diff --git a/go.mod b/go.mod index 92f422a..bb59809 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/messagebird/go-rest-api +module github.com/messagebird/go-rest-api/v6 -go 1.13 \ No newline at end of file +go 1.14 diff --git a/group/group.go b/group/group.go index 0eeb4a5..6f2878a 100644 --- a/group/group.go +++ b/group/group.go @@ -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. diff --git a/group/group_test.go b/group/group_test.go index b8f1383..21445ea 100644 --- a/group/group_test.go +++ b/group/group_test.go @@ -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) { diff --git a/hlr/hlr.go b/hlr/hlr.go index 63c237f..b16e348 100644 --- a/hlr/hlr.go +++ b/hlr/hlr.go @@ -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 diff --git a/hlr/hlr_test.go b/hlr/hlr_test.go index 0eee574..b872b5f 100644 --- a/hlr/hlr_test.go +++ b/hlr/hlr_test.go @@ -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) { diff --git a/internal/mbtest/test_client.go b/internal/mbtest/test_client.go index 1100538..85f1e9d 100644 --- a/internal/mbtest/test_client.go +++ b/internal/mbtest/test_client.go @@ -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. diff --git a/lookup/lookup.go b/lookup/lookup.go index 817c886..9529c4a 100644 --- a/lookup/lookup.go +++ b/lookup/lookup.go @@ -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. diff --git a/lookup/lookup_test.go b/lookup/lookup_test.go index d4b94fd..18cda69 100644 --- a/lookup/lookup_test.go +++ b/lookup/lookup_test.go @@ -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) { diff --git a/mms/message.go b/mms/message.go index fe82f83..7158a28 100644 --- a/mms/message.go +++ b/mms/message.go @@ -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. diff --git a/mms/message_test.go b/mms/message_test.go index 85e76ca..ec5b150 100644 --- a/mms/message_test.go +++ b/mms/message_test.go @@ -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) { diff --git a/number/number.go b/number/number.go index f7d8f87..c59a8ce 100644 --- a/number/number.go +++ b/number/number.go @@ -6,7 +6,7 @@ import ( "net/url" "strconv" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) const ( diff --git a/number/number_test.go b/number/number_test.go index 5c7402a..7316a90 100644 --- a/number/number_test.go +++ b/number/number_test.go @@ -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) { diff --git a/sms/message.go b/sms/message.go index a0b4aaf..59beb7a 100644 --- a/sms/message.go +++ b/sms/message.go @@ -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. diff --git a/sms/message_test.go b/sms/message_test.go index 0afa4b6..388376e 100644 --- a/sms/message_test.go +++ b/sms/message_test.go @@ -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) { diff --git a/verify/verify.go b/verify/verify.go index 27bce1d..538d308 100644 --- a/verify/verify.go +++ b/verify/verify.go @@ -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. diff --git a/verify/verify_test.go b/verify/verify_test.go index 83a6bcd..f083dfa 100644 --- a/verify/verify_test.go +++ b/verify/verify_test.go @@ -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) { diff --git a/voice/call.go b/voice/call.go index 16c160b..8436a99 100644 --- a/voice/call.go +++ b/voice/call.go @@ -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. diff --git a/voice/callflow.go b/voice/callflow.go index 9fac993..c063371 100644 --- a/voice/callflow.go +++ b/voice/callflow.go @@ -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 diff --git a/voice/leg.go b/voice/leg.go index 869aba0..04ed63c 100644 --- a/voice/leg.go +++ b/voice/leg.go @@ -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. diff --git a/voice/main_test.go b/voice/main_test.go index 28b828d..7e4ed06 100644 --- a/voice/main_test.go +++ b/voice/main_test.go @@ -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()) { diff --git a/voice/paginator.go b/voice/paginator.go index 40b79e0..64ff44c 100644 --- a/voice/paginator.go +++ b/voice/paginator.go @@ -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 diff --git a/voice/recording.go b/voice/recording.go index ae6fc8d..6a0f90c 100644 --- a/voice/recording.go +++ b/voice/recording.go @@ -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. diff --git a/voice/recording_test.go b/voice/recording_test.go index 4eb09b4..48ab541 100644 --- a/voice/recording_test.go +++ b/voice/recording_test.go @@ -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) { diff --git a/voice/transcription.go b/voice/transcription.go index 302ca5b..7956581 100644 --- a/voice/transcription.go +++ b/voice/transcription.go @@ -8,7 +8,7 @@ import ( "runtime" "time" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) // A Transcription is a textual representation of a recording as text. diff --git a/voice/transcription_test.go b/voice/transcription_test.go index 6ba8f04..1f67f2f 100644 --- a/voice/transcription_test.go +++ b/voice/transcription_test.go @@ -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 TestMain(m *testing.M) { diff --git a/voice/voice.go b/voice/voice.go index 93a6f5b..39d3d85 100644 --- a/voice/voice.go +++ b/voice/voice.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) const apiRoot = "https://voice.messagebird.com/v1" diff --git a/voice/voice_test.go b/voice/voice_test.go index d1edd7f..ea44e6d 100644 --- a/voice/voice_test.go +++ b/voice/voice_test.go @@ -3,7 +3,7 @@ package voice import ( "testing" - "github.com/messagebird/go-rest-api/internal/mbtest" + "github.com/messagebird/go-rest-api/v6/internal/mbtest" ) func TestErrorReader(t *testing.T) { diff --git a/voice/webhook.go b/voice/webhook.go index bfec6e2..9817476 100644 --- a/voice/webhook.go +++ b/voice/webhook.go @@ -7,7 +7,7 @@ import ( "reflect" "time" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) // A Webhook is an HTTP callback to your platform. They are sent when calls are diff --git a/voicemessage/voice_message.go b/voicemessage/voice_message.go index 0d068ee..c83fd30 100644 --- a/voicemessage/voice_message.go +++ b/voicemessage/voice_message.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - messagebird "github.com/messagebird/go-rest-api" + messagebird "github.com/messagebird/go-rest-api/v6" ) // VoiceMessage wraps data needed to transform text messages into voice messages. diff --git a/voicemessage/voice_message_test.go b/voicemessage/voice_message_test.go index edada54..cc79da0 100644 --- a/voicemessage/voice_message_test.go +++ b/voicemessage/voice_message_test.go @@ -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) {