Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot API 7.9 #192

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/api_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,10 @@ pub struct SendVideoNoteParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendPaidMediaParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

pub chat_id: ChatId,

pub star_count: u32,
Expand Down Expand Up @@ -1557,6 +1561,33 @@ pub struct EditChatInviteLinkParams {
pub creates_join_request: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct CreateChatSubscriptionInviteLinkParams {
#[builder(setter(into))]
pub chat_id: ChatId,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub name: Option<String>,

pub subscription_period: u32,

pub subscription_price: u16,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct EditChatSubscriptionInviteLinkParams {
#[builder(setter(into))]
pub chat_id: ChatId,

#[builder(setter(into))]
pub invite_link: String,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub name: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct RevokeChatInviteLinkParams {
#[builder(setter(into))]
Expand Down
18 changes: 18 additions & 0 deletions src/api_traits/async_telegram_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::api_params::CloseGeneralForumTopicParams;
use crate::api_params::CopyMessageParams;
use crate::api_params::CopyMessagesParams;
use crate::api_params::CreateChatInviteLinkParams;
use crate::api_params::CreateChatSubscriptionInviteLinkParams;
use crate::api_params::CreateForumTopicParams;
use crate::api_params::CreateInvoiceLinkParams;
use crate::api_params::CreateNewStickerSetParams;
Expand All @@ -28,6 +29,7 @@ use crate::api_params::DeleteStickerFromSetParams;
use crate::api_params::DeleteStickerSetParams;
use crate::api_params::DeleteWebhookParams;
use crate::api_params::EditChatInviteLinkParams;
use crate::api_params::EditChatSubscriptionInviteLinkParams;
use crate::api_params::EditForumTopicParams;
use crate::api_params::EditGeneralForumTopicParams;
use crate::api_params::EditMessageCaptionParams;
Expand Down Expand Up @@ -621,6 +623,22 @@ pub trait AsyncTelegramApi {
self.request("editChatInviteLink", Some(params)).await
}

async fn create_chat_subscription_invite_link(
&self,
params: &CreateChatSubscriptionInviteLinkParams,
) -> Result<MethodResponse<ChatInviteLink>, Self::Error> {
self.request("createChatSubscriptionInviteLink", Some(params))
.await
}

async fn edit_chat_subscription_invite_link(
&self,
params: &EditChatSubscriptionInviteLinkParams,
) -> Result<MethodResponse<ChatInviteLink>, Self::Error> {
self.request("editChatSubscriptionInviteLink", Some(params))
.await
}

async fn revoke_chat_invite_link(
&self,
params: &RevokeChatInviteLinkParams,
Expand Down
16 changes: 16 additions & 0 deletions src/api_traits/telegram_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::api_params::CloseGeneralForumTopicParams;
use crate::api_params::CopyMessageParams;
use crate::api_params::CopyMessagesParams;
use crate::api_params::CreateChatInviteLinkParams;
use crate::api_params::CreateChatSubscriptionInviteLinkParams;
use crate::api_params::CreateForumTopicParams;
use crate::api_params::CreateInvoiceLinkParams;
use crate::api_params::CreateNewStickerSetParams;
Expand All @@ -28,6 +29,7 @@ use crate::api_params::DeleteStickerFromSetParams;
use crate::api_params::DeleteStickerSetParams;
use crate::api_params::DeleteWebhookParams;
use crate::api_params::EditChatInviteLinkParams;
use crate::api_params::EditChatSubscriptionInviteLinkParams;
use crate::api_params::EditForumTopicParams;
use crate::api_params::EditGeneralForumTopicParams;
use crate::api_params::EditMessageCaptionParams;
Expand Down Expand Up @@ -583,6 +585,20 @@ pub trait TelegramApi {
self.request("editChatInviteLink", Some(params))
}

fn create_chat_subscription_invite_link(
&self,
params: &CreateChatSubscriptionInviteLinkParams,
) -> Result<MethodResponse<ChatInviteLink>, Self::Error> {
self.request("createChatSubscriptionInviteLink", Some(params))
}

fn edit_chat_subscription_invite_link(
&self,
params: &EditChatSubscriptionInviteLinkParams,
) -> Result<MethodResponse<ChatInviteLink>, Self::Error> {
self.request("editChatSubscriptionInviteLink", Some(params))
}

fn revoke_chat_invite_link(
&self,
params: &RevokeChatInviteLinkParams,
Expand Down
12 changes: 12 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ pub struct ChatMemberAdministrator {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct ChatMemberMember {
pub user: User,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub until_date: Option<u64>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
Expand Down Expand Up @@ -2293,6 +2297,7 @@ pub struct ChatLocation {
pub enum ReactionType {
Emoji(ReactionTypeEmoji),
CustomEmoji(ReactionTypeCustomEmoji),
Paid(ReactionTypePaid),
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder, Eq)]
Expand All @@ -2307,6 +2312,9 @@ pub struct ReactionTypeCustomEmoji {
pub custom_emoji_id: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder, Eq)]
pub struct ReactionTypePaid {}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct ReactionCount {
#[builder(setter(into))]
Expand Down Expand Up @@ -4249,6 +4257,10 @@ pub struct TransactionPartnerUser {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub invoice_payload: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub paid_media: Option<Vec<PaidMedia>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
Expand Down