Skip to content

Commit 3c1c518

Browse files
committed
Merge pull request #1 from messagebird/sam-voicemessages-originator
Add the originator parameter to the /voicemessages endpoint
2 parents cbe77e1 + c175be3 commit 3c1c518

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
const (
21-
ClientVersion = "2.1.0"
21+
ClientVersion = "2.1.1"
2222
Endpoint = "https://rest.messagebird.com"
2323
)
2424

voice_message.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
type VoiceMessage struct {
1010
Id string
1111
HRef string
12+
Originator string
1213
Body string
1314
Reference string
1415
Language string
@@ -22,6 +23,7 @@ type VoiceMessage struct {
2223
}
2324

2425
type VoiceMessageParams struct {
26+
Originator string
2527
Reference string
2628
Language string
2729
Voice string
@@ -39,6 +41,9 @@ func paramsForVoiceMessage(params *VoiceMessageParams) *url.Values {
3941
return urlParams
4042
}
4143

44+
if params.Originator != "" {
45+
urlParams.Set("originator", params.Originator)
46+
}
4247
if params.Reference != "" {
4348
urlParams.Set("reference", params.Reference)
4449
}

voice_message_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
var voiceMessageObject []byte = []byte(`{
99
"id":"430c44a0354aab7ac9553f7a49907463",
1010
"href":"https:\/\/rest.messagebird.com\/voicemessages\/430c44a0354aab7ac9553f7a49907463",
11+
"originator":"MessageBird",
1112
"body":"Hello World",
1213
"reference":null,
1314
"language":"en-gb",
@@ -47,6 +48,10 @@ func TestNewVoiceMessage(t *testing.T) {
4748
t.Errorf("Unexpected voice message href: %s", message.HRef)
4849
}
4950

51+
if message.Originator != "MessageBird" {
52+
t.Errorf("Unexpected voice message originator: %s", message.Originator)
53+
}
54+
5055
if message.Body != "Hello World" {
5156
t.Errorf("Unexpected voice message body: %s", message.Body)
5257
}

0 commit comments

Comments
 (0)