Skip to content

Commit

Permalink
added method to delete member in conversations client (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK authored Nov 20, 2024
1 parent b296283 commit f4d0994
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Conversation/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ public function updateMember(UpdateMemberRequest $updateMemberRequest): Member
return $member;
}

public function deleteMember(string $memberId, string $conversationId): bool
{
$this->getApiResource()->delete($conversationId . '/members/' . $memberId);

return true;
}

public function createEvent(EventRequest $event): Event
{
$response = $this->getAPIResource()->create($event->toArray(), '/' . $event->getConversationId() . '/events');
Expand Down
23 changes: 23 additions & 0 deletions test/Conversation/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,29 @@ public function testWillUpdateMemberInConversation(): void
$this->assertInstanceOf(Member::class, $response);
}

public function testWillDeleteMemberInConversation(): void
{
$this->vonageClient->send(Argument::that(function (Request $request) use (&$requestIndex) {
$this->assertEquals('DELETE', $request->getMethod());

$uri = $request->getUri();
$uriString = $uri->__toString();

$this->assertEquals(
'https://api.nexmo.com/v1/conversations/CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a/members/' .
'MEM-63f61863-4a51-4f6b-86e1-46edebio0391',
$uriString
);

return true;
}))->willReturn($this->getResponse('delete-member', 204));

$this->conversationsClient->deleteMember(
'MEM-63f61863-4a51-4f6b-86e1-46edebio0391',
'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a'
);
}

public function testWillCreateEvent(): void
{
$messageText = new EventRequest(
Expand Down
Empty file.

0 comments on commit f4d0994

Please sign in to comment.