Add getUserChatBoosts TBA method

This commit is contained in:
Andrey Brusnik 2024-07-19 18:22:08 +04:00
parent 48b7c7b24b
commit 467468c546
No known key found for this signature in database
GPG key ID: D33232F28CFF442C
12 changed files with 99 additions and 7 deletions

View file

@ -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( Method(
names: ("setMyCommands", "SetMyCommands", "set_my_commands"), names: ("setMyCommands", "SetMyCommands", "set_my_commands"),
return_ty: True, return_ty: True,

View file

@ -161,6 +161,7 @@ where
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,

View file

@ -260,6 +260,7 @@ where
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,
@ -738,6 +739,12 @@ trait ErasableRequester<'a> {
callback_query_id: String, callback_query_id: String,
) -> ErasedRequest<'a, AnswerCallbackQuery, Self::Err>; ) -> 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( fn set_my_commands(
&self, &self,
commands: Vec<BotCommand>, commands: Vec<BotCommand>,
@ -1580,6 +1587,14 @@ where
Requester::answer_callback_query(self, callback_query_id).erase() 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( fn set_my_commands(
&self, &self,
commands: Vec<BotCommand>, commands: Vec<BotCommand>,

View file

@ -242,6 +242,7 @@ where
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,

View file

@ -144,6 +144,7 @@ where
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,

View file

@ -190,6 +190,7 @@ where
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,

View file

@ -860,6 +860,18 @@ impl Requester for Bot {
) )
} }
type GetUserChatBoosts = JsonRequest<payloads::GetUserChatBoosts>;
fn get_user_chat_boosts<C>(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts
where
C: Into<Recipient>,
{
Self::GetUserChatBoosts::new(
self.clone(),
payloads::GetUserChatBoosts::new(chat_id, user_id),
)
}
type SetMyCommands = JsonRequest<payloads::SetMyCommands>; type SetMyCommands = JsonRequest<payloads::SetMyCommands>;
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands

View file

@ -1053,6 +1053,14 @@ macro_rules! requester_forward {
$body!(answer_callback_query this (callback_query_id: C)) $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<C>(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts where C: Into<Recipient> {
let this = self;
$body!(get_user_chat_boosts this (chat_id: C, user_id: UserId))
}
};
(@method set_my_commands $body:ident $ty:ident) => { (@method set_my_commands $body:ident $ty:ident) => {
type SetMyCommands = $ty![SetMyCommands]; type SetMyCommands = $ty![SetMyCommands];

View file

@ -77,6 +77,7 @@ mod get_my_name;
mod get_my_short_description; mod get_my_short_description;
mod get_sticker_set; mod get_sticker_set;
mod get_updates; mod get_updates;
mod get_user_chat_boosts;
mod get_user_profile_photos; mod get_user_profile_photos;
mod get_webhook_info; mod get_webhook_info;
mod hide_general_forum_topic; 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_my_short_description::{GetMyShortDescription, GetMyShortDescriptionSetters};
pub use get_sticker_set::{GetStickerSet, GetStickerSetSetters}; pub use get_sticker_set::{GetStickerSet, GetStickerSetSetters};
pub use get_updates::{GetUpdates, GetUpdatesSetters}; 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_user_profile_photos::{GetUserProfilePhotos, GetUserProfilePhotosSetters};
pub use get_webhook_info::{GetWebhookInfo, GetWebhookInfoSetters}; pub use get_webhook_info::{GetWebhookInfo, GetWebhookInfoSetters};
pub use hide_general_forum_topic::{HideGeneralForumTopic, HideGeneralForumTopicSetters}; pub use hide_general_forum_topic::{HideGeneralForumTopic, HideGeneralForumTopicSetters};

View file

@ -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,
}
}
}

View file

@ -25,13 +25,14 @@ pub use crate::payloads::{
GetGameHighScoresSetters as _, GetMeSetters as _, GetMyCommandsSetters as _, GetGameHighScoresSetters as _, GetMeSetters as _, GetMyCommandsSetters as _,
GetMyDefaultAdministratorRightsSetters as _, GetMyDescriptionSetters as _, GetMyDefaultAdministratorRightsSetters as _, GetMyDescriptionSetters as _,
GetMyNameSetters as _, GetMyShortDescriptionSetters as _, GetStickerSetSetters as _, GetMyNameSetters as _, GetMyShortDescriptionSetters as _, GetStickerSetSetters as _,
GetUpdatesSetters as _, GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _, GetUpdatesSetters as _, GetUserChatBoostsSetters as _, GetUserProfilePhotosSetters as _,
HideGeneralForumTopicSetters as _, KickChatMemberSetters as _, LeaveChatSetters as _, GetWebhookInfoSetters as _, HideGeneralForumTopicSetters as _, KickChatMemberSetters as _,
LogOutSetters as _, PinChatMessageSetters as _, PromoteChatMemberSetters as _, LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _,
ReopenForumTopicSetters as _, ReopenGeneralForumTopicSetters as _, PromoteChatMemberSetters as _, ReopenForumTopicSetters as _,
RestrictChatMemberSetters as _, RevokeChatInviteLinkSetters as _, SendAnimationSetters as _, ReopenGeneralForumTopicSetters as _, RestrictChatMemberSetters as _,
SendAudioSetters as _, SendChatActionSetters as _, SendContactSetters as _, RevokeChatInviteLinkSetters as _, SendAnimationSetters as _, SendAudioSetters as _,
SendDiceSetters as _, SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _, SendChatActionSetters as _, SendContactSetters as _, SendDiceSetters as _,
SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _,
SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _, SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _,
SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _, SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _,
SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _, SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _,

View file

@ -817,6 +817,13 @@ pub trait Requester {
where where
C: Into<String>; C: Into<String>;
type GetUserChatBoosts: Request<Payload = GetUserChatBoosts, Err = Self::Err>;
/// For Telegram documentation see [`GetUserChatBoosts`].
fn get_user_chat_boosts<C>(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts
where
C: Into<Recipient>;
type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>; type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>;
/// For Telegram documentation see [`SetMyCommands`]. /// For Telegram documentation see [`SetMyCommands`].
@ -1363,6 +1370,7 @@ macro_rules! forward_all {
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
get_user_chat_boosts,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
set_my_name, set_my_name,