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 serde::{Deserialize, Serialize};
/// Contains a list of Telegram Star transactions.
/// # Documentation
/// <https://core.telegram.org/bots/api#startransactions>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StarTransactions {
/// The list of transactions
pub transactions: Box<[crate::types::StarTransaction]>,
}
impl StarTransactions {
/// Creates a new `StarTransactions`.
///
/// # Arguments
/// * `transactions` - The list of transactions
#[must_use]
pub fn new<T0Item: Into<crate::types::StarTransaction>, T0: IntoIterator<Item = T0Item>>(
transactions: T0,
) -> Self {
Self {
transactions: transactions.into_iter().map(Into::into).collect(),
}
}
/// The list of transactions
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn transactions<T: Into<Box<[crate::types::StarTransaction]>>>(self, val: T) -> Self {
let mut this = self;
this.transactions = this
.transactions
.into_vec()
.into_iter()
.chain(val.into())
.collect();
this
}
/// The list of transactions
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn transaction<T: Into<crate::types::StarTransaction>>(self, val: T) -> Self {
let mut this = self;
this.transactions = this
.transactions
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect();
this
}
}