Skip to content

Commit 4fe396b

Browse files
committed
Merge pull request #61 from intercom/get-all-conversations
Get all conversations
2 parents d27861a + 6822d0a commit 4fe396b

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/Intercom/Service/config/intercom_public_conversation.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,11 @@
9595
"extends": "_abstract_pagination_page",
9696
"httpMethod": "GET",
9797
"parameters": {
98-
"email": {
98+
"type": {
9999
"location": "query",
100100
"required": false,
101101
"type": "string"
102102
},
103-
"type": {
104-
"location": "query",
105-
"required": true,
106-
"static": true,
107-
"default": "user"
108-
},
109103
"id": {
110104
"location": "query",
111105
"required": false,

tests/Intercom/Resources/ConversationTest.php

+20-2
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,38 @@ public function testGetConversation()
4141
$this->assertEquals(true, $response['open']);
4242
}
4343

44-
public function testGetConversations()
44+
public function testGetAllConversations()
4545
{
4646
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
4747
$response = $this->client->getConversations();
4848
$conversations = $response->get('conversations');
4949

50-
$this->assertRequest('GET', '/conversations?type=user');
50+
$this->assertRequest('GET', '/conversations');
5151

5252
$this->assertInstanceOf('\Guzzle\Service\Resource\Model', $response);
5353
$this->assertEquals(1, count($conversations));
5454
$this->assertEquals(1400850973, $conversations['0']['created_at']);
5555
$this->assertEquals('536e564f316c83104c000020', $conversations['0']['user']['id']);
5656
$this->assertEquals('admin', $conversations['0']['assignee']['type']);
5757
}
58+
59+
public function testGetUserConversations()
60+
{
61+
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
62+
$response = $this->client->getConversations(['type' => 'user']);
63+
$conversations = $response->get('conversations');
64+
65+
$this->assertRequest('GET', '/conversations?type=user');
66+
}
67+
68+
public function testGetAdminConversations()
69+
{
70+
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
71+
$response = $this->client->getConversations(['type' => 'admin']);
72+
$conversations = $response->get('conversations');
73+
74+
$this->assertRequest('GET', '/conversations?type=admin');
75+
}
5876

5977
public function testReplyToConversation()
6078
{

0 commit comments

Comments
 (0)