Add 'GetUserProfilePhotos' method support

This commit is contained in:
netkas 2024-11-05 19:19:14 -05:00
parent ee2dff1e31
commit 44260ccaee
2 changed files with 43 additions and 0 deletions

View file

@ -13,6 +13,7 @@
use TgBotLib\Methods\ForwardMessages;
use TgBotLib\Methods\GetMe;
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserProfilePhotos;
use TgBotLib\Methods\GetWebhookInfo;
use TgBotLib\Methods\Logout;
use TgBotLib\Methods\SendAnimation;
@ -64,6 +65,7 @@
case SEND_DICE = 'sendDice';
case SEND_CHAT_ACTION = 'sendChatAction';
case SET_MESSAGE_REACTION = 'setMessageReaction';
case GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos';
/**
* Executes a command on the provided bot with the given parameters.
@ -105,6 +107,7 @@
self::SEND_DICE => SendDice::execute($bot, $parameters),
self::SEND_CHAT_ACTION => SendChatAction::execute($bot, $parameters),
self::SET_MESSAGE_REACTION => SetMessageReaction::execute($bot, $parameters),
self::GET_USER_PROFILE_PHOTOS => GetUserProfilePhotos::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,40 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\UserProfilePhotos;
class GetUserProfilePhotos extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): UserProfilePhotos
{
return $bot->sendRequest(Methods::GET_USER_PROFILE_PHOTOS->value, $parameters);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'user_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'offset',
'limit'
];
}
}