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
use crate::client::Bot;
use serde::Serialize;
/// Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#setuseremojistatus>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct SetUserEmojiStatus {
/// Unique identifier of the target user
pub user_id: i64,
/// Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
#[serde(skip_serializing_if = "Option::is_none")]
pub emoji_status_custom_emoji_id: Option<Box<str>>,
/// Expiration date of the emoji status, if any
#[serde(skip_serializing_if = "Option::is_none")]
pub emoji_status_expiration_date: Option<i64>,
}
impl SetUserEmojiStatus {
/// Creates a new `SetUserEmojiStatus`.
///
/// # Arguments
/// * `user_id` - Unique identifier of the target user
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<i64>>(user_id: T0) -> Self {
Self {
user_id: user_id.into(),
emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: None,
}
}
/// Unique identifier of the target user
#[must_use]
pub fn user_id<T: Into<i64>>(mut self, val: T) -> Self {
self.user_id = val.into();
self
}
/// Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
#[must_use]
pub fn emoji_status_custom_emoji_id<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.emoji_status_custom_emoji_id = Some(val.into());
self
}
/// Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
#[must_use]
pub fn emoji_status_custom_emoji_id_option<T: Into<Box<str>>>(
mut self,
val: Option<T>,
) -> Self {
self.emoji_status_custom_emoji_id = val.map(Into::into);
self
}
/// Expiration date of the emoji status, if any
#[must_use]
pub fn emoji_status_expiration_date<T: Into<i64>>(mut self, val: T) -> Self {
self.emoji_status_expiration_date = Some(val.into());
self
}
/// Expiration date of the emoji status, if any
#[must_use]
pub fn emoji_status_expiration_date_option<T: Into<i64>>(mut self, val: Option<T>) -> Self {
self.emoji_status_expiration_date = val.map(Into::into);
self
}
}
impl super::TelegramMethod for SetUserEmojiStatus {
type Method = Self;
type Return = bool;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("setUserEmojiStatus", self, None)
}
}