maxbot-api-client-ts 1.0.0

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.
package/dist/api.d.mts ADDED
@@ -0,0 +1,723 @@
1
+ interface ClientConfig {
2
+ base_url?: string;
3
+ token: string;
4
+ timeout?: number;
5
+ globalRPS?: number;
6
+ }
7
+ interface RequestOptions {
8
+ query?: Record<string, any>;
9
+ payload?: any;
10
+ body?: BodyInit;
11
+ headers?: Record<string, string>;
12
+ }
13
+ declare class APIClient {
14
+ private base_url;
15
+ private token;
16
+ private timeout;
17
+ private rateLimiter;
18
+ constructor(cfg: ClientConfig);
19
+ request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
20
+ setGlobalRateLimit(rps: number): void;
21
+ getTimeout(): number;
22
+ }
23
+
24
+ declare enum AttachmentType {
25
+ Image = "image",
26
+ Video = "video",
27
+ Audio = "audio",
28
+ File = "file",
29
+ Sticker = "sticker",
30
+ Contact = "contact",
31
+ Keyboard = "inline_keyboard",
32
+ Share = "share",
33
+ Location = "location"
34
+ }
35
+ declare enum ChatType {
36
+ Channel = "channel",
37
+ Chat = "chat",
38
+ Dialog = "dialog"
39
+ }
40
+ declare enum UploadType {
41
+ Image = "image",
42
+ Video = "video",
43
+ Audio = "audio",
44
+ File = "file"
45
+ }
46
+ declare enum ChatStatus {
47
+ Active = "active",
48
+ Closed = "closed",
49
+ Left = "left",
50
+ Removed = "removed"
51
+ }
52
+ declare enum MarkupType {
53
+ MarkupStrong = "strong",
54
+ MarkupEmphasized = "emphasized",
55
+ MarkupMonospaced = "monospaced",
56
+ MarkupLink = "link",
57
+ MarkupStrikethrough = "strikethrough",
58
+ MarkupUnderline = "underline",
59
+ MarkupUser = "user_mention"
60
+ }
61
+ declare enum Format {
62
+ HTML = "html",
63
+ Markdown = "markdown"
64
+ }
65
+ declare enum UpdateType {
66
+ TypeBotAdded = "bot_added",
67
+ TypeBotRemoved = "bot_removed",
68
+ TypeBotStarted = "bot_started",
69
+ TypeBotStopped = "bot_stopped",
70
+ TypeChatTitleChanged = "chat_title_changed",
71
+ TypeDialogMuted = "dialog_muted",
72
+ TypeDialogUnmuted = "dialog_unmuted",
73
+ TypeDialogCleared = "dialog_cleared",
74
+ TypeDialogRemoved = "dialog_removed",
75
+ TypeMessageCreated = "message_created",
76
+ TypeMessageCallback = "message_callback",
77
+ TypeMessageEdited = "message_edited",
78
+ TypeMessageRemoved = "message_removed",
79
+ TypeUserAdded = "user_added",
80
+ TypeUserRemoved = "user_removed"
81
+ }
82
+ declare enum LinkedMessageType {
83
+ forward = "forward",
84
+ reply = "reply"
85
+ }
86
+ declare enum SenderAction {
87
+ typing_on = "typing_on",
88
+ typing_off = "typing_off",
89
+ sending_photo = "sending_photo",
90
+ sending_video = "sending_video",
91
+ sending_audio = "sending_audio",
92
+ sending_file = "sending_file",
93
+ mark_seen = "mark_seen"
94
+ }
95
+ declare enum ChatAdminPermission {
96
+ read_all_messages = "read_all_messages",
97
+ add_remove_members = "add_remove_members",
98
+ add_admins = "add_admins",
99
+ change_chat_info = "change_chat_info",
100
+ pin_message = "pin_message",
101
+ write = "write",
102
+ edit_link = "edit_link"
103
+ }
104
+
105
+ interface Attachment {
106
+ type: AttachmentType;
107
+ payload?: any;
108
+ latitude?: number;
109
+ longitude?: number;
110
+ }
111
+ interface PhotoAttachmentPayload {
112
+ photo_id?: number;
113
+ token?: string;
114
+ url?: string;
115
+ }
116
+ interface User {
117
+ user_id: number;
118
+ first_name: string;
119
+ last_name?: string;
120
+ username?: string;
121
+ is_bot: boolean;
122
+ last_activity_time: number;
123
+ }
124
+ interface BotCommand {
125
+ name: string;
126
+ description?: string;
127
+ }
128
+ interface BotInfo extends User {
129
+ description?: string;
130
+ avatar_url?: string;
131
+ full_avatar_url?: string;
132
+ commands?: BotCommand[];
133
+ }
134
+ interface BotPatch {
135
+ name?: string;
136
+ username?: string;
137
+ description?: string;
138
+ commands?: BotCommand[];
139
+ photo?: PhotoAttachmentPayload;
140
+ }
141
+ interface Image {
142
+ url: string;
143
+ }
144
+ interface DialogWithUser extends User {
145
+ description?: string;
146
+ avatar_url: string;
147
+ full_avatar_url: string;
148
+ }
149
+ interface MessageStat {
150
+ views: number;
151
+ }
152
+ interface LinkedMessage {
153
+ type: LinkedMessageType;
154
+ sender?: User;
155
+ chat_id?: number;
156
+ message?: MessageBody;
157
+ }
158
+ interface MessageBody {
159
+ mid: string;
160
+ seq: number;
161
+ text?: string;
162
+ attachments?: Attachment[];
163
+ markup?: MarkupElement[];
164
+ }
165
+ interface Recipient {
166
+ chat_id?: number;
167
+ chat_type: ChatType;
168
+ user_id?: number;
169
+ }
170
+ interface Message {
171
+ sender: User;
172
+ recipient: Recipient;
173
+ timestamp: number;
174
+ link?: LinkedMessage;
175
+ body: MessageBody;
176
+ stat?: MessageStat;
177
+ url?: string;
178
+ }
179
+ interface Chat {
180
+ chat_id: number;
181
+ type: ChatType;
182
+ status: ChatStatus;
183
+ title?: string;
184
+ icon?: Image;
185
+ last_event_time: number;
186
+ participants_count: number;
187
+ owner_id?: number;
188
+ participants?: Record<string, number>;
189
+ is_public: boolean;
190
+ link?: string;
191
+ description?: string;
192
+ dialog_with_user?: DialogWithUser;
193
+ chat_message_id: string;
194
+ pinned_message?: Message;
195
+ }
196
+ interface ChatMember extends DialogWithUser {
197
+ last_access_time: number;
198
+ is_owner: boolean;
199
+ is_admin: boolean;
200
+ join_time: number;
201
+ permissions: ChatAdminPermission[];
202
+ alias?: string;
203
+ }
204
+ interface ChatAdmin {
205
+ user_id: number;
206
+ permissions: ChatAdminPermission[];
207
+ alias?: string;
208
+ }
209
+ interface MessagesList {
210
+ messages: Message[];
211
+ }
212
+ interface MarkupElement {
213
+ type: MarkupType;
214
+ from: number;
215
+ length: number;
216
+ }
217
+ interface VideoUrls {
218
+ mp4_1080?: string;
219
+ mp4_720?: string;
220
+ mp4_480?: string;
221
+ mp4_360?: string;
222
+ mp4_240?: string;
223
+ mp4_144?: string;
224
+ hls?: string;
225
+ }
226
+ interface NewMessageLink {
227
+ type: LinkedMessageType;
228
+ mid: string;
229
+ }
230
+ interface NewMessageBody {
231
+ text?: string;
232
+ attachments?: Attachment[];
233
+ link?: NewMessageLink;
234
+ notify?: boolean;
235
+ format?: Format;
236
+ }
237
+ interface Callback {
238
+ timestamp: number;
239
+ callback_id: string;
240
+ payload?: string;
241
+ user: User;
242
+ }
243
+ interface Update {
244
+ update_type: UpdateType;
245
+ timestamp: number;
246
+ callback?: Callback;
247
+ message: Message;
248
+ message_id?: string;
249
+ chat_id?: number;
250
+ user_id?: number;
251
+ muted_until?: number;
252
+ user_locale?: string;
253
+ is_channel?: boolean;
254
+ }
255
+ interface Subscription {
256
+ url: string;
257
+ time: number;
258
+ update_types?: UpdateType[];
259
+ }
260
+ interface ChatInfo {
261
+ chat_id: number;
262
+ type: ChatType;
263
+ status: ChatStatus;
264
+ title?: string;
265
+ icon?: Image;
266
+ last_event_time: number;
267
+ participants_count?: number;
268
+ owner_id?: number;
269
+ participants?: Record<string, number>;
270
+ is_public: boolean;
271
+ link?: string;
272
+ description?: string;
273
+ dialog_with_user?: DialogWithUser[];
274
+ chat_message_id?: string;
275
+ pinned_message?: Message[];
276
+ }
277
+
278
+ declare class BotsService {
279
+ private client;
280
+ constructor(client: APIClient);
281
+ /**
282
+ * GetBot returns information about the current bot (ID, name, description).
283
+ * @returns Promise<BotInfo>
284
+ * @example
285
+ * const response = await bot.bots.getBot();
286
+ * console.log("Connected as:", info.first_name);
287
+ */
288
+ getBot(): Promise<BotInfo>;
289
+ /**
290
+ * PatchBot updates bot information.
291
+ * Fill in only the fields you want to change.
292
+ * @param req - The bot data to update.
293
+ * @returns Promise<BotInfo>
294
+ * @example
295
+ * const response = await bot.bots.patchBot({
296
+ * name: "New Name",
297
+ * description: "New description"
298
+ * });
299
+ */
300
+ patchBot(req: BotPatch): Promise<BotInfo>;
301
+ }
302
+
303
+ interface GetChatsReq {
304
+ count?: number;
305
+ marker?: number;
306
+ }
307
+ interface GetChatsResp {
308
+ chats: Chat[];
309
+ marker?: number;
310
+ }
311
+ interface GetChatReq {
312
+ chat_id: number;
313
+ }
314
+ interface EditChatReq {
315
+ chat_id: number;
316
+ icon?: Image;
317
+ title?: string;
318
+ pin?: string;
319
+ notify?: boolean;
320
+ }
321
+ interface DeleteChatReq {
322
+ chat_id: number;
323
+ }
324
+ interface SendActionReq {
325
+ chat_id: number;
326
+ action: SenderAction;
327
+ }
328
+ interface PinMessageReq {
329
+ chat_id: number;
330
+ message_id: string;
331
+ notify?: boolean;
332
+ }
333
+ interface UnpinMessageReq {
334
+ chat_id: number;
335
+ }
336
+ interface GetPinnedMessageReq {
337
+ chat_id: number;
338
+ }
339
+ interface GetChatMembershipReq {
340
+ chat_id: number;
341
+ }
342
+ interface LeaveChatReq {
343
+ chat_id: number;
344
+ }
345
+ interface GetChatAdminsReq {
346
+ chat_id: number;
347
+ }
348
+ interface GetChatAdminsResp {
349
+ members: ChatMember[];
350
+ marker?: number;
351
+ }
352
+ interface SetChatAdminsReq {
353
+ chat_id: number;
354
+ admins: ChatAdmin[];
355
+ marker?: number;
356
+ }
357
+ interface DeleteAdminReq {
358
+ chat_id: number;
359
+ user_id: number;
360
+ }
361
+ interface GetChatMembersReq {
362
+ chat_id: number;
363
+ user_ids?: number[];
364
+ marker?: number;
365
+ count?: number;
366
+ }
367
+ interface AddMembersReq {
368
+ chat_id: number;
369
+ user_ids?: number[];
370
+ }
371
+ interface AddMembersResp extends SimpleQueryResult {
372
+ failed_user_ids?: number[];
373
+ failed_user_details?: FailedUserDetails[];
374
+ }
375
+ interface FailedUserDetails {
376
+ error_code: string;
377
+ user_ids: number[];
378
+ }
379
+ interface DeleteMemberReq {
380
+ chat_id: number;
381
+ user_id: number;
382
+ block?: boolean;
383
+ }
384
+ interface GetSubscriptionsResp {
385
+ subscriptions: Subscription[];
386
+ }
387
+ interface SubscribeReq {
388
+ url: string;
389
+ update_types?: UpdateType[];
390
+ secret?: string;
391
+ }
392
+ interface UnsubscribeReq {
393
+ url: string;
394
+ }
395
+ interface GetUpdatesReq {
396
+ limit?: number;
397
+ timeout?: number;
398
+ marker?: number;
399
+ types?: UpdateType[];
400
+ }
401
+ interface GetUpdatesResp {
402
+ updates: Update[];
403
+ marker: number;
404
+ }
405
+ interface UploadFileReq {
406
+ type: UploadType;
407
+ upload_url?: string;
408
+ file_path: string;
409
+ }
410
+ interface UploadedInfo {
411
+ file_id?: number;
412
+ token?: string;
413
+ }
414
+ interface GetMessagesReq {
415
+ chat_id?: number;
416
+ message_ids?: string[];
417
+ from?: number;
418
+ to?: number;
419
+ count?: number;
420
+ }
421
+ interface SendMessageReq {
422
+ user_id?: number;
423
+ chat_id?: number;
424
+ text?: string;
425
+ format?: Format;
426
+ notify?: boolean;
427
+ attachments?: Attachment[];
428
+ link?: NewMessageLink;
429
+ disable_link_preview?: boolean;
430
+ }
431
+ interface SendMessageResp {
432
+ message: Message;
433
+ }
434
+ interface EditMessageReq {
435
+ message_id: string;
436
+ text?: string;
437
+ attachments?: Attachment[];
438
+ link?: NewMessageLink;
439
+ notify?: boolean;
440
+ format?: Format;
441
+ }
442
+ interface DeleteMessageReq {
443
+ message_id: string;
444
+ }
445
+ interface GetMessageReq {
446
+ message_id: string;
447
+ }
448
+ interface GetVideoInfoReq {
449
+ video_token: string;
450
+ }
451
+ interface GetVideoInfoResp {
452
+ token: string;
453
+ urls?: VideoUrls;
454
+ thumbnail?: PhotoAttachmentPayload;
455
+ width?: number;
456
+ height?: number;
457
+ duration?: number;
458
+ }
459
+ interface AnswerCallbackReq {
460
+ callback_id: string;
461
+ message?: NewMessageBody;
462
+ notification?: string;
463
+ }
464
+ interface SimpleQueryResult {
465
+ success: boolean;
466
+ message?: string;
467
+ }
468
+ interface SendFileReq {
469
+ user_id?: number;
470
+ chat_id?: number;
471
+ text?: string;
472
+ format?: Format;
473
+ notify?: boolean;
474
+ file_source: string;
475
+ link?: NewMessageLink;
476
+ disable_link_preview?: boolean;
477
+ attachments?: Attachment[];
478
+ }
479
+
480
+ declare class ChatsService {
481
+ private client;
482
+ constructor(client: APIClient);
483
+ /**
484
+ * GetChats returns a list of group chats in which the bot participated.
485
+ * @param req - Filter parameters for chats.
486
+ * @example
487
+ * const response = await bot.chats.getChats({ limit: 10 });
488
+ */
489
+ getChats(req: GetChatsReq): Promise<GetChatsResp>;
490
+ /**
491
+ * GetChat returns information about a group chat by its ID.
492
+ * @param req - Object containing the chat_id.
493
+ * @example
494
+ * const response = await bot.chats.getChat({ chat_id: 123456789 });
495
+ */
496
+ getChat(req: GetChatReq): Promise<ChatInfo>;
497
+ /**
498
+ * EditChat allows you to edit information about a group chat.
499
+ * @param req - Chat edit parameters.
500
+ * @example
501
+ * await bot.chats.editChat({ chat_id: 123456789, title: "New Title" });
502
+ */
503
+ editChat(req: EditChatReq): Promise<ChatInfo>;
504
+ /**
505
+ * DeleteChat deletes a group chat for all participants.
506
+ * @example
507
+ * await bot.chats.deleteChat({ chat_id: 123456789 });
508
+ */
509
+ deleteChat(req: DeleteChatReq): Promise<SimpleQueryResult>;
510
+ /**
511
+ * SendAction allows sending bot actions to a group chat (e.g., "typing").
512
+ * @example
513
+ * await bot.chats.sendAction({ chat_id: 123456789, action: "typing" });
514
+ */
515
+ sendAction(req: SendActionReq): Promise<SimpleQueryResult>;
516
+ /**
517
+ * GetPinnedMessage returns the pinned message in a chat.
518
+ * @example
519
+ * const response = await bot.chats.getPinnedMessage({ chat_id: 123456789 });
520
+ */
521
+ getPinnedMessage(req: GetPinnedMessageReq): Promise<Message>;
522
+ /**
523
+ * PinMessage pins a message in a group chat.
524
+ * @example
525
+ * await bot.chats.pinMessage({ chat_id: 123456789, message_id: "456" });
526
+ */
527
+ pinMessage(req: PinMessageReq): Promise<SimpleQueryResult>;
528
+ /**
529
+ * UnpinMessage removes the pinned message in a group chat.
530
+ * @example
531
+ * await bot.chats.unpinMessage({ chat_id: 123456789 });
532
+ */
533
+ unpinMessage(req: UnpinMessageReq): Promise<SimpleQueryResult>;
534
+ /**
535
+ * GetChatMembership returns the bot's membership details in a group chat.
536
+ * @example
537
+ * const response = await bot.chats.getChatMembership({ chat_id: 123456789 });
538
+ */
539
+ getChatMembership(req: GetChatMembershipReq): Promise<ChatMember>;
540
+ /**
541
+ * LeaveChat removes the bot from a group chat.
542
+ * @example
543
+ * await bot.chats.leaveChat({ chat_id: 123456789 });
544
+ */
545
+ leaveChat(req: LeaveChatReq): Promise<SimpleQueryResult>;
546
+ /**
547
+ * GetChatAdmins returns a list of all group chat administrators.
548
+ * @example
549
+ * const response = await bot.chats.getChatAdmins({ chat_id: 123456789 });
550
+ */
551
+ getChatAdmins(req: GetChatAdminsReq): Promise<GetChatAdminsResp>;
552
+ /**
553
+ * SetChatAdmins assigns a group member as an administrator.
554
+ * @example
555
+ * await bot.chats.setChatAdmins({ chat_id: 123456789, user_id: 456 });
556
+ */
557
+ setChatAdmins(req: SetChatAdminsReq): Promise<SimpleQueryResult>;
558
+ /**
559
+ * DeleteAdmin revokes the user's administrator rights in a group chat.
560
+ * @example
561
+ * await bot.chats.deleteAdmin({ chat_id: 123456789, user_id: 456 });
562
+ */
563
+ deleteAdmin(req: DeleteAdminReq): Promise<SimpleQueryResult>;
564
+ /**
565
+ * GetChatMembers returns a list of participants in a group chat.
566
+ * @example
567
+ * const response = await bot.chats.getChatMembers({ chat_id: 123456789, limit: 50 });
568
+ */
569
+ getChatMembers(req: GetChatMembersReq): Promise<GetChatAdminsResp>;
570
+ /**
571
+ * AddMembers adds participants to a group chat.
572
+ * @example
573
+ * await bot.chats.addMembers({ chat_id: 123456789, user_ids: [456, 789] });
574
+ */
575
+ addMembers(req: AddMembersReq): Promise<AddMembersResp>;
576
+ /**
577
+ * DeleteMember removes a participant from a group chat.
578
+ * @example
579
+ * await bot.chats.deleteMember({ chat_id: 123456789, user_id: 456 });
580
+ */
581
+ deleteMember(req: DeleteMemberReq): Promise<SimpleQueryResult>;
582
+ }
583
+
584
+ declare class HelpersService {
585
+ private client;
586
+ constructor(client: APIClient);
587
+ /**
588
+ * SendFile simplifies file sending by automatically determining if the source is a URL or a local path.
589
+ * @param req - File send request parameters.
590
+ * @example
591
+ * await bot.helpers.sendFile({ chat_id: 123, file_source: "./photo.jpg" });
592
+ * await bot.helpers.sendFile({ chat_id: 123, file_source: "https://site.com/image.png" });
593
+ */
594
+ sendFile(req: SendFileReq): Promise<Message>;
595
+ /**
596
+ * SendFileByUrl sends a file using a direct URL. If the file is not an image,
597
+ * it will be downloaded to a temporary directory and uploaded to MAX servers.
598
+ * @param req - File send request with a URL in file_source.
599
+ */
600
+ sendFileByUrl(req: SendFileReq): Promise<Message>;
601
+ /**
602
+ * SendFileByUpload uploads a local file to MAX servers and sends it to the chat.
603
+ * @param req - File send request with a local path in file_source.
604
+ */
605
+ sendFileByUpload(req: SendFileReq): Promise<Message>;
606
+ private sendInternal;
607
+ private isURL;
608
+ private getExtension;
609
+ private determineUploadType;
610
+ private buildAttachmentFromToken;
611
+ private downloadTempFile;
612
+ }
613
+
614
+ declare class MessagesService {
615
+ private client;
616
+ constructor(client: APIClient);
617
+ /**
618
+ * GetMessages returns information about a message or an array of messages from a chat.
619
+ * @param req - Query parameters (chat_id, user_id, limit, etc.).
620
+ * @example
621
+ * const response = await bot.messages.getMessages({ chat_id: 123, limit: 10 });
622
+ */
623
+ getMessages(req: GetMessagesReq): Promise<MessagesList>;
624
+ /**
625
+ * SendMessage sends a text or media message to a specified user or chat.
626
+ * @param req - Message parameters including text and attachments.
627
+ * @example
628
+ * await bot.messages.sendMessage({ user_id: 123, text: "Hello!" });
629
+ */
630
+ sendMessage(req: SendMessageReq): Promise<SendMessageResp>;
631
+ /**
632
+ * EditMessage edits the text or media of a previously sent message.
633
+ * @param req - Edit parameters (message_id, new text, etc.).
634
+ * @example
635
+ * await bot.messages.editMessage({ message_id: 456, text: "Updated text" });
636
+ */
637
+ editMessage(req: EditMessageReq): Promise<SimpleQueryResult>;
638
+ /**
639
+ * DeleteMessage deletes a message from a chat.
640
+ * @example
641
+ * await bot.messages.deleteMessage({ chat_id: 123, message_id: 456 });
642
+ */
643
+ deleteMessage(req: DeleteMessageReq): Promise<SimpleQueryResult>;
644
+ /**
645
+ * GetMessage extracts the content and metadata of a specific message by its ID.
646
+ * @example
647
+ * const response = await bot.messages.getMessage({ message_id: 456 });
648
+ */
649
+ getMessage(req: GetMessageReq): Promise<Message>;
650
+ /**
651
+ * GetVideoInfo returns detailed information about an attached video.
652
+ * @example
653
+ * const response = await bot.messages.getVideoInfo({ video_token: "video123" });
654
+ */
655
+ getVideoInfo(req: GetVideoInfoReq): Promise<GetVideoInfoResp>;
656
+ /**
657
+ * AnswerCallback sends a response after a user clicks a button.
658
+ * @example
659
+ * await bot.messages.answerCallback({ callback_id: "cb123", text: "Got it!" });
660
+ */
661
+ answerCallback(req: AnswerCallbackReq): Promise<SimpleQueryResult>;
662
+ }
663
+
664
+ declare class SubscriptionsService {
665
+ private client;
666
+ constructor(client: APIClient);
667
+ /**
668
+ * GetSubscriptions returns a list of webhook notification subscriptions.
669
+ * @example
670
+ * const response = await bot.subscriptions.getSubscriptions();
671
+ */
672
+ getSubscriptions(): Promise<GetSubscriptionsResp>;
673
+ /**
674
+ * Subscribe configures the delivery of bot events via a webhook.
675
+ * @param req - Subscription parameters (url, types).
676
+ * @example
677
+ * await bot.subscriptions.subscribe({ url: "https://my.site/webhook", types: ["message.created"] });
678
+ */
679
+ subscribe(req: SubscribeReq): Promise<SimpleQueryResult>;
680
+ /**
681
+ * Unsubscribe cancels the bot's subscription to receiving updates via webhook.
682
+ * @example
683
+ * await bot.subscriptions.unsubscribe({ url: "https://my.site/webhook" });
684
+ */
685
+ unsubscribe(req: UnsubscribeReq): Promise<SimpleQueryResult>;
686
+ /**
687
+ * GetUpdates retrieves incoming updates (Long-polling).
688
+ * @param req - Polling parameters (marker, timeout, limit).
689
+ * @example
690
+ * const response = await bot.subscriptions.getUpdates({ timeout: 25 });
691
+ */
692
+ getUpdates(req: GetUpdatesReq): Promise<GetUpdatesResp>;
693
+ }
694
+
695
+ declare class UploadsService {
696
+ private client;
697
+ constructor(client: APIClient);
698
+ /**
699
+ * UploadFile uploads a file to MAX servers for subsequent transmission.
700
+ * It handles both the initial request for an upload URL and the actual multipart upload.
701
+ * @param req - Upload parameters (type, file_path).
702
+ * @returns Promise<UploadedInfo> containing the file token.
703
+ * @example
704
+ * const response = await bot.uploads.uploadFile({ type: "image", file_path: "./corgi.png" });
705
+ * console.log("File token:", file.token);
706
+ */
707
+ uploadFile(req: UploadFileReq): Promise<UploadedInfo>;
708
+ private getupload_url;
709
+ private uploadMultipart;
710
+ }
711
+
712
+ declare class MaxBotAPI {
713
+ bots: BotsService;
714
+ chats: ChatsService;
715
+ helpers: HelpersService;
716
+ messages: MessagesService;
717
+ subscriptions: SubscriptionsService;
718
+ uploads: UploadsService;
719
+ client: APIClient;
720
+ constructor(cfg: ClientConfig);
721
+ }
722
+
723
+ export { MaxBotAPI };