1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
use serde::{Deserialize, Serialize};
use super::chat::Chat;
use super::user::User;
// ---------------------------------------------------------------------------
// ChatBoostAdded
// ---------------------------------------------------------------------------
/// Service message about a user boosting a chat.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostAdded {
/// Number of boosts added by the user.
pub boost_count: i64,
}
// ---------------------------------------------------------------------------
// ChatBoostSource -- tagged union on the "source" field
// ---------------------------------------------------------------------------
/// The boost was obtained by subscribing to Telegram Premium or gifting a subscription.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostSourcePremium {
/// User that boosted the chat.
pub user: User,
}
/// The boost was obtained by the creation of Telegram Premium gift codes to boost a chat.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostSourceGiftCode {
/// User for which the gift code was created.
pub user: User,
}
/// The boost was obtained by the creation of a Telegram Premium giveaway or a Telegram Star.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostSourceGiveaway {
/// Identifier of a message in the chat with the giveaway.
pub giveaway_message_id: i64,
/// User that won the prize in the giveaway; for Telegram Premium giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
/// Number of Telegram Stars split between giveaway winners; for Telegram Star giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
/// True if the giveaway was completed but there was no user to win the prize.
#[serde(skip_serializing_if = "Option::is_none")]
pub is_unclaimed: Option<bool>,
}
/// Source of a chat boost. Discriminated by the `"source"` field.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "source", rename_all = "snake_case")]
#[non_exhaustive]
pub enum ChatBoostSource {
/// The boost was obtained by subscribing to Telegram Premium.
Premium(ChatBoostSourcePremium),
/// The boost was obtained by creating Telegram Premium gift codes.
GiftCode(ChatBoostSourceGiftCode),
/// The boost was obtained through a giveaway.
Giveaway(ChatBoostSourceGiveaway),
}
// ---------------------------------------------------------------------------
// ChatBoost
// ---------------------------------------------------------------------------
/// Contains information about a chat boost.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoost {
/// Unique identifier of the boost.
pub boost_id: String,
/// Unix timestamp when the chat was boosted.
pub add_date: i64,
/// Unix timestamp when the boost will automatically expire.
pub expiration_date: i64,
/// Source of the added boost.
pub source: ChatBoostSource,
}
// ---------------------------------------------------------------------------
// ChatBoostUpdated
// ---------------------------------------------------------------------------
/// A boost added to a chat or changed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostUpdated {
/// Chat which was boosted.
pub chat: Chat,
/// Information about the chat boost.
pub boost: ChatBoost,
}
// ---------------------------------------------------------------------------
// ChatBoostRemoved
// ---------------------------------------------------------------------------
/// A boost removed from a chat.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatBoostRemoved {
/// Chat which was boosted.
pub chat: Chat,
/// Unique identifier of the boost.
pub boost_id: String,
/// Unix timestamp when the boost was removed.
pub remove_date: i64,
/// Source of the removed boost.
pub source: ChatBoostSource,
}
// ---------------------------------------------------------------------------
// UserChatBoosts
// ---------------------------------------------------------------------------
/// A list of boosts added to a chat by a user.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct UserChatBoosts {
/// List of boosts added to the chat by the user.
pub boosts: Vec<ChatBoost>,
}