Rename "thumb" to "thumbnail" in types

This commit is contained in:
Сырцев Вадим Игоревич 2024-04-04 20:19:25 +03:00
parent 331a1e006a
commit c1ec37eb0a
20 changed files with 174 additions and 174 deletions

View file

@ -126,7 +126,7 @@ mod tests {
InputMediaAnimation::new(InputFile::read( InputMediaAnimation::new(InputFile::read(
File::open("../../media/example.gif").await.unwrap(), File::open("../../media/example.gif").await.unwrap(),
)) ))
.thumb(InputFile::read( .thumbnail(InputFile::read(
File::open("../../media/teloxide-core-logo.png").await.unwrap(), File::open("../../media/teloxide-core-logo.png").await.unwrap(),
)) ))
.duration(17), .duration(17),

View file

@ -24,7 +24,7 @@ pub struct Animation {
pub duration: Seconds, pub duration: Seconds,
/// An animation thumbnail as defined by a sender. /// An animation thumbnail as defined by a sender.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
/// An original animation filename as defined by a sender. /// An original animation filename as defined by a sender.
pub file_name: Option<String>, pub file_name: Option<String>,
@ -46,7 +46,7 @@ mod tests {
"width":320, "width":320,
"height":320, "height":320,
"duration":59, "duration":59,
"thumb":{ "thumbnail":{
"file_id":"id", "file_id":"id",
"file_unique_id":"", "file_unique_id":"",
"width":320, "width":320,
@ -61,7 +61,7 @@ mod tests {
width: 320, width: 320,
height: 320, height: 320,
duration: Seconds::from_seconds(59), duration: Seconds::from_seconds(59),
thumb: Some(PhotoSize { thumbnail: Some(PhotoSize {
file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 }, file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 },
width: 320, width: 320,
height: 320, height: 320,

View file

@ -31,7 +31,7 @@ pub struct Audio {
pub mime_type: Option<Mime>, pub mime_type: Option<Mime>,
/// A thumbnail of the album cover to which the music file belongs. /// A thumbnail of the album cover to which the music file belongs.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
} }
#[cfg(test)] #[cfg(test)]
@ -48,7 +48,7 @@ mod tests {
"title":"Title", "title":"Title",
"mime_type":"application/zip", "mime_type":"application/zip",
"file_size":123456, "file_size":123456,
"thumb":{ "thumbnail":{
"file_id":"id", "file_id":"id",
"file_unique_id":"", "file_unique_id":"",
"width":320, "width":320,
@ -62,7 +62,7 @@ mod tests {
performer: Some("Performer".to_string()), performer: Some("Performer".to_string()),
title: Some("Title".to_string()), title: Some("Title".to_string()),
mime_type: Some("application/zip".parse().unwrap()), 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 }, file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 },
width: 320, width: 320,
height: 320, height: 320,

View file

@ -19,7 +19,7 @@ pub struct Document {
pub file: FileMeta, pub file: FileMeta,
/// A document thumbnail as defined by a sender. /// A document thumbnail as defined by a sender.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
/// An original filename as defined by a sender. /// An original filename as defined by a sender.
pub file_name: Option<String>, pub file_name: Option<String>,

View file

@ -426,9 +426,9 @@ mod tests {
description: None, description: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
}); });
let expected_json = r#"{"type":"document","id":"id","title":"title","document_url":"http://document_url/","mime_type":"application/pdf"}"#; 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), disable_web_page_preview: Some(true),
entities: None, entities: None,
})), })),
thumb_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()), thumbnail_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()),
thumb_width: Some(1), thumbnail_width: Some(1),
thumb_height: 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -521,7 +521,7 @@ mod tests {
gif_width: None, gif_width: None,
gif_height: None, gif_height: None,
gif_duration: None, gif_duration: None,
thumb_url: Url::parse("http://thumb_url/").unwrap(), thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
title: None, title: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
@ -530,7 +530,7 @@ mod tests {
input_message_content: None, 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -545,7 +545,7 @@ mod tests {
gif_width: Some(1), gif_width: Some(1),
gif_height: Some(1), gif_height: Some(1),
gif_duration: Some(Seconds::from_seconds(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")), title: Some(String::from("title")),
caption: Some(String::from("caption")), caption: Some(String::from("caption")),
parse_mode: Some(ParseMode::Html), 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -619,7 +619,7 @@ mod tests {
mpeg4_width: None, mpeg4_width: None,
mpeg4_height: None, mpeg4_height: None,
mpeg4_duration: None, mpeg4_duration: None,
thumb_url: Url::parse("http://thumb_url/").unwrap(), thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
title: None, title: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
@ -628,7 +628,7 @@ mod tests {
input_message_content: None, 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -643,7 +643,7 @@ mod tests {
mpeg4_width: Some(1), mpeg4_width: Some(1),
mpeg4_height: Some(1), mpeg4_height: Some(1),
mpeg4_duration: Some(Seconds::from_seconds(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")), title: Some(String::from("title")),
caption: Some(String::from("caption")), caption: Some(String::from("caption")),
parse_mode: Some(ParseMode::Html), 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -716,7 +716,7 @@ mod tests {
let structure = InlineQueryResult::Photo(InlineQueryResultPhoto { let structure = InlineQueryResult::Photo(InlineQueryResultPhoto {
id: String::from("id"), id: String::from("id"),
photo_url: Url::parse("http://photo_url/").unwrap(), 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_width: None,
photo_height: None, photo_height: None,
title: None, title: None,
@ -728,7 +728,7 @@ mod tests {
input_message_content: None, 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -740,7 +740,7 @@ mod tests {
let structure = InlineQueryResult::Photo(InlineQueryResultPhoto { let structure = InlineQueryResult::Photo(InlineQueryResultPhoto {
id: String::from("id"), id: String::from("id"),
photo_url: Url::parse("http://photo_url/").unwrap(), 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_width: Some(1),
photo_height: Some(1), photo_height: Some(1),
title: Some(String::from("title")), 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -859,7 +859,7 @@ mod tests {
id: String::from("id"), id: String::from("id"),
video_url: Url::parse("http://video_url/").unwrap(), video_url: Url::parse("http://video_url/").unwrap(),
mime_type: Mime::from_str("video/mp4").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"), title: String::from("title"),
caption: None, caption: None,
parse_mode: None, parse_mode: None,
@ -872,7 +872,7 @@ mod tests {
input_message_content: None, 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -885,7 +885,7 @@ mod tests {
id: String::from("id"), id: String::from("id"),
video_url: Url::parse("http://video_url/").unwrap(), video_url: Url::parse("http://video_url/").unwrap(),
mime_type: Mime::from_str("video/mp4").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"), title: String::from("title"),
caption: Some(String::from("caption")), caption: Some(String::from("caption")),
parse_mode: Some(ParseMode::Html), 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -1031,9 +1031,9 @@ mod tests {
url: None, url: None,
hide_url: None, hide_url: None,
description: None, description: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
}); });
let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"}}"#; 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()), url: Some(Url::parse("http://url/").unwrap()),
hide_url: Some(true), hide_url: Some(true),
description: Some(String::from("description")), description: Some(String::from("description")),
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
thumb_width: Some(1), thumbnail_width: Some(1),
thumb_height: 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -1080,9 +1080,9 @@ mod tests {
vcard: None, vcard: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
}); });
let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name"}"#; 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, parse_mode: None,
disable_web_page_preview: None, disable_web_page_preview: None,
})), })),
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
thumb_width: Some(1), thumbnail_width: Some(1),
thumb_height: 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -1162,9 +1162,9 @@ mod tests {
proximity_alert_radius: None, proximity_alert_radius: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
}); });
let expected_json = let expected_json =
@ -1193,12 +1193,12 @@ mod tests {
parse_mode: None, parse_mode: None,
disable_web_page_preview: None, disable_web_page_preview: None,
})), })),
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
thumb_width: Some(1), thumbnail_width: Some(1),
thumb_height: 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);
@ -1219,9 +1219,9 @@ mod tests {
google_place_type: None, google_place_type: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
}); });
let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address"}"#; 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, parse_mode: None,
disable_web_page_preview: None, disable_web_page_preview: None,
})), })),
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()), thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
thumb_width: Some(1), thumbnail_width: Some(1),
thumb_height: 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(); let actual_json = serde_json::to_string(&structure).unwrap();
assert_eq!(expected_json, actual_json); assert_eq!(expected_json, actual_json);

View file

@ -31,13 +31,13 @@ pub struct InlineQueryResultArticle {
pub description: Option<String>, pub description: Option<String>,
/// Url of the thumbnail for the result. /// Url of the thumbnail for the result.
pub thumb_url: Option<reqwest::Url>, pub thumbnail_url: Option<reqwest::Url>,
/// Thumbnail width. /// Thumbnail width.
pub thumb_width: Option<u32>, pub thumbnail_width: Option<u32>,
/// Thumbnail height. /// Thumbnail height.
pub thumb_height: Option<u32>, pub thumbnail_height: Option<u32>,
} }
impl InlineQueryResultArticle { impl InlineQueryResultArticle {
@ -54,9 +54,9 @@ impl InlineQueryResultArticle {
url: None, url: None,
hide_url: None, hide_url: None,
description: None, description: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
} }
} }
@ -109,20 +109,20 @@ impl InlineQueryResultArticle {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = Some(val); self.thumbnail_url = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_width(mut self, val: u32) -> Self { pub fn thumbnail_width(mut self, val: u32) -> Self {
self.thumb_width = Some(val); self.thumbnail_width = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_height(mut self, val: u32) -> Self { pub fn thumbnail_height(mut self, val: u32) -> Self {
self.thumb_height = Some(val); self.thumbnail_height = Some(val);
self self
} }
} }

View file

@ -39,13 +39,13 @@ pub struct InlineQueryResultContact {
pub input_message_content: Option<InputMessageContent>, pub input_message_content: Option<InputMessageContent>,
/// Url of the thumbnail for the result. /// Url of the thumbnail for the result.
pub thumb_url: Option<reqwest::Url>, pub thumbnail_url: Option<reqwest::Url>,
/// Thumbnail width. /// Thumbnail width.
pub thumb_width: Option<u32>, pub thumbnail_width: Option<u32>,
/// Thumbnail height. /// Thumbnail height.
pub thumb_height: Option<u32>, pub thumbnail_height: Option<u32>,
} }
impl InlineQueryResultContact { impl InlineQueryResultContact {
@ -63,9 +63,9 @@ impl InlineQueryResultContact {
vcard: None, vcard: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
} }
} }
@ -122,20 +122,20 @@ impl InlineQueryResultContact {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = Some(val); self.thumbnail_url = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_width(mut self, val: u32) -> Self { pub fn thumbnail_width(mut self, val: u32) -> Self {
self.thumb_width = Some(val); self.thumbnail_width = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_height(mut self, val: u32) -> Self { pub fn thumbnail_height(mut self, val: u32) -> Self {
self.thumb_height = Some(val); self.thumbnail_height = Some(val);
self self
} }
} }

View file

@ -53,13 +53,13 @@ pub struct InlineQueryResultDocument {
pub input_message_content: Option<InputMessageContent>, pub input_message_content: Option<InputMessageContent>,
/// URL of the thumbnail (jpeg only) for the file. /// URL of the thumbnail (jpeg only) for the file.
pub thumb_url: Option<reqwest::Url>, pub thumbnail_url: Option<reqwest::Url>,
/// Thumbnail width. /// Thumbnail width.
pub thumb_width: Option<u32>, pub thumbnail_width: Option<u32>,
/// Thumbnail height. /// Thumbnail height.
pub thumb_height: Option<u32>, pub thumbnail_height: Option<u32>,
} }
impl InlineQueryResultDocument { impl InlineQueryResultDocument {
@ -134,20 +134,20 @@ impl InlineQueryResultDocument {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = Some(val); self.thumbnail_url = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_width(mut self, val: u32) -> Self { pub fn thumbnail_width(mut self, val: u32) -> Self {
self.thumb_width = Some(val); self.thumbnail_width = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_height(mut self, val: u32) -> Self { pub fn thumbnail_height(mut self, val: u32) -> Self {
self.thumb_height = Some(val); self.thumbnail_height = Some(val);
self self
} }
} }

View file

@ -28,7 +28,7 @@ pub struct InlineQueryResultGif {
pub gif_duration: Option<Seconds>, pub gif_duration: Option<Seconds>,
/// URL of the static thumbnail for the result (jpeg or gif). /// 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. /// Title for the result.
pub title: Option<String>, pub title: Option<String>,
@ -68,7 +68,7 @@ impl InlineQueryResultGif {
gif_width: None, gif_width: None,
gif_height: None, gif_height: None,
gif_duration: None, gif_duration: None,
thumb_url, thumbnail_url: thumb_url,
title: None, title: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
@ -111,8 +111,8 @@ impl InlineQueryResultGif {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = val; self.thumbnail_url = val;
self self
} }

View file

@ -49,13 +49,13 @@ pub struct InlineQueryResultLocation {
pub input_message_content: Option<InputMessageContent>, pub input_message_content: Option<InputMessageContent>,
/// Url of the thumbnail for the result. /// Url of the thumbnail for the result.
pub thumb_url: Option<reqwest::Url>, pub thumbnail_url: Option<reqwest::Url>,
/// Thumbnail width. /// Thumbnail width.
pub thumb_width: Option<u32>, pub thumbnail_width: Option<u32>,
/// Thumbnail height. /// Thumbnail height.
pub thumb_height: Option<u32>, pub thumbnail_height: Option<u32>,
} }
impl InlineQueryResultLocation { impl InlineQueryResultLocation {
@ -72,9 +72,9 @@ impl InlineQueryResultLocation {
live_period: None, live_period: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
horizontal_accuracy: None, horizontal_accuracy: None,
heading: None, heading: None,
proximity_alert_radius: None, proximity_alert_radius: None,
@ -146,20 +146,20 @@ impl InlineQueryResultLocation {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = Some(val); self.thumbnail_url = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_width(mut self, val: u32) -> Self { pub fn thumbnail_width(mut self, val: u32) -> Self {
self.thumb_width = Some(val); self.thumbnail_width = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_height(mut self, val: u32) -> Self { pub fn thumbnail_height(mut self, val: u32) -> Self {
self.thumb_height = Some(val); self.thumbnail_height = Some(val);
self self
} }
} }

View file

@ -31,7 +31,7 @@ pub struct InlineQueryResultMpeg4Gif {
pub mpeg4_duration: Option<Seconds>, pub mpeg4_duration: Option<Seconds>,
/// URL of the static thumbnail (jpeg or gif) for the result. /// 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. /// Title for the result.
pub title: Option<String>, pub title: Option<String>,
@ -68,7 +68,7 @@ impl InlineQueryResultMpeg4Gif {
Self { Self {
id: id.into(), id: id.into(),
mpeg4_url, mpeg4_url,
thumb_url, thumbnail_url: thumb_url,
mpeg4_width: None, mpeg4_width: None,
mpeg4_height: None, mpeg4_height: None,
mpeg4_duration: None, mpeg4_duration: None,
@ -114,8 +114,8 @@ impl InlineQueryResultMpeg4Gif {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = val; self.thumbnail_url = val;
self self
} }

View file

@ -20,7 +20,7 @@ pub struct InlineQueryResultPhoto {
pub photo_url: reqwest::Url, pub photo_url: reqwest::Url,
/// URL of the thumbnail for the photo. /// URL of the thumbnail for the photo.
pub thumb_url: reqwest::Url, pub thumbnail_url: reqwest::Url,
/// Width of the photo. /// Width of the photo.
pub photo_width: Option<u32>, pub photo_width: Option<u32>,
@ -66,7 +66,7 @@ impl InlineQueryResultPhoto {
Self { Self {
id: id.into(), id: id.into(),
photo_url, photo_url,
thumb_url, thumbnail_url: thumb_url,
photo_width: None, photo_width: None,
photo_height: None, photo_height: None,
title: None, title: None,
@ -94,8 +94,8 @@ impl InlineQueryResultPhoto {
} }
#[must_use] #[must_use]
pub fn thumb_url<S>(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url<S>(mut self, val: reqwest::Url) -> Self {
self.thumb_url = val; self.thumbnail_url = val;
self self
} }

View file

@ -52,13 +52,13 @@ pub struct InlineQueryResultVenue {
pub input_message_content: Option<InputMessageContent>, pub input_message_content: Option<InputMessageContent>,
/// Url of the thumbnail for the result. /// Url of the thumbnail for the result.
pub thumb_url: Option<reqwest::Url>, pub thumbnail_url: Option<reqwest::Url>,
/// Thumbnail width. /// Thumbnail width.
pub thumb_width: Option<u32>, pub thumbnail_width: Option<u32>,
/// Thumbnail height. /// Thumbnail height.
pub thumb_height: Option<u32>, pub thumbnail_height: Option<u32>,
} }
impl InlineQueryResultVenue { impl InlineQueryResultVenue {
@ -80,9 +80,9 @@ impl InlineQueryResultVenue {
google_place_type: None, google_place_type: None,
reply_markup: None, reply_markup: None,
input_message_content: None, input_message_content: None,
thumb_url: None, thumbnail_url: None,
thumb_width: None, thumbnail_width: None,
thumb_height: None, thumbnail_height: None,
} }
} }
@ -167,20 +167,20 @@ impl InlineQueryResultVenue {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = Some(val); self.thumbnail_url = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_width(mut self, val: u32) -> Self { pub fn thumbnail_width(mut self, val: u32) -> Self {
self.thumb_width = Some(val); self.thumbnail_width = Some(val);
self self
} }
#[must_use] #[must_use]
pub fn thumb_height(mut self, val: u32) -> Self { pub fn thumbnail_height(mut self, val: u32) -> Self {
self.thumb_height = Some(val); self.thumbnail_height = Some(val);
self self
} }
} }

View file

@ -25,7 +25,7 @@ pub struct InlineQueryResultVideo {
pub mime_type: Mime, pub mime_type: Mime,
/// URL of the thumbnail (jpeg only) for the video. /// URL of the thumbnail (jpeg only) for the video.
pub thumb_url: reqwest::Url, pub thumbnail_url: reqwest::Url,
/// Title for the result. /// Title for the result.
pub title: String, pub title: String,
@ -87,7 +87,7 @@ impl InlineQueryResultVideo {
id: id.into(), id: id.into(),
video_url, video_url,
mime_type, mime_type,
thumb_url, thumbnail_url: thumb_url,
title: title.into(), title: title.into(),
caption: None, caption: None,
parse_mode: None, parse_mode: None,
@ -122,8 +122,8 @@ impl InlineQueryResultVideo {
} }
#[must_use] #[must_use]
pub fn thumb_url(mut self, val: reqwest::Url) -> Self { pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
self.thumb_url = val; self.thumbnail_url = val;
self self
} }

View file

@ -101,7 +101,7 @@ pub struct InputMediaVideo {
/// JPEG format and less than 200 kB in size. A thumbnails width and /// JPEG format and less than 200 kB in size. A thumbnails width and
/// height should not exceed 320. Ignored if the file is not uploaded /// height should not exceed 320. Ignored if the file is not uploaded
/// using multipart/form-data. /// using multipart/form-data.
pub thumb: Option<InputFile>, pub thumbnail: Option<InputFile>,
/// Caption of the video to be sent, 0-1024 characters. /// Caption of the video to be sent, 0-1024 characters.
pub caption: Option<String>, pub caption: Option<String>,
@ -139,7 +139,7 @@ impl InputMediaVideo {
pub const fn new(media: InputFile) -> Self { pub const fn new(media: InputFile) -> Self {
Self { Self {
media, media,
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
caption_entities: None, caption_entities: None,
@ -156,8 +156,8 @@ impl InputMediaVideo {
self self
} }
pub fn thumb(mut self, val: InputFile) -> Self { pub fn thumbnail(mut self, val: InputFile) -> Self {
self.thumb = Some(val); self.thumbnail = Some(val);
self self
} }
@ -226,7 +226,7 @@ pub struct InputMediaAnimation {
/// JPEG format and less than 200 kB in size. A thumbnails width and /// JPEG format and less than 200 kB in size. A thumbnails width and
/// height should not exceed 320. Ignored if the file is not uploaded /// height should not exceed 320. Ignored if the file is not uploaded
/// using multipart/form-data. /// using multipart/form-data.
pub thumb: Option<InputFile>, pub thumbnail: Option<InputFile>,
/// Caption of the animation to be sent, 0-1024 characters. /// Caption of the animation to be sent, 0-1024 characters.
pub caption: Option<String>, pub caption: Option<String>,
@ -262,7 +262,7 @@ impl InputMediaAnimation {
pub const fn new(media: InputFile) -> Self { pub const fn new(media: InputFile) -> Self {
Self { Self {
media, media,
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
width: None, width: None,
@ -278,8 +278,8 @@ impl InputMediaAnimation {
self self
} }
pub fn thumb(mut self, val: InputFile) -> Self { pub fn thumbnail(mut self, val: InputFile) -> Self {
self.thumb = Some(val); self.thumbnail = Some(val);
self self
} }
@ -342,7 +342,7 @@ pub struct InputMediaAudio {
/// JPEG format and less than 200 kB in size. A thumbnails width and /// JPEG format and less than 200 kB in size. A thumbnails width and
/// height should not exceed 320. Ignored if the file is not uploaded /// height should not exceed 320. Ignored if the file is not uploaded
/// using multipart/form-data. /// using multipart/form-data.
pub thumb: Option<InputFile>, pub thumbnail: Option<InputFile>,
/// Caption of the audio to be sent, 0-1024 characters. /// Caption of the audio to be sent, 0-1024 characters.
pub caption: Option<String>, pub caption: Option<String>,
@ -373,7 +373,7 @@ impl InputMediaAudio {
pub const fn new(media: InputFile) -> Self { pub const fn new(media: InputFile) -> Self {
Self { Self {
media, media,
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
performer: None, performer: None,
@ -388,8 +388,8 @@ impl InputMediaAudio {
self self
} }
pub fn thumb(mut self, val: InputFile) -> Self { pub fn thumbnail(mut self, val: InputFile) -> Self {
self.thumb = Some(val); self.thumbnail = Some(val);
self self
} }
@ -450,7 +450,7 @@ pub struct InputMediaDocument {
/// JPEG format and less than 200 kB in size. A thumbnails width and /// JPEG format and less than 200 kB in size. A thumbnails width and
/// height should not exceed 320. Ignored if the file is not uploaded /// height should not exceed 320. Ignored if the file is not uploaded
/// using multipart/form-data. /// using multipart/form-data.
pub thumb: Option<InputFile>, pub thumbnail: Option<InputFile>,
/// Caption of the document to be sent, 0-1024 characters. /// Caption of the document to be sent, 0-1024 characters.
pub caption: Option<String>, pub caption: Option<String>,
@ -477,7 +477,7 @@ impl InputMediaDocument {
pub const fn new(media: InputFile) -> Self { pub const fn new(media: InputFile) -> Self {
Self { Self {
media, media,
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
disable_content_type_detection: None, disable_content_type_detection: None,
@ -490,8 +490,8 @@ impl InputMediaDocument {
self self
} }
pub fn thumb(mut self, val: InputFile) -> Self { pub fn thumbnail(mut self, val: InputFile) -> Self {
self.thumb = Some(val); self.thumbnail = Some(val);
self self
} }
@ -534,30 +534,30 @@ impl InputMedia {
pub(crate) fn files(&self) -> impl Iterator<Item = &InputFile> { pub(crate) fn files(&self) -> impl Iterator<Item = &InputFile> {
use InputMedia::*; use InputMedia::*;
let (media, thumb) = match self { let (media, thumbnail) = match self {
Photo(InputMediaPhoto { media, .. }) => (media, None), Photo(InputMediaPhoto { media, .. }) => (media, None),
Document(InputMediaDocument { media, thumb, .. }) Document(InputMediaDocument { media, thumbnail, .. })
| Audio(InputMediaAudio { media, thumb, .. }) | Audio(InputMediaAudio { media, thumbnail, .. })
| Animation(InputMediaAnimation { media, thumb, .. }) | Animation(InputMediaAnimation { media, thumbnail, .. })
| Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_ref()), | 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 /// Returns an iterator of all files in this input media
pub(crate) fn files_mut(&mut self) -> impl Iterator<Item = &mut InputFile> { pub(crate) fn files_mut(&mut self) -> impl Iterator<Item = &mut InputFile> {
use InputMedia::*; use InputMedia::*;
let (media, thumb) = match self { let (media, thumbnail) = match self {
Photo(InputMediaPhoto { media, .. }) => (media, None), Photo(InputMediaPhoto { media, .. }) => (media, None),
Document(InputMediaDocument { media, thumb, .. }) Document(InputMediaDocument { media, thumbnail, .. })
| Audio(InputMediaAudio { media, thumb, .. }) | Audio(InputMediaAudio { media, thumbnail, .. })
| Animation(InputMediaAnimation { media, thumb, .. }) | Animation(InputMediaAnimation { media, thumbnail, .. })
| Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_mut()), | 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 expected_json = r#"{"type":"video","media":"123456"}"#;
let video = InputMedia::Video(InputMediaVideo { let video = InputMedia::Video(InputMediaVideo {
media: InputFile::file_id("123456"), media: InputFile::file_id("123456"),
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
width: None, width: None,
@ -605,7 +605,7 @@ mod tests {
let expected_json = r#"{"type":"animation","media":"123456"}"#; let expected_json = r#"{"type":"animation","media":"123456"}"#;
let video = InputMedia::Animation(InputMediaAnimation { let video = InputMedia::Animation(InputMediaAnimation {
media: InputFile::file_id("123456"), media: InputFile::file_id("123456"),
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
width: None, width: None,
@ -624,7 +624,7 @@ mod tests {
let expected_json = r#"{"type":"audio","media":"123456"}"#; let expected_json = r#"{"type":"audio","media":"123456"}"#;
let video = InputMedia::Audio(InputMediaAudio { let video = InputMedia::Audio(InputMediaAudio {
media: InputFile::file_id("123456"), media: InputFile::file_id("123456"),
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
duration: None, duration: None,
@ -642,7 +642,7 @@ mod tests {
let expected_json = r#"{"type":"document","media":"123456"}"#; let expected_json = r#"{"type":"document","media":"123456"}"#;
let video = InputMedia::Document(InputMediaDocument { let video = InputMedia::Document(InputMediaDocument {
media: InputFile::file_id("123456"), media: InputFile::file_id("123456"),
thumb: None, thumbnail: None,
caption: None, caption: None,
parse_mode: None, parse_mode: None,
caption_entities: None, caption_entities: None,

View file

@ -44,7 +44,7 @@ pub struct Sticker {
pub format: StickerFormat, pub format: StickerFormat,
/// Sticker thumbnail in the `.webp` or `.jpg` format. /// Sticker thumbnail in the `.webp` or `.jpg` format.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
/// Emoji associated with the sticker. /// Emoji associated with the sticker.
pub emoji: Option<String>, pub emoji: Option<String>,
@ -341,7 +341,7 @@ mod tests {
"y_shift": 0.5525, "y_shift": 0.5525,
"scale": 1.94 "scale": 1.94
}, },
"thumb": { "thumbnail": {
"file_id": "AAMCAQADFQABYzA0qlYHijpjMzMwBFKnEVE5XdkAAjIKAAK_jJAE1TRw7D936M8BAAdtAAMpBA", "file_id": "AAMCAQADFQABYzA0qlYHijpjMzMwBFKnEVE5XdkAAjIKAAK_jJAE1TRw7D936M8BAAdtAAMpBA",
"file_unique_id": "AQADMgoAAr-MkARy", "file_unique_id": "AQADMgoAAr-MkARy",
"file_size": 11028, "file_size": 11028,
@ -360,7 +360,7 @@ mod tests {
assert_eq!(sticker.mask_position().unwrap().point, MaskPoint::Forehead); assert_eq!(sticker.mask_position().unwrap().point, MaskPoint::Forehead);
assert_eq!(sticker.is_animated(), false); assert_eq!(sticker.is_animated(), false);
assert_eq!(sticker.is_video(), 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.file.size, 18290);
assert_eq!(sticker.width, 512); assert_eq!(sticker.width, 512);
assert_eq!(sticker.height, 512); assert_eq!(sticker.height, 512);
@ -381,7 +381,7 @@ mod tests {
"is_animated": false, "is_animated": false,
"is_video": false, "is_video": false,
"type": "regular", "type": "regular",
"thumb": { "thumbnail": {
"file_id": "AAMCAgADFQABYzBxOJ1GWrttqL7FSRwdAtrq-AkAAtkHAALBGJ4LUUUh5CUew90BAAdtAAMpBA", "file_id": "AAMCAgADFQABYzBxOJ1GWrttqL7FSRwdAtrq-AkAAtkHAALBGJ4LUUUh5CUew90BAAdtAAMpBA",
"file_unique_id": "AQAD2QcAAsEYngty", "file_unique_id": "AQAD2QcAAsEYngty",
"file_size": 4558, "file_size": 4558,
@ -400,7 +400,7 @@ mod tests {
assert_eq!(sticker.premium_animation(), None); assert_eq!(sticker.premium_animation(), None);
assert_eq!(sticker.is_animated(), false); assert_eq!(sticker.is_animated(), false);
assert_eq!(sticker.is_video(), 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.file.size, 25734);
assert_eq!(sticker.width, 463); assert_eq!(sticker.width, 463);
assert_eq!(sticker.height, 512); assert_eq!(sticker.height, 512);

View file

@ -28,7 +28,7 @@ pub struct StickerSet {
pub stickers: Vec<Sticker>, pub stickers: Vec<Sticker>,
/// Sticker set thumbnail in the `.webp`, `.tgs` or `.webm` format. /// Sticker set thumbnail in the `.webp`, `.tgs` or `.webm` format.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
} }
/// This allows calling [`StickerType`]'s methods directly on [`StickerSet`]. /// This allows calling [`StickerType`]'s methods directly on [`StickerSet`].
@ -143,7 +143,7 @@ mod tests {
assert!(set.is_static()); assert!(set.is_static());
assert!(set.is_regular()); assert!(set.is_regular());
assert!(set.thumb.is_none()); assert!(set.thumbnail.is_none());
assert_eq!(set.stickers.len(), 2); assert_eq!(set.stickers.len(), 2);
} }
} }

View file

@ -23,7 +23,7 @@ pub struct Video {
pub duration: Seconds, pub duration: Seconds,
/// Video thumbnail. /// Video thumbnail.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
/// Original filename as defined by sender /// Original filename as defined by sender
pub file_name: Option<String>, pub file_name: Option<String>,

View file

@ -24,5 +24,5 @@ pub struct VideoNote {
pub duration: Seconds, pub duration: Seconds,
/// Video thumbnail. /// Video thumbnail.
pub thumb: Option<PhotoSize>, pub thumbnail: Option<PhotoSize>,
} }

View file

@ -41,7 +41,7 @@ async fn main() {
))), ))),
) )
.description("DuckDuckGo Search") .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 .url("https://duckduckgo.com/about".parse().unwrap()); // Note: This is the url that will open if they click the thumbnail
let results = vec![ let results = vec![