diff --git a/src/types/animation.rs b/src/types/animation.rs index ad39e4a3..dc52901c 100644 --- a/src/types/animation.rs +++ b/src/types/animation.rs @@ -40,6 +40,86 @@ pub struct Animation { pub file_size: Option, } +impl Animation { + pub fn new( + file_id: S1, + file_unique_id: S2, + width: u32, + height: u32, + duration: u32, + ) -> Self + where + S1: Into, + S2: Into, + { + Self { + file_id: file_id.into(), + file_unique_id: file_unique_id.into(), + width, + height, + duration, + thumb: None, + file_name: None, + mime_type: None, + file_size: None, + } + } + + pub fn file_id(mut self, val: S) -> Self + where + S: Into, + { + self.file_id = val.into(); + self + } + + pub fn file_unique_id(mut self, val: S) -> Self + where + S: Into, + { + self.file_unique_id = val.into(); + self + } + + pub fn width(mut self, val: u32) -> Self { + self.width = val; + self + } + + pub fn height(mut self, val: u32) -> Self { + self.height = val; + self + } + + pub fn duration(mut self, val: u32) -> Self { + self.duration = val; + self + } + + pub fn thumb(mut self, val: PhotoSize) -> Self { + self.thumb = Some(val); + self + } + + pub fn file_name(mut self, val: S) -> Self + where + S: Into, + { + self.file_name = Some(val.into()); + self + } + + pub fn mime_type(mut self, val: MimeWrapper) -> Self { + self.mime_type = Some(val); + self + } + + pub fn file_size(mut self, val: u32) -> Self { + self.file_size = Some(val); + self + } +} + #[cfg(test)] mod tests { use super::*;