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
use serde::{Deserialize, Serialize};
/// This object contains information about the users whose identifiers were shared with the bot using a [`crate::types::KeyboardButtonRequestUsers`] button.
/// # Documentation
/// <https://core.telegram.org/bots/api#usersshared>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UsersShared {
/// Identifier of the request
pub request_id: i64,
/// Information about users shared with the bot.
pub users: Box<[crate::types::SharedUser]>,
}
impl UsersShared {
/// Creates a new `UsersShared`.
///
/// # Arguments
/// * `request_id` - Identifier of the request
/// * `users` - Information about users shared with the bot.
#[must_use]
pub fn new<
T0: Into<i64>,
T1Item: Into<crate::types::SharedUser>,
T1: IntoIterator<Item = T1Item>,
>(
request_id: T0,
users: T1,
) -> Self {
Self {
request_id: request_id.into(),
users: users.into_iter().map(Into::into).collect(),
}
}
/// Identifier of the request
#[must_use]
pub fn request_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.request_id = val.into();
this
}
/// Information about users shared with the bot.
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn users<T: Into<Box<[crate::types::SharedUser]>>>(self, val: T) -> Self {
let mut this = self;
this.users = this
.users
.into_vec()
.into_iter()
.chain(val.into())
.collect();
this
}
/// Information about users shared with the bot.
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn user<T: Into<crate::types::SharedUser>>(self, val: T) -> Self {
let mut this = self;
this.users = this
.users
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect();
this
}
}