From c775c3c2b79309a4711832580abec5dc10205baf Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Mon, 27 Jul 2020 22:09:35 +0600 Subject: [PATCH] Add setters to InputMediaVideo --- src/types/input_media.rs | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/types/input_media.rs b/src/types/input_media.rs index 6da283ec..dfeacb17 100644 --- a/src/types/input_media.rs +++ b/src/types/input_media.rs @@ -104,6 +104,64 @@ pub struct InputMediaVideo { pub supports_streaming: Option, } +impl InputMediaVideo { + pub fn new(media: InputFile) -> Self { + Self { + media, + thumb: None, + caption: None, + parse_mode: None, + width: None, + height: None, + duration: None, + supports_streaming: None, + } + } + + pub fn media(mut self, val: InputFile) -> Self { + self.media = val; + self + } + + pub fn thumb(mut self, val: InputFile) -> Self { + self.thumb = Some(val); + self + } + + pub fn caption(mut self, val: S) -> Self + where + S: Into, + { + self.caption = Some(val.into()); + self + } + + pub fn parse_mode(mut self, val: ParseMode) -> Self { + self.parse_mode = Some(val); + self + } + + pub fn width(mut self, val: u16) -> Self { + self.width = Some(val); + self + } + + pub fn height(mut self, val: u16) -> Self { + self.height = Some(val); + self + } + + pub fn duration(mut self, val: u16) -> Self { + self.duration = Some(val); + self + } + + pub fn supports_streaming(mut self, val: bool) -> Self { + self.supports_streaming = Some(val); + self + } +} + /// Represents an animation file (GIF or H.264/MPEG-4 AVC video without /// sound) to be sent. ///