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
use crate::client::Bot;
use serde::Serialize;
/// Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#replacestickerinset>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct ReplaceStickerInSet {
/// User identifier of the sticker set owner
pub user_id: i64,
/// Sticker set name
pub name: Box<str>,
/// File identifier of the replaced sticker
pub old_sticker: Box<str>,
/// A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
pub sticker: crate::types::InputSticker,
}
impl ReplaceStickerInSet {
/// Creates a new `ReplaceStickerInSet`.
///
/// # Arguments
/// * `user_id` - User identifier of the sticker set owner
/// * `name` - Sticker set name
/// * `old_sticker` - File identifier of the replaced sticker
/// * `sticker` - A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
#[must_use]
pub fn new<
T0: Into<i64>,
T1: Into<Box<str>>,
T2: Into<Box<str>>,
T3: Into<crate::types::InputSticker>,
>(
user_id: T0,
name: T1,
old_sticker: T2,
sticker: T3,
) -> Self {
Self {
user_id: user_id.into(),
name: name.into(),
old_sticker: old_sticker.into(),
sticker: sticker.into(),
}
}
/// User identifier of the sticker set owner
#[must_use]
pub fn user_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.user_id = val.into();
this
}
/// 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
}
/// File identifier of the replaced sticker
#[must_use]
pub fn old_sticker<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.old_sticker = val.into();
this
}
/// A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
#[must_use]
pub fn sticker<T: Into<crate::types::InputSticker>>(self, val: T) -> Self {
let mut this = self;
this.sticker = val.into();
this
}
}
impl super::TelegramMethod for ReplaceStickerInSet {
type Method = Self;
type Return = bool;
fn build_request<Client>(mut self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
let mut files = vec![];
super::prepare_input_sticker(&mut files, &mut self.sticker);
super::Request::new("replaceStickerInSet", self, Some(files))
}
}