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
use serde::{Deserialize, Serialize};
/// This object represents a sticker set.
/// # Documentation
/// <https://core.telegram.org/bots/api#stickerset>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StickerSet {
/// Sticker set name
pub name: Box<str>,
/// Sticker set title
pub title: Box<str>,
/// Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
pub sticker_type: Box<str>,
/// List of all set stickers
pub stickers: Box<[crate::types::Sticker]>,
/// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<crate::types::PhotoSize>,
}
impl StickerSet {
/// Creates a new `StickerSet`.
///
/// # Arguments
/// * `name` - Sticker set name
/// * `title` - Sticker set title
/// * `sticker_type` - Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
/// * `stickers` - List of all set stickers
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<
T0: Into<Box<str>>,
T1: Into<Box<str>>,
T2: Into<Box<str>>,
T3Item: Into<crate::types::Sticker>,
T3: IntoIterator<Item = T3Item>,
>(
name: T0,
title: T1,
sticker_type: T2,
stickers: T3,
) -> Self {
Self {
name: name.into(),
title: title.into(),
sticker_type: sticker_type.into(),
stickers: stickers.into_iter().map(Into::into).collect(),
thumbnail: None,
}
}
/// Sticker set name
#[must_use]
pub fn name<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.name = val.into();
this
}
/// Sticker set title
#[must_use]
pub fn title<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.title = val.into();
this
}
/// Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
#[must_use]
pub fn sticker_type<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.sticker_type = val.into();
this
}
/// List of all set stickers
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn stickers<T: Into<Box<[crate::types::Sticker]>>>(self, val: T) -> Self {
let mut this = self;
this.stickers = this
.stickers
.into_vec()
.into_iter()
.chain(val.into())
.collect();
this
}
/// List of all set stickers
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn sticker<T: Into<crate::types::Sticker>>(self, val: T) -> Self {
let mut this = self;
this.stickers = this
.stickers
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect();
this
}
/// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
#[must_use]
pub fn thumbnail<T: Into<crate::types::PhotoSize>>(self, val: T) -> Self {
let mut this = self;
this.thumbnail = Some(val.into());
this
}
/// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
#[must_use]
pub fn thumbnail_option<T: Into<crate::types::PhotoSize>>(self, val: Option<T>) -> Self {
let mut this = self;
this.thumbnail = val.map(Into::into);
this
}
}