diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 2169a8a7..c7a9a3b4 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -2931,6 +2931,28 @@ Schema( ), ], ), + Method( + names: ("getUserChatBoosts", "GetUserChatBoosts", "get_user_chat_boosts"), + return_ty: RawTy("UserChatBoosts"), + doc: Doc( + md: "Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a [UserChatBoosts] object.", + md_links: {"UserChatBoosts": "https://core.telegram.org/bots/api#userchatboosts"}, + ), + tg_doc: "https://core.telegram.org/bots/api#getuserchatboosts", + tg_category: "Available methods", + params: [ + Param( + name: "chat_id", + ty: RawTy("Recipient"), + descr: Doc(md: "Unique identifier for the chat or username of the channel (in the format @channelusername)"), + ), + Param( + name: "user_id", + ty: RawTy("UserId"), + descr: Doc(md: "Unique identifier of the target user"), + ), + ], + ), Method( names: ("setMyCommands", "SetMyCommands", "set_my_commands"), return_ty: True, diff --git a/crates/teloxide-core/src/adaptors/cache_me.rs b/crates/teloxide-core/src/adaptors/cache_me.rs index 4ab96541..aafe2aca 100644 --- a/crates/teloxide-core/src/adaptors/cache_me.rs +++ b/crates/teloxide-core/src/adaptors/cache_me.rs @@ -161,6 +161,7 @@ where unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name, diff --git a/crates/teloxide-core/src/adaptors/erased.rs b/crates/teloxide-core/src/adaptors/erased.rs index 0c2a907d..7d4eae0f 100644 --- a/crates/teloxide-core/src/adaptors/erased.rs +++ b/crates/teloxide-core/src/adaptors/erased.rs @@ -260,6 +260,7 @@ where unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name, @@ -738,6 +739,12 @@ trait ErasableRequester<'a> { callback_query_id: String, ) -> ErasedRequest<'a, AnswerCallbackQuery, Self::Err>; + fn get_user_chat_boosts( + &self, + chat_id: Recipient, + user_id: UserId, + ) -> ErasedRequest<'a, GetUserChatBoosts, Self::Err>; + fn set_my_commands( &self, commands: Vec, @@ -1580,6 +1587,14 @@ where Requester::answer_callback_query(self, callback_query_id).erase() } + fn get_user_chat_boosts( + &self, + chat_id: Recipient, + user_id: UserId, + ) -> ErasedRequest<'a, GetUserChatBoosts, Self::Err> { + Requester::get_user_chat_boosts(self, chat_id, user_id).erase() + } + fn set_my_commands( &self, commands: Vec, diff --git a/crates/teloxide-core/src/adaptors/parse_mode.rs b/crates/teloxide-core/src/adaptors/parse_mode.rs index 1b4fba80..2906302e 100644 --- a/crates/teloxide-core/src/adaptors/parse_mode.rs +++ b/crates/teloxide-core/src/adaptors/parse_mode.rs @@ -242,6 +242,7 @@ where unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name, diff --git a/crates/teloxide-core/src/adaptors/throttle/requester_impl.rs b/crates/teloxide-core/src/adaptors/throttle/requester_impl.rs index 0fbe3a5f..9c6fbd28 100644 --- a/crates/teloxide-core/src/adaptors/throttle/requester_impl.rs +++ b/crates/teloxide-core/src/adaptors/throttle/requester_impl.rs @@ -144,6 +144,7 @@ where unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name, diff --git a/crates/teloxide-core/src/adaptors/trace.rs b/crates/teloxide-core/src/adaptors/trace.rs index 7c6ebfa8..4a865dc3 100644 --- a/crates/teloxide-core/src/adaptors/trace.rs +++ b/crates/teloxide-core/src/adaptors/trace.rs @@ -190,6 +190,7 @@ where unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name, diff --git a/crates/teloxide-core/src/bot/api.rs b/crates/teloxide-core/src/bot/api.rs index 27912b41..2088bbcb 100644 --- a/crates/teloxide-core/src/bot/api.rs +++ b/crates/teloxide-core/src/bot/api.rs @@ -860,6 +860,18 @@ impl Requester for Bot { ) } + type GetUserChatBoosts = JsonRequest; + + fn get_user_chat_boosts(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts + where + C: Into, + { + Self::GetUserChatBoosts::new( + self.clone(), + payloads::GetUserChatBoosts::new(chat_id, user_id), + ) + } + type SetMyCommands = JsonRequest; fn set_my_commands(&self, commands: C) -> Self::SetMyCommands diff --git a/crates/teloxide-core/src/local_macros.rs b/crates/teloxide-core/src/local_macros.rs index 242f807b..3fd2bbc7 100644 --- a/crates/teloxide-core/src/local_macros.rs +++ b/crates/teloxide-core/src/local_macros.rs @@ -1053,6 +1053,14 @@ macro_rules! requester_forward { $body!(answer_callback_query this (callback_query_id: C)) } }; + (@method get_user_chat_boosts $body:ident $ty:ident) => { + type GetUserChatBoosts = $ty![GetUserChatBoosts]; + + fn get_user_chat_boosts(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts where C: Into { + let this = self; + $body!(get_user_chat_boosts this (chat_id: C, user_id: UserId)) + } + }; (@method set_my_commands $body:ident $ty:ident) => { type SetMyCommands = $ty![SetMyCommands]; diff --git a/crates/teloxide-core/src/payloads.rs b/crates/teloxide-core/src/payloads.rs index cdcd85f1..47fbac31 100644 --- a/crates/teloxide-core/src/payloads.rs +++ b/crates/teloxide-core/src/payloads.rs @@ -77,6 +77,7 @@ mod get_my_name; mod get_my_short_description; mod get_sticker_set; mod get_updates; +mod get_user_chat_boosts; mod get_user_profile_photos; mod get_webhook_info; mod hide_general_forum_topic; @@ -213,6 +214,7 @@ pub use get_my_name::{GetMyName, GetMyNameSetters}; pub use get_my_short_description::{GetMyShortDescription, GetMyShortDescriptionSetters}; pub use get_sticker_set::{GetStickerSet, GetStickerSetSetters}; pub use get_updates::{GetUpdates, GetUpdatesSetters}; +pub use get_user_chat_boosts::{GetUserChatBoosts, GetUserChatBoostsSetters}; pub use get_user_profile_photos::{GetUserProfilePhotos, GetUserProfilePhotosSetters}; pub use get_webhook_info::{GetWebhookInfo, GetWebhookInfoSetters}; pub use hide_general_forum_topic::{HideGeneralForumTopic, HideGeneralForumTopicSetters}; diff --git a/crates/teloxide-core/src/payloads/get_user_chat_boosts.rs b/crates/teloxide-core/src/payloads/get_user_chat_boosts.rs new file mode 100644 index 00000000..6cbfadc3 --- /dev/null +++ b/crates/teloxide-core/src/payloads/get_user_chat_boosts.rs @@ -0,0 +1,20 @@ +//! Generated by `codegen_payloads`, do not edit by hand. + +use serde::Serialize; + +use crate::types::{Recipient, UserChatBoosts, UserId}; + +impl_payload! { + /// Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a [`UserChatBoosts`] object. + /// + /// [`UserChatBoosts`]: crate::types::UserChatBoosts + #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)] + pub GetUserChatBoosts (GetUserChatBoostsSetters) => UserChatBoosts { + required { + /// Unique identifier for the chat or username of the channel (in the format @channelusername) + pub chat_id: Recipient [into], + /// Unique identifier of the target user + pub user_id: UserId, + } + } +} diff --git a/crates/teloxide-core/src/payloads/setters.rs b/crates/teloxide-core/src/payloads/setters.rs index 279fda1d..06a24b76 100644 --- a/crates/teloxide-core/src/payloads/setters.rs +++ b/crates/teloxide-core/src/payloads/setters.rs @@ -25,13 +25,14 @@ pub use crate::payloads::{ GetGameHighScoresSetters as _, GetMeSetters as _, GetMyCommandsSetters as _, GetMyDefaultAdministratorRightsSetters as _, GetMyDescriptionSetters as _, GetMyNameSetters as _, GetMyShortDescriptionSetters as _, GetStickerSetSetters as _, - GetUpdatesSetters as _, GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _, - HideGeneralForumTopicSetters as _, KickChatMemberSetters as _, LeaveChatSetters as _, - LogOutSetters as _, PinChatMessageSetters as _, PromoteChatMemberSetters as _, - ReopenForumTopicSetters as _, ReopenGeneralForumTopicSetters as _, - RestrictChatMemberSetters as _, RevokeChatInviteLinkSetters as _, SendAnimationSetters as _, - SendAudioSetters as _, SendChatActionSetters as _, SendContactSetters as _, - SendDiceSetters as _, SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _, + GetUpdatesSetters as _, GetUserChatBoostsSetters as _, GetUserProfilePhotosSetters as _, + GetWebhookInfoSetters as _, HideGeneralForumTopicSetters as _, KickChatMemberSetters as _, + LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _, + PromoteChatMemberSetters as _, ReopenForumTopicSetters as _, + ReopenGeneralForumTopicSetters as _, RestrictChatMemberSetters as _, + RevokeChatInviteLinkSetters as _, SendAnimationSetters as _, SendAudioSetters as _, + SendChatActionSetters as _, SendContactSetters as _, SendDiceSetters as _, + SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _, SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _, SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _, SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _, diff --git a/crates/teloxide-core/src/requests/requester.rs b/crates/teloxide-core/src/requests/requester.rs index 2936e8b2..977e2c19 100644 --- a/crates/teloxide-core/src/requests/requester.rs +++ b/crates/teloxide-core/src/requests/requester.rs @@ -817,6 +817,13 @@ pub trait Requester { where C: Into; + type GetUserChatBoosts: Request; + + /// For Telegram documentation see [`GetUserChatBoosts`]. + fn get_user_chat_boosts(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts + where + C: Into; + type SetMyCommands: Request; /// For Telegram documentation see [`SetMyCommands`]. @@ -1363,6 +1370,7 @@ macro_rules! forward_all { unhide_general_forum_topic, unpin_all_general_forum_topic_messages, answer_callback_query, + get_user_chat_boosts, set_my_commands, get_my_commands, set_my_name,