Skip to content

Commit 8ee404c

Browse files
committed
Merge pull request #104 from AntoineLemaire/master
Add deleteContact
2 parents a0f2796 + e504f97 commit 8ee404c

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,11 @@ $updated = $intercom->updateContact([
513513
'custom_attributes' => ['foo' => 'bar']
514514
]);
515515

516+
//Delete a contact
517+
$deleted = $intercom->deleteContact([
518+
"id" => "530370b477ad7120001d"
519+
]);
520+
516521
//Get all contacts by email
517522
$search = $intercom->getContacts(['email' => '[email protected]']);
518523

src/Intercom/Service/config/intercom_public_contact.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,25 @@
186186
"responseType": "model",
187187
"summary": "Creates the contact",
188188
"uri": "/contacts"
189+
},
190+
"deleteContact": {
191+
"httpMethod": "DELETE",
192+
"parameters": {
193+
"id": {
194+
"location": "json",
195+
"required": false,
196+
"type": "string"
197+
},
198+
"user_id": {
199+
"location": "json",
200+
"required": false,
201+
"type": "string"
202+
}
203+
},
204+
"responseClass": "ContactModel",
205+
"responseType": "model",
206+
"summary": "Deletes a contact given id or user_id",
207+
"uri": "/contacts"
189208
}
190209
},
191210
"models": {

tests/Intercom/Resources/ContactTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ public function testCreateContact()
4444
$this->assertEquals("Silver Dove", $response['pseudonym']);
4545
}
4646

47+
public function testDeleteContact()
48+
{
49+
$this->setMockResponse($this->client, 'Contact/Contact.txt');
50+
$response = $this->client->deleteContact(['id' => '1234']);
51+
52+
$this->assertRequest('DELETE', '/contacts');
53+
$this->assertRequestJson(['id' => '1234']);
54+
}
55+
4756
public function testConvertContact()
4857
{
4958
$this->setMockResponse($this->client, 'Contact/Contact.txt');

0 commit comments

Comments
 (0)