From 932178d2038f312c820ee1906c3123d8252c0e17 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 22 Nov 2024 22:11:29 -0500 Subject: [PATCH] Add AnswerShippingQuery method --- src/TgBotLib/Enums/Methods.php | 3 ++ src/TgBotLib/Methods/AnswerShippingQuery.php | 50 ++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/TgBotLib/Methods/AnswerShippingQuery.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 0623aa2..1dd35af 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -8,6 +8,7 @@ use TgBotLib\Methods\AddStickerToSet; use TgBotLib\Methods\AnswerCallbackQuery; use TgBotLib\Methods\AnswerInlineQuery; + use TgBotLib\Methods\AnswerShippingQuery; use TgBotLib\Methods\AnswerWebAppQuery; use TgBotLib\Methods\ApproveChatJoinRequest; use TgBotLib\Methods\BanChatMember; @@ -243,6 +244,7 @@ case SAVE_PREPARED_INLINE_MESSAGE = 'savePreparedInlineMessage'; case SEND_INVOICE = 'sendInvoice'; case CREATE_INVOICE_LINK = 'createInvoiceLink'; + case ANSWER_SHIPPING_QUERY = 'answerShippingQuery'; /** * Executes a command on the provided bot with the given parameters. @@ -374,6 +376,7 @@ self::SAVE_PREPARED_INLINE_MESSAGE => SavePreparedInlineMessage::execute($bot, $parameters), self::SEND_INVOICE => SendInvoice::execute($bot, $parameters), self::CREATE_INVOICE_LINK => CreateInvoiceLink::execute($bot, $parameters), + self::ANSWER_SHIPPING_QUERY => AnswerShippingQuery::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/AnswerShippingQuery.php b/src/TgBotLib/Methods/AnswerShippingQuery.php new file mode 100644 index 0000000..6ff5b51 --- /dev/null +++ b/src/TgBotLib/Methods/AnswerShippingQuery.php @@ -0,0 +1,50 @@ +toArray()); + } + } + + return (bool)self::executeCurl(self::buildPost($bot, Methods::ANSWER_SHIPPING_QUERY->value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'shipping_query_id', + 'ok' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'shipping_options', + 'error_message' + ]; + } + } \ No newline at end of file