maxbot-api-client-python 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maxbot_api_client_python/__init__.py +7 -0
- maxbot_api_client_python/api.py +35 -0
- maxbot_api_client_python/client.py +195 -0
- maxbot_api_client_python/exceptions.py +36 -0
- maxbot_api_client_python/tools/__init__.py +8 -0
- maxbot_api_client_python/tools/bots.py +52 -0
- maxbot_api_client_python/tools/chats.py +445 -0
- maxbot_api_client_python/tools/helpers.py +259 -0
- maxbot_api_client_python/tools/messages.py +194 -0
- maxbot_api_client_python/tools/subscriptions.py +101 -0
- maxbot_api_client_python/tools/uploads.py +91 -0
- maxbot_api_client_python/types/__init__.py +4 -0
- maxbot_api_client_python/types/constants.py +109 -0
- maxbot_api_client_python/types/models.py +458 -0
- maxbot_api_client_python/utils.py +68 -0
- maxbot_api_client_python-1.1.0.dist-info/METADATA +241 -0
- maxbot_api_client_python-1.1.0.dist-info/RECORD +20 -0
- maxbot_api_client_python-1.1.0.dist-info/WHEEL +5 -0
- maxbot_api_client_python-1.1.0.dist-info/licenses/LICENSE +21 -0
- maxbot_api_client_python-1.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
from maxbot_api_client_python.client import Client, decode, adecode
|
|
2
|
+
from maxbot_api_client_python.types.constants import Paths
|
|
3
|
+
from maxbot_api_client_python.types import models
|
|
4
|
+
|
|
5
|
+
class Messages:
|
|
6
|
+
def __init__(self, client: Client):
|
|
7
|
+
self.client = client
|
|
8
|
+
|
|
9
|
+
def GetMessages(self, **kwargs) -> models.MessagesList:
|
|
10
|
+
"""
|
|
11
|
+
Retrieves a list of messages.
|
|
12
|
+
It can fetch messages belonging to a specific ChatID or by an exact list of MessageIDs.
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
# Fetch messages by Chat ID
|
|
16
|
+
response = api.messages.GetMessages(chat_id=123456)
|
|
17
|
+
|
|
18
|
+
# Fetch specific messages:
|
|
19
|
+
response = api.messages.GetMessages(message_ids=["mid:1", "mid:2"])
|
|
20
|
+
"""
|
|
21
|
+
req = models.GetMessagesReq(**kwargs)
|
|
22
|
+
return decode(self.client, "GET", Paths.MESSAGES, models.MessagesList, query=req.model_dump(exclude_none=True))
|
|
23
|
+
|
|
24
|
+
def SendMessage(self, **kwargs) -> models.SendMessageResp:
|
|
25
|
+
"""
|
|
26
|
+
Sends a text message or attachment to a specific user or chat.
|
|
27
|
+
If Notify is False, no push notification will be sent to the user.
|
|
28
|
+
|
|
29
|
+
Example:
|
|
30
|
+
response = api.messages.SendMessage(
|
|
31
|
+
chat_id=123456,
|
|
32
|
+
text="Hello, world!",
|
|
33
|
+
notify=True
|
|
34
|
+
)
|
|
35
|
+
"""
|
|
36
|
+
req = models.SendMessageReq(**kwargs)
|
|
37
|
+
return decode(self.client, "POST", Paths.MESSAGES, models.SendMessageResp, query=req.model_dump(exclude_none=True), payload=req)
|
|
38
|
+
|
|
39
|
+
def EditMessage(self, **kwargs) -> models.SimpleQueryResult:
|
|
40
|
+
"""
|
|
41
|
+
Modifies the content of a previously sent message.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
response = api.messages.EditMessage(
|
|
45
|
+
message_id="mid:987654321...",
|
|
46
|
+
text="Updated message text!",
|
|
47
|
+
format="HTML"
|
|
48
|
+
)
|
|
49
|
+
"""
|
|
50
|
+
req = models.EditMessageReq(**kwargs)
|
|
51
|
+
return decode(self.client, "PUT", Paths.MESSAGES, models.SimpleQueryResult, query=req.model_dump(exclude_none=True), payload=req)
|
|
52
|
+
|
|
53
|
+
def DeleteMessage(self, **kwargs) -> models.SimpleQueryResult:
|
|
54
|
+
"""
|
|
55
|
+
Removes a previously sent message by its ID.
|
|
56
|
+
|
|
57
|
+
Example:
|
|
58
|
+
response = api.messages.DeleteMessage(
|
|
59
|
+
message_id="mid:987654321..."
|
|
60
|
+
)
|
|
61
|
+
"""
|
|
62
|
+
req = models.DeleteMessageReq(**kwargs)
|
|
63
|
+
return decode(self.client, "DELETE", Paths.MESSAGES, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
|
|
64
|
+
|
|
65
|
+
def GetMessage(self, **kwargs) -> models.Message:
|
|
66
|
+
"""
|
|
67
|
+
Retrieves full information about a message by its ID.
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
response = api.messages.GetMessage(
|
|
71
|
+
message_id="mid:987654321..."
|
|
72
|
+
)
|
|
73
|
+
"""
|
|
74
|
+
req = models.GetMessageReq(**kwargs)
|
|
75
|
+
path = f"{Paths.MESSAGES}/{req.message_id}"
|
|
76
|
+
return decode(self.client, "GET", path, models.Message)
|
|
77
|
+
|
|
78
|
+
def GetVideoInfo(self, **kwargs) -> models.GetVideoInfoResp:
|
|
79
|
+
"""
|
|
80
|
+
Retrieves metadata and the processing status for an uploaded video.
|
|
81
|
+
|
|
82
|
+
Example:
|
|
83
|
+
response = api.messages.GetVideoInfo(
|
|
84
|
+
video_token="vtok_abc123xyz..."
|
|
85
|
+
)
|
|
86
|
+
"""
|
|
87
|
+
req = models.GetVideoInfoReq(**kwargs)
|
|
88
|
+
path = f"{Paths.VIDEOS}/{req.video_token}"
|
|
89
|
+
return decode(self.client, "GET", path, models.GetVideoInfoResp)
|
|
90
|
+
|
|
91
|
+
def AnswerCallback(self, **kwargs) -> models.SimpleQueryResult:
|
|
92
|
+
"""
|
|
93
|
+
Acknowledges and responds to a user clicking an inline button.
|
|
94
|
+
|
|
95
|
+
Example:
|
|
96
|
+
response = api.messages.AnswerCallback(
|
|
97
|
+
callback_id="cbk_12345...",
|
|
98
|
+
message=NewMessageBody(text="Action confirmed!")
|
|
99
|
+
)
|
|
100
|
+
"""
|
|
101
|
+
req = models.AnswerCallbackReq(**kwargs)
|
|
102
|
+
return decode(self.client, "POST", Paths.ANSWERS, models.SimpleQueryResult, query=req.model_dump(exclude_none=True), payload=req)
|
|
103
|
+
|
|
104
|
+
async def GetMessagesAsync(self, **kwargs) -> models.MessagesList:
|
|
105
|
+
"""Async version of GetMessages.
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
# Fetch messages by Chat ID
|
|
109
|
+
response = await api.messages.GetMessagesAsync(chat_id=123456)
|
|
110
|
+
|
|
111
|
+
# Fetch specific messages:
|
|
112
|
+
response = await api.messages.GetMessagesAsync(message_ids=["mid:1", "mid:2"])
|
|
113
|
+
"""
|
|
114
|
+
req = models.GetMessagesReq(**kwargs)
|
|
115
|
+
return await adecode(self.client, "GET", Paths.MESSAGES, models.MessagesList, query=req.model_dump(exclude_none=True))
|
|
116
|
+
|
|
117
|
+
async def SendMessageAsync(self, **kwargs) -> models.SendMessageResp:
|
|
118
|
+
"""
|
|
119
|
+
Async version of SendMessage.
|
|
120
|
+
|
|
121
|
+
Example:
|
|
122
|
+
response = await api.messages.SendMessageAsync(
|
|
123
|
+
chat_id=123456,
|
|
124
|
+
text="Hello, world!",
|
|
125
|
+
notify=True
|
|
126
|
+
)
|
|
127
|
+
"""
|
|
128
|
+
req = models.SendMessageReq(**kwargs)
|
|
129
|
+
return await adecode(self.client, "POST", Paths.MESSAGES, models.SendMessageResp, query=req.model_dump(exclude_none=True), payload=req)
|
|
130
|
+
|
|
131
|
+
async def EditMessageAsync(self, **kwargs) -> models.SimpleQueryResult:
|
|
132
|
+
"""
|
|
133
|
+
Async version of EditMessage.
|
|
134
|
+
|
|
135
|
+
Example:
|
|
136
|
+
response = await api.messages.EditMessageAsync(
|
|
137
|
+
message_id="mid:987654321...",
|
|
138
|
+
text="Updated message text!",
|
|
139
|
+
format="HTML"
|
|
140
|
+
)
|
|
141
|
+
"""
|
|
142
|
+
req = models.EditMessageReq(**kwargs)
|
|
143
|
+
return await adecode(self.client, "PUT", Paths.MESSAGES, models.SimpleQueryResult, query=req.model_dump(exclude_none=True), payload=req)
|
|
144
|
+
|
|
145
|
+
async def DeleteMessageAsync(self, **kwargs) -> models.SimpleQueryResult:
|
|
146
|
+
"""
|
|
147
|
+
Async version of DeleteMessage.
|
|
148
|
+
|
|
149
|
+
Example:
|
|
150
|
+
response = await api.messages.DeleteMessageAsync(
|
|
151
|
+
message_id="mid:987654321..."
|
|
152
|
+
)
|
|
153
|
+
"""
|
|
154
|
+
req = models.DeleteMessageReq(**kwargs)
|
|
155
|
+
return await adecode(self.client, "DELETE", Paths.MESSAGES, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
|
|
156
|
+
|
|
157
|
+
async def GetMessageAsync(self, **kwargs) -> models.Message:
|
|
158
|
+
"""
|
|
159
|
+
Async version of GetMessage.
|
|
160
|
+
|
|
161
|
+
Example:
|
|
162
|
+
response = await api.messages.GetMessageAsync(
|
|
163
|
+
message_id="mid:987654321..."
|
|
164
|
+
)
|
|
165
|
+
"""
|
|
166
|
+
req = models.GetMessageReq(**kwargs)
|
|
167
|
+
path = f"{Paths.MESSAGES}/{req.message_id}"
|
|
168
|
+
return await adecode(self.client, "GET", path, models.Message)
|
|
169
|
+
|
|
170
|
+
async def GetVideoInfoAsync(self, **kwargs) -> models.GetVideoInfoResp:
|
|
171
|
+
"""
|
|
172
|
+
Async version of GetVideoInfo.
|
|
173
|
+
|
|
174
|
+
Example:
|
|
175
|
+
response = await api.messages.GetVideoInfoAsync(
|
|
176
|
+
video_token="vtok_abc123xyz..."
|
|
177
|
+
)
|
|
178
|
+
"""
|
|
179
|
+
req = models.GetVideoInfoReq(**kwargs)
|
|
180
|
+
path = f"{Paths.VIDEOS}/{req.video_token}"
|
|
181
|
+
return await adecode(self.client, "GET", path, models.GetVideoInfoResp)
|
|
182
|
+
|
|
183
|
+
async def AnswerCallbackAsync(self, **kwargs) -> models.SimpleQueryResult:
|
|
184
|
+
"""
|
|
185
|
+
Async version of AnswerCallback.
|
|
186
|
+
|
|
187
|
+
Example:
|
|
188
|
+
response = await api.messages.AnswerCallbackAsync(
|
|
189
|
+
callback_id="cbk_12345...",
|
|
190
|
+
message=NewMessageBody(text="Action confirmed!")
|
|
191
|
+
)
|
|
192
|
+
"""
|
|
193
|
+
req = models.AnswerCallbackReq(**kwargs)
|
|
194
|
+
return await adecode(self.client, "POST", Paths.ANSWERS, models.SimpleQueryResult, query=req.model_dump(exclude_none=True), payload=req)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from maxbot_api_client_python.client import Client, decode, adecode
|
|
2
|
+
from maxbot_api_client_python.types.constants import Paths
|
|
3
|
+
from maxbot_api_client_python.types import models
|
|
4
|
+
|
|
5
|
+
class Subscriptions:
|
|
6
|
+
def __init__(self, client: Client):
|
|
7
|
+
self.client = client
|
|
8
|
+
|
|
9
|
+
def GetSubscriptions(self) -> models.GetSubscriptionsResp:
|
|
10
|
+
"""
|
|
11
|
+
Returns a list of all subscriptions if your bot receives data via a Webhook.
|
|
12
|
+
|
|
13
|
+
Example:
|
|
14
|
+
response = api.subscriptions.GetSubscriptions()
|
|
15
|
+
"""
|
|
16
|
+
return decode(self.client, "GET", Paths.SUBSCRIPTIONS, models.GetSubscriptionsResp)
|
|
17
|
+
|
|
18
|
+
def Subscribe(self, **kwargs) -> models.SimpleQueryResult:
|
|
19
|
+
"""
|
|
20
|
+
Configures the delivery of bot events via Webhook.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
response = api.subscriptions.Subscribe(
|
|
24
|
+
url="https://webhook.site/endpoint"
|
|
25
|
+
)
|
|
26
|
+
"""
|
|
27
|
+
req = models.SubscribeReq(**kwargs)
|
|
28
|
+
return decode(self.client, "POST", Paths.SUBSCRIPTIONS, models.SimpleQueryResult, payload=req)
|
|
29
|
+
|
|
30
|
+
def Unsubscribe(self, **kwargs) -> models.SimpleQueryResult:
|
|
31
|
+
"""
|
|
32
|
+
Unsubscribes the bot from receiving updates via Webhook.
|
|
33
|
+
|
|
34
|
+
Example:
|
|
35
|
+
response = api.subscriptions.Unsubscribe(
|
|
36
|
+
url="https://webhook.site/endpoint"
|
|
37
|
+
)
|
|
38
|
+
"""
|
|
39
|
+
req = models.UnsubscribeReq(**kwargs)
|
|
40
|
+
return decode(self.client, "DELETE", Paths.SUBSCRIPTIONS, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
|
|
41
|
+
|
|
42
|
+
def GetUpdates(self, **kwargs) -> models.GetUpdatesResp:
|
|
43
|
+
"""
|
|
44
|
+
Fetches new events (incoming messages, bot additions, etc.) from the server.
|
|
45
|
+
Use this method for long-polling. Provide a Marker to acknowledge previous
|
|
46
|
+
updates and fetch only new ones.
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
response = api.subscriptions.GetUpdates(
|
|
50
|
+
marker=123456789,
|
|
51
|
+
timeout=30 # seconds to wait for new updates
|
|
52
|
+
)
|
|
53
|
+
"""
|
|
54
|
+
req = models.GetUpdatesReq(**kwargs)
|
|
55
|
+
return decode(self.client, "GET", Paths.UPDATES, models.GetUpdatesResp, query=req.model_dump(exclude_none=True))
|
|
56
|
+
|
|
57
|
+
async def GetSubscriptionsAsync(self) -> models.GetSubscriptionsResp:
|
|
58
|
+
"""
|
|
59
|
+
Async version of GetSubscriptions.
|
|
60
|
+
|
|
61
|
+
Example:
|
|
62
|
+
response = await api.subscriptions.GetSubscriptionsAsync()
|
|
63
|
+
"""
|
|
64
|
+
return await adecode(self.client, "GET", Paths.SUBSCRIPTIONS, models.GetSubscriptionsResp)
|
|
65
|
+
|
|
66
|
+
async def SubscribeAsync(self, **kwargs) -> models.SimpleQueryResult:
|
|
67
|
+
"""
|
|
68
|
+
Async version of Subscribe.
|
|
69
|
+
|
|
70
|
+
Example:
|
|
71
|
+
response = await api.subscriptions.SubscribeAsync(
|
|
72
|
+
url="https://webhook.site/endpoint"
|
|
73
|
+
)
|
|
74
|
+
"""
|
|
75
|
+
req = models.SubscribeReq(**kwargs)
|
|
76
|
+
return await adecode(self.client, "POST", Paths.SUBSCRIPTIONS, models.SimpleQueryResult, payload=req)
|
|
77
|
+
|
|
78
|
+
async def UnsubscribeAsync(self, **kwargs) -> models.SimpleQueryResult:
|
|
79
|
+
"""
|
|
80
|
+
Async version of Unsubscribe.
|
|
81
|
+
|
|
82
|
+
Example:
|
|
83
|
+
response = await api.subscriptions.UnsubscribeAsync(
|
|
84
|
+
url="https://webhook.site/endpoint"
|
|
85
|
+
)
|
|
86
|
+
"""
|
|
87
|
+
req = models.UnsubscribeReq(**kwargs)
|
|
88
|
+
return await adecode(self.client, "DELETE", Paths.SUBSCRIPTIONS, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
|
|
89
|
+
|
|
90
|
+
async def GetUpdatesAsync(self, **kwargs) -> models.GetUpdatesResp:
|
|
91
|
+
"""
|
|
92
|
+
Async version of GetUpdates.
|
|
93
|
+
|
|
94
|
+
Example:
|
|
95
|
+
response = await api.subscriptions.GetUpdatesAsync(
|
|
96
|
+
marker=123456789,
|
|
97
|
+
timeout=30 # seconds to wait for new updates
|
|
98
|
+
)
|
|
99
|
+
"""
|
|
100
|
+
req = models.GetUpdatesReq(**kwargs)
|
|
101
|
+
return await adecode(self.client, "GET", Paths.UPDATES, models.GetUpdatesResp, query=req.model_dump(exclude_none=True))
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import asyncio, logging
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from tenacity import retry, stop_after_attempt, wait_exponential
|
|
6
|
+
|
|
7
|
+
from maxbot_api_client_python.client import Client, decode
|
|
8
|
+
from maxbot_api_client_python.types.constants import Paths, UploadType
|
|
9
|
+
from maxbot_api_client_python.types.models import UploadedInfo, UploadFileReq, PhotoAttachmentRequestPayload
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
class Uploads:
|
|
14
|
+
def __init__(self, client: Client):
|
|
15
|
+
self.client = client
|
|
16
|
+
|
|
17
|
+
@retry(
|
|
18
|
+
stop=stop_after_attempt(3),
|
|
19
|
+
wait=wait_exponential(multiplier=1, min=2, max=10),
|
|
20
|
+
reraise=True,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def UploadFile(self, **kwargs) -> UploadedInfo:
|
|
24
|
+
"""
|
|
25
|
+
Uploads a file to the server and returns the upload metadata.
|
|
26
|
+
It seamlessly handles both STEP 1 (obtaining the URL) and STEP 2 (streaming the file).
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
response = api.uploads.UploadFile(
|
|
30
|
+
type=UploadType.IMAGE,
|
|
31
|
+
file_path="/path/to/image.png"
|
|
32
|
+
)
|
|
33
|
+
"""
|
|
34
|
+
req = UploadFileReq(**kwargs)
|
|
35
|
+
init_resp = self.get_upload_url(req.type)
|
|
36
|
+
|
|
37
|
+
if init_resp.url:
|
|
38
|
+
if not req.file_path:
|
|
39
|
+
raise ValueError("file_path must be provided for multipart uploads.")
|
|
40
|
+
|
|
41
|
+
multipart_resp = self.upload_multipart(init_resp.url, req.file_path)
|
|
42
|
+
|
|
43
|
+
if multipart_resp:
|
|
44
|
+
if multipart_resp.token:
|
|
45
|
+
return multipart_resp
|
|
46
|
+
|
|
47
|
+
if multipart_resp.photos:
|
|
48
|
+
first_photo = next(iter(multipart_resp.photos.values()), None)
|
|
49
|
+
if first_photo and first_photo.token:
|
|
50
|
+
multipart_resp.token = first_photo.token
|
|
51
|
+
return multipart_resp
|
|
52
|
+
|
|
53
|
+
if init_resp.token:
|
|
54
|
+
return UploadedInfo(token=init_resp.token)
|
|
55
|
+
|
|
56
|
+
raise Exception("Server did not return token after upload")
|
|
57
|
+
|
|
58
|
+
def get_upload_url(self, upload_type: UploadType) -> PhotoAttachmentRequestPayload:
|
|
59
|
+
"""Internal helper: Obtains the target URL for uploading."""
|
|
60
|
+
return decode(self.client, "POST", Paths.UPLOADS, PhotoAttachmentRequestPayload, query={"type": upload_type.value})
|
|
61
|
+
|
|
62
|
+
def upload_multipart(self, upload_url: str, file_path: str) -> Optional[UploadedInfo]:
|
|
63
|
+
"""Internal helper: Streams the file to the obtained URL."""
|
|
64
|
+
path = Path(file_path)
|
|
65
|
+
try:
|
|
66
|
+
with open(path, "rb") as f:
|
|
67
|
+
files = {"file": (path.name, f)}
|
|
68
|
+
return decode(self.client, "POST", upload_url, UploadedInfo, files=files)
|
|
69
|
+
except OSError as e:
|
|
70
|
+
logger.error(f"Failed to read file for upload: {e}")
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
async def UploadFileAsync(self, **kwargs) -> UploadedInfo:
|
|
74
|
+
"""
|
|
75
|
+
Async version of UploadFile.
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
response = await api.uploads.UploadFileAsync(
|
|
79
|
+
type=UploadType.IMAGE,
|
|
80
|
+
file_path="/path/to/image.png"
|
|
81
|
+
)
|
|
82
|
+
"""
|
|
83
|
+
return await asyncio.to_thread(self.UploadFile, **kwargs)
|
|
84
|
+
|
|
85
|
+
async def get_upload_url_async(self, upload_type: UploadType) -> PhotoAttachmentRequestPayload:
|
|
86
|
+
"""Async version of get_upload_url."""
|
|
87
|
+
return await asyncio.to_thread(self.get_upload_url, upload_type)
|
|
88
|
+
|
|
89
|
+
async def upload_multipart_async(self, upload_url: str, file_path: str) -> Optional[UploadedInfo]:
|
|
90
|
+
"""Async version of upload_multipart."""
|
|
91
|
+
return await asyncio.to_thread(self.upload_multipart, upload_url, file_path)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
DEFAULT_BASE_URL = "https://platform-api.max.ru"
|
|
4
|
+
|
|
5
|
+
class Paths(str, Enum):
|
|
6
|
+
ME = "me"
|
|
7
|
+
CHATS = "chats"
|
|
8
|
+
ANSWERS = "answers"
|
|
9
|
+
UPDATES = "updates"
|
|
10
|
+
UPLOADS = "uploads"
|
|
11
|
+
MESSAGES = "messages"
|
|
12
|
+
SUBSCRIPTIONS = "subscriptions"
|
|
13
|
+
VIDEOS = "videos"
|
|
14
|
+
|
|
15
|
+
CHATS_ID = "chats/{}"
|
|
16
|
+
CHATS_PIN = "chats/{}/pin"
|
|
17
|
+
CHATS_ACTIONS = "chats/{}/actions"
|
|
18
|
+
CHATS_MEMBERS = "chats/{}/members"
|
|
19
|
+
CHATS_MEMBERS_ME = "chats/{}/members/me"
|
|
20
|
+
CHATS_MEMBERS_ADMIN = "chats/{}/members/admins"
|
|
21
|
+
CHATS_MEMBERS_ADMIN_ID = "chats/{}/members/admins/{}"
|
|
22
|
+
|
|
23
|
+
class AttachmentType(str, Enum):
|
|
24
|
+
IMAGE = "image"
|
|
25
|
+
VIDEO = "video"
|
|
26
|
+
AUDIO = "audio"
|
|
27
|
+
FILE = "file"
|
|
28
|
+
STICKER = "sticker"
|
|
29
|
+
CONTACT = "contact"
|
|
30
|
+
KEYBOARD = "inline_keyboard"
|
|
31
|
+
SHARE = "share"
|
|
32
|
+
LOCATION = "location"
|
|
33
|
+
|
|
34
|
+
class ChatType(str, Enum):
|
|
35
|
+
CHANNEL = "channel"
|
|
36
|
+
CHAT = "chat"
|
|
37
|
+
DIALOG = "dialog"
|
|
38
|
+
|
|
39
|
+
class ChatStatus(str, Enum):
|
|
40
|
+
ACTIVE = "active"
|
|
41
|
+
CLOSED = "closed"
|
|
42
|
+
LEFT = "left"
|
|
43
|
+
REMOVED = "removed"
|
|
44
|
+
|
|
45
|
+
class MarkupType(str, Enum):
|
|
46
|
+
STRONG = "strong"
|
|
47
|
+
EMPHASIZED = "emphasized"
|
|
48
|
+
MONOSPACED = "monospaced"
|
|
49
|
+
LINK = "link"
|
|
50
|
+
STRIKETHROUGH = "strikethrough"
|
|
51
|
+
UNDERLINE = "underline"
|
|
52
|
+
USER = "user_mention"
|
|
53
|
+
|
|
54
|
+
class Format(str, Enum):
|
|
55
|
+
HTML = "html"
|
|
56
|
+
MARKDOWN = "markdown"
|
|
57
|
+
|
|
58
|
+
class UpdateType(str, Enum):
|
|
59
|
+
BOT_ADDED = "bot_added"
|
|
60
|
+
BOT_REMOVED = "bot_removed"
|
|
61
|
+
BOT_STARTED = "bot_started"
|
|
62
|
+
BOT_STOPPED = "bot_stopped"
|
|
63
|
+
CHAT_TITLE_CHANGED = "chat_title_changed"
|
|
64
|
+
DIALOG_MUTED = "dialog_muted"
|
|
65
|
+
DIALOG_UNMUTED = "dialog_unmuted"
|
|
66
|
+
DIALOG_CLEARED = "dialog_cleared"
|
|
67
|
+
DIALOG_REMOVED = "dialog_removed"
|
|
68
|
+
MESSAGE_CREATED = "message_created"
|
|
69
|
+
MESSAGE_CALLBACK = "message_callback"
|
|
70
|
+
MESSAGE_EDITED = "message_edited"
|
|
71
|
+
MESSAGE_REMOVED = "message_removed"
|
|
72
|
+
USER_ADDED = "user_added"
|
|
73
|
+
USER_REMOVED = "user_removed"
|
|
74
|
+
|
|
75
|
+
class LinkedMessageType(str, Enum):
|
|
76
|
+
FORWARD = "forward"
|
|
77
|
+
REPLY = "reply"
|
|
78
|
+
|
|
79
|
+
class SenderAction(str, Enum):
|
|
80
|
+
TYPING_ON = "typing_on"
|
|
81
|
+
TYPING_OFF = "typing_off"
|
|
82
|
+
SENDING_PHOTO = "sending_photo"
|
|
83
|
+
SENDING_VIDEO = "sending_video"
|
|
84
|
+
SENDING_AUDIO = "sending_audio"
|
|
85
|
+
SENDING_FILE = "sending_file"
|
|
86
|
+
MARK_SEEN = "mark_seen"
|
|
87
|
+
|
|
88
|
+
class ChatAdminPermission(str, Enum):
|
|
89
|
+
READ_ALL_MESSAGES = "read_all_messages"
|
|
90
|
+
ADD_REMOVE_USERS = "add_remove_members"
|
|
91
|
+
ADD_ADMINS = "add_admins"
|
|
92
|
+
CHANGE_CHAT_PHOTO = "change_chat_info"
|
|
93
|
+
PIN_MESSAGE = "pin_message"
|
|
94
|
+
WRITE = "write"
|
|
95
|
+
EDIT_LINK = "edit_link"
|
|
96
|
+
|
|
97
|
+
class ButtonType(str, Enum):
|
|
98
|
+
CALLBACK = "callback"
|
|
99
|
+
LINK = "link"
|
|
100
|
+
REQUEST_LOCATION = "request_geo_location"
|
|
101
|
+
REQUEST_CONTACT = "request_contact"
|
|
102
|
+
OPEN_APP = "open_app"
|
|
103
|
+
MESSAGE = "message"
|
|
104
|
+
|
|
105
|
+
class UploadType(str, Enum):
|
|
106
|
+
IMAGE = "image"
|
|
107
|
+
VIDEO = "video"
|
|
108
|
+
AUDIO = "audio"
|
|
109
|
+
FILE = "file"
|