Skip to content

Commit

Permalink
Bot API 7.9 (#192)
Browse files Browse the repository at this point in the history
* Bot API 7.9

* fix
  • Loading branch information
ayrat555 authored Aug 18, 2024
1 parent 72ffbdd commit 9a07eb8
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
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

0 comments on commit 9a07eb8

Please sign in to comment.