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
use crate::client::Bot;
use serde::Serialize;
/// Stores a keyboard button that can be used by a user within a Mini App. Returns a [`crate::types::PreparedKeyboardButton`] object.
/// # Documentation
/// <https://core.telegram.org/bots/api#savepreparedkeyboardbutton>
/// # Returns
/// - `crate::types::PreparedKeyboardButton`
#[derive(Clone, Debug, Serialize)]
pub struct SavePreparedKeyboardButton {
/// Unique identifier of the target user that can use the button
pub user_id: i64,
/// A JSON-serialized object describing the button to be saved. The button must be of the type `request_users`, `request_chat`, or `request_managed_bot`
pub button: crate::types::KeyboardButton,
}
impl SavePreparedKeyboardButton {
/// Creates a new `SavePreparedKeyboardButton`.
///
/// # Arguments
/// * `user_id` - Unique identifier of the target user that can use the button
/// * `button` - A JSON-serialized object describing the button to be saved. The button must be of the type `request_users`, `request_chat`, or `request_managed_bot`
#[must_use]
pub fn new<T0: Into<i64>, T1: Into<crate::types::KeyboardButton>>(
user_id: T0,
button: T1,
) -> Self {
Self {
user_id: user_id.into(),
button: button.into(),
}
}
/// Unique identifier of the target user that can use the button
#[must_use]
pub fn user_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.user_id = val.into();
this
}
/// A JSON-serialized object describing the button to be saved. The button must be of the type `request_users`, `request_chat`, or `request_managed_bot`
#[must_use]
pub fn button<T: Into<crate::types::KeyboardButton>>(self, val: T) -> Self {
let mut this = self;
this.button = val.into();
this
}
}
impl super::TelegramMethod for SavePreparedKeyboardButton {
type Method = Self;
type Return = crate::types::PreparedKeyboardButton;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("savePreparedKeyboardButton", self, None)
}
}