maxbot-api-client-python 1.1.2__py3-none-any.whl → 2.0.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.
@@ -1,165 +1,178 @@
1
- from maxbot_api_client_python.client import Client, decode, adecode
1
+ from typing import Any
2
+
3
+ from maxbot_api_client_python.client import Client
2
4
  from maxbot_api_client_python.types.constants import Paths
3
- from maxbot_api_client_python.types import models
5
+ from maxbot_api_client_python.types.models import AddMembersReq, AddMembersResp, ChatInfo, ChatMember, DeleteAdminReq, DeleteChatReq, DeleteMemberReq, EditChatReq, GetChatAdminsReq, GetChatAdminsResp, GetChatMembersReq, GetChatMembersResp, GetChatMembershipReq, GetChatReq, GetChatsReq, GetChatsResp, GetMessagesReq, GetPinnedMessageReq, LeaveChatReq, Message, PinMessageReq, SendActionReq, SetChatAdminsReq, SimpleQueryResult, UnpinMessageReq
4
6
 
5
7
  class Chats:
6
8
  def __init__(self, client: Client):
7
9
  self.client = client
8
10
 
9
- def GetChats(self, **kwargs) -> models.GetChatsResp:
11
+ def get_chats(self, **kwargs: Any) -> GetChatsResp:
10
12
  """
11
13
  Returns information about chats that the bot participated in: a result list and a marker pointing to the next page.
12
14
 
13
15
  Example:
14
- response = api.chats.GetChats(
16
+ response = bot.chats.get_chats(
15
17
  count=20
16
18
  )
17
19
  """
18
- req = models.GetChatsReq(**kwargs)
19
- return decode(self.client, "GET", Paths.CHATS, models.GetChatsResp, query=req.model_dump(exclude_none=True))
20
+ req = GetChatsReq(**kwargs)
21
+ query, payload = self.client.split_request(req)
22
+ return self.client.decode("GET", Paths.CHATS, GetChatsResp, query=query, payload=payload)
20
23
 
21
- def GetChat(self, **kwargs) -> models.ChatInfo:
24
+ def get_chat(self, **kwargs: Any) -> ChatInfo:
22
25
  """
23
26
  Returns info about a specific chat.
24
27
 
25
28
  Example:
26
- response = api.chats.GetChat(
29
+ response = bot.chats.get_chat(
27
30
  chat_id=123456789
28
31
  )
29
32
  """
30
- req = models.GetChatReq(**kwargs)
33
+ req = GetChatReq(**kwargs)
31
34
  path = Paths.CHATS_ID.format(req.chat_id)
32
- return decode(self.client, "GET", path, models.ChatInfo)
35
+ query, payload = self.client.split_request(req)
36
+ return self.client.decode("GET", path, ChatInfo, query=query, payload=payload)
33
37
 
34
- def EditChat(self, **kwargs) -> models.ChatInfo:
38
+ def edit_chat(self, **kwargs: Any) -> ChatInfo:
35
39
  """
36
40
  Modifies the properties of a chat, such as its title, icon, or notification settings.
37
41
 
38
42
  Example:
39
- response = api.chats.EditChat(
43
+ response = bot.chats.edit_chat(
40
44
  chat_id=123456789,
41
45
  title="Updated Chat Title",
42
46
  notify=True
43
47
  )
44
48
  """
45
- req = models.EditChatReq(**kwargs)
49
+ req = EditChatReq(**kwargs)
46
50
  path = Paths.CHATS_ID.format(req.chat_id)
47
- return decode(self.client, "PATCH", path, models.ChatInfo, payload=req)
51
+ query, payload = self.client.split_request(req)
52
+ return self.client.decode("PATCH", path, ChatInfo, query=query, payload=payload)
48
53
 
49
- def DeleteChat(self, **kwargs) -> models.SimpleQueryResult:
54
+ def delete_chat(self, **kwargs: Any) -> SimpleQueryResult:
50
55
  """
51
56
  Permanently deletes a chat for the bot.
52
57
 
53
58
  Example:
54
- response = api.chats.DeleteChat(
59
+ response = bot.chats.delete_chat(
55
60
  chat_id=123456789
56
61
  )
57
62
  """
58
- req = models.DeleteChatReq(**kwargs)
63
+ req = DeleteChatReq(**kwargs)
59
64
  path = Paths.CHATS_ID.format(req.chat_id)
60
- return decode(self.client, "DELETE", path, models.SimpleQueryResult)
65
+ query, payload = self.client.split_request(req)
66
+ return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
61
67
 
62
- def SendAction(self, **kwargs) -> models.SimpleQueryResult:
68
+ def send_action(self, **kwargs: Any) -> SimpleQueryResult:
63
69
  """
64
70
  Broadcasts a temporary status action (e.g., "typing...", "recording video...") to the chat participants.
65
71
 
66
72
  Example:
67
- response = api.chats.SendAction(
73
+ response = bot.chats.send_action(
68
74
  chat_id=123456789,
69
75
  action="mark_seen"
70
76
  )
71
77
  """
72
- req = models.SendActionReq(**kwargs)
78
+ req = SendActionReq(**kwargs)
73
79
  path = Paths.CHATS_ACTIONS.format(req.chat_id)
74
- return decode(self.client, "POST", path, models.SimpleQueryResult, payload=req)
80
+ query, payload = self.client.split_request(req)
81
+ return self.client.decode("POST", path, SimpleQueryResult, query=query, payload=payload)
75
82
 
76
- def GetPinnedMessage(self, **kwargs) -> models.Message:
83
+ def get_pinned_message(self, **kwargs: Any) -> Message:
77
84
  """
78
85
  Retrieves the currently pinned message in the specified chat.
79
86
 
80
87
  Example:
81
- response = api.chats.GetPinnedMessage(
88
+ response = bot.chats.get_pinned_message(
82
89
  chat_id=123456789
83
90
  )
84
91
  """
85
- req = models.GetPinnedMessageReq(**kwargs)
92
+ req = GetPinnedMessageReq(**kwargs)
86
93
  path = Paths.CHATS_PIN.format(req.chat_id)
87
- return decode(self.client, "GET", path, models.Message)
94
+ query, payload = self.client.split_request(req)
95
+ return self.client.decode("GET", path, Message, query=query, payload=payload)
88
96
 
89
- def PinMessage(self, **kwargs) -> models.SimpleQueryResult:
97
+ def pin_message(self, **kwargs: Any) -> SimpleQueryResult:
90
98
  """
91
99
  Pins a specific message in the chat.
92
100
  You can optionally specify whether to notify chat members about the new pinned message.
93
101
 
94
102
  Example:
95
- response = api.chats.PinMessage(
103
+ response = bot.chats.pin_message(
96
104
  chat_id=123456789,
97
105
  message_id="mid:987654321...",
98
106
  notify=True
99
107
  )
100
108
  """
101
- req = models.PinMessageReq(**kwargs)
109
+ req = PinMessageReq(**kwargs)
102
110
  path = Paths.CHATS_PIN.format(req.chat_id)
103
- return decode(self.client, "PUT", path, models.SimpleQueryResult, payload=req)
111
+ query, payload = self.client.split_request(req)
112
+ return self.client.decode("PUT", path, SimpleQueryResult, query=query, payload=payload)
104
113
 
105
- def UnpinMessage(self, **kwargs) -> models.SimpleQueryResult:
114
+ def unpin_message(self, **kwargs: Any) -> SimpleQueryResult:
106
115
  """
107
116
  Removes the pinned message from the specified chat.
108
117
 
109
118
  Example:
110
- response = api.chats.UnpinMessage(
119
+ response = bot.chats.unpin_message(
111
120
  chat_id=123456789
112
121
  )
113
122
  """
114
- req = models.UnpinMessageReq(**kwargs)
123
+ req = UnpinMessageReq(**kwargs)
115
124
  path = Paths.CHATS_PIN.format(req.chat_id)
116
- return decode(self.client, "DELETE", path, models.SimpleQueryResult)
125
+ query, payload = self.client.split_request(req)
126
+ return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
117
127
 
118
- def GetChatMembership(self, **kwargs) -> models.ChatMember:
128
+ def get_chat_membership(self, **kwargs: Any) -> ChatMember:
119
129
  """
120
130
  Returns chat membership info for the current bot.
121
131
 
122
132
  Example:
123
- response = api.chats.GetChatMembership(
133
+ response = bot.chats.get_chat_membership(
124
134
  chat_id=123456789
125
135
  )
126
136
  """
127
- req = models.GetChatMembershipReq(**kwargs)
137
+ req = GetChatMembershipReq(**kwargs)
128
138
  path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
129
- return decode(self.client, "GET", path, models.ChatMember)
139
+ query, payload = self.client.split_request(req)
140
+ return self.client.decode("GET", path, ChatMember, query=query, payload=payload)
130
141
 
131
- def LeaveChat(self, **kwargs) -> models.SimpleQueryResult:
142
+ def leave_chat(self, **kwargs: Any) -> SimpleQueryResult:
132
143
  """
133
144
  Removes the bot from chat members.
134
145
 
135
146
  Example:
136
- response = api.chats.LeaveChat(
147
+ response = bot.chats.leave_chat(
137
148
  chat_id=123456789
138
149
  )
139
150
  """
140
- req = models.LeaveChatReq(**kwargs)
151
+ req = LeaveChatReq(**kwargs)
141
152
  path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
142
- return decode(self.client, "DELETE", path, models.SimpleQueryResult)
153
+ query, payload = self.client.split_request(req)
154
+ return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
143
155
 
144
- def GetChatAdmins(self, **kwargs) -> models.GetChatAdminsResp:
156
+ def get_chat_admins(self, **kwargs: Any) -> GetChatAdminsResp:
145
157
  """
146
158
  Retrieves a list of administrators for the specified group chat.
147
159
 
148
160
  Example:
149
- response = api.chats.GetChatAdmins(
161
+ response = bot.chats.get_chat_admins(
150
162
  chat_id=123456789
151
163
  )
152
164
  """
153
- req = models.GetChatAdminsReq(**kwargs)
165
+ req = GetChatAdminsReq(**kwargs)
154
166
  path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
155
- return decode(self.client, "GET", path, models.GetChatAdminsResp)
167
+ query, payload = self.client.split_request(req)
168
+ return self.client.decode("GET", path, GetChatAdminsResp, query=query, payload=payload)
156
169
 
157
- def SetChatAdmins(self, **kwargs) -> models.SimpleQueryResult:
170
+ def set_chat_admins(self, **kwargs: Any) -> SimpleQueryResult:
158
171
  """
159
172
  Assigns administrator rights to specific users in a group chat.
160
173
 
161
174
  Example:
162
- response = api.chats.SetChatAdmins(
175
+ response = bot.chats.set_chat_admins(
163
176
  chat_id=123456789,
164
177
  admins=[
165
178
  ChatAdmin(user_id=98765, role="admin"),
@@ -167,279 +180,300 @@ class Chats:
167
180
  ]
168
181
  )
169
182
  """
170
- req = models.SetChatAdminsReq(**kwargs)
183
+ req = SetChatAdminsReq(**kwargs)
171
184
  path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
172
- return decode(self.client, "POST", path, models.SimpleQueryResult, payload=req)
185
+ query, payload = self.client.split_request(req)
186
+ return self.client.decode("POST", path, SimpleQueryResult, query=query, payload=payload)
173
187
 
174
- def DeleteAdmin(self, **kwargs) -> models.SimpleQueryResult:
188
+ def delete_admin(self, **kwargs: Any) -> SimpleQueryResult:
175
189
  """
176
190
  Revokes administrator rights from a specific user in a group chat.
177
191
 
178
192
  Example:
179
- response = api.chats.DeleteAdmin(
193
+ response = bot.chats.delete_admin(
180
194
  chat_id=123456789,
181
195
  user_id=98765
182
196
  )
183
197
  """
184
- req = models.DeleteAdminReq(**kwargs)
198
+ req = DeleteAdminReq(**kwargs)
185
199
  path = Paths.CHATS_MEMBERS_ADMIN_ID.format(req.chat_id, req.user_id)
186
- return decode(self.client, "DELETE", path, models.SimpleQueryResult)
200
+ query, payload = self.client.split_request(req)
201
+ return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
187
202
 
188
- def GetChatMembers(self, **kwargs) -> models.GetChatAdminsResp:
203
+ def get_chat_members(self, **kwargs: Any) -> GetChatMembersResp:
189
204
  """
190
205
  Returns users participated in the chat.
191
206
 
192
207
  Example:
193
- response = api.chats.GetChatMembers(
208
+ response = bot.chats.get_chat_members(
194
209
  chat_id=123456789,
195
210
  count=20
196
211
  )
197
212
  """
198
- req = models.GetChatMembersReq(**kwargs)
213
+ req = GetChatMembersReq(**kwargs)
199
214
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
200
- return decode(self.client, "GET", path, models.GetChatAdminsResp, query=req.model_dump(exclude_none=True))
215
+ query, payload = self.client.split_request(req)
216
+ return self.client.decode("GET", path, GetChatMembersResp, query=query, payload=payload)
201
217
 
202
- def AddMembers(self, **kwargs) -> models.AddMembersResp:
218
+ def add_members(self, **kwargs: Any) -> AddMembersResp:
203
219
  """
204
220
  Adds one or more users to a group chat.
205
221
 
206
222
  Example:
207
- response = api.chats.AddMembers(
223
+ response = bot.chats.add_members(
208
224
  chat_id=123456789,
209
225
  user_ids=[11111, 22222]
210
226
  )
211
227
  """
212
- req = models.AddMembersReq(**kwargs)
228
+ req = AddMembersReq(**kwargs)
213
229
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
214
- return decode(self.client, "POST", path, models.AddMembersResp, payload=req)
230
+ query, payload = self.client.split_request(req)
231
+ return self.client.decode("POST", path, AddMembersResp, query=query, payload=payload)
215
232
 
216
- def DeleteMember(self, **kwargs) -> models.SimpleQueryResult:
233
+ def delete_member(self, **kwargs: Any) -> SimpleQueryResult:
217
234
  """
218
235
  Removes a specific user from a group chat.
219
236
  You can optionally block the user from rejoining.
220
237
 
221
238
  Example:
222
- response = api.chats.DeleteMember(
239
+ response = bot.chats.delete_member(
223
240
  chat_id=123456789,
224
241
  user_id=98765,
225
242
  block=True
226
243
  )
227
244
  """
228
- req = models.DeleteMemberReq(**kwargs)
245
+ req = DeleteMemberReq(**kwargs)
229
246
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
230
- return decode(self.client, "DELETE", path, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
247
+ query, payload = self.client.split_request(req)
248
+ return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
231
249
 
232
- async def GetChatsAsync(self, **kwargs) -> models.GetChatsResp:
250
+ async def get_chats_async(self, **kwargs: Any) -> GetChatsResp:
233
251
  """
234
- Async version of GetChats.
252
+ Async version of get_chats.
235
253
 
236
254
  Example:
237
- response = await api.chats.GetChatsAsync(
255
+ response = await bot.chats.get_chats_async(
238
256
  count=20
239
257
  )
240
258
  """
241
- req = models.GetChatsReq(**kwargs)
242
- return await adecode(self.client, "GET", Paths.CHATS, models.GetChatsResp, query=req.model_dump(exclude_none=True))
259
+ req = GetChatsReq(**kwargs)
260
+ query, payload = self.client.split_request(req)
261
+ return await self.client.adecode("GET", Paths.CHATS, GetChatsResp, query=query, payload=payload)
243
262
 
244
- async def GetChatAsync(self, **kwargs) -> models.ChatInfo:
263
+ async def get_chat_async(self, **kwargs: Any) -> ChatInfo:
245
264
  """
246
- Async version of GetChat.
265
+ Async version of get_chat.
247
266
 
248
267
  Example:
249
- response = await api.chats.GetChatAsync(
268
+ response = await bot.chats.get_chat_async(
250
269
  chat_id=123456789
251
270
  )
252
271
  """
253
- req = models.GetChatReq(**kwargs)
272
+ req = GetChatReq(**kwargs)
254
273
  path = Paths.CHATS_ID.format(req.chat_id)
255
- return await adecode(self.client, "GET", path, models.ChatInfo)
256
-
257
- async def EditChatAsync(self, **kwargs) -> models.ChatInfo:
274
+ query, payload = self.client.split_request(req)
275
+ return await self.client.adecode("GET", path, ChatInfo, query=query, payload=payload)
276
+
277
+ async def edit_chat_async(self, **kwargs: Any) -> ChatInfo:
258
278
  """
259
279
  Async version of EditChat.
260
280
 
261
281
  Example:
262
- response = await api.chats.EditChatAsync(
282
+ response = await bot.chats.edit_chat_async(
263
283
  chat_id=123456789,
264
284
  title="Updated Chat Title"
265
285
  )
266
286
  """
267
- req = models.EditChatReq(**kwargs)
287
+ req = EditChatReq(**kwargs)
268
288
  path = Paths.CHATS_ID.format(req.chat_id)
269
- return await adecode(self.client, "PATCH", path, models.ChatInfo, payload=req)
289
+ query, payload = self.client.split_request(req)
290
+ return await self.client.adecode("PATCH", path, ChatInfo, query=query, payload=payload)
270
291
 
271
- async def DeleteChatAsync(self, **kwargs) -> models.SimpleQueryResult:
292
+ async def delete_chat_async(self, **kwargs: Any) -> SimpleQueryResult:
272
293
  """
273
294
  Async version of DeleteChat.
274
295
 
275
296
  Example:
276
- response = await api.chats.DeleteChatAsync(
297
+ response = await bot.chats.delete_chat_async(
277
298
  chat_id=123456789
278
299
  )
279
300
  """
280
- req = models.DeleteChatReq(**kwargs)
301
+ req = DeleteChatReq(**kwargs)
281
302
  path = Paths.CHATS_ID.format(req.chat_id)
282
- return await adecode(self.client, "DELETE", path, models.SimpleQueryResult)
303
+ query, payload = self.client.split_request(req)
304
+ return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
283
305
 
284
- async def SendActionAsync(self, **kwargs) -> models.SimpleQueryResult:
306
+ async def send_action_async(self, **kwargs: Any) -> SimpleQueryResult:
285
307
  """
286
308
  Async version of SendAction.
287
309
 
288
310
  Example:
289
- response = await api.chats.SendActionAsync(
311
+ response = await bot.chats.send_action_async(
290
312
  chat_id=123456789,
291
313
  action="typing"
292
314
  )
293
315
  """
294
- req = models.SendActionReq(**kwargs)
316
+ req = SendActionReq(**kwargs)
295
317
  path = Paths.CHATS_ACTIONS.format(req.chat_id)
296
- return await adecode(self.client, "POST", path, models.SimpleQueryResult, payload=req)
318
+ query, payload = self.client.split_request(req)
319
+ return await self.client.adecode("POST", path, SimpleQueryResult, query=query, payload=payload)
297
320
 
298
- async def GetPinnedMessageAsync(self, **kwargs) -> models.Message:
321
+ async def get_pinned_message_async(self, **kwargs: Any) -> Message:
299
322
  """
300
323
  Async version of GetPinnedMessage.
301
324
 
302
325
  Example:
303
- response = await api.chats.GetPinnedMessageAsync(
326
+ response = await bot.chats.get_pinned_message_async(
304
327
  chat_id=123456789
305
328
  )
306
329
  """
307
- req = models.GetPinnedMessageReq(**kwargs)
330
+ req = GetPinnedMessageReq(**kwargs)
308
331
  path = Paths.CHATS_PIN.format(req.chat_id)
309
- return await adecode(self.client, "GET", path, models.Message)
332
+ query, payload = self.client.split_request(req)
333
+ return await self.client.adecode("GET", path, Message, query=query, payload=payload)
310
334
 
311
- async def PinMessageAsync(self, **kwargs) -> models.SimpleQueryResult:
335
+ async def pin_message_async(self, **kwargs: Any) -> SimpleQueryResult:
312
336
  """
313
337
  Async version of PinMessage.
314
338
 
315
339
  Example:
316
- response = await api.chats.PinMessageAsync(
340
+ response = await bot.chats.pin_message_async(
317
341
  chat_id=123456789,
318
342
  message_id="mid:987654321..."
319
343
  )
320
344
  """
321
- req = models.PinMessageReq(**kwargs)
345
+ req = PinMessageReq(**kwargs)
322
346
  path = Paths.CHATS_PIN.format(req.chat_id)
323
- return await adecode(self.client, "PUT", path, models.SimpleQueryResult, payload=req)
347
+ query, payload = self.client.split_request(req)
348
+ return await self.client.adecode("PUT", path, SimpleQueryResult, query=query, payload=payload)
324
349
 
325
- async def UnpinMessageAsync(self, **kwargs) -> models.SimpleQueryResult:
350
+ async def unpin_message_async(self, **kwargs: Any) -> SimpleQueryResult:
326
351
  """
327
352
  Async version of UnpinMessage.
328
353
 
329
354
  Example:
330
- response = await api.chats.UnpinMessageAsync(
355
+ response = await bot.chats.unpin_message_async(
331
356
  chat_id=123456789
332
357
  )
333
358
  """
334
- req = models.UnpinMessageReq(**kwargs)
359
+ req = UnpinMessageReq(**kwargs)
335
360
  path = Paths.CHATS_PIN.format(req.chat_id)
336
- return await adecode(self.client, "DELETE", path, models.SimpleQueryResult)
361
+ query, payload = self.client.split_request(req)
362
+ return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
337
363
 
338
- async def GetChatMembershipAsync(self, **kwargs) -> models.ChatMember:
364
+ async def get_chat_membership_async(self, **kwargs: Any) -> ChatMember:
339
365
  """
340
366
  Async version of GetChatMembership.
341
367
 
342
368
  Example:
343
- response = await api.chats.GetChatMembershipAsync(
369
+ response = await bot.chats.get_chat_membership_async(
344
370
  chat_id=123456789
345
371
  )
346
372
  """
347
- req = models.GetChatMembershipReq(**kwargs)
373
+ req = GetChatMembershipReq(**kwargs)
348
374
  path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
349
- return await adecode(self.client, "GET", path, models.ChatMember)
375
+ query, payload = self.client.split_request(req)
376
+ return await self.client.adecode("GET", path, ChatMember, query=query, payload=payload)
350
377
 
351
- async def LeaveChatAsync(self, **kwargs) -> models.SimpleQueryResult:
378
+ async def leave_chat_async(self, **kwargs: Any) -> SimpleQueryResult:
352
379
  """
353
380
  Async version of LeaveChat.
354
381
 
355
382
  Example:
356
- response = await api.chats.LeaveChatAsync(
383
+ response = await bot.chats.leave_chat_async(
357
384
  chat_id=123456789
358
385
  )
359
386
  """
360
- req = models.LeaveChatReq(**kwargs)
387
+ req = LeaveChatReq(**kwargs)
361
388
  path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
362
- return await adecode(self.client, "DELETE", path, models.SimpleQueryResult)
389
+ query, payload = self.client.split_request(req)
390
+ return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
363
391
 
364
- async def GetChatAdminsAsync(self, **kwargs) -> models.GetChatAdminsResp:
392
+ async def get_chat_admins_async(self, **kwargs: Any) -> GetChatAdminsResp:
365
393
  """
366
- Async version of GetChatAdmins.
394
+ Async version of get_chatAdmins.
367
395
 
368
396
  Example:
369
- response = await api.chats.GetChatAdminsAsync(
397
+ response = await bot.chats.get_chat_admins_async(
370
398
  chat_id=123456789
371
399
  )
372
400
  """
373
- req = models.GetChatAdminsReq(**kwargs)
401
+ req = GetChatAdminsReq(**kwargs)
374
402
  path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
375
- return await adecode(self.client, "GET", path, models.GetChatAdminsResp)
403
+ query, payload = self.client.split_request(req)
404
+ return await self.client.adecode("GET", path, GetChatAdminsResp, query=query, payload=payload)
376
405
 
377
- async def SetChatAdminsAsync(self, **kwargs) -> models.SimpleQueryResult:
406
+ async def set_chat_admins_async(self, **kwargs: Any) -> SimpleQueryResult:
378
407
  """
379
408
  Async version of SetChatAdmins.
380
409
 
381
410
  Example:
382
- response = await api.chats.SetChatAdminsAsync(
411
+ response = await bot.chats.set_chat_admins_async(
383
412
  chat_id=123456789,
384
413
  admins=[ChatAdmin(user_id=98765, role="admin")]
385
414
  )
386
415
  """
387
- req = models.SetChatAdminsReq(**kwargs)
416
+ req = SetChatAdminsReq(**kwargs)
388
417
  path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
389
- return await adecode(self.client, "POST", path, models.SimpleQueryResult, payload=req)
418
+ query, payload = self.client.split_request(req)
419
+ return await self.client.adecode("POST", path, SimpleQueryResult, query=query, payload=payload)
390
420
 
391
- async def DeleteAdminAsync(self, **kwargs) -> models.SimpleQueryResult:
421
+ async def delete_admin_async(self, **kwargs: Any) -> SimpleQueryResult:
392
422
  """
393
423
  Async version of DeleteAdmin.
394
424
 
395
425
  Example:
396
- response = await api.chats.DeleteAdminAsync(
426
+ response = await bot.chats.delete_admin_async(
397
427
  chat_id=123456789,
398
428
  user_id=98765
399
429
  )
400
430
  """
401
- req = models.DeleteAdminReq(**kwargs)
431
+ req = DeleteAdminReq(**kwargs)
402
432
  path = Paths.CHATS_MEMBERS_ADMIN_ID.format(req.chat_id, req.user_id)
403
- return await adecode(self.client, "DELETE", path, models.SimpleQueryResult)
433
+ query, payload = self.client.split_request(req)
434
+ return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
404
435
 
405
- async def GetChatMembersAsync(self, **kwargs) -> models.GetChatAdminsResp:
436
+ async def get_chat_members_async(self, **kwargs: Any) -> GetChatMembersResp:
406
437
  """
407
438
  Async version of GetChatMembers.
408
439
 
409
440
  Example:
410
- response = await api.chats.GetChatMembersAsync(
441
+ response = await bot.chats.get_chat_members_async(
411
442
  chat_id=123456789,
412
443
  count=20
413
444
  )
414
445
  """
415
- req = models.GetChatMembersReq(**kwargs)
446
+ req = GetChatMembersReq(**kwargs)
416
447
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
417
- return await adecode(self.client, "GET", path, models.GetChatAdminsResp, query=req.model_dump(exclude_none=True))
448
+ query, payload = self.client.split_request(req)
449
+ return await self.client.adecode("GET", path, GetChatMembersResp, query=query, payload=payload)
418
450
 
419
- async def AddMembersAsync(self, **kwargs) -> models.AddMembersResp:
451
+ async def add_members_async(self, **kwargs: Any) -> AddMembersResp:
420
452
  """
421
453
  Async version of AddMembers.
422
454
 
423
455
  Example:
424
- response = await api.chats.AddMembersAsync(
456
+ response = await bot.chats.add_members_async(
425
457
  chat_id=123456789,
426
458
  user_ids=[11111, 22222]
427
459
  )
428
460
  """
429
- req = models.AddMembersReq(**kwargs)
461
+ req = AddMembersReq(**kwargs)
430
462
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
431
- return await adecode(self.client, "POST", path, models.AddMembersResp, payload=req)
463
+ query, payload = self.client.split_request(req)
464
+ return await self.client.adecode("POST", path, AddMembersResp, query=query, payload=payload)
432
465
 
433
- async def DeleteMemberAsync(self, **kwargs) -> models.SimpleQueryResult:
466
+ async def delete_member_async(self, **kwargs: Any) -> SimpleQueryResult:
434
467
  """
435
468
  Async version of DeleteMember.
436
469
 
437
470
  Example:
438
- response = await api.chats.DeleteMemberAsync(
471
+ response = await bot.chats.delete_member_async(
439
472
  chat_id=123456789,
440
473
  user_id=98765
441
474
  )
442
475
  """
443
- req = models.DeleteMemberReq(**kwargs)
476
+ req = DeleteMemberReq(**kwargs)
444
477
  path = Paths.CHATS_MEMBERS.format(req.chat_id)
445
- return await adecode(self.client, "DELETE", path, models.SimpleQueryResult, query=req.model_dump(exclude_none=True))
478
+ query, payload = self.client.split_request(req)
479
+ return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)