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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
use serde::{Deserialize, Serialize};
use super::message::Message;
// ---------------------------------------------------------------------------
// StarAmount — defined here to avoid circular dependency with the payment
// module; mirrors telegram._payment.stars.staramount.StarAmount.
// ---------------------------------------------------------------------------
/// An amount of Telegram Stars.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct StarAmount {
/// Integer amount of Telegram Stars, rounded to 0 decimal places.
pub amount: i64,
/// The number of 1/1000000000 shares of Telegram Stars by the amount value.
#[serde(skip_serializing_if = "Option::is_none")]
pub nanostar_amount: Option<i64>,
}
// ---------------------------------------------------------------------------
// SuggestedPostPrice
// ---------------------------------------------------------------------------
/// Price of a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostPrice {
/// Currency: `"XTR"` for Telegram Stars or `"TON"` for toncoins.
pub currency: String,
/// Amount in the smallest units of the currency.
pub amount: i64,
}
// ---------------------------------------------------------------------------
// SuggestedPostParameters
// ---------------------------------------------------------------------------
/// Parameters of a post being suggested by the bot.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostParameters {
/// Proposed price; absent if the post is unpaid.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
/// Proposed Unix timestamp send date; absent if any time within 30 days is acceptable.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
}
// ---------------------------------------------------------------------------
// SuggestedPostInfo
// ---------------------------------------------------------------------------
/// Information about a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostInfo {
/// State: `"pending"`, `"approved"`, or `"declined"`.
pub state: String,
/// Proposed price; absent if the post is unpaid.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
/// Proposed Unix timestamp send date.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
}
// ---------------------------------------------------------------------------
// SuggestedPostDeclined
// ---------------------------------------------------------------------------
/// Service message about the rejection of a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostDeclined {
/// Message containing the suggested post.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
/// Comment with which the post was declined.
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
}
// ---------------------------------------------------------------------------
// SuggestedPostPaid
// ---------------------------------------------------------------------------
/// Service message about a successful payment for a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostPaid {
/// Currency: `"XTR"` for Telegram Stars or `"TON"` for toncoins.
pub currency: String,
/// Message containing the suggested post.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
/// Amount received in nanotoncoins; for TON payments only.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// Amount of Telegram Stars received; for XTR payments only.
#[serde(skip_serializing_if = "Option::is_none")]
pub star_amount: Option<StarAmount>,
}
// ---------------------------------------------------------------------------
// SuggestedPostRefunded
// ---------------------------------------------------------------------------
/// Service message about a payment refund for a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostRefunded {
/// Reason for the refund (`"post_deleted"` or `"payment_refunded"`).
pub reason: String,
/// Message containing the suggested post.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
}
// ---------------------------------------------------------------------------
// SuggestedPostApproved
// ---------------------------------------------------------------------------
/// Service message about the approval of a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostApproved {
/// Unix timestamp when the post will be published.
pub send_date: i64,
/// Message containing the suggested post.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
/// Amount paid for the post.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
}
// ---------------------------------------------------------------------------
// SuggestedPostApprovalFailed
// ---------------------------------------------------------------------------
/// Service message about a failed approval of a suggested post.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuggestedPostApprovalFailed {
/// Expected price of the post.
pub price: SuggestedPostPrice,
/// Message containing the suggested post.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
}