Skip to content

Commit

Permalink
Get chat by id
Browse files Browse the repository at this point in the history
  • Loading branch information
dietercoopman committed Feb 17, 2024
1 parent f98ec58 commit a2785ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ You have to provide this API permissions: `Chat.ReadWrite`
getJoinedTeams(): array|GraphResponse|mixed
getChannels(team): array|GraphResponse|mixed
getChats(): array|GraphResponse|mixed
getChat(id): array|GraphResponse|mixed
getMembersInChat(chat): array|GraphResponse|mixed
send(teamOrChat, message): array|GraphResponse|mixed
```
Expand Down Expand Up @@ -200,6 +201,12 @@ Get all the chats for a user ( additional permissions needed: `Chat.Read.All` )

```php
$chats = $teamsClass->getChats();

```
Get a chat by a given id ( additional permissions needed: `Chat.Read.All` )

```php
$chats = $teamsClass->getChat('your-chat-id');
```

Get all the members in a channel ( additional permissions needed: `ChannelMessage.Read.All` )
Expand Down
11 changes: 10 additions & 1 deletion src/Teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use LLoadout\Microsoftgraph\Traits\Authenticate;
use LLoadout\Microsoftgraph\Traits\Connect;
use Microsoft\Graph\Http\GraphResponse;
use Microsoft\Graph\Model\Channel;
use Microsoft\Graph\Model\Chat;
use Microsoft\Graph\Model\ConversationMember;
Expand All @@ -30,6 +31,14 @@ public function getChats(): array
return $this->get('/me/chats', returns: Chat::class);
}

/**
* Get a specific chat by id
*/
public function getChat(string $id): Chat
{
return $this->get('/me/chats/'.$id, returns: Chat::class);
}

/**
* Get all the members in a chat
*/
Expand All @@ -49,7 +58,7 @@ public function getChannels(Team $team): array
/**
* Send a message to a chat
*/
public function send(Chat|Channel $chat, string $message): array
public function send(Chat|Channel $chat, string $message): GraphResponse
{

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

0 comments on commit a2785ec

Please sign in to comment.