Add GetUpdates method for fetching updates

This commit is contained in:
netkas 2024-11-01 12:44:54 -04:00
parent ead1347f34
commit 845a0d3b3c
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,39 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\Update;
class GetUpdates extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): array
{
return array_map(
fn($update) => Update::fromArray($update),
self::executeCurl(self::buildPost($bot, Methods::GET_UPDATES->value, $parameters))['result']
);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
// TODO: Implement getRequiredParameters() method.
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
// TODO: Implement getOptionalParameters() method.
}
}