Repository: defstudio/telegraph (php)

Issue:
chatMember method not exist
get error when call chatMember method : 
When I try this:
```
$chat =  TelegraphChat::where('chat_id', '-1001917277777')->first();
$chat->chatMember('367389764')->send();
```
I get this error:

`local.ERROR: Call to undefined method DefStudio\Telegraph\Models\TelegraphChat::chatMember() `

Pull request:
#421 implement memberInfo() method + docs
#421 implement memberInfo() method + docs

Patch:
diff --git a/docs/content/13.models/2.telegraph-chat.md b/docs/content/13.models/2.telegraph-chat.md
index babe9858..6f9b70ab 100644
--- a/docs/content/13.models/2.telegraph-chat.md
+++ b/docs/content/13.models/2.telegraph-chat.md
@@ -55,7 +55,27 @@ Retrieves the chat member count from telegram
 ```php
 /** @var \DefStudio\Telegraph\Models\TelegraphChat $telegraphChat */
 
-$telegraphChat->info(); /* 42 */
+$telegraphChat->memberCount(); /* 42 */
+```
+
+### `memberInfo()`
+
+Retrieves the chat member info from telegram
+
+```php
+/** @var \DefStudio\Telegraph\Models\TelegraphChat $telegraphChat */
+
+$telegraphChat->memberInfo('user_id'); 
+
+/*
+status: string
+user: {
+    id: xxxxx
+    firstName: string
+    lastName: string
+    ...
+}
+*/
 ```
 
 ## Optional parameters
diff --git a/src/DTO/ChatMember.php b/src/DTO/ChatMember.php
index b03de41e..8c3a15a8 100644
--- a/src/DTO/ChatMember.php
+++ b/src/DTO/ChatMember.php
@@ -18,13 +18,16 @@ class ChatMember implements Arrayable
     private string $status;
     private User $user;
     private bool $isAnonymous;
+    private string $custom_title;
+    private bool $is_member;
+    private ?int $until_date;
 
     private function __construct()
     {
     }
 
     /**
-     * @param array{status:string, user:array<string, mixed>, is_anonymous?:bool} $data
+     * @param array{status:string, user:array<string, mixed>, is_anonymous?:bool, custom_title?:string, is_member?:bool, until_date?:int} $data
      */
     public static function fromArray(array $data): ChatMember
     {
@@ -37,6 +40,12 @@ class ChatMember implements Arrayable
 
         $member->isAnonymous = $data['is_anonymous'] ?? false;
 
+        $member->custom_title = $data['custom_title'] ?? '';
+
+        $member->is_member = $data['is_member'] ?? false;
+
+        $member->until_date = $data['until_date'] ?? null;
+
         return $member;
     }
 
@@ -55,12 +64,30 @@ class ChatMember implements Arrayable
         return $this->isAnonymous;
     }
 
+    public function custom_title(): string
+    {
+        return $this->custom_title;
+    }
+
+    public function is_member(): bool
+    {
+        return $this->is_member;
+    }
+
+    public function until_date(): ?int
+    {
+        return $this->until_date;
+    }
+
     public function toArray(): array
     {
         return array_filter([
             'status' => $this->status,
             'user' => $this->user->toArray(),
             'is_anonymous' => $this->isAnonymous,
+            'custom_title' => $this->custom_title,
+            'is_member' => $this->is_member,
+            'until_date' => $this->until_date,
         ]);
     }
 }
diff --git a/src/DTO/Message.php b/src/DTO/Message.php
index 580c7015..1de2d3e9 100644
--- a/src/DTO/Message.php
+++ b/src/DTO/Message.php
@@ -171,7 +171,7 @@ class Message implements Arrayable
         if (isset($data['web_app_data']['data'])) {
             $webAppData = json_decode($data['web_app_data']['data'], true);
 
-            if(!$webAppData) {
+            if (!$webAppData) {
                 $webAppData = $data['web_app_data']['data'];
             }
 
diff --git a/src/Models/TelegraphChat.php b/src/Models/TelegraphChat.php
index 879c27f2..cd7c6739 100644
--- a/src/Models/TelegraphChat.php
+++ b/src/Models/TelegraphChat.php
@@ -9,6 +9,7 @@ namespace DefStudio\Telegraph\Models;
 use DefStudio\Telegraph\Concerns\HasStorage;
 use DefStudio\Telegraph\Contracts\Storable;
 use DefStudio\Telegraph\Database\Factories\TelegraphChatFactory;
+use DefStudio\Telegraph\DTO\ChatMember;
 use DefStudio\Telegraph\Exceptions\TelegraphException;
 use DefStudio\Telegraph\Facades\Telegraph as TelegraphFacade;
 use DefStudio\Telegraph\Keyboard\Keyboard;
@@ -95,6 +96,22 @@ class TelegraphChat extends Model implements Storable
         return $reply->json('result');
     }
 
+    public function memberInfo(string $user_id): null|ChatMember
+    {
+        $reply = TelegraphFacade::chat($this)->chatMember($user_id)->send();
+
+        if ($reply->telegraphError()) {
+            throw TelegraphException::failedToRetrieveChatInfo();
+        }
+
+        if (!$reply->json('result')) {
+            return null;
+        }
+
+        /* @phpstan-ignore-next-line */
+        return ChatMember::fromArray($reply->json('result'));
+    }
+
     public function withData(string $key, mixed $value): Telegraph
     {
         return TelegraphFacade::chat($this)->withData($key, $value);


Test patch:
diff --git a/tests/Unit/Concerns/HasBotsAndChatsTest.php b/tests/Unit/Concerns/HasBotsAndChatsTest.php
index 790fae86..b02fcf5b 100644
--- a/tests/Unit/Concerns/HasBotsAndChatsTest.php
+++ b/tests/Unit/Concerns/HasBotsAndChatsTest.php
@@ -219,7 +219,7 @@ it('can retrieve chat member count', function () {
 
 it('can retrieve a chat member', function () {
     expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
-        return $telegraph->chat(make_chat())->chatMember(123456);
+        return $telegraph->chat(make_chat())->chatMember('123456');
     })->toMatchTelegramSnapshot();
 });
 
diff --git a/tests/Unit/Models/TelegraphChatTest.php b/tests/Unit/Models/TelegraphChatTest.php
index 8e41f2d4..2c8c4562 100644
--- a/tests/Unit/Models/TelegraphChatTest.php
+++ b/tests/Unit/Models/TelegraphChatTest.php
@@ -483,6 +483,15 @@ it('can retrieve its member count', function () {
     Telegraph::assertSentData(\DefStudio\Telegraph\Telegraph::ENDPOINT_GET_CHAT_MEMBER_COUNT);
 });
 
+it('can retrieve its member info', function () {
+    Telegraph::fake();
+    $chat = make_chat();
+
+    $chat->memberInfo(123456);
+
+    Telegraph::assertSentData(\DefStudio\Telegraph\Telegraph::ENDPOINT_GET_CHAT_MEMBER);
+});
+
 it('can generate a primary invite link', function () {
     Telegraph::fake();
     $chat = make_chat();