Skip to content

Commit

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

* fix clippy

* non_exhaustive
  • Loading branch information
ayrat555 authored Dec 7, 2024
1 parent cbb2e22 commit e9a799f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2252,10 +2252,22 @@ pub struct RevenueWithdrawalStateSucceeded {
#[derive(Eq)]
pub struct RevenueWithdrawalStateFailed {}

#[apply(apistruct!)]
#[derive(Eq)]
pub struct AffiliateInfo {
pub affiliate_user: Option<User>,
pub affiliate_chat: Option<Chat>,
pub commission_per_mille: u32,
pub amount: u32,
pub nanostar_amount: Option<u32>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(tag = "type", rename_all = "snake_case")]
#[non_exhaustive]
pub enum TransactionPartner {
User(Box<TransactionPartnerUser>),
AffiliateProgram(TransactionPartnerAffiliateProgram),
Fragment(TransactionPartnerFragment),
TelegramAds(TransactionPartnerTelegramAds),
TelegramApi(TransactionPartnerTelegramApi),
Expand All @@ -2265,13 +2277,21 @@ pub enum TransactionPartner {
#[apply(apistruct!)]
pub struct TransactionPartnerUser {
pub user: User,
pub affiliate: Option<AffiliateInfo>,
pub invoice_payload: Option<String>,
pub subscription_period: Option<u32>,
pub paid_media: Option<Vec<PaidMedia>>,
pub paid_media_payload: Option<String>,
pub gift: Option<Gift>,
}

#[apply(apistruct!)]
#[derive(Eq)]
pub struct TransactionPartnerAffiliateProgram {
pub sponsor_user: User,
pub commission_per_mille: u32,
}

#[apply(apistruct!)]
#[derive(Eq)]
pub struct TransactionPartnerFragment {
Expand All @@ -2296,6 +2316,7 @@ pub struct TransactionPartnerOther {}
pub struct StarTransaction {
pub id: String,
pub amount: u32,
pub nanostar_amount: u32,
pub date: u64,
pub source: Option<TransactionPartner>,
pub receiver: Option<TransactionPartner>,
Expand Down

0 comments on commit e9a799f

Please sign in to comment.