diff --git a/crates/teloxide-core/src/serde_multipart/mod.rs b/crates/teloxide-core/src/serde_multipart/mod.rs index bef53433..7827823e 100644 --- a/crates/teloxide-core/src/serde_multipart/mod.rs +++ b/crates/teloxide-core/src/serde_multipart/mod.rs @@ -126,7 +126,7 @@ mod tests { InputMediaAnimation::new(InputFile::read( File::open("../../media/example.gif").await.unwrap(), )) - .thumb(InputFile::read( + .thumbnail(InputFile::read( File::open("../../media/teloxide-core-logo.png").await.unwrap(), )) .duration(17), diff --git a/crates/teloxide-core/src/types/animation.rs b/crates/teloxide-core/src/types/animation.rs index 7ac7b206..4e7b82e3 100644 --- a/crates/teloxide-core/src/types/animation.rs +++ b/crates/teloxide-core/src/types/animation.rs @@ -24,7 +24,7 @@ pub struct Animation { pub duration: Seconds, /// An animation thumbnail as defined by a sender. - pub thumb: Option, + pub thumbnail: Option, /// An original animation filename as defined by a sender. pub file_name: Option, @@ -46,7 +46,7 @@ mod tests { "width":320, "height":320, "duration":59, - "thumb":{ + "thumbnail":{ "file_id":"id", "file_unique_id":"", "width":320, @@ -61,7 +61,7 @@ mod tests { width: 320, height: 320, duration: Seconds::from_seconds(59), - thumb: Some(PhotoSize { + thumbnail: Some(PhotoSize { file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 }, width: 320, height: 320, diff --git a/crates/teloxide-core/src/types/audio.rs b/crates/teloxide-core/src/types/audio.rs index 7032111a..42e63ce1 100644 --- a/crates/teloxide-core/src/types/audio.rs +++ b/crates/teloxide-core/src/types/audio.rs @@ -31,7 +31,7 @@ pub struct Audio { pub mime_type: Option, /// A thumbnail of the album cover to which the music file belongs. - pub thumb: Option, + pub thumbnail: Option, } #[cfg(test)] @@ -48,7 +48,7 @@ mod tests { "title":"Title", "mime_type":"application/zip", "file_size":123456, - "thumb":{ + "thumbnail":{ "file_id":"id", "file_unique_id":"", "width":320, @@ -62,7 +62,7 @@ mod tests { performer: Some("Performer".to_string()), title: Some("Title".to_string()), mime_type: Some("application/zip".parse().unwrap()), - thumb: Some(PhotoSize { + thumbnail: Some(PhotoSize { file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 }, width: 320, height: 320, diff --git a/crates/teloxide-core/src/types/document.rs b/crates/teloxide-core/src/types/document.rs index 4ad439ae..47dee033 100644 --- a/crates/teloxide-core/src/types/document.rs +++ b/crates/teloxide-core/src/types/document.rs @@ -19,7 +19,7 @@ pub struct Document { pub file: FileMeta, /// A document thumbnail as defined by a sender. - pub thumb: Option, + pub thumbnail: Option, /// An original filename as defined by a sender. pub file_name: Option, diff --git a/crates/teloxide-core/src/types/inline_query_result.rs b/crates/teloxide-core/src/types/inline_query_result.rs index 44da6bec..fa39d603 100644 --- a/crates/teloxide-core/src/types/inline_query_result.rs +++ b/crates/teloxide-core/src/types/inline_query_result.rs @@ -426,9 +426,9 @@ mod tests { description: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, }); let expected_json = r#"{"type":"document","id":"id","title":"title","document_url":"http://document_url/","mime_type":"application/pdf"}"#; @@ -456,12 +456,12 @@ mod tests { disable_web_page_preview: Some(true), entities: None, })), - thumb_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()), - thumb_width: Some(1), - thumb_height: Some(1), + thumbnail_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()), + thumbnail_width: Some(1), + thumbnail_height: Some(1), }); - let expected_json = r#"{"type":"document","id":"id","title":"title","caption":"caption","parse_mode":"HTML","document_url":"http://document_url/","mime_type":"application/pdf","description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#; + let expected_json = r#"{"type":"document","id":"id","title":"title","caption":"caption","parse_mode":"HTML","document_url":"http://document_url/","mime_type":"application/pdf","description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -521,7 +521,7 @@ mod tests { gif_width: None, gif_height: None, gif_duration: None, - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: None, caption: None, parse_mode: None, @@ -530,7 +530,7 @@ mod tests { input_message_content: None, }); - let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","thumb_url":"http://thumb_url/"}"#; + let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","thumbnail_url":"http://thumb_url/"}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -545,7 +545,7 @@ mod tests { gif_width: Some(1), gif_height: Some(1), gif_duration: Some(Seconds::from_seconds(1)), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: Some(String::from("title")), caption: Some(String::from("caption")), parse_mode: Some(ParseMode::Html), @@ -559,7 +559,7 @@ mod tests { })), }); - let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","gif_width":1,"gif_height":1,"gif_duration":1,"thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; + let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","gif_width":1,"gif_height":1,"gif_duration":1,"thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -619,7 +619,7 @@ mod tests { mpeg4_width: None, mpeg4_height: None, mpeg4_duration: None, - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: None, caption: None, parse_mode: None, @@ -628,7 +628,7 @@ mod tests { input_message_content: None, }); - let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","thumb_url":"http://thumb_url/"}"#; + let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","thumbnail_url":"http://thumb_url/"}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -643,7 +643,7 @@ mod tests { mpeg4_width: Some(1), mpeg4_height: Some(1), mpeg4_duration: Some(Seconds::from_seconds(1)), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: Some(String::from("title")), caption: Some(String::from("caption")), parse_mode: Some(ParseMode::Html), @@ -657,7 +657,7 @@ mod tests { })), }); - let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","mpeg4_width":1,"mpeg4_height":1,"mpeg4_duration":1,"thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; + let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","mpeg4_width":1,"mpeg4_height":1,"mpeg4_duration":1,"thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -716,7 +716,7 @@ mod tests { let structure = InlineQueryResult::Photo(InlineQueryResultPhoto { id: String::from("id"), photo_url: Url::parse("http://photo_url/").unwrap(), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), photo_width: None, photo_height: None, title: None, @@ -728,7 +728,7 @@ mod tests { input_message_content: None, }); - let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumb_url":"http://thumb_url/"}"#; + let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumbnail_url":"http://thumb_url/"}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -740,7 +740,7 @@ mod tests { let structure = InlineQueryResult::Photo(InlineQueryResultPhoto { id: String::from("id"), photo_url: Url::parse("http://photo_url/").unwrap(), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), photo_width: Some(1), photo_height: Some(1), title: Some(String::from("title")), @@ -757,7 +757,7 @@ mod tests { })), }); - let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumb_url":"http://thumb_url/","photo_width":1,"photo_height":1,"title":"title","description":"description","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; + let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumbnail_url":"http://thumb_url/","photo_width":1,"photo_height":1,"title":"title","description":"description","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -859,7 +859,7 @@ mod tests { id: String::from("id"), video_url: Url::parse("http://video_url/").unwrap(), mime_type: Mime::from_str("video/mp4").unwrap(), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: String::from("title"), caption: None, parse_mode: None, @@ -872,7 +872,7 @@ mod tests { input_message_content: None, }); - let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumb_url":"http://thumb_url/","title":"title"}"#; + let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumbnail_url":"http://thumb_url/","title":"title"}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -885,7 +885,7 @@ mod tests { id: String::from("id"), video_url: Url::parse("http://video_url/").unwrap(), mime_type: Mime::from_str("video/mp4").unwrap(), - thumb_url: Url::parse("http://thumb_url/").unwrap(), + thumbnail_url: Url::parse("http://thumb_url/").unwrap(), title: String::from("title"), caption: Some(String::from("caption")), parse_mode: Some(ParseMode::Html), @@ -907,7 +907,7 @@ mod tests { )), }); - let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","video_width":1,"video_height":1,"video_duration":1,"description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"latitude":1.0,"longitude":1.0}}"#; + let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","video_width":1,"video_height":1,"video_duration":1,"description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"latitude":1.0,"longitude":1.0}}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -1031,9 +1031,9 @@ mod tests { url: None, hide_url: None, description: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, }); let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"}}"#; @@ -1058,12 +1058,12 @@ mod tests { url: Some(Url::parse("http://url/").unwrap()), hide_url: Some(true), description: Some(String::from("description")), - thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), - thumb_width: Some(1), - thumb_height: Some(1), + thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()), + thumbnail_width: Some(1), + thumbnail_height: Some(1), }); - let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"},"reply_markup":{"inline_keyboard":[]},"url":"http://url/","hide_url":true,"description":"description","thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#; + let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"},"reply_markup":{"inline_keyboard":[]},"url":"http://url/","hide_url":true,"description":"description","thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -1080,9 +1080,9 @@ mod tests { vcard: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, }); let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name"}"#; @@ -1107,12 +1107,12 @@ mod tests { parse_mode: None, disable_web_page_preview: None, })), - thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), - thumb_width: Some(1), - thumb_height: Some(1), + thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()), + thumbnail_width: Some(1), + thumbnail_height: Some(1), }); - let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name","last_name":"last_name","vcard":"vcard","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#; + let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name","last_name":"last_name","vcard":"vcard","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -1162,9 +1162,9 @@ mod tests { proximity_alert_radius: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, }); let expected_json = @@ -1193,12 +1193,12 @@ mod tests { parse_mode: None, disable_web_page_preview: None, })), - thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), - thumb_width: Some(1), - thumb_height: Some(1), + thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()), + thumbnail_width: Some(1), + thumbnail_height: Some(1), }); - let expected_json = r#"{"type":"location","id":"id","latitude":1.0,"longitude":1.0,"title":"title","horizontal_accuracy":1.0,"live_period":1,"heading":1,"proximity_alert_radius":1,"reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#; + let expected_json = r#"{"type":"location","id":"id","latitude":1.0,"longitude":1.0,"title":"title","horizontal_accuracy":1.0,"live_period":1,"heading":1,"proximity_alert_radius":1,"reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); @@ -1219,9 +1219,9 @@ mod tests { google_place_type: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, }); let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address"}"#; @@ -1250,12 +1250,12 @@ mod tests { parse_mode: None, disable_web_page_preview: None, })), - thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), - thumb_width: Some(1), - thumb_height: Some(1), + thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()), + thumbnail_width: Some(1), + thumbnail_height: Some(1), }); - let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address","foursquare_id":"foursquare_id","foursquare_type":"foursquare_type","google_place_id":"google_place_id","google_place_type":"google_place_type","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#; + let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address","foursquare_id":"foursquare_id","foursquare_type":"foursquare_type","google_place_id":"google_place_id","google_place_type":"google_place_type","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#; let actual_json = serde_json::to_string(&structure).unwrap(); assert_eq!(expected_json, actual_json); diff --git a/crates/teloxide-core/src/types/inline_query_result_article.rs b/crates/teloxide-core/src/types/inline_query_result_article.rs index 132d8f0d..cae7c116 100644 --- a/crates/teloxide-core/src/types/inline_query_result_article.rs +++ b/crates/teloxide-core/src/types/inline_query_result_article.rs @@ -31,13 +31,13 @@ pub struct InlineQueryResultArticle { pub description: Option, /// Url of the thumbnail for the result. - pub thumb_url: Option, + pub thumbnail_url: Option, /// Thumbnail width. - pub thumb_width: Option, + pub thumbnail_width: Option, /// Thumbnail height. - pub thumb_height: Option, + pub thumbnail_height: Option, } impl InlineQueryResultArticle { @@ -54,9 +54,9 @@ impl InlineQueryResultArticle { url: None, hide_url: None, description: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, } } @@ -109,20 +109,20 @@ impl InlineQueryResultArticle { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = Some(val); + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = Some(val); self } #[must_use] - pub fn thumb_width(mut self, val: u32) -> Self { - self.thumb_width = Some(val); + pub fn thumbnail_width(mut self, val: u32) -> Self { + self.thumbnail_width = Some(val); self } #[must_use] - pub fn thumb_height(mut self, val: u32) -> Self { - self.thumb_height = Some(val); + pub fn thumbnail_height(mut self, val: u32) -> Self { + self.thumbnail_height = Some(val); self } } diff --git a/crates/teloxide-core/src/types/inline_query_result_contact.rs b/crates/teloxide-core/src/types/inline_query_result_contact.rs index ab1516d9..dcb4a7bf 100644 --- a/crates/teloxide-core/src/types/inline_query_result_contact.rs +++ b/crates/teloxide-core/src/types/inline_query_result_contact.rs @@ -39,13 +39,13 @@ pub struct InlineQueryResultContact { pub input_message_content: Option, /// Url of the thumbnail for the result. - pub thumb_url: Option, + pub thumbnail_url: Option, /// Thumbnail width. - pub thumb_width: Option, + pub thumbnail_width: Option, /// Thumbnail height. - pub thumb_height: Option, + pub thumbnail_height: Option, } impl InlineQueryResultContact { @@ -63,9 +63,9 @@ impl InlineQueryResultContact { vcard: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, } } @@ -122,20 +122,20 @@ impl InlineQueryResultContact { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = Some(val); + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = Some(val); self } #[must_use] - pub fn thumb_width(mut self, val: u32) -> Self { - self.thumb_width = Some(val); + pub fn thumbnail_width(mut self, val: u32) -> Self { + self.thumbnail_width = Some(val); self } #[must_use] - pub fn thumb_height(mut self, val: u32) -> Self { - self.thumb_height = Some(val); + pub fn thumbnail_height(mut self, val: u32) -> Self { + self.thumbnail_height = Some(val); self } } diff --git a/crates/teloxide-core/src/types/inline_query_result_document.rs b/crates/teloxide-core/src/types/inline_query_result_document.rs index 7ca1c100..c62b1849 100644 --- a/crates/teloxide-core/src/types/inline_query_result_document.rs +++ b/crates/teloxide-core/src/types/inline_query_result_document.rs @@ -53,13 +53,13 @@ pub struct InlineQueryResultDocument { pub input_message_content: Option, /// URL of the thumbnail (jpeg only) for the file. - pub thumb_url: Option, + pub thumbnail_url: Option, /// Thumbnail width. - pub thumb_width: Option, + pub thumbnail_width: Option, /// Thumbnail height. - pub thumb_height: Option, + pub thumbnail_height: Option, } impl InlineQueryResultDocument { @@ -134,20 +134,20 @@ impl InlineQueryResultDocument { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = Some(val); + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = Some(val); self } #[must_use] - pub fn thumb_width(mut self, val: u32) -> Self { - self.thumb_width = Some(val); + pub fn thumbnail_width(mut self, val: u32) -> Self { + self.thumbnail_width = Some(val); self } #[must_use] - pub fn thumb_height(mut self, val: u32) -> Self { - self.thumb_height = Some(val); + pub fn thumbnail_height(mut self, val: u32) -> Self { + self.thumbnail_height = Some(val); self } } diff --git a/crates/teloxide-core/src/types/inline_query_result_gif.rs b/crates/teloxide-core/src/types/inline_query_result_gif.rs index 02cc7327..a04505a0 100644 --- a/crates/teloxide-core/src/types/inline_query_result_gif.rs +++ b/crates/teloxide-core/src/types/inline_query_result_gif.rs @@ -28,7 +28,7 @@ pub struct InlineQueryResultGif { pub gif_duration: Option, /// URL of the static thumbnail for the result (jpeg or gif). - pub thumb_url: reqwest::Url, + pub thumbnail_url: reqwest::Url, /// Title for the result. pub title: Option, @@ -68,7 +68,7 @@ impl InlineQueryResultGif { gif_width: None, gif_height: None, gif_duration: None, - thumb_url, + thumbnail_url: thumb_url, title: None, caption: None, parse_mode: None, @@ -111,8 +111,8 @@ impl InlineQueryResultGif { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = val; + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = val; self } diff --git a/crates/teloxide-core/src/types/inline_query_result_location.rs b/crates/teloxide-core/src/types/inline_query_result_location.rs index 5838085a..ad82dd86 100644 --- a/crates/teloxide-core/src/types/inline_query_result_location.rs +++ b/crates/teloxide-core/src/types/inline_query_result_location.rs @@ -49,13 +49,13 @@ pub struct InlineQueryResultLocation { pub input_message_content: Option, /// Url of the thumbnail for the result. - pub thumb_url: Option, + pub thumbnail_url: Option, /// Thumbnail width. - pub thumb_width: Option, + pub thumbnail_width: Option, /// Thumbnail height. - pub thumb_height: Option, + pub thumbnail_height: Option, } impl InlineQueryResultLocation { @@ -72,9 +72,9 @@ impl InlineQueryResultLocation { live_period: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, horizontal_accuracy: None, heading: None, proximity_alert_radius: None, @@ -146,20 +146,20 @@ impl InlineQueryResultLocation { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = Some(val); + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = Some(val); self } #[must_use] - pub fn thumb_width(mut self, val: u32) -> Self { - self.thumb_width = Some(val); + pub fn thumbnail_width(mut self, val: u32) -> Self { + self.thumbnail_width = Some(val); self } #[must_use] - pub fn thumb_height(mut self, val: u32) -> Self { - self.thumb_height = Some(val); + pub fn thumbnail_height(mut self, val: u32) -> Self { + self.thumbnail_height = Some(val); self } } diff --git a/crates/teloxide-core/src/types/inline_query_result_mpeg4_gif.rs b/crates/teloxide-core/src/types/inline_query_result_mpeg4_gif.rs index 75dea28a..0235eac5 100644 --- a/crates/teloxide-core/src/types/inline_query_result_mpeg4_gif.rs +++ b/crates/teloxide-core/src/types/inline_query_result_mpeg4_gif.rs @@ -31,7 +31,7 @@ pub struct InlineQueryResultMpeg4Gif { pub mpeg4_duration: Option, /// URL of the static thumbnail (jpeg or gif) for the result. - pub thumb_url: reqwest::Url, + pub thumbnail_url: reqwest::Url, /// Title for the result. pub title: Option, @@ -68,7 +68,7 @@ impl InlineQueryResultMpeg4Gif { Self { id: id.into(), mpeg4_url, - thumb_url, + thumbnail_url: thumb_url, mpeg4_width: None, mpeg4_height: None, mpeg4_duration: None, @@ -114,8 +114,8 @@ impl InlineQueryResultMpeg4Gif { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = val; + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = val; self } diff --git a/crates/teloxide-core/src/types/inline_query_result_photo.rs b/crates/teloxide-core/src/types/inline_query_result_photo.rs index 6e3459c3..e0a1ed0d 100644 --- a/crates/teloxide-core/src/types/inline_query_result_photo.rs +++ b/crates/teloxide-core/src/types/inline_query_result_photo.rs @@ -20,7 +20,7 @@ pub struct InlineQueryResultPhoto { pub photo_url: reqwest::Url, /// URL of the thumbnail for the photo. - pub thumb_url: reqwest::Url, + pub thumbnail_url: reqwest::Url, /// Width of the photo. pub photo_width: Option, @@ -66,7 +66,7 @@ impl InlineQueryResultPhoto { Self { id: id.into(), photo_url, - thumb_url, + thumbnail_url: thumb_url, photo_width: None, photo_height: None, title: None, @@ -94,8 +94,8 @@ impl InlineQueryResultPhoto { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = val; + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = val; self } diff --git a/crates/teloxide-core/src/types/inline_query_result_venue.rs b/crates/teloxide-core/src/types/inline_query_result_venue.rs index 7449f035..111e539c 100644 --- a/crates/teloxide-core/src/types/inline_query_result_venue.rs +++ b/crates/teloxide-core/src/types/inline_query_result_venue.rs @@ -52,13 +52,13 @@ pub struct InlineQueryResultVenue { pub input_message_content: Option, /// Url of the thumbnail for the result. - pub thumb_url: Option, + pub thumbnail_url: Option, /// Thumbnail width. - pub thumb_width: Option, + pub thumbnail_width: Option, /// Thumbnail height. - pub thumb_height: Option, + pub thumbnail_height: Option, } impl InlineQueryResultVenue { @@ -80,9 +80,9 @@ impl InlineQueryResultVenue { google_place_type: None, reply_markup: None, input_message_content: None, - thumb_url: None, - thumb_width: None, - thumb_height: None, + thumbnail_url: None, + thumbnail_width: None, + thumbnail_height: None, } } @@ -167,20 +167,20 @@ impl InlineQueryResultVenue { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = Some(val); + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = Some(val); self } #[must_use] - pub fn thumb_width(mut self, val: u32) -> Self { - self.thumb_width = Some(val); + pub fn thumbnail_width(mut self, val: u32) -> Self { + self.thumbnail_width = Some(val); self } #[must_use] - pub fn thumb_height(mut self, val: u32) -> Self { - self.thumb_height = Some(val); + pub fn thumbnail_height(mut self, val: u32) -> Self { + self.thumbnail_height = Some(val); self } } diff --git a/crates/teloxide-core/src/types/inline_query_result_video.rs b/crates/teloxide-core/src/types/inline_query_result_video.rs index 6dbb4189..130a617f 100644 --- a/crates/teloxide-core/src/types/inline_query_result_video.rs +++ b/crates/teloxide-core/src/types/inline_query_result_video.rs @@ -25,7 +25,7 @@ pub struct InlineQueryResultVideo { pub mime_type: Mime, /// URL of the thumbnail (jpeg only) for the video. - pub thumb_url: reqwest::Url, + pub thumbnail_url: reqwest::Url, /// Title for the result. pub title: String, @@ -87,7 +87,7 @@ impl InlineQueryResultVideo { id: id.into(), video_url, mime_type, - thumb_url, + thumbnail_url: thumb_url, title: title.into(), caption: None, parse_mode: None, @@ -122,8 +122,8 @@ impl InlineQueryResultVideo { } #[must_use] - pub fn thumb_url(mut self, val: reqwest::Url) -> Self { - self.thumb_url = val; + pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self { + self.thumbnail_url = val; self } diff --git a/crates/teloxide-core/src/types/input_media.rs b/crates/teloxide-core/src/types/input_media.rs index aaefba5a..e0228e7d 100644 --- a/crates/teloxide-core/src/types/input_media.rs +++ b/crates/teloxide-core/src/types/input_media.rs @@ -101,7 +101,7 @@ pub struct InputMediaVideo { /// JPEG format and less than 200 kB in size. A thumbnail‘s width and /// height should not exceed 320. Ignored if the file is not uploaded /// using multipart/form-data. - pub thumb: Option, + pub thumbnail: Option, /// Caption of the video to be sent, 0-1024 characters. pub caption: Option, @@ -139,7 +139,7 @@ impl InputMediaVideo { pub const fn new(media: InputFile) -> Self { Self { media, - thumb: None, + thumbnail: None, caption: None, parse_mode: None, caption_entities: None, @@ -156,8 +156,8 @@ impl InputMediaVideo { self } - pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val); + pub fn thumbnail(mut self, val: InputFile) -> Self { + self.thumbnail = Some(val); self } @@ -226,7 +226,7 @@ pub struct InputMediaAnimation { /// JPEG format and less than 200 kB in size. A thumbnail‘s width and /// height should not exceed 320. Ignored if the file is not uploaded /// using multipart/form-data. - pub thumb: Option, + pub thumbnail: Option, /// Caption of the animation to be sent, 0-1024 characters. pub caption: Option, @@ -262,7 +262,7 @@ impl InputMediaAnimation { pub const fn new(media: InputFile) -> Self { Self { media, - thumb: None, + thumbnail: None, caption: None, parse_mode: None, width: None, @@ -278,8 +278,8 @@ impl InputMediaAnimation { self } - pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val); + pub fn thumbnail(mut self, val: InputFile) -> Self { + self.thumbnail = Some(val); self } @@ -342,7 +342,7 @@ pub struct InputMediaAudio { /// JPEG format and less than 200 kB in size. A thumbnail‘s width and /// height should not exceed 320. Ignored if the file is not uploaded /// using multipart/form-data. - pub thumb: Option, + pub thumbnail: Option, /// Caption of the audio to be sent, 0-1024 characters. pub caption: Option, @@ -373,7 +373,7 @@ impl InputMediaAudio { pub const fn new(media: InputFile) -> Self { Self { media, - thumb: None, + thumbnail: None, caption: None, parse_mode: None, performer: None, @@ -388,8 +388,8 @@ impl InputMediaAudio { self } - pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val); + pub fn thumbnail(mut self, val: InputFile) -> Self { + self.thumbnail = Some(val); self } @@ -450,7 +450,7 @@ pub struct InputMediaDocument { /// JPEG format and less than 200 kB in size. A thumbnail‘s width and /// height should not exceed 320. Ignored if the file is not uploaded /// using multipart/form-data. - pub thumb: Option, + pub thumbnail: Option, /// Caption of the document to be sent, 0-1024 characters. pub caption: Option, @@ -477,7 +477,7 @@ impl InputMediaDocument { pub const fn new(media: InputFile) -> Self { Self { media, - thumb: None, + thumbnail: None, caption: None, parse_mode: None, disable_content_type_detection: None, @@ -490,8 +490,8 @@ impl InputMediaDocument { self } - pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val); + pub fn thumbnail(mut self, val: InputFile) -> Self { + self.thumbnail = Some(val); self } @@ -534,30 +534,30 @@ impl InputMedia { pub(crate) fn files(&self) -> impl Iterator { use InputMedia::*; - let (media, thumb) = match self { + let (media, thumbnail) = match self { Photo(InputMediaPhoto { media, .. }) => (media, None), - Document(InputMediaDocument { media, thumb, .. }) - | Audio(InputMediaAudio { media, thumb, .. }) - | Animation(InputMediaAnimation { media, thumb, .. }) - | Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_ref()), + Document(InputMediaDocument { media, thumbnail, .. }) + | Audio(InputMediaAudio { media, thumbnail, .. }) + | Animation(InputMediaAnimation { media, thumbnail, .. }) + | Video(InputMediaVideo { media, thumbnail, .. }) => (media, thumbnail.as_ref()), }; - iter::once(media).chain(thumb) + iter::once(media).chain(thumbnail) } /// Returns an iterator of all files in this input media pub(crate) fn files_mut(&mut self) -> impl Iterator { use InputMedia::*; - let (media, thumb) = match self { + let (media, thumbnail) = match self { Photo(InputMediaPhoto { media, .. }) => (media, None), - Document(InputMediaDocument { media, thumb, .. }) - | Audio(InputMediaAudio { media, thumb, .. }) - | Animation(InputMediaAnimation { media, thumb, .. }) - | Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_mut()), + Document(InputMediaDocument { media, thumbnail, .. }) + | Audio(InputMediaAudio { media, thumbnail, .. }) + | Animation(InputMediaAnimation { media, thumbnail, .. }) + | Video(InputMediaVideo { media, thumbnail, .. }) => (media, thumbnail.as_mut()), }; - iter::once(media).chain(thumb) + iter::once(media).chain(thumbnail) } } @@ -585,7 +585,7 @@ mod tests { let expected_json = r#"{"type":"video","media":"123456"}"#; let video = InputMedia::Video(InputMediaVideo { media: InputFile::file_id("123456"), - thumb: None, + thumbnail: None, caption: None, parse_mode: None, width: None, @@ -605,7 +605,7 @@ mod tests { let expected_json = r#"{"type":"animation","media":"123456"}"#; let video = InputMedia::Animation(InputMediaAnimation { media: InputFile::file_id("123456"), - thumb: None, + thumbnail: None, caption: None, parse_mode: None, width: None, @@ -624,7 +624,7 @@ mod tests { let expected_json = r#"{"type":"audio","media":"123456"}"#; let video = InputMedia::Audio(InputMediaAudio { media: InputFile::file_id("123456"), - thumb: None, + thumbnail: None, caption: None, parse_mode: None, duration: None, @@ -642,7 +642,7 @@ mod tests { let expected_json = r#"{"type":"document","media":"123456"}"#; let video = InputMedia::Document(InputMediaDocument { media: InputFile::file_id("123456"), - thumb: None, + thumbnail: None, caption: None, parse_mode: None, caption_entities: None, diff --git a/crates/teloxide-core/src/types/sticker.rs b/crates/teloxide-core/src/types/sticker.rs index 33c2a0a5..b63b0a15 100644 --- a/crates/teloxide-core/src/types/sticker.rs +++ b/crates/teloxide-core/src/types/sticker.rs @@ -44,7 +44,7 @@ pub struct Sticker { pub format: StickerFormat, /// Sticker thumbnail in the `.webp` or `.jpg` format. - pub thumb: Option, + pub thumbnail: Option, /// Emoji associated with the sticker. pub emoji: Option, @@ -341,7 +341,7 @@ mod tests { "y_shift": 0.5525, "scale": 1.94 }, - "thumb": { + "thumbnail": { "file_id": "AAMCAQADFQABYzA0qlYHijpjMzMwBFKnEVE5XdkAAjIKAAK_jJAE1TRw7D936M8BAAdtAAMpBA", "file_unique_id": "AQADMgoAAr-MkARy", "file_size": 11028, @@ -360,7 +360,7 @@ mod tests { assert_eq!(sticker.mask_position().unwrap().point, MaskPoint::Forehead); assert_eq!(sticker.is_animated(), false); assert_eq!(sticker.is_video(), false); - assert_eq!(sticker.thumb.clone().unwrap().file.size, 11028); + assert_eq!(sticker.thumbnail.clone().unwrap().file.size, 11028); assert_eq!(sticker.file.size, 18290); assert_eq!(sticker.width, 512); assert_eq!(sticker.height, 512); @@ -381,7 +381,7 @@ mod tests { "is_animated": false, "is_video": false, "type": "regular", - "thumb": { + "thumbnail": { "file_id": "AAMCAgADFQABYzBxOJ1GWrttqL7FSRwdAtrq-AkAAtkHAALBGJ4LUUUh5CUew90BAAdtAAMpBA", "file_unique_id": "AQAD2QcAAsEYngty", "file_size": 4558, @@ -400,7 +400,7 @@ mod tests { assert_eq!(sticker.premium_animation(), None); assert_eq!(sticker.is_animated(), false); assert_eq!(sticker.is_video(), false); - assert_eq!(sticker.thumb.clone().unwrap().file.size, 4558); + assert_eq!(sticker.thumbnail.clone().unwrap().file.size, 4558); assert_eq!(sticker.file.size, 25734); assert_eq!(sticker.width, 463); assert_eq!(sticker.height, 512); diff --git a/crates/teloxide-core/src/types/sticker_set.rs b/crates/teloxide-core/src/types/sticker_set.rs index 02bad6a3..5d3c08e7 100644 --- a/crates/teloxide-core/src/types/sticker_set.rs +++ b/crates/teloxide-core/src/types/sticker_set.rs @@ -28,7 +28,7 @@ pub struct StickerSet { pub stickers: Vec, /// Sticker set thumbnail in the `.webp`, `.tgs` or `.webm` format. - pub thumb: Option, + pub thumbnail: Option, } /// This allows calling [`StickerType`]'s methods directly on [`StickerSet`]. @@ -143,7 +143,7 @@ mod tests { assert!(set.is_static()); assert!(set.is_regular()); - assert!(set.thumb.is_none()); + assert!(set.thumbnail.is_none()); assert_eq!(set.stickers.len(), 2); } } diff --git a/crates/teloxide-core/src/types/video.rs b/crates/teloxide-core/src/types/video.rs index f6d12b65..8f0f4cca 100644 --- a/crates/teloxide-core/src/types/video.rs +++ b/crates/teloxide-core/src/types/video.rs @@ -23,7 +23,7 @@ pub struct Video { pub duration: Seconds, /// Video thumbnail. - pub thumb: Option, + pub thumbnail: Option, /// Original filename as defined by sender pub file_name: Option, diff --git a/crates/teloxide-core/src/types/video_note.rs b/crates/teloxide-core/src/types/video_note.rs index 2c14b681..cfdf9022 100644 --- a/crates/teloxide-core/src/types/video_note.rs +++ b/crates/teloxide-core/src/types/video_note.rs @@ -24,5 +24,5 @@ pub struct VideoNote { pub duration: Seconds, /// Video thumbnail. - pub thumb: Option, + pub thumbnail: Option, } diff --git a/crates/teloxide/examples/inline.rs b/crates/teloxide/examples/inline.rs index c2c9cd85..dfca23ef 100644 --- a/crates/teloxide/examples/inline.rs +++ b/crates/teloxide/examples/inline.rs @@ -41,7 +41,7 @@ async fn main() { ))), ) .description("DuckDuckGo Search") - .thumb_url("https://duckduckgo.com/assets/logo_header.v108.png".parse().unwrap()) + .thumbnail_url("https://duckduckgo.com/assets/logo_header.v108.png".parse().unwrap()) .url("https://duckduckgo.com/about".parse().unwrap()); // Note: This is the url that will open if they click the thumbnail let results = vec![