Skip to content

Commit f6c2c7f

Browse files
authored
Deprecate CallFlow Title usage (#116)
This field is deprecated now although users still can send and receive it.
1 parent 9e46bb9 commit f6c2c7f

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

voice/call_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ func TestInitiateCall(t *testing.T) {
1515

1616
source, destination := "31000000000", "31000000000"
1717
callflow := CallFlow{
18-
Title: "Say test",
1918
Steps: []CallFlowStep{
2019
&CallFlowSayStep{
2120
Voice: "male",
@@ -40,7 +39,6 @@ func TestCallByID(t *testing.T) {
4039

4140
source, destination := "31000000000", "31000000000"
4241
callflow := CallFlow{
43-
Title: "Say test",
4442
Steps: []CallFlowStep{
4543
&CallFlowSayStep{
4644
Voice: "male",

voice/callflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"reflect"
88
"time"
99

10-
"github.com/messagebird/go-rest-api/v7"
10+
messagebird "github.com/messagebird/go-rest-api/v7"
1111
)
1212

1313
// A CallFlow describes the flow of operations (steps) to be executed when
@@ -33,7 +33,7 @@ type CallFlow struct {
3333

3434
type jsonCallFlow struct {
3535
ID string `json:"id,omitempty"`
36-
Title string `json:"title"`
36+
Title string `json:"title,omitempty"`
3737
Steps []CallFlowStep `json:"steps"`
3838
Record bool `json:"record"`
3939
CreatedAt string `json:"createdAt"`

voice/callflow_test.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
func ExampleCallFlow() {
1313
callflow := CallFlow{
14-
Title: "My CallFlow",
1514
Steps: []CallFlowStep{
1615
&CallFlowSayStep{
1716
Payload: "Hello",
@@ -41,8 +40,7 @@ func TestCallFlowJSONMarshal(t *testing.T) {
4140
refCreatedAt, _ := time.Parse(time.RFC3339, "2018-01-29T13:46:06Z")
4241
refUpdatedAt, _ := time.Parse(time.RFC3339, "2018-01-30T16:00:34Z")
4342
referenceCallflow := &CallFlow{
44-
ID: "id",
45-
Title: "title",
43+
ID: "id",
4644
Steps: []CallFlowStep{
4745
&CallFlowSayStep{
4846
CallFlowStepBase: CallFlowStepBase{
@@ -88,7 +86,6 @@ func TestCallFlowJSONMarshal(t *testing.T) {
8886
func TestCallFlowJSONUnmarshal(t *testing.T) {
8987
referenceJSON := `{
9088
"id": "id",
91-
"title": "title",
9289
"steps": [
9390
{
9491
"id": "1",
@@ -124,8 +121,7 @@ func TestCallFlowJSONUnmarshal(t *testing.T) {
124121
refCreatedAt, _ := time.Parse(time.RFC3339, "2018-01-29T13:46:06Z")
125122
refUpdatedAt, _ := time.Parse(time.RFC3339, "2018-01-30T16:00:34Z")
126123
referenceCallflow := &CallFlow{
127-
ID: "id",
128-
Title: "title",
124+
ID: "id",
129125
Steps: []CallFlowStep{
130126
&CallFlowSayStep{
131127
CallFlowStepBase: CallFlowStepBase{
@@ -173,7 +169,6 @@ func TestCreateCallFlow(t *testing.T) {
173169
}
174170

175171
newCf := &CallFlow{
176-
Title: "the-title",
177172
Steps: []CallFlowStep{
178173
&CallFlowSayStep{
179174
Payload: "Hello",
@@ -197,7 +192,6 @@ func TestCreateCallFlow(t *testing.T) {
197192
}
198193
err := newCf.Create(mbClient)
199194
assert.NoError(t, err)
200-
assert.Equal(t, "the-title", newCf.Title)
201195
assert.Len(t, newCf.Steps, 3)
202196
}
203197

@@ -208,7 +202,6 @@ func TestCallFlowByID(t *testing.T) {
208202
}
209203

210204
newCf := &CallFlow{
211-
Title: "the-title",
212205
Steps: []CallFlowStep{
213206
&CallFlowHangupStep{},
214207
},
@@ -227,7 +220,7 @@ func TestCallFlowList(t *testing.T) {
227220
t.SkipNow()
228221
}
229222

230-
for _, c := range []string{"foo", "bar", "baz"} {
223+
for _, c := range []string{"foo", "bar", ""} {
231224
newCf := &CallFlow{
232225
Title: c,
233226
Steps: []CallFlowStep{

0 commit comments

Comments
 (0)