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 8.1 #239

Merged
merged 3 commits into from
Dec 7, 2024
Merged
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
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")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something like this could be marked as non_exhaustive… on the other hand, its a breaking change on a breaking release, so it might be more helpful to get the actual change for people to adapt to the new case rather to not notice the new case on the (breaking) update

#[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
Loading