Add GetUpdates method for fetching updates
This commit is contained in:
parent
ead1347f34
commit
845a0d3b3c
2 changed files with 42 additions and 0 deletions
39
src/TgBotLib/Methods/GetUpdates.php
Normal file
39
src/TgBotLib/Methods/GetUpdates.php
Normal 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.
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue