1#![allow(clippy::too_many_arguments)]
3
4use url::Url;
5
6use crate::{errors::AsResponseParameters, payloads::*, requests::Request, types::*};
7
8#[cfg_attr(all(any(docsrs, dep_docsrs), feature = "nightly"), doc(notable_trait))]
144pub trait Requester {
145 type Err: std::error::Error + Send + AsResponseParameters;
147
148 type GetUpdates: Request<Payload = GetUpdates, Err = Self::Err>;
152
153 fn get_updates(&self) -> Self::GetUpdates;
155
156 type SetWebhook: Request<Payload = SetWebhook, Err = Self::Err>;
157
158 fn set_webhook(&self, url: Url) -> Self::SetWebhook;
160
161 type DeleteWebhook: Request<Payload = DeleteWebhook, Err = Self::Err>;
162
163 fn delete_webhook(&self) -> Self::DeleteWebhook;
165
166 type GetWebhookInfo: Request<Payload = GetWebhookInfo, Err = Self::Err>;
167
168 fn get_webhook_info(&self) -> Self::GetWebhookInfo;
170
171 type GetMe: Request<Payload = GetMe, Err = Self::Err>;
172
173 fn get_me(&self) -> Self::GetMe;
175
176 type LogOut: Request<Payload = LogOut, Err = Self::Err>;
177
178 fn log_out(&self) -> Self::LogOut;
180
181 type Close: Request<Payload = Close, Err = Self::Err>;
182
183 fn close(&self) -> Self::Close;
185
186 type SendMessage: Request<Payload = SendMessage, Err = Self::Err>;
187
188 fn send_message<T>(&self, text: T) -> Self::SendMessage
190 where
191 T: Into<String>;
192
193 type SendMessageDraft: Request<Payload = SendMessageDraft, Err = Self::Err>;
194
195 fn send_message_draft<C>(&self, chat_id: C, draft_id: i64) -> Self::SendMessageDraft
197 where
198 C: Into<ChatId>;
199
200 type SendRichMessage: Request<Payload = SendRichMessage, Err = Self::Err>;
201
202 fn send_rich_message(&self, rich_message: InputRichMessage) -> Self::SendRichMessage;
204
205 type SendRichMessageDraft: Request<Payload = SendRichMessageDraft, Err = Self::Err>;
206
207 fn send_rich_message_draft<C>(
209 &self,
210 chat_id: C,
211 draft_id: i64,
212 rich_message: InputRichMessage,
213 ) -> Self::SendRichMessageDraft
214 where
215 C: Into<ChatId>;
216
217 type ForwardMessage: Request<Payload = ForwardMessage, Err = Self::Err>;
218
219 fn forward_message<C, F>(
221 &self,
222 chat_id: C,
223 from_chat_id: F,
224 message_id: MessageId,
225 ) -> Self::ForwardMessage
226 where
227 C: Into<Recipient>,
228 F: Into<Recipient>;
229
230 type ForwardMessages: Request<Payload = ForwardMessages, Err = Self::Err>;
231
232 fn forward_messages<C, F, M>(
234 &self,
235 chat_id: C,
236 from_chat_id: F,
237 message_ids: M,
238 ) -> Self::ForwardMessages
239 where
240 C: Into<Recipient>,
241 F: Into<Recipient>,
242 M: IntoIterator<Item = MessageId>;
243
244 type CopyMessage: Request<Payload = CopyMessage, Err = Self::Err>;
245
246 fn copy_message<C, F>(
248 &self,
249 chat_id: C,
250 from_chat_id: F,
251 message_id: MessageId,
252 ) -> Self::CopyMessage
253 where
254 C: Into<Recipient>,
255 F: Into<Recipient>;
256
257 type CopyMessages: Request<Payload = CopyMessages, Err = Self::Err>;
258
259 fn copy_messages<C, F, M>(
261 &self,
262 chat_id: C,
263 from_chat_id: F,
264 message_ids: M,
265 ) -> Self::CopyMessages
266 where
267 C: Into<Recipient>,
268 F: Into<Recipient>,
269 M: IntoIterator<Item = MessageId>;
270
271 type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>;
272
273 fn send_photo(&self, photo: InputFile) -> Self::SendPhoto;
275
276 type SendLivePhoto: Request<Payload = SendLivePhoto, Err = Self::Err>;
277
278 fn send_live_photo(&self, live_photo: InputFile, photo: InputFile) -> Self::SendLivePhoto;
280
281 type SendAudio: Request<Payload = SendAudio, Err = Self::Err>;
282
283 fn send_audio(&self, audio: InputFile) -> Self::SendAudio;
285
286 type SendDocument: Request<Payload = SendDocument, Err = Self::Err>;
287
288 fn send_document(&self, document: InputFile) -> Self::SendDocument;
290
291 type SendVideo: Request<Payload = SendVideo, Err = Self::Err>;
292
293 fn send_video(&self, video: InputFile) -> Self::SendVideo;
295
296 type SendAnimation: Request<Payload = SendAnimation, Err = Self::Err>;
297
298 fn send_animation(&self, animation: InputFile) -> Self::SendAnimation;
300
301 type SendVoice: Request<Payload = SendVoice, Err = Self::Err>;
302
303 fn send_voice(&self, voice: InputFile) -> Self::SendVoice;
305
306 type SendVideoNote: Request<Payload = SendVideoNote, Err = Self::Err>;
307
308 fn send_video_note(&self, video_note: InputFile) -> Self::SendVideoNote;
310
311 type SendWidget: Request<Payload = SendWidget, Err = Self::Err>;
312
313 fn send_widget<C, H>(&self, chat_id: C, html: H) -> Self::SendWidget
315 where
316 C: Into<Recipient>,
317 H: Into<String>;
318
319 type SendSharedWidget: Request<Payload = SendSharedWidget, Err = Self::Err>;
320
321 fn send_shared_widget<C>(&self, chat_id: C, widget_id: WidgetId) -> Self::SendSharedWidget
323 where
324 C: Into<Recipient>;
325
326 type SendPaidMedia: Request<Payload = SendPaidMedia, Err = Self::Err>;
327
328 fn send_paid_media<C, M>(&self, chat_id: C, star_count: u64, media: M) -> Self::SendPaidMedia
330 where
331 C: Into<Recipient>,
332 M: IntoIterator<Item = InputPaidMedia>;
333
334 type SendMediaGroup: Request<Payload = SendMediaGroup, Err = Self::Err>;
335
336 fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup
338 where
339 C: Into<Recipient>,
340 M: IntoIterator<Item = InputGroupMedia>;
341
342 type SendLocation: Request<Payload = SendLocation, Err = Self::Err>;
343
344 fn send_location(&self, latitude: f64, longitude: f64) -> Self::SendLocation;
346
347 type EditMessageLiveLocation: Request<Payload = EditMessageLiveLocation, Err = Self::Err>;
348
349 fn edit_message_live_location<C>(
351 &self,
352 chat_id: C,
353 message_id: MessageId,
354 latitude: f64,
355 longitude: f64,
356 ) -> Self::EditMessageLiveLocation
357 where
358 C: Into<Recipient>;
359
360 type EditMessageLiveLocationInline: Request<
361 Payload = EditMessageLiveLocationInline,
362 Err = Self::Err,
363 >;
364
365 fn edit_message_live_location_inline<I>(
367 &self,
368 inline_message_id: I,
369 latitude: f64,
370 longitude: f64,
371 ) -> Self::EditMessageLiveLocationInline
372 where
373 I: Into<String>;
374
375 type StopMessageLiveLocation: Request<Payload = StopMessageLiveLocation, Err = Self::Err>;
376
377 fn stop_message_live_location<C>(
379 &self,
380 chat_id: C,
381 message_id: MessageId,
382 ) -> Self::StopMessageLiveLocation
383 where
384 C: Into<Recipient>;
385
386 type StopMessageLiveLocationInline: Request<
387 Payload = StopMessageLiveLocationInline,
388 Err = Self::Err,
389 >;
390
391 fn stop_message_live_location_inline<I>(
393 &self,
394 inline_message_id: I,
395 ) -> Self::StopMessageLiveLocationInline
396 where
397 I: Into<String>;
398
399 type EditMessageChecklist: Request<Payload = EditMessageChecklist, Err = Self::Err>;
400
401 fn edit_message_checklist<C>(
403 &self,
404 business_connection_id: BusinessConnectionId,
405 chat_id: C,
406 message_id: MessageId,
407 checklist: InputChecklist,
408 ) -> Self::EditMessageChecklist
409 where
410 C: Into<ChatId>;
411
412 type SendVenue: Request<Payload = SendVenue, Err = Self::Err>;
413
414 fn send_venue<T, A>(
416 &self,
417 latitude: f64,
418 longitude: f64,
419 title: T,
420 address: A,
421 ) -> Self::SendVenue
422 where
423 T: Into<String>,
424 A: Into<String>;
425
426 type SendContact: Request<Payload = SendContact, Err = Self::Err>;
427
428 fn send_contact<P, F>(&self, phone_number: P, first_name: F) -> Self::SendContact
430 where
431 P: Into<String>,
432 F: Into<String>;
433
434 type GetManagedBotToken: Request<Payload = GetManagedBotToken, Err = Self::Err>;
435
436 fn get_managed_bot_token(&self, user_id: UserId) -> Self::GetManagedBotToken;
438
439 type GetManagedBotAccessSettings: Request<
440 Payload = GetManagedBotAccessSettings,
441 Err = Self::Err,
442 >;
443
444 fn get_managed_bot_access_settings(&self, user_id: UserId)
446 -> Self::GetManagedBotAccessSettings;
447
448 type SetManagedBotAccessSettings: Request<
449 Payload = SetManagedBotAccessSettings,
450 Err = Self::Err,
451 >;
452
453 fn set_managed_bot_access_settings(
455 &self,
456 user_id: UserId,
457 is_access_restricted: bool,
458 ) -> Self::SetManagedBotAccessSettings;
459
460 type ReplaceManagedBotToken: Request<Payload = ReplaceManagedBotToken, Err = Self::Err>;
461
462 fn replace_managed_bot_token(&self, user_id: UserId) -> Self::ReplaceManagedBotToken;
464
465 type SavePreparedKeyboardButton: Request<Payload = SavePreparedKeyboardButton, Err = Self::Err>;
466
467 fn save_prepared_keyboard_button(
469 &self,
470 user_id: UserId,
471 button: KeyboardButton,
472 ) -> Self::SavePreparedKeyboardButton;
473
474 type SendPoll: Request<Payload = SendPoll, Err = Self::Err>;
475
476 fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll
478 where
479 C: Into<Recipient>,
480 Q: Into<String>,
481 O: IntoIterator<Item = InputPollOption>;
482
483 type SendChecklist: Request<Payload = SendChecklist, Err = Self::Err>;
484
485 fn send_checklist<C>(
487 &self,
488 business_connection_id: BusinessConnectionId,
489 chat_id: C,
490 checklist: InputChecklist,
491 ) -> Self::SendChecklist
492 where
493 C: Into<ChatId>;
494
495 type SendDice: Request<Payload = SendDice, Err = Self::Err>;
496
497 fn send_dice<C>(&self, chat_id: C) -> Self::SendDice
499 where
500 C: Into<Recipient>;
501
502 type SendChatAction: Request<Payload = SendChatAction, Err = Self::Err>;
503
504 fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction
506 where
507 C: Into<Recipient>;
508
509 type SetMessageReaction: Request<Payload = SetMessageReaction, Err = Self::Err>;
510
511 fn set_message_reaction<C>(
513 &self,
514 chat_id: C,
515 message_id: MessageId,
516 ) -> Self::SetMessageReaction
517 where
518 C: Into<Recipient>;
519
520 type GetUserProfilePhotos: Request<Payload = GetUserProfilePhotos, Err = Self::Err>;
521
522 fn get_user_profile_photos(&self, user_id: UserId) -> Self::GetUserProfilePhotos;
524
525 type SetUserEmojiStatus: Request<Payload = SetUserEmojiStatus, Err = Self::Err>;
526
527 fn set_user_emoji_status(&self, user_id: UserId) -> Self::SetUserEmojiStatus;
529
530 type GetFile: Request<Payload = GetFile, Err = Self::Err>;
531
532 fn get_file(&self, file_id: FileId) -> Self::GetFile;
534
535 type BanChatMember: Request<Payload = BanChatMember, Err = Self::Err>;
536
537 fn ban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::BanChatMember
539 where
540 C: Into<Recipient>;
541
542 type KickChatMember: Request<Payload = KickChatMember, Err = Self::Err>;
543
544 fn kick_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::KickChatMember
546 where
547 C: Into<Recipient>;
548
549 type UnbanChatMember: Request<Payload = UnbanChatMember, Err = Self::Err>;
550
551 fn unban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::UnbanChatMember
553 where
554 C: Into<Recipient>;
555
556 type RestrictChatMember: Request<Payload = RestrictChatMember, Err = Self::Err>;
557
558 fn restrict_chat_member<C>(
560 &self,
561 chat_id: C,
562 user_id: UserId,
563 permissions: ChatPermissions,
564 ) -> Self::RestrictChatMember
565 where
566 C: Into<Recipient>;
567
568 type PromoteChatMember: Request<Payload = PromoteChatMember, Err = Self::Err>;
569
570 fn promote_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::PromoteChatMember
572 where
573 C: Into<Recipient>;
574
575 type SetChatAdministratorCustomTitle: Request<
576 Payload = SetChatAdministratorCustomTitle,
577 Err = Self::Err,
578 >;
579
580 fn set_chat_administrator_custom_title<Ch, C>(
582 &self,
583 chat_id: Ch,
584 user_id: UserId,
585 custom_title: C,
586 ) -> Self::SetChatAdministratorCustomTitle
587 where
588 Ch: Into<Recipient>,
589 C: Into<String>;
590
591 type SetChatMemberTag: Request<Payload = SetChatMemberTag, Err = Self::Err>;
592
593 fn set_chat_member_tag<C>(&self, chat_id: C, user_id: UserId) -> Self::SetChatMemberTag
595 where
596 C: Into<Recipient>;
597
598 type BanChatSenderChat: Request<Payload = BanChatSenderChat, Err = Self::Err>;
599
600 fn ban_chat_sender_chat<C, S>(&self, chat_id: C, sender_chat_id: S) -> Self::BanChatSenderChat
602 where
603 C: Into<Recipient>,
604 S: Into<ChatId>;
605
606 type UnbanChatSenderChat: Request<Payload = UnbanChatSenderChat, Err = Self::Err>;
607
608 fn unban_chat_sender_chat<C, S>(
610 &self,
611 chat_id: C,
612 sender_chat_id: S,
613 ) -> Self::UnbanChatSenderChat
614 where
615 C: Into<Recipient>,
616 S: Into<ChatId>;
617
618 type SetChatPermissions: Request<Payload = SetChatPermissions, Err = Self::Err>;
619
620 fn set_chat_permissions<C>(
622 &self,
623 chat_id: C,
624 permissions: ChatPermissions,
625 ) -> Self::SetChatPermissions
626 where
627 C: Into<Recipient>;
628
629 type ExportChatInviteLink: Request<Payload = ExportChatInviteLink, Err = Self::Err>;
630
631 fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink
633 where
634 C: Into<Recipient>;
635
636 type CreateChatInviteLink: Request<Payload = CreateChatInviteLink, Err = Self::Err>;
637
638 fn create_chat_invite_link<C>(&self, chat_id: C) -> Self::CreateChatInviteLink
640 where
641 C: Into<Recipient>;
642
643 type EditChatInviteLink: Request<Payload = EditChatInviteLink, Err = Self::Err>;
644
645 fn edit_chat_invite_link<C, I>(&self, chat_id: C, invite_link: I) -> Self::EditChatInviteLink
647 where
648 C: Into<Recipient>,
649 I: Into<String>;
650
651 type CreateChatSubscriptionInviteLink: Request<
652 Payload = CreateChatSubscriptionInviteLink,
653 Err = Self::Err,
654 >;
655
656 fn create_chat_subscription_invite_link<C>(
658 &self,
659 chat_id: C,
660 subscription_period: Seconds,
661 subscription_price: u32,
662 ) -> Self::CreateChatSubscriptionInviteLink
663 where
664 C: Into<Recipient>;
665
666 type EditChatSubscriptionInviteLink: Request<
667 Payload = EditChatSubscriptionInviteLink,
668 Err = Self::Err,
669 >;
670
671 fn edit_chat_subscription_invite_link<C, I>(
673 &self,
674 chat_id: C,
675 invite_link: I,
676 ) -> Self::EditChatSubscriptionInviteLink
677 where
678 C: Into<Recipient>,
679 I: Into<String>;
680
681 type RevokeChatInviteLink: Request<Payload = RevokeChatInviteLink, Err = Self::Err>;
682
683 fn revoke_chat_invite_link<C, I>(
685 &self,
686 chat_id: C,
687 invite_link: I,
688 ) -> Self::RevokeChatInviteLink
689 where
690 C: Into<Recipient>,
691 I: Into<String>;
692
693 type ApproveChatJoinRequest: Request<Payload = ApproveChatJoinRequest, Err = Self::Err>;
694
695 fn approve_chat_join_request<C>(
697 &self,
698 chat_id: C,
699 user_id: UserId,
700 ) -> Self::ApproveChatJoinRequest
701 where
702 C: Into<Recipient>;
703
704 type DeclineChatJoinRequest: Request<Payload = DeclineChatJoinRequest, Err = Self::Err>;
705
706 fn decline_chat_join_request<C>(
708 &self,
709 chat_id: C,
710 user_id: UserId,
711 ) -> Self::DeclineChatJoinRequest
712 where
713 C: Into<Recipient>;
714
715 type AnswerChatJoinRequestQuery: Request<Payload = AnswerChatJoinRequestQuery, Err = Self::Err>;
716
717 fn answer_chat_join_request_query<C>(
719 &self,
720 chat_join_request_query_id: C,
721 result: ChatJoinRequestQueryResult,
722 ) -> Self::AnswerChatJoinRequestQuery
723 where
724 C: Into<String>;
725
726 type SendChatJoinRequestWebApp: Request<Payload = SendChatJoinRequestWebApp, Err = Self::Err>;
727
728 fn send_chat_join_request_web_app<C, W>(
730 &self,
731 chat_join_request_query_id: C,
732 web_app_url: W,
733 ) -> Self::SendChatJoinRequestWebApp
734 where
735 C: Into<String>,
736 W: Into<String>;
737
738 type SetChatPhoto: Request<Payload = SetChatPhoto, Err = Self::Err>;
739
740 fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
742 where
743 C: Into<Recipient>;
744
745 type DeleteChatPhoto: Request<Payload = DeleteChatPhoto, Err = Self::Err>;
746
747 fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto
749 where
750 C: Into<Recipient>;
751
752 type SetChatTitle: Request<Payload = SetChatTitle, Err = Self::Err>;
753
754 fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle
756 where
757 C: Into<Recipient>,
758 T: Into<String>;
759
760 type SetChatDescription: Request<Payload = SetChatDescription, Err = Self::Err>;
761
762 fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription
764 where
765 C: Into<Recipient>;
766
767 type PinChatMessage: Request<Payload = PinChatMessage, Err = Self::Err>;
768
769 fn pin_chat_message<C>(&self, chat_id: C, message_id: MessageId) -> Self::PinChatMessage
771 where
772 C: Into<Recipient>;
773
774 type UnpinChatMessage: Request<Payload = UnpinChatMessage, Err = Self::Err>;
775
776 fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage
778 where
779 C: Into<Recipient>;
780
781 type UnpinAllChatMessages: Request<Payload = UnpinAllChatMessages, Err = Self::Err>;
782
783 fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages
785 where
786 C: Into<Recipient>;
787
788 type LeaveChat: Request<Payload = LeaveChat, Err = Self::Err>;
789
790 fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat
792 where
793 C: Into<Recipient>;
794
795 type GetChat: Request<Payload = GetChat, Err = Self::Err>;
796
797 fn get_chat<C>(&self, chat_id: C) -> Self::GetChat
799 where
800 C: Into<Recipient>;
801
802 type GetChatAdministrators: Request<Payload = GetChatAdministrators, Err = Self::Err>;
803
804 fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators
806 where
807 C: Into<Recipient>;
808
809 type GetChatMemberCount: Request<Payload = GetChatMemberCount, Err = Self::Err>;
810
811 fn get_chat_member_count<C>(&self, chat_id: C) -> Self::GetChatMemberCount
813 where
814 C: Into<Recipient>;
815
816 type GetChatMembersCount: Request<Payload = GetChatMembersCount, Err = Self::Err>;
817
818 fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount
820 where
821 C: Into<Recipient>;
822
823 type GetChatMember: Request<Payload = GetChatMember, Err = Self::Err>;
824
825 fn get_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::GetChatMember
827 where
828 C: Into<Recipient>;
829
830 type GetUserPersonalChatMessages: Request<
831 Payload = GetUserPersonalChatMessages,
832 Err = Self::Err,
833 >;
834
835 fn get_user_personal_chat_messages(
837 &self,
838 user_id: UserId,
839 limit: u8,
840 ) -> Self::GetUserPersonalChatMessages;
841
842 type SetChatStickerSet: Request<Payload = SetChatStickerSet, Err = Self::Err>;
843
844 fn set_chat_sticker_set<C, S>(
846 &self,
847 chat_id: C,
848 sticker_set_name: S,
849 ) -> Self::SetChatStickerSet
850 where
851 C: Into<Recipient>,
852 S: Into<String>;
853
854 type DeleteChatStickerSet: Request<Payload = DeleteChatStickerSet, Err = Self::Err>;
855
856 fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet
858 where
859 C: Into<Recipient>;
860
861 type GetForumTopicIconStickers: Request<Payload = GetForumTopicIconStickers, Err = Self::Err>;
862
863 fn get_forum_topic_icon_stickers(&self) -> Self::GetForumTopicIconStickers;
865
866 type CreateForumTopic: Request<Payload = CreateForumTopic, Err = Self::Err>;
867
868 fn create_forum_topic<C, N>(&self, chat_id: C, name: N) -> Self::CreateForumTopic
870 where
871 C: Into<Recipient>,
872 N: Into<String>;
873
874 type EditForumTopic: Request<Payload = EditForumTopic, Err = Self::Err>;
875
876 fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::EditForumTopic
878 where
879 C: Into<Recipient>;
880
881 type CloseForumTopic: Request<Payload = CloseForumTopic, Err = Self::Err>;
882
883 fn close_forum_topic<C>(
885 &self,
886 chat_id: C,
887 message_thread_id: ThreadId,
888 ) -> Self::CloseForumTopic
889 where
890 C: Into<Recipient>;
891
892 type ReopenForumTopic: Request<Payload = ReopenForumTopic, Err = Self::Err>;
893
894 fn reopen_forum_topic<C>(
896 &self,
897 chat_id: C,
898 message_thread_id: ThreadId,
899 ) -> Self::ReopenForumTopic
900 where
901 C: Into<Recipient>;
902
903 type DeleteForumTopic: Request<Payload = DeleteForumTopic, Err = Self::Err>;
904
905 fn delete_forum_topic<C>(
907 &self,
908 chat_id: C,
909 message_thread_id: ThreadId,
910 ) -> Self::DeleteForumTopic
911 where
912 C: Into<Recipient>;
913
914 type UnpinAllForumTopicMessages: Request<Payload = UnpinAllForumTopicMessages, Err = Self::Err>;
915
916 fn unpin_all_forum_topic_messages<C>(
918 &self,
919 chat_id: C,
920 message_thread_id: ThreadId,
921 ) -> Self::UnpinAllForumTopicMessages
922 where
923 C: Into<Recipient>;
924
925 type EditGeneralForumTopic: Request<Payload = EditGeneralForumTopic, Err = Self::Err>;
926
927 fn edit_general_forum_topic<C, N>(&self, chat_id: C, name: N) -> Self::EditGeneralForumTopic
929 where
930 C: Into<Recipient>,
931 N: Into<String>;
932
933 type CloseGeneralForumTopic: Request<Payload = CloseGeneralForumTopic, Err = Self::Err>;
934
935 fn close_general_forum_topic<C>(&self, chat_id: C) -> Self::CloseGeneralForumTopic
937 where
938 C: Into<Recipient>;
939
940 type ReopenGeneralForumTopic: Request<Payload = ReopenGeneralForumTopic, Err = Self::Err>;
941
942 fn reopen_general_forum_topic<C>(&self, chat_id: C) -> Self::ReopenGeneralForumTopic
944 where
945 C: Into<Recipient>;
946
947 type HideGeneralForumTopic: Request<Payload = HideGeneralForumTopic, Err = Self::Err>;
948
949 fn hide_general_forum_topic<C>(&self, chat_id: C) -> Self::HideGeneralForumTopic
951 where
952 C: Into<Recipient>;
953
954 type UnhideGeneralForumTopic: Request<Payload = UnhideGeneralForumTopic, Err = Self::Err>;
955
956 fn unhide_general_forum_topic<C>(&self, chat_id: C) -> Self::UnhideGeneralForumTopic
958 where
959 C: Into<Recipient>;
960
961 type UnpinAllGeneralForumTopicMessages: Request<
962 Payload = UnpinAllGeneralForumTopicMessages,
963 Err = Self::Err,
964 >;
965
966 fn unpin_all_general_forum_topic_messages<C>(
968 &self,
969 chat_id: C,
970 ) -> Self::UnpinAllGeneralForumTopicMessages
971 where
972 C: Into<Recipient>;
973
974 type GetChatShareThemeBackdrops: Request<Payload = GetChatShareThemeBackdrops, Err = Self::Err>;
975
976 fn get_chat_share_theme_backdrops(&self) -> Self::GetChatShareThemeBackdrops;
978
979 type AnswerWidgetQuery: Request<Payload = AnswerWidgetQuery, Err = Self::Err>;
980
981 fn answer_widget_query(&self, widget_query_id: WidgetQueryId) -> Self::AnswerWidgetQuery;
983
984 type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>;
985
986 fn answer_callback_query(
988 &self,
989 callback_query_id: CallbackQueryId,
990 ) -> Self::AnswerCallbackQuery;
991
992 type GetUserChatBoosts: Request<Payload = GetUserChatBoosts, Err = Self::Err>;
993
994 fn get_user_chat_boosts<C>(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts
996 where
997 C: Into<Recipient>;
998
999 type AnswerGuestQuery: Request<Payload = AnswerGuestQuery, Err = Self::Err>;
1000
1001 fn answer_guest_query<G>(
1003 &self,
1004 guest_query_id: G,
1005 result: InlineQueryResult,
1006 ) -> Self::AnswerGuestQuery
1007 where
1008 G: Into<String>;
1009
1010 type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>;
1011
1012 fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands
1014 where
1015 C: IntoIterator<Item = BotCommand>;
1016
1017 type GetBusinessConnection: Request<Payload = GetBusinessConnection, Err = Self::Err>;
1018
1019 fn get_business_connection(
1021 &self,
1022 business_connection_id: BusinessConnectionId,
1023 ) -> Self::GetBusinessConnection;
1024
1025 type GetMyCommands: Request<Payload = GetMyCommands, Err = Self::Err>;
1026
1027 fn get_my_commands(&self) -> Self::GetMyCommands;
1029
1030 type SetMySettings: Request<Payload = SetMySettings, Err = Self::Err>;
1031
1032 fn set_my_settings(&self) -> Self::SetMySettings;
1034
1035 type SetMyName: Request<Payload = SetMyName, Err = Self::Err>;
1036
1037 fn set_my_name(&self) -> Self::SetMyName;
1039
1040 type GetMyName: Request<Payload = GetMyName, Err = Self::Err>;
1041
1042 fn get_my_name(&self) -> Self::GetMyName;
1044
1045 type SetMyDescription: Request<Payload = SetMyDescription, Err = Self::Err>;
1046
1047 fn set_my_description(&self) -> Self::SetMyDescription;
1049
1050 type GetMyDescription: Request<Payload = GetMyDescription, Err = Self::Err>;
1051
1052 fn get_my_description(&self) -> Self::GetMyDescription;
1054
1055 type SetMyShortDescription: Request<Payload = SetMyShortDescription, Err = Self::Err>;
1056
1057 fn set_my_short_description(&self) -> Self::SetMyShortDescription;
1059
1060 type GetMyShortDescription: Request<Payload = GetMyShortDescription, Err = Self::Err>;
1061
1062 fn get_my_short_description(&self) -> Self::GetMyShortDescription;
1064
1065 type SetChatMenuButton: Request<Payload = SetChatMenuButton, Err = Self::Err>;
1066
1067 fn set_chat_menu_button(&self) -> Self::SetChatMenuButton;
1069
1070 type GetChatMenuButton: Request<Payload = GetChatMenuButton, Err = Self::Err>;
1071
1072 fn get_chat_menu_button(&self) -> Self::GetChatMenuButton;
1074
1075 type SetMyProfilePhoto: Request<Payload = SetMyProfilePhoto, Err = Self::Err>;
1076
1077 fn set_my_profile_photo(&self, photo: InputProfilePhoto) -> Self::SetMyProfilePhoto;
1079
1080 type RemoveMyProfilePhoto: Request<Payload = RemoveMyProfilePhoto, Err = Self::Err>;
1081
1082 fn remove_my_profile_photo(&self) -> Self::RemoveMyProfilePhoto;
1084
1085 type SetMyDefaultAdministratorRights: Request<
1086 Payload = SetMyDefaultAdministratorRights,
1087 Err = Self::Err,
1088 >;
1089
1090 fn set_my_default_administrator_rights(&self) -> Self::SetMyDefaultAdministratorRights;
1092
1093 type GetMyDefaultAdministratorRights: Request<
1094 Payload = GetMyDefaultAdministratorRights,
1095 Err = Self::Err,
1096 >;
1097
1098 fn get_my_default_administrator_rights(&self) -> Self::GetMyDefaultAdministratorRights;
1100
1101 type DeleteMyCommands: Request<Payload = DeleteMyCommands, Err = Self::Err>;
1102
1103 fn delete_my_commands(&self) -> Self::DeleteMyCommands;
1105
1106 type AnswerInlineQuery: Request<Payload = AnswerInlineQuery, Err = Self::Err>;
1107
1108 fn answer_inline_query<R>(
1110 &self,
1111 inline_query_id: InlineQueryId,
1112 results: R,
1113 ) -> Self::AnswerInlineQuery
1114 where
1115 R: IntoIterator<Item = InlineQueryResult>;
1116
1117 type AnswerWebAppQuery: Request<Payload = AnswerWebAppQuery, Err = Self::Err>;
1118
1119 fn answer_web_app_query<W>(
1121 &self,
1122 web_app_query_id: W,
1123 result: InlineQueryResult,
1124 ) -> Self::AnswerWebAppQuery
1125 where
1126 W: Into<String>;
1127
1128 type SavePreparedInlineMessage: Request<Payload = SavePreparedInlineMessage, Err = Self::Err>;
1129
1130 fn save_prepared_inline_message(
1132 &self,
1133 user_id: UserId,
1134 result: InlineQueryResult,
1135 ) -> Self::SavePreparedInlineMessage;
1136
1137 type EditMessageText: Request<Payload = EditMessageText, Err = Self::Err>;
1138
1139 fn edit_message_text<C>(&self, chat_id: C, message_id: MessageId) -> Self::EditMessageText
1141 where
1142 C: Into<Recipient>;
1143
1144 type EditMessageTextInline: Request<Payload = EditMessageTextInline, Err = Self::Err>;
1145
1146 fn edit_message_text_inline<I>(&self, inline_message_id: I) -> Self::EditMessageTextInline
1148 where
1149 I: Into<String>;
1150
1151 type EditMessageCaption: Request<Payload = EditMessageCaption, Err = Self::Err>;
1152
1153 fn edit_message_caption<C>(
1155 &self,
1156 chat_id: C,
1157 message_id: MessageId,
1158 ) -> Self::EditMessageCaption
1159 where
1160 C: Into<Recipient>;
1161
1162 type EditMessageCaptionInline: Request<Payload = EditMessageCaptionInline, Err = Self::Err>;
1163
1164 fn edit_message_caption_inline<I>(
1166 &self,
1167 inline_message_id: I,
1168 ) -> Self::EditMessageCaptionInline
1169 where
1170 I: Into<String>;
1171
1172 type EditMessageMedia: Request<Payload = EditMessageMedia, Err = Self::Err>;
1173
1174 fn edit_message_media<C>(
1176 &self,
1177 chat_id: C,
1178 message_id: MessageId,
1179 media: InputMedia,
1180 ) -> Self::EditMessageMedia
1181 where
1182 C: Into<Recipient>;
1183
1184 type EditMessageMediaInline: Request<Payload = EditMessageMediaInline, Err = Self::Err>;
1185
1186 fn edit_message_media_inline<I>(
1188 &self,
1189 inline_message_id: I,
1190 media: InputMedia,
1191 ) -> Self::EditMessageMediaInline
1192 where
1193 I: Into<String>;
1194
1195 type EditMessageWidgetData: Request<Payload = EditMessageWidgetData, Err = Self::Err>;
1196
1197 fn edit_message_widget_data<C>(
1199 &self,
1200 chat_id: C,
1201 message_id: MessageId,
1202 ) -> Self::EditMessageWidgetData
1203 where
1204 C: Into<Recipient>;
1205
1206 type EditMessageWidgetDataInline: Request<
1207 Payload = EditMessageWidgetDataInline,
1208 Err = Self::Err,
1209 >;
1210
1211 fn edit_message_widget_data_inline<I>(
1213 &self,
1214 inline_message_id: I,
1215 ) -> Self::EditMessageWidgetDataInline
1216 where
1217 I: Into<String>;
1218
1219 type EditSharedWidgetData: Request<Payload = EditSharedWidgetData, Err = Self::Err>;
1220
1221 fn edit_shared_widget_data<P>(
1223 &self,
1224 widget_id: WidgetId,
1225 public_data: P,
1226 ) -> Self::EditSharedWidgetData
1227 where
1228 P: Into<String>;
1229
1230 type EditMessageReplyMarkup: Request<Payload = EditMessageReplyMarkup, Err = Self::Err>;
1231
1232 fn edit_message_reply_markup<C>(
1234 &self,
1235 chat_id: C,
1236 message_id: MessageId,
1237 ) -> Self::EditMessageReplyMarkup
1238 where
1239 C: Into<Recipient>;
1240
1241 type EditMessageReplyMarkupInline: Request<
1242 Payload = EditMessageReplyMarkupInline,
1243 Err = Self::Err,
1244 >;
1245
1246 fn edit_message_reply_markup_inline<I>(
1248 &self,
1249 inline_message_id: I,
1250 ) -> Self::EditMessageReplyMarkupInline
1251 where
1252 I: Into<String>;
1253
1254 type EditEphemeralMessageText: Request<Payload = EditEphemeralMessageText, Err = Self::Err>;
1255
1256 fn edit_ephemeral_message_text<C>(
1258 &self,
1259 chat_id: C,
1260 receiver_user_id: i64,
1261 ephemeral_message_id: MessageId,
1262 ) -> Self::EditEphemeralMessageText
1263 where
1264 C: Into<Recipient>;
1265
1266 type EditEphemeralMessageCaption: Request<
1267 Payload = EditEphemeralMessageCaption,
1268 Err = Self::Err,
1269 >;
1270
1271 fn edit_ephemeral_message_caption<C>(
1273 &self,
1274 chat_id: C,
1275 receiver_user_id: i64,
1276 ephemeral_message_id: MessageId,
1277 ) -> Self::EditEphemeralMessageCaption
1278 where
1279 C: Into<Recipient>;
1280
1281 type EditEphemeralMessageMedia: Request<Payload = EditEphemeralMessageMedia, Err = Self::Err>;
1282
1283 fn edit_ephemeral_message_media<C>(
1285 &self,
1286 chat_id: C,
1287 receiver_user_id: i64,
1288 ephemeral_message_id: MessageId,
1289 media: InputMedia,
1290 ) -> Self::EditEphemeralMessageMedia
1291 where
1292 C: Into<Recipient>;
1293
1294 type EditEphemeralMessageReplyMarkup: Request<
1295 Payload = EditEphemeralMessageReplyMarkup,
1296 Err = Self::Err,
1297 >;
1298
1299 fn edit_ephemeral_message_reply_markup<C>(
1301 &self,
1302 chat_id: C,
1303 receiver_user_id: i64,
1304 ephemeral_message_id: MessageId,
1305 ) -> Self::EditEphemeralMessageReplyMarkup
1306 where
1307 C: Into<Recipient>;
1308
1309 type StopPoll: Request<Payload = StopPoll, Err = Self::Err>;
1310
1311 fn stop_poll<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopPoll
1313 where
1314 C: Into<Recipient>;
1315
1316 type ApproveSuggestedPost: Request<Payload = ApproveSuggestedPost, Err = Self::Err>;
1317
1318 fn approve_suggested_post<C>(
1320 &self,
1321 chat_id: C,
1322 message_id: MessageId,
1323 ) -> Self::ApproveSuggestedPost
1324 where
1325 C: Into<ChatId>;
1326
1327 type DeclineSuggestedPost: Request<Payload = DeclineSuggestedPost, Err = Self::Err>;
1328
1329 fn decline_suggested_post<C>(
1331 &self,
1332 chat_id: C,
1333 message_id: MessageId,
1334 ) -> Self::DeclineSuggestedPost
1335 where
1336 C: Into<ChatId>;
1337
1338 type DeleteMessage: Request<Payload = DeleteMessage, Err = Self::Err>;
1339
1340 fn delete_message<C>(&self, chat_id: C, message_id: MessageId) -> Self::DeleteMessage
1342 where
1343 C: Into<Recipient>;
1344
1345 type DeleteEphemeralMessage: Request<Payload = DeleteEphemeralMessage, Err = Self::Err>;
1346
1347 fn delete_ephemeral_message<C>(
1349 &self,
1350 chat_id: C,
1351 receiver_user_id: i64,
1352 ephemeral_message_id: MessageId,
1353 ) -> Self::DeleteEphemeralMessage
1354 where
1355 C: Into<Recipient>;
1356
1357 type DeleteMessages: Request<Payload = DeleteMessages, Err = Self::Err>;
1358
1359 fn delete_messages<C, M>(&self, chat_id: C, message_ids: M) -> Self::DeleteMessages
1361 where
1362 C: Into<Recipient>,
1363 M: IntoIterator<Item = MessageId>;
1364
1365 type DeleteMessageReaction: Request<Payload = DeleteMessageReaction, Err = Self::Err>;
1366
1367 fn delete_message_reaction<C>(
1369 &self,
1370 chat_id: C,
1371 message_id: MessageId,
1372 ) -> Self::DeleteMessageReaction
1373 where
1374 C: Into<Recipient>;
1375
1376 type DeleteAllMessageReactions: Request<Payload = DeleteAllMessageReactions, Err = Self::Err>;
1377
1378 fn delete_all_message_reactions<C>(&self, chat_id: C) -> Self::DeleteAllMessageReactions
1380 where
1381 C: Into<Recipient>;
1382
1383 type SendSticker: Request<Payload = SendSticker, Err = Self::Err>;
1384
1385 fn send_sticker(&self, sticker: InputFile) -> Self::SendSticker;
1387
1388 type GetStickerSet: Request<Payload = GetStickerSet, Err = Self::Err>;
1389
1390 fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet
1392 where
1393 N: Into<String>;
1394
1395 type GetCustomEmojiStickers: Request<Payload = GetCustomEmojiStickers, Err = Self::Err>;
1396
1397 fn get_custom_emoji_stickers<C>(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers
1399 where
1400 C: IntoIterator<Item = CustomEmojiId>;
1401
1402 type UploadStickerFile: Request<Payload = UploadStickerFile, Err = Self::Err>;
1403
1404 fn upload_sticker_file(
1406 &self,
1407 user_id: UserId,
1408 sticker: InputFile,
1409 sticker_format: StickerFormat,
1410 ) -> Self::UploadStickerFile;
1411
1412 type CreateNewStickerSet: Request<Payload = CreateNewStickerSet, Err = Self::Err>;
1413
1414 fn create_new_sticker_set<N, T, S>(
1416 &self,
1417 user_id: UserId,
1418 name: N,
1419 title: T,
1420 stickers: S,
1421 ) -> Self::CreateNewStickerSet
1422 where
1423 N: Into<String>,
1424 T: Into<String>,
1425 S: IntoIterator<Item = InputSticker>;
1426
1427 type AddStickerToSet: Request<Payload = AddStickerToSet, Err = Self::Err>;
1428
1429 fn add_sticker_to_set<N>(
1431 &self,
1432 user_id: UserId,
1433 name: N,
1434 sticker: InputSticker,
1435 ) -> Self::AddStickerToSet
1436 where
1437 N: Into<String>;
1438
1439 type SetStickerPositionInSet: Request<Payload = SetStickerPositionInSet, Err = Self::Err>;
1440
1441 fn set_sticker_position_in_set<S>(
1443 &self,
1444 sticker: S,
1445 position: u32,
1446 ) -> Self::SetStickerPositionInSet
1447 where
1448 S: Into<String>;
1449
1450 type DeleteStickerFromSet: Request<Payload = DeleteStickerFromSet, Err = Self::Err>;
1451
1452 fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet
1454 where
1455 S: Into<String>;
1456
1457 type ReplaceStickerInSet: Request<Payload = ReplaceStickerInSet, Err = Self::Err>;
1458
1459 fn replace_sticker_in_set<N, O>(
1461 &self,
1462 user_id: UserId,
1463 name: N,
1464 old_sticker: O,
1465 sticker: InputSticker,
1466 ) -> Self::ReplaceStickerInSet
1467 where
1468 N: Into<String>,
1469 O: Into<String>;
1470
1471 type SetStickerSetThumbnail: Request<Payload = SetStickerSetThumbnail, Err = Self::Err>;
1472
1473 fn set_sticker_set_thumbnail<N>(
1475 &self,
1476 name: N,
1477 user_id: UserId,
1478 format: StickerFormat,
1479 ) -> Self::SetStickerSetThumbnail
1480 where
1481 N: Into<String>;
1482
1483 type SetCustomEmojiStickerSetThumbnail: Request<
1484 Payload = SetCustomEmojiStickerSetThumbnail,
1485 Err = Self::Err,
1486 >;
1487
1488 fn set_custom_emoji_sticker_set_thumbnail<N>(
1490 &self,
1491 name: N,
1492 ) -> Self::SetCustomEmojiStickerSetThumbnail
1493 where
1494 N: Into<String>;
1495
1496 type SetStickerSetTitle: Request<Payload = SetStickerSetTitle, Err = Self::Err>;
1497
1498 fn set_sticker_set_title<N, T>(&self, name: N, title: T) -> Self::SetStickerSetTitle
1500 where
1501 N: Into<String>,
1502 T: Into<String>;
1503
1504 type DeleteStickerSet: Request<Payload = DeleteStickerSet, Err = Self::Err>;
1505
1506 fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet
1508 where
1509 N: Into<String>;
1510
1511 type SetStickerEmojiList: Request<Payload = SetStickerEmojiList, Err = Self::Err>;
1512
1513 fn set_sticker_emoji_list<S, E>(&self, sticker: S, emoji_list: E) -> Self::SetStickerEmojiList
1515 where
1516 S: Into<String>,
1517 E: IntoIterator<Item = String>;
1518
1519 type SetStickerKeywords: Request<Payload = SetStickerKeywords, Err = Self::Err>;
1520
1521 fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords
1523 where
1524 S: Into<String>;
1525
1526 type SetStickerMaskPosition: Request<Payload = SetStickerMaskPosition, Err = Self::Err>;
1527
1528 fn set_sticker_mask_position<S>(&self, sticker: S) -> Self::SetStickerMaskPosition
1530 where
1531 S: Into<String>;
1532
1533 type GetAvailableGifts: Request<Payload = GetAvailableGifts, Err = Self::Err>;
1534
1535 fn get_available_gifts(&self) -> Self::GetAvailableGifts;
1537
1538 type SendGift: Request<Payload = SendGift, Err = Self::Err>;
1539
1540 fn send_gift(&self, user_id: UserId, gift_id: GiftId) -> Self::SendGift;
1542
1543 type SendGiftChat: Request<Payload = SendGiftChat, Err = Self::Err>;
1544
1545 fn send_gift_chat<C>(&self, chat_id: C, gift_id: GiftId) -> Self::SendGiftChat
1547 where
1548 C: Into<Recipient>;
1549
1550 type GiftPremiumSubscription: Request<Payload = GiftPremiumSubscription, Err = Self::Err>;
1551
1552 fn gift_premium_subscription(
1554 &self,
1555 user_id: UserId,
1556 month_count: u8,
1557 star_count: u64,
1558 ) -> Self::GiftPremiumSubscription;
1559
1560 type VerifyUser: Request<Payload = VerifyUser, Err = Self::Err>;
1561
1562 fn verify_user(&self, user_id: UserId) -> Self::VerifyUser;
1564
1565 type VerifyChat: Request<Payload = VerifyChat, Err = Self::Err>;
1566
1567 fn verify_chat<C>(&self, chat_id: C) -> Self::VerifyChat
1569 where
1570 C: Into<Recipient>;
1571
1572 type RemoveUserVerification: Request<Payload = RemoveUserVerification, Err = Self::Err>;
1573
1574 fn remove_user_verification(&self, user_id: UserId) -> Self::RemoveUserVerification;
1576
1577 type RemoveChatVerification: Request<Payload = RemoveChatVerification, Err = Self::Err>;
1578
1579 fn remove_chat_verification<C>(&self, chat_id: C) -> Self::RemoveChatVerification
1581 where
1582 C: Into<Recipient>;
1583
1584 type ReadBusinessMessage: Request<Payload = ReadBusinessMessage, Err = Self::Err>;
1585
1586 fn read_business_message<C>(
1588 &self,
1589 business_connection_id: BusinessConnectionId,
1590 chat_id: C,
1591 message_id: MessageId,
1592 ) -> Self::ReadBusinessMessage
1593 where
1594 C: Into<ChatId>;
1595
1596 type DeleteBusinessMessages: Request<Payload = DeleteBusinessMessages, Err = Self::Err>;
1597
1598 fn delete_business_messages<M>(
1600 &self,
1601 business_connection_id: BusinessConnectionId,
1602 message_ids: M,
1603 ) -> Self::DeleteBusinessMessages
1604 where
1605 M: IntoIterator<Item = MessageId>;
1606
1607 type SetBusinessAccountName: Request<Payload = SetBusinessAccountName, Err = Self::Err>;
1608
1609 fn set_business_account_name<F>(
1611 &self,
1612 business_connection_id: BusinessConnectionId,
1613 first_name: F,
1614 ) -> Self::SetBusinessAccountName
1615 where
1616 F: Into<String>;
1617
1618 type SetBusinessAccountUsername: Request<Payload = SetBusinessAccountUsername, Err = Self::Err>;
1619
1620 fn set_business_account_username(
1622 &self,
1623 business_connection_id: BusinessConnectionId,
1624 ) -> Self::SetBusinessAccountUsername;
1625
1626 type SetBusinessAccountBio: Request<Payload = SetBusinessAccountBio, Err = Self::Err>;
1627
1628 fn set_business_account_bio(
1630 &self,
1631 business_connection_id: BusinessConnectionId,
1632 ) -> Self::SetBusinessAccountBio;
1633
1634 type SetBusinessAccountProfilePhoto: Request<
1635 Payload = SetBusinessAccountProfilePhoto,
1636 Err = Self::Err,
1637 >;
1638
1639 fn set_business_account_profile_photo(
1641 &self,
1642 business_connection_id: BusinessConnectionId,
1643 photo: InputProfilePhoto,
1644 ) -> Self::SetBusinessAccountProfilePhoto;
1645
1646 type RemoveBusinessAccountProfilePhoto: Request<
1647 Payload = RemoveBusinessAccountProfilePhoto,
1648 Err = Self::Err,
1649 >;
1650
1651 fn remove_business_account_profile_photo(
1653 &self,
1654 business_connection_id: BusinessConnectionId,
1655 ) -> Self::RemoveBusinessAccountProfilePhoto;
1656
1657 type SetBusinessAccountGiftSettings: Request<
1658 Payload = SetBusinessAccountGiftSettings,
1659 Err = Self::Err,
1660 >;
1661
1662 fn set_business_account_gift_settings(
1664 &self,
1665 business_connection_id: BusinessConnectionId,
1666 show_gift_button: bool,
1667 accepted_gift_types: AcceptedGiftTypes,
1668 ) -> Self::SetBusinessAccountGiftSettings;
1669
1670 type GetBusinessAccountStarBalance: Request<
1671 Payload = GetBusinessAccountStarBalance,
1672 Err = Self::Err,
1673 >;
1674
1675 fn get_business_account_star_balance(
1677 &self,
1678 business_connection_id: BusinessConnectionId,
1679 ) -> Self::GetBusinessAccountStarBalance;
1680
1681 type TransferBusinessAccountStars: Request<
1682 Payload = TransferBusinessAccountStars,
1683 Err = Self::Err,
1684 >;
1685
1686 fn transfer_business_account_stars(
1688 &self,
1689 business_connection_id: BusinessConnectionId,
1690 star_count: u64,
1691 ) -> Self::TransferBusinessAccountStars;
1692
1693 type GetBusinessAccountGifts: Request<Payload = GetBusinessAccountGifts, Err = Self::Err>;
1694
1695 fn get_business_account_gifts(
1697 &self,
1698 business_connection_id: BusinessConnectionId,
1699 ) -> Self::GetBusinessAccountGifts;
1700
1701 type GetUserGifts: Request<Payload = GetUserGifts, Err = Self::Err>;
1702
1703 fn get_user_gifts(&self, user_id: UserId) -> Self::GetUserGifts;
1705
1706 type GetUserProfileAudios: Request<Payload = GetUserProfileAudios, Err = Self::Err>;
1707
1708 fn get_user_profile_audios(&self, user_id: UserId) -> Self::GetUserProfileAudios;
1710
1711 type GetChatGifts: Request<Payload = GetChatGifts, Err = Self::Err>;
1712
1713 fn get_chat_gifts<C>(&self, chat_id: C) -> Self::GetChatGifts
1715 where
1716 C: Into<Recipient>;
1717
1718 type GetUniqueGift: Request<Payload = GetUniqueGift, Err = Self::Err>;
1719
1720 fn get_unique_gift<N>(&self, name: N) -> Self::GetUniqueGift
1722 where
1723 N: Into<String>;
1724
1725 type DeleteBusinessAccountGift: Request<Payload = DeleteBusinessAccountGift, Err = Self::Err>;
1726
1727 fn delete_business_account_gift(
1729 &self,
1730 business_connection_id: BusinessConnectionId,
1731 owned_gift_id: OwnedGiftId,
1732 ) -> Self::DeleteBusinessAccountGift;
1733
1734 type ConvertGiftToStars: Request<Payload = ConvertGiftToStars, Err = Self::Err>;
1735
1736 fn convert_gift_to_stars(
1738 &self,
1739 business_connection_id: BusinessConnectionId,
1740 owned_gift_id: OwnedGiftId,
1741 ) -> Self::ConvertGiftToStars;
1742
1743 type UpgradeGift: Request<Payload = UpgradeGift, Err = Self::Err>;
1744
1745 fn upgrade_gift(
1747 &self,
1748 business_connection_id: BusinessConnectionId,
1749 owned_gift_id: OwnedGiftId,
1750 ) -> Self::UpgradeGift;
1751
1752 type TransferGift: Request<Payload = TransferGift, Err = Self::Err>;
1753
1754 fn transfer_gift<N>(
1756 &self,
1757 business_connection_id: BusinessConnectionId,
1758 owned_gift_id: OwnedGiftId,
1759 new_owner_chat_id: N,
1760 ) -> Self::TransferGift
1761 where
1762 N: Into<ChatId>;
1763
1764 type RepostStory: Request<Payload = RepostStory, Err = Self::Err>;
1765
1766 fn repost_story<F>(
1768 &self,
1769 business_connection_id: BusinessConnectionId,
1770 from_chat_id: F,
1771 from_story_id: StoryId,
1772 active_period: Seconds,
1773 ) -> Self::RepostStory
1774 where
1775 F: Into<Recipient>;
1776
1777 type PostStory: Request<Payload = PostStory, Err = Self::Err>;
1778
1779 fn post_story(
1781 &self,
1782 business_connection_id: BusinessConnectionId,
1783 content: InputStoryContent,
1784 active_period: Seconds,
1785 ) -> Self::PostStory;
1786
1787 type EditStory: Request<Payload = EditStory, Err = Self::Err>;
1788
1789 fn edit_story(
1791 &self,
1792 business_connection_id: BusinessConnectionId,
1793 story_id: StoryId,
1794 content: InputStoryContent,
1795 ) -> Self::EditStory;
1796
1797 type DeleteStory: Request<Payload = DeleteStory, Err = Self::Err>;
1798
1799 fn delete_story(
1801 &self,
1802 business_connection_id: BusinessConnectionId,
1803 story_id: StoryId,
1804 ) -> Self::DeleteStory;
1805
1806 type SendInvoice: Request<Payload = SendInvoice, Err = Self::Err>;
1807
1808 fn send_invoice<Ch, T, D, Pa, C, P>(
1810 &self,
1811 chat_id: Ch,
1812 title: T,
1813 description: D,
1814 payload: Pa,
1815 currency: C,
1816 prices: P,
1817 ) -> Self::SendInvoice
1818 where
1819 Ch: Into<Recipient>,
1820 T: Into<String>,
1821 D: Into<String>,
1822 Pa: Into<String>,
1823 C: Into<String>,
1824 P: IntoIterator<Item = LabeledPrice>;
1825
1826 type CreateInvoiceLink: Request<Payload = CreateInvoiceLink, Err = Self::Err>;
1827
1828 fn create_invoice_link<T, D, Pa, C, P>(
1830 &self,
1831 title: T,
1832 description: D,
1833 payload: Pa,
1834 currency: C,
1835 prices: P,
1836 ) -> Self::CreateInvoiceLink
1837 where
1838 T: Into<String>,
1839 D: Into<String>,
1840 Pa: Into<String>,
1841 C: Into<String>,
1842 P: IntoIterator<Item = LabeledPrice>;
1843
1844 type AnswerShippingQuery: Request<Payload = AnswerShippingQuery, Err = Self::Err>;
1845
1846 fn answer_shipping_query(
1848 &self,
1849 shipping_query_id: ShippingQueryId,
1850 ok: bool,
1851 ) -> Self::AnswerShippingQuery;
1852
1853 type AnswerPreCheckoutQuery: Request<Payload = AnswerPreCheckoutQuery, Err = Self::Err>;
1854
1855 fn answer_pre_checkout_query(
1857 &self,
1858 pre_checkout_query_id: PreCheckoutQueryId,
1859 ok: bool,
1860 ) -> Self::AnswerPreCheckoutQuery;
1861
1862 type GetMyStarBalance: Request<Payload = GetMyStarBalance, Err = Self::Err>;
1863
1864 fn get_my_star_balance(&self) -> Self::GetMyStarBalance;
1866
1867 type GetStarTransactions: Request<Payload = GetStarTransactions, Err = Self::Err>;
1868
1869 fn get_star_transactions(&self) -> Self::GetStarTransactions;
1871
1872 type RefundStarPayment: Request<Payload = RefundStarPayment, Err = Self::Err>;
1873
1874 fn refund_star_payment(
1876 &self,
1877 user_id: UserId,
1878 telegram_payment_charge_id: TelegramTransactionId,
1879 ) -> Self::RefundStarPayment;
1880
1881 type EditUserStarSubscription: Request<Payload = EditUserStarSubscription, Err = Self::Err>;
1882
1883 fn edit_user_star_subscription(
1885 &self,
1886 user_id: UserId,
1887 telegram_payment_charge_id: TelegramTransactionId,
1888 is_canceled: bool,
1889 ) -> Self::EditUserStarSubscription;
1890
1891 type SetPassportDataErrors: Request<Payload = SetPassportDataErrors, Err = Self::Err>;
1892
1893 fn set_passport_data_errors<E>(
1895 &self,
1896 user_id: UserId,
1897 errors: E,
1898 ) -> Self::SetPassportDataErrors
1899 where
1900 E: IntoIterator<Item = PassportElementError>;
1901
1902 type SendGame: Request<Payload = SendGame, Err = Self::Err>;
1903
1904 fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame
1906 where
1907 C: Into<ChatId>,
1908 G: Into<String>;
1909
1910 type SetGameScore: Request<Payload = SetGameScore, Err = Self::Err>;
1911
1912 fn set_game_score<C>(
1914 &self,
1915 user_id: UserId,
1916 score: u64,
1917 chat_id: C,
1918 message_id: MessageId,
1919 ) -> Self::SetGameScore
1920 where
1921 C: Into<ChatId>;
1922
1923 type SetGameScoreInline: Request<Payload = SetGameScoreInline, Err = Self::Err>;
1924
1925 fn set_game_score_inline<I>(
1927 &self,
1928 user_id: UserId,
1929 score: u64,
1930 inline_message_id: I,
1931 ) -> Self::SetGameScoreInline
1932 where
1933 I: Into<String>;
1934
1935 type GetGameHighScores: Request<Payload = GetGameHighScores, Err = Self::Err>;
1936
1937 fn get_game_high_scores<T>(&self, user_id: UserId, target: T) -> Self::GetGameHighScores
1939 where
1940 T: Into<TargetMessage>;
1941 }
1943
1944macro_rules! fty {
1945 ($T:ident) => {
1946 B::$T
1947 };
1948}
1949
1950macro_rules! fwd_deref {
1951 ($m:ident $this:ident ($($arg:ident : $T:ty),*)) => {
1952 core::ops::Deref::deref($this).$m($($arg),*)
1953 };
1954}
1955
1956macro_rules! forward_all {
1957 ($body:ident, $ty:ident) => {
1958 requester_forward! {
1959 get_me,
1960 send_widget,
1961 send_shared_widget,
1962 get_chat_share_theme_backdrops,
1963 answer_widget_query,
1964 get_unique_gift,
1965 delete_business_account_gift,
1966 edit_message_widget_data,
1967 edit_message_widget_data_inline,
1968 edit_shared_widget_data,
1969 log_out,
1970 close,
1971 get_updates,
1972 set_webhook,
1973 delete_webhook,
1974 get_webhook_info,
1975 forward_message,
1976 forward_messages,
1977 copy_message,
1978 copy_messages,
1979 send_message,
1980 send_message_draft,
1981 send_rich_message,
1982 send_rich_message_draft,
1983 send_photo,
1984 send_live_photo,
1985 send_audio,
1986 send_document,
1987 send_video,
1988 send_animation,
1989 send_voice,
1990 send_video_note,
1991 send_paid_media,
1992 send_media_group,
1993 send_location,
1994 edit_message_live_location,
1995 edit_message_live_location_inline,
1996 stop_message_live_location,
1997 stop_message_live_location_inline,
1998 edit_message_checklist,
1999 send_venue,
2000 send_contact,
2001 send_poll,
2002 send_checklist,
2003 send_dice,
2004 send_chat_action,
2005 set_message_reaction,
2006 get_user_profile_photos,
2007 set_user_emoji_status,
2008 get_file,
2009 kick_chat_member,
2010 ban_chat_member,
2011 unban_chat_member,
2012 restrict_chat_member,
2013 promote_chat_member,
2014 set_chat_administrator_custom_title,
2015 set_chat_member_tag,
2016 ban_chat_sender_chat,
2017 unban_chat_sender_chat,
2018 set_chat_permissions,
2019 export_chat_invite_link,
2020 create_chat_invite_link,
2021 edit_chat_invite_link,
2022 create_chat_subscription_invite_link,
2023 edit_chat_subscription_invite_link,
2024 revoke_chat_invite_link,
2025 set_chat_photo,
2026 delete_chat_photo,
2027 set_chat_title,
2028 set_chat_description,
2029 pin_chat_message,
2030 unpin_chat_message,
2031 unpin_all_chat_messages,
2032 leave_chat,
2033 get_chat,
2034 get_chat_administrators,
2035 get_chat_members_count,
2036 get_chat_member_count,
2037 get_chat_member,
2038 get_user_personal_chat_messages,
2039 set_chat_sticker_set,
2040 delete_chat_sticker_set,
2041 get_forum_topic_icon_stickers,
2042 create_forum_topic,
2043 edit_forum_topic,
2044 close_forum_topic,
2045 reopen_forum_topic,
2046 delete_forum_topic,
2047 unpin_all_forum_topic_messages,
2048 edit_general_forum_topic,
2049 close_general_forum_topic,
2050 reopen_general_forum_topic,
2051 hide_general_forum_topic,
2052 unhide_general_forum_topic,
2053 unpin_all_general_forum_topic_messages,
2054 answer_callback_query,
2055 get_user_chat_boosts,
2056 answer_guest_query,
2057 set_my_commands,
2058 get_business_connection,
2059 get_my_commands,
2060 set_my_settings,
2061 set_my_name,
2062 get_my_name,
2063 set_my_description,
2064 get_my_description,
2065 set_my_short_description,
2066 get_my_short_description,
2067 set_chat_menu_button,
2068 get_chat_menu_button,
2069 set_my_default_administrator_rights,
2070 get_my_default_administrator_rights,
2071 delete_my_commands,
2072 answer_inline_query,
2073 answer_web_app_query,
2074 save_prepared_inline_message,
2075 get_managed_bot_token,
2076 get_managed_bot_access_settings,
2077 set_managed_bot_access_settings,
2078 replace_managed_bot_token,
2079 save_prepared_keyboard_button,
2080 edit_message_text,
2081 edit_message_text_inline,
2082 edit_message_caption,
2083 edit_message_caption_inline,
2084 edit_message_media,
2085 edit_message_media_inline,
2086 edit_message_reply_markup,
2087 edit_message_reply_markup_inline,
2088 edit_ephemeral_message_text,
2089 edit_ephemeral_message_caption,
2090 edit_ephemeral_message_media,
2091 edit_ephemeral_message_reply_markup,
2092 stop_poll,
2093 approve_suggested_post,
2094 decline_suggested_post,
2095 delete_message,
2096 delete_ephemeral_message,
2097 delete_messages,
2098 delete_message_reaction,
2099 delete_all_message_reactions,
2100 send_sticker,
2101 get_sticker_set,
2102 get_custom_emoji_stickers,
2103 upload_sticker_file,
2104 create_new_sticker_set,
2105 add_sticker_to_set,
2106 set_sticker_position_in_set,
2107 delete_sticker_from_set,
2108 replace_sticker_in_set,
2109 set_sticker_set_thumbnail,
2110 set_custom_emoji_sticker_set_thumbnail,
2111 set_sticker_set_title,
2112 delete_sticker_set,
2113 set_sticker_emoji_list,
2114 set_sticker_keywords,
2115 set_sticker_mask_position,
2116 get_available_gifts,
2117 send_gift,
2118 send_gift_chat,
2119 gift_premium_subscription,
2120 verify_user,
2121 verify_chat,
2122 remove_user_verification,
2123 remove_chat_verification,
2124 read_business_message,
2125 delete_business_messages,
2126 set_business_account_name,
2127 set_business_account_username,
2128 set_business_account_bio,
2129 set_business_account_profile_photo,
2130 remove_business_account_profile_photo,
2131 set_business_account_gift_settings,
2132 get_business_account_star_balance,
2133 transfer_business_account_stars,
2134 get_business_account_gifts,
2135 get_user_gifts,
2136 get_user_profile_audios,
2137 get_chat_gifts,
2138 set_my_profile_photo,
2139 remove_my_profile_photo,
2140 convert_gift_to_stars,
2141 upgrade_gift,
2142 transfer_gift,
2143 repost_story,
2144 post_story,
2145 edit_story,
2146 delete_story,
2147 send_invoice,
2148 create_invoice_link,
2149 answer_shipping_query,
2150 answer_pre_checkout_query,
2151 get_my_star_balance,
2152 get_star_transactions,
2153 refund_star_payment,
2154 edit_user_star_subscription,
2155 set_passport_data_errors,
2156 send_game,
2157 set_game_score,
2158 set_game_score_inline,
2159 get_game_high_scores,
2160 approve_chat_join_request,
2161 decline_chat_join_request,
2162 answer_chat_join_request_query,
2163 send_chat_join_request_web_app
2164 => $body, $ty
2165 }
2166 };
2167 () => {
2168 forward_all! { fwd_deref, fty }
2169 };
2170}
2171
2172impl<B> Requester for &B
2173where
2174 B: Requester,
2175{
2176 type Err = B::Err;
2177
2178 forward_all! {}
2179}
2180
2181impl<B> Requester for &mut B
2182where
2183 B: Requester,
2184{
2185 type Err = B::Err;
2186
2187 forward_all! {}
2188}
2189
2190impl<B> Requester for Box<B>
2191where
2192 B: Requester,
2193{
2194 type Err = B::Err;
2195
2196 forward_all! {}
2197}
2198
2199impl<B> Requester for std::sync::Arc<B>
2200where
2201 B: Requester,
2202{
2203 type Err = B::Err;
2204
2205 forward_all! {}
2206}
2207
2208impl<B> Requester for std::rc::Rc<B>
2209where
2210 B: Requester,
2211{
2212 type Err = B::Err;
2213
2214 forward_all! {}
2215}
2216
2217#[test]
2243#[allow(clippy::format_collect)]
2245fn codegen_requester_methods() {
2246 use crate::codegen::{
2247 add_hidden_preamble,
2248 convert::{convert_for, Convert},
2249 ensure_file_contents, min_prefix, project_root, reformat, replace_block,
2250 schema::{self, Type},
2251 to_uppercase,
2252 };
2253 use indexmap::IndexMap;
2254 use itertools::Itertools;
2255
2256 let schema = schema::get();
2257
2258 let methods = schema
2259 .methods
2260 .iter()
2261 .map(|m| {
2262 let mut convert_params = m
2263 .params
2264 .iter()
2265 .filter(|p| !matches!(p.ty, Type::Option(_)))
2266 .map(|p| (&p.name, convert_for(&p.ty)))
2267 .filter(|(_, c)| !matches!(c, Convert::Id(_)))
2268 .map(|(name, _)| &**name)
2269 .collect::<Vec<_>>();
2270
2271 convert_params.sort_unstable();
2272
2273 let prefixes: IndexMap<_, _> = convert_params
2274 .iter()
2275 .copied()
2276 .chain(["\0"])
2278 .tuple_windows()
2279 .map(|(l, r)| (l, min_prefix(l, r)))
2280 .collect();
2281
2282 let args = m
2283 .params
2284 .iter()
2285 .filter(|p| !matches!(p.ty, schema::Type::Option(_)))
2286 .map(|p| match prefixes.get(&*p.name) {
2287 Some(prefix) => format!("{}: {}", p.name, to_uppercase(prefix)),
2288 None => format!("{}: {}", p.name, p.ty),
2289 })
2290 .join(", ");
2291
2292 let generics = m
2293 .params
2294 .iter()
2295 .flat_map(|p| prefixes.get(&*p.name))
2296 .copied()
2297 .map(to_uppercase)
2298 .join(", ");
2299 let where_clause = m
2300 .params
2301 .iter()
2302 .filter(|p| !matches!(p.ty, Type::Option(_)))
2303 .flat_map(|p| match convert_for(&p.ty) {
2304 Convert::Id(_) => None,
2305 Convert::Into(ty) => {
2306 Some(format!("{}: Into<{}>", to_uppercase(prefixes[&*p.name]), ty))
2307 }
2308 Convert::Collect(ty) => Some(format!(
2309 "{}: IntoIterator<Item = {}>",
2310 to_uppercase(prefixes[&*p.name]),
2311 ty
2312 )),
2313 })
2314 .join(",\n ");
2315
2316 let generics =
2317 if generics.is_empty() { String::from("") } else { format!("<{generics}>") };
2318
2319 let where_clause = if where_clause.is_empty() {
2320 String::from("")
2321 } else {
2322 format!(" where {where_clause}")
2323 };
2324
2325 format!(
2326 "
2327type {Method}: Request<Payload = {Method}, Err = Self::Err>;
2328
2329/// For Telegram documentation see [`{Method}`].
2330fn {method} {generics} (&self, {args}) -> Self::{Method}{where_clause};
2331 ",
2332 Method = m.names.1,
2333 method = m.names.2,
2334 )
2335 })
2336 .collect::<String>();
2337
2338 let path = project_root().join("src/requests/requester.rs");
2339
2340 ensure_file_contents(
2341 &path,
2342 &reformat(replace_block(
2343 &path,
2344 "requester_methods",
2345 &add_hidden_preamble("codegen_requester_methods", methods),
2346 )),
2347 );
2348}