From 845a0d3b3c9cef65bc0b2feb97f56f4f14dbcedd Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 1 Nov 2024 12:44:54 -0400 Subject: [PATCH] Add GetUpdates method for fetching updates --- src/TgBotLib/Enums/Methods.php | 3 +++ src/TgBotLib/Methods/GetUpdates.php | 39 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/TgBotLib/Methods/GetUpdates.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index cbedcd8..1e520ea 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -11,6 +11,7 @@ use TgBotLib\Methods\ForwardMessage; use TgBotLib\Methods\ForwardMessages; use TgBotLib\Methods\GetMe; + use TgBotLib\Methods\GetUpdates; use TgBotLib\Methods\Logout; use TgBotLib\Methods\SendAnimation; use TgBotLib\Methods\SendAudio; @@ -31,6 +32,7 @@ enum Methods : string { + case GET_UPDATES = 'getUpdates'; case GET_ME = 'getMe'; case LOGOUT = 'logOut'; case CLOSE = 'close'; @@ -67,6 +69,7 @@ { return match($this) { + self::GET_UPDATES => GetUpdates::execute($bot, $parameters), self::GET_ME => GetMe::execute($bot, $parameters), self::LOGOUT => LogOut::execute($bot, $parameters), self::CLOSE => Close::execute($bot, $parameters), diff --git a/src/TgBotLib/Methods/GetUpdates.php b/src/TgBotLib/Methods/GetUpdates.php new file mode 100644 index 0000000..bba4ec2 --- /dev/null +++ b/src/TgBotLib/Methods/GetUpdates.php @@ -0,0 +1,39 @@ + 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. + } +} \ No newline at end of file