From b994717f64e5f6dced431b8ef6faf0037d086e63 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 28 Jul 2025 01:13:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=20Webhook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maxapi/methods/get_subscriptions.py | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 maxapi/methods/get_subscriptions.py diff --git a/maxapi/methods/get_subscriptions.py b/maxapi/methods/get_subscriptions.py new file mode 100644 index 0000000..fd44497 --- /dev/null +++ b/maxapi/methods/get_subscriptions.py @@ -0,0 +1,44 @@ +from typing import TYPE_CHECKING + +from ..methods.types.getted_subscriptions import GettedSubscriptions + +from ..enums.http_method import HTTPMethod +from ..enums.api_path import ApiPath + +from ..connection.base import BaseConnection + + +if TYPE_CHECKING: + from ..bot import Bot + + +class GetSubscriptions(BaseConnection): + + """ + Если ваш бот получает данные через WebHook, этот класс возвращает список всех подписок. + """ + + def __init__( + self, + bot: 'Bot', + ): + self.bot = bot + + async def fetch(self) -> GettedSubscriptions: + + """ + Отправляет запрос на получение списка всех подписок. + + Returns: + GettedSubscriptions: Объект со списком подписок + """ + + if self.bot is None: + raise RuntimeError('Bot не инициализирован') + + return await super().request( + method=HTTPMethod.GET, + path=ApiPath.SUBSCRIPTIONS, + model=GettedSubscriptions, + params=self.bot.params + ) \ No newline at end of file