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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
use crate::client::Bot;
use serde::Serialize;
/// Returns the gifts received and owned by a managed business account. Requires the `can_view_gifts_and_stars` business bot right. Returns [`crate::types::OwnedGifts`] on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#getbusinessaccountgifts>
/// # Returns
/// - `crate::types::OwnedGifts`
#[derive(Clone, Debug, Serialize)]
pub struct GetBusinessAccountGifts {
/// Unique identifier of the business connection
pub business_connection_id: Box<str>,
/// Pass `true` to exclude gifts that aren't saved to the account's profile page
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_unsaved: Option<bool>,
/// Pass `true` to exclude gifts that are saved to the account's profile page
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_saved: Option<bool>,
/// Pass `true` to exclude gifts that can be purchased an unlimited number of times
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_unlimited: Option<bool>,
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_limited_upgradable: Option<bool>,
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_limited_non_upgradable: Option<bool>,
/// Pass `true` to exclude unique gifts
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_unique: Option<bool>,
/// Pass `true` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_from_blockchain: Option<bool>,
/// Pass `true` to sort results by gift price instead of send date. Sorting is applied before pagination.
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by_price: Option<bool>,
/// Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<Box<str>>,
/// The maximum number of gifts to be returned; 1-100. Defaults to 100
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<u8>,
}
impl GetBusinessAccountGifts {
/// Creates a new `GetBusinessAccountGifts`.
///
/// # Arguments
/// * `business_connection_id` - Unique identifier of the business connection
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<Box<str>>>(business_connection_id: T0) -> Self {
Self {
business_connection_id: business_connection_id.into(),
exclude_unsaved: None,
exclude_saved: None,
exclude_unlimited: None,
exclude_limited_upgradable: None,
exclude_limited_non_upgradable: None,
exclude_unique: None,
exclude_from_blockchain: None,
sort_by_price: None,
offset: None,
limit: None,
}
}
/// Unique identifier of the business connection
#[must_use]
pub fn business_connection_id<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.business_connection_id = val.into();
self
}
/// Pass `true` to exclude gifts that aren't saved to the account's profile page
#[must_use]
pub fn exclude_unsaved<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_unsaved = Some(val.into());
self
}
/// Pass `true` to exclude gifts that aren't saved to the account's profile page
#[must_use]
pub fn exclude_unsaved_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_unsaved = val.map(Into::into);
self
}
/// Pass `true` to exclude gifts that are saved to the account's profile page
#[must_use]
pub fn exclude_saved<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_saved = Some(val.into());
self
}
/// Pass `true` to exclude gifts that are saved to the account's profile page
#[must_use]
pub fn exclude_saved_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_saved = val.map(Into::into);
self
}
/// Pass `true` to exclude gifts that can be purchased an unlimited number of times
#[must_use]
pub fn exclude_unlimited<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_unlimited = Some(val.into());
self
}
/// Pass `true` to exclude gifts that can be purchased an unlimited number of times
#[must_use]
pub fn exclude_unlimited_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_unlimited = val.map(Into::into);
self
}
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
#[must_use]
pub fn exclude_limited_upgradable<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_limited_upgradable = Some(val.into());
self
}
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
#[must_use]
pub fn exclude_limited_upgradable_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_limited_upgradable = val.map(Into::into);
self
}
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
#[must_use]
pub fn exclude_limited_non_upgradable<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_limited_non_upgradable = Some(val.into());
self
}
/// Pass `true` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
#[must_use]
pub fn exclude_limited_non_upgradable_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_limited_non_upgradable = val.map(Into::into);
self
}
/// Pass `true` to exclude unique gifts
#[must_use]
pub fn exclude_unique<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_unique = Some(val.into());
self
}
/// Pass `true` to exclude unique gifts
#[must_use]
pub fn exclude_unique_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_unique = val.map(Into::into);
self
}
/// Pass `true` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
#[must_use]
pub fn exclude_from_blockchain<T: Into<bool>>(mut self, val: T) -> Self {
self.exclude_from_blockchain = Some(val.into());
self
}
/// Pass `true` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
#[must_use]
pub fn exclude_from_blockchain_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.exclude_from_blockchain = val.map(Into::into);
self
}
/// Pass `true` to sort results by gift price instead of send date. Sorting is applied before pagination.
#[must_use]
pub fn sort_by_price<T: Into<bool>>(mut self, val: T) -> Self {
self.sort_by_price = Some(val.into());
self
}
/// Pass `true` to sort results by gift price instead of send date. Sorting is applied before pagination.
#[must_use]
pub fn sort_by_price_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.sort_by_price = val.map(Into::into);
self
}
/// Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
#[must_use]
pub fn offset<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.offset = Some(val.into());
self
}
/// Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
#[must_use]
pub fn offset_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
self.offset = val.map(Into::into);
self
}
/// The maximum number of gifts to be returned; 1-100. Defaults to 100
#[must_use]
pub fn limit<T: Into<u8>>(mut self, val: T) -> Self {
self.limit = Some(val.into());
self
}
/// The maximum number of gifts to be returned; 1-100. Defaults to 100
#[must_use]
pub fn limit_option<T: Into<u8>>(mut self, val: Option<T>) -> Self {
self.limit = val.map(Into::into);
self
}
}
impl super::TelegramMethod for GetBusinessAccountGifts {
type Method = Self;
type Return = crate::types::OwnedGifts;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("getBusinessAccountGifts", self, None)
}
}