teloxide_core/types/
inline_query_result_mpeg4_gif.rs1use serde::{Deserialize, Serialize};
2
3use crate::types::{InlineKeyboardMarkup, InputMessageContent, MessageEntity, ParseMode, Seconds};
4
5#[serde_with::skip_serializing_none]
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct InlineQueryResultMpeg4Gif {
16 pub id: String,
18
19 pub mpeg4_url: reqwest::Url,
23
24 pub mpeg4_width: Option<u32>,
26
27 pub mpeg4_height: Option<u32>,
29
30 pub mpeg4_duration: Option<Seconds>,
32
33 pub thumbnail_url: reqwest::Url,
36
37 pub thumbnail_mime_type: Option<String>,
41
42 pub title: Option<String>,
44
45 pub caption: Option<String>,
47
48 pub parse_mode: Option<ParseMode>,
55
56 pub caption_entities: Option<Vec<MessageEntity>>,
59
60 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
62 pub show_caption_above_media: bool,
63
64 pub reply_markup: Option<InlineKeyboardMarkup>,
68
69 pub input_message_content: Option<InputMessageContent>,
71}
72
73impl InlineQueryResultMpeg4Gif {
74 pub fn new<S>(id: S, mpeg4_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
75 where
76 S: Into<String>,
77 {
78 Self {
79 id: id.into(),
80 mpeg4_url,
81 thumbnail_url,
82 thumbnail_mime_type: None,
83 mpeg4_width: None,
84 mpeg4_height: None,
85 mpeg4_duration: None,
86 title: None,
87 caption: None,
88 parse_mode: None,
89 caption_entities: None,
90 show_caption_above_media: false,
91 reply_markup: None,
92 input_message_content: None,
93 }
94 }
95
96 pub fn id<S>(mut self, val: S) -> Self
97 where
98 S: Into<String>,
99 {
100 self.id = val.into();
101 self
102 }
103
104 #[must_use]
105 pub fn mpeg4_url(mut self, val: reqwest::Url) -> Self {
106 self.mpeg4_url = val;
107 self
108 }
109
110 #[must_use]
111 pub fn mpeg4_width(mut self, val: u32) -> Self {
112 self.mpeg4_width = Some(val);
113 self
114 }
115
116 #[must_use]
117 pub fn mpeg4_height(mut self, val: u32) -> Self {
118 self.mpeg4_height = Some(val);
119 self
120 }
121
122 #[must_use]
123 pub fn mpeg4_duration(mut self, val: Seconds) -> Self {
124 self.mpeg4_duration = Some(val);
125 self
126 }
127
128 #[must_use]
129 pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
130 self.thumbnail_url = val;
131 self
132 }
133
134 pub fn title<S>(mut self, val: S) -> Self
135 where
136 S: Into<String>,
137 {
138 self.title = Some(val.into());
139 self
140 }
141
142 pub fn caption<S>(mut self, val: S) -> Self
143 where
144 S: Into<String>,
145 {
146 self.caption = Some(val.into());
147 self
148 }
149
150 #[must_use]
151 pub fn parse_mode(mut self, val: ParseMode) -> Self {
152 self.parse_mode = Some(val);
153 self
154 }
155
156 pub fn caption_entities<C>(mut self, val: C) -> Self
157 where
158 C: IntoIterator<Item = MessageEntity>,
159 {
160 self.caption_entities = Some(val.into_iter().collect());
161 self
162 }
163
164 pub fn show_caption_above_media(mut self, val: bool) -> Self {
165 self.show_caption_above_media = val;
166 self
167 }
168
169 #[must_use]
170 pub fn reply_markup(mut self, val: InlineKeyboardMarkup) -> Self {
171 self.reply_markup = Some(val);
172 self
173 }
174
175 #[must_use]
176 pub fn input_message_content(mut self, val: InputMessageContent) -> Self {
177 self.input_message_content = Some(val);
178 self
179 }
180}