Repository: defstudio/telegraph (php)

Issue:
Implement `getChatMember` method
https://core.telegram.org/bots/api#getchatmember

Pull request description:
chatMember method implemented
closes #259 

Telegram API getChatMember method is implemented as chatMember.

Patch:
diff --git a/docs/content/en/features/telegram-api-calls.md b/docs/content/en/features/telegram-api-calls.md
index a0326aa7..7eea50af 100644
--- a/docs/content/en/features/telegram-api-calls.md
+++ b/docs/content/en/features/telegram-api-calls.md
@@ -310,13 +310,6 @@ title: my telegram group
 ...
 */
 ```
-## chatMenuButton
-
-retrieves a bot current menu button info
-
-```php
-Telegraph::chatMenuButton()->send();
-```
 
 ### getFileInfo
 
@@ -334,6 +327,14 @@ retrieves Chat member count
 Telegraph::chatMemberCount()->send();
 ```
 
+## chatMember
+
+retrieves a Chat member
+
+```php
+Telegraph::chatMember($userId)->send();
+```
+
 ## userProfilePhotos
 
 retrieves the User's profile photos
diff --git a/src/Concerns/HasBotsAndChats.php b/src/Concerns/HasBotsAndChats.php
index 6eb9fe84..dc823aa9 100644
--- a/src/Concerns/HasBotsAndChats.php
+++ b/src/Concerns/HasBotsAndChats.php
@@ -262,15 +262,6 @@ trait HasBotsAndChats
         return $telegraph;
     }
 
-    public function chatMenuButton(): Telegraph
-    {
-        $telegraph = clone $this;
-
-        $telegraph->endpoint = self::ENDPOINT_GET_CHAT_MENU_BUTTON;
-
-        return $telegraph;
-    }
-
     public function generateChatPrimaryInviteLink(): Telegraph
     {
         $telegraph = clone $this;
@@ -359,6 +350,17 @@ trait HasBotsAndChats
         return $telegraph;
     }
 
+    public function chatMember(string $userId): Telegraph
+    {
+        $telegraph = clone $this;
+
+        $telegraph->endpoint = self::ENDPOINT_GET_CHAT_MEMBER;
+        $telegraph->data['chat_id'] = $telegraph->getChat()->chat_id;
+        $telegraph->data['user_id'] = $userId;
+
+        return $telegraph;
+    }
+
     /**
      * @param array<int|string, string|bool> $permissions
      */
diff --git a/src/Facades/Telegraph.php b/src/Facades/Telegraph.php
index 89d5b1b8..e9c6b864 100644
--- a/src/Facades/Telegraph.php
+++ b/src/Facades/Telegraph.php
@@ -51,6 +51,7 @@ use Illuminate\Support\Facades\Facade;
  * @method static \DefStudio\Telegraph\Telegraph  editChatInviteLink()
  * @method static \DefStudio\Telegraph\Telegraph  revokeChatInviteLink()
  * @method static \DefStudio\Telegraph\Telegraph  chatMemberCount()
+ * @method static \DefStudio\Telegraph\Telegraph  chatMember(string $userId)
  * @method static \DefStudio\Telegraph\Telegraph  setChatPermissions(array $permissions)
  * @method static \DefStudio\Telegraph\Telegraph  banChatMember(string $userId)
  * @method static \DefStudio\Telegraph\Telegraph  unbanChatMember(string $userId)
@@ -58,7 +59,6 @@ use Illuminate\Support\Facades\Facade;
  * @method static \DefStudio\Telegraph\Telegraph  promoteChatMember(string $userId, array $permissions)
  * @method static \DefStudio\Telegraph\Telegraph  demoteChatMember(string $userId)
  * @method static \DefStudio\Telegraph\Telegraph  userProfilePhotos(string $userId)
- * @method static \DefStudio\Telegraph\Telegraph  chatMenuButton()
  * @method static TelegraphPollPayload poll(string $question)
  * @method static TelegraphQuizPayload quiz(string $question)
  * @method static string store(Downloadable $attachment, string $path, string $filename = null)
diff --git a/src/Telegraph.php b/src/Telegraph.php
index 62a9562b..11c26e6c 100755
--- a/src/Telegraph.php
+++ b/src/Telegraph.php
@@ -87,6 +87,7 @@ class Telegraph
     public const ENDPOINT_LEAVE_CHAT = 'leaveChat';
     public const ENDPOINT_GET_CHAT_INFO = 'getChat';
     public const ENDPOINT_GET_CHAT_MEMBER_COUNT = 'getChatMemberCount';
+    public const ENDPOINT_GET_CHAT_MEMBER = 'getChatMember';
     public const ENDPOINT_SET_CHAT_PERMISSIONS = 'setChatPermissions';
     public const ENDPOINT_BAN_CHAT_MEMBER = 'banChatMember';
     public const ENDPOINT_UNBAN_CHAT_MEMBER = 'unbanChatMember';
@@ -95,7 +96,6 @@ class Telegraph
     public const ENDPOINT_SEND_POLL = 'sendPoll';
     public const ENDPOINT_FORWARD_MESSAGE = 'forwardMessage';
     public const ENDPOINT_GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos';
-    public const ENDPOINT_GET_CHAT_MENU_BUTTON = 'getChatMenuButton';
 
 
     /** @var array<string, mixed> */


Test patch:
diff --git a/tests/Unit/Concerns/HasBotsAndChatsTest.php b/tests/Unit/Concerns/HasBotsAndChatsTest.php
index 21870000..ded50df1 100644
--- a/tests/Unit/Concerns/HasBotsAndChatsTest.php
+++ b/tests/Unit/Concerns/HasBotsAndChatsTest.php
@@ -148,6 +148,12 @@ it('can retrieve chat member count', function () {
     })->toMatchTelegramSnapshot();
 });
 
+it('can retrieve a chat member', function () {
+    expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
+        return $telegraph->chat(make_chat())->chatMember(123456);
+    })->toMatchTelegramSnapshot();
+});
+
 it('can generate a chat primary invite link', function () {
     expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
         return $telegraph->chat(make_chat())->generateChatPrimaryInviteLink();
@@ -326,10 +332,3 @@ it('can demote a chat member', function () {
             ->demoteChatMember(123456);
     })->toMatchTelegramSnapshot();
 });
-
-it('can retrieve chat menu button', function () {
-    expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
-        return $telegraph->chat(make_chat())
-            ->chatMenuButton();
-    })->toMatchTelegramSnapshot();
-});
diff --git a/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_a_chat_member__1.yml b/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_a_chat_member__1.yml
new file mode 100644
index 00000000..c9231585
--- /dev/null
+++ b/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_a_chat_member__1.yml
@@ -0,0 +1,5 @@
+url: 'https://api.telegram.org/bot3f3814e1-5836-3d77-904e-60f64b15df36/getChatMember'
+payload:
+    chat_id: '-123456789'
+    user_id: '123456'
+files: {  }
diff --git a/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_chat_menu_button__1.yml b/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_chat_menu_button__1.yml
deleted file mode 100644
index 62f48b2c..00000000
--- a/tests/__snapshots__/HasBotsAndChatsTest__it_can_retrieve_chat_menu_button__1.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-url: 'https://api.telegram.org/bot3f3814e1-5836-3d77-904e-60f64b15df36/getChatMenuButton'
-payload: {  }
-files: {  }