Skip to content

Commit

Permalink
Include tag list when retrieving single conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Skrepnek committed Jul 4, 2017
1 parent 2ab68fa commit 79a5799
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package intercom

import (
"encoding/json"

"gopkg.in/intercom/intercom-go.v2/interfaces"
)

Expand Down
1 change: 1 addition & 0 deletions conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Conversation struct {
Read bool `json:"read"`
ConversationMessage ConversationMessage `json:"conversation_message"`
ConversationParts ConversationPartList `json:"conversation_parts"`
TagList *TagList `json:"tags"`
}

// A ConversationMessage is the message that started the conversation rendered for presentation
Expand Down
6 changes: 6 additions & 0 deletions conversation_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ func TestConversationFind(t *testing.T) {
if convo.ID != "147" {
t.Errorf("Conversation not retrieved, %s", convo.ID)
}
if convo.TagList == nil || convo.TagList.Tags[0].ID != "12345" {
t.Errorf("Conversation tags not retrieved, %s", convo.ID)
}
}

func TestConversationRead(t *testing.T) {
Expand Down Expand Up @@ -84,6 +87,9 @@ func TestConversationListAll(t *testing.T) {
if convos.Conversations[0].ConversationParts.Parts[0].CreatedAt != 1400857494 {
t.Errorf("Conversation Part CreatedAt not retrieved")
}
if convos.Conversations[0].TagList != nil {
t.Errorf("Conversation Tags should be nil")
}
}

func TestConversationListUserUnread(t *testing.T) {
Expand Down
8 changes: 8 additions & 0 deletions fixtures/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,13 @@
},
"attachments": []
}]
},
"tags": {
"type": "tag.list",
"tags": [{
"type": "tag",
"id": "12345",
"name": "Some tag"
}]
}
}

0 comments on commit 79a5799

Please sign in to comment.