Add setters to Sticker

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 20:00:51 +06:00
parent fd89c138f0
commit f4a87b0d70

View file

@ -43,3 +43,93 @@ pub struct Sticker {
/// File size.
pub file_size: Option<u32>,
}
impl Sticker {
pub fn new<S1, S2>(
file_id: S1,
file_unique_id: S2,
width: u16,
height: u16,
is_animated: bool,
) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
is_animated,
thumb: None,
emoji: None,
set_name: None,
mask_position: None,
file_size: None,
}
}
pub fn file_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.file_id = val.into();
self
}
pub fn file_unique_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.file_unique_id = val.into();
self
}
pub fn height(mut self, val: u16) -> Self {
self.height = val;
self
}
pub fn width(mut self, val: u16) -> Self {
self.width = val;
self
}
#[allow(clippy::wrong_self_convention)]
pub fn is_animated(mut self, val: bool) -> Self {
self.is_animated = val;
self
}
pub fn thumb(mut self, val: PhotoSize) -> Self {
self.thumb = Some(val);
self
}
pub fn emoji<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.emoji = Some(val.into());
self
}
pub fn set_name<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.set_name = Some(val.into());
self
}
pub fn mask_position(mut self, val: MaskPosition) -> Self {
self.mask_position = Some(val);
self
}
pub fn file_size(mut self, val: u32) -> Self {
self.file_size = Some(val);
self
}
}