Skip to content

Commit a2785ec

Browse files
committed
Get chat by id
1 parent f98ec58 commit a2785ec

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ You have to provide this API permissions: `Chat.ReadWrite`
172172
getJoinedTeams(): array|GraphResponse|mixed
173173
getChannels(team): array|GraphResponse|mixed
174174
getChats(): array|GraphResponse|mixed
175+
getChat(id): array|GraphResponse|mixed
175176
getMembersInChat(chat): array|GraphResponse|mixed
176177
send(teamOrChat, message): array|GraphResponse|mixed
177178
```
@@ -200,6 +201,12 @@ Get all the chats for a user ( additional permissions needed: `Chat.Read.All` )
200201

201202
```php
202203
$chats = $teamsClass->getChats();
204+
205+
```
206+
Get a chat by a given id ( additional permissions needed: `Chat.Read.All` )
207+
208+
```php
209+
$chats = $teamsClass->getChat('your-chat-id');
203210
```
204211

205212
Get all the members in a channel ( additional permissions needed: `ChannelMessage.Read.All` )

src/Teams.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use LLoadout\Microsoftgraph\Traits\Authenticate;
66
use LLoadout\Microsoftgraph\Traits\Connect;
7+
use Microsoft\Graph\Http\GraphResponse;
78
use Microsoft\Graph\Model\Channel;
89
use Microsoft\Graph\Model\Chat;
910
use Microsoft\Graph\Model\ConversationMember;
@@ -30,6 +31,14 @@ public function getChats(): array
3031
return $this->get('/me/chats', returns: Chat::class);
3132
}
3233

34+
/**
35+
* Get a specific chat by id
36+
*/
37+
public function getChat(string $id): Chat
38+
{
39+
return $this->get('/me/chats/'.$id, returns: Chat::class);
40+
}
41+
3342
/**
3443
* Get all the members in a chat
3544
*/
@@ -49,7 +58,7 @@ public function getChannels(Team $team): array
4958
/**
5059
* Send a message to a chat
5160
*/
52-
public function send(Chat|Channel $chat, string $message): array
61+
public function send(Chat|Channel $chat, string $message): GraphResponse
5362
{
5463

5564
$data = json_decode('{"body": {"contentType": "html"}}');

0 commit comments

Comments
 (0)