Add missing thumbnail_mime_type field to InlineQueryResultGif & InlineQueryResultMpeg4Gif

This commit is contained in:
Сырцев Вадим Игоревич 2024-06-11 18:58:10 +03:00
parent 4d703e2dcf
commit f883651dbc
2 changed files with 21 additions and 7 deletions

View file

@ -21,15 +21,21 @@ pub struct InlineQueryResultGif {
/// Width of the GIF.
pub gif_width: Option<u32>,
/// Height of the GIFv.
/// Height of the GIF.
pub gif_height: Option<u32>,
/// Duration of the GIF.
pub gif_duration: Option<Seconds>,
/// URL of the static thumbnail for the result (jpeg or gif).
/// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the
/// result
pub thumbnail_url: reqwest::Url,
// FIXME: maybe make dedicated enum for the mime type?
/// MIME type of the thumbnail, must be one of “image/jpeg”,
/// “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
pub thumbnail_mime_type: Option<String>,
/// Title for the result.
pub title: Option<String>,
@ -58,7 +64,7 @@ pub struct InlineQueryResultGif {
}
impl InlineQueryResultGif {
pub fn new<S>(id: S, gif_url: reqwest::Url, thumb_url: reqwest::Url) -> Self
pub fn new<S>(id: S, gif_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
where
S: Into<String>,
{
@ -68,7 +74,8 @@ impl InlineQueryResultGif {
gif_width: None,
gif_height: None,
gif_duration: None,
thumbnail_url: thumb_url,
thumbnail_url,
thumbnail_mime_type: None,
title: None,
caption: None,
parse_mode: None,

View file

@ -30,9 +30,15 @@ pub struct InlineQueryResultMpeg4Gif {
/// Video duration.
pub mpeg4_duration: Option<Seconds>,
/// URL of the static thumbnail (jpeg or gif) for the result.
/// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the
/// result
pub thumbnail_url: reqwest::Url,
// FIXME: maybe make dedicated enum for the mime type?
/// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or
/// “video/mp4”. Defaults to “image/jpeg”
pub thumbnail_mime_type: Option<String>,
/// Title for the result.
pub title: Option<String>,
@ -61,14 +67,15 @@ pub struct InlineQueryResultMpeg4Gif {
}
impl InlineQueryResultMpeg4Gif {
pub fn new<S>(id: S, mpeg4_url: reqwest::Url, thumb_url: reqwest::Url) -> Self
pub fn new<S>(id: S, mpeg4_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
where
S: Into<String>,
{
Self {
id: id.into(),
mpeg4_url,
thumbnail_url: thumb_url,
thumbnail_url,
thumbnail_mime_type: None,
mpeg4_width: None,
mpeg4_height: None,
mpeg4_duration: None,