Add #[serde(skip_serializing_if = "Option::is_none")] to InlineQueryResult* optional fields

This commit is contained in:
Waffle 2019-09-19 00:58:30 +03:00
parent 1bee0a9c26
commit 3c65d34955
20 changed files with 115 additions and 1 deletions

View file

@ -9,17 +9,24 @@ pub struct InlineQueryResultArticle {
/// Content of the message to be sent
pub input_message_content: InputMessageContent,
/// Optional. Inline keyboard attached to the message
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
/// Optional. URL of the result
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
/// Optional. Pass True, if you don't want the URL to be shown in the message
#[serde(skip_serializing_if = "Option::is_none")]
pub hide_url: Option<bool>,
/// Optional. Short description of the result
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// Optional. Url of the thumbnail for the result
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_url: Option<String>,
/// Optional. Thumbnail width
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_width: Option<i32>,
/// Optional. Thumbnail height
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_height: Option<i32>,
}

View file

@ -5,10 +5,16 @@ pub struct InlineQueryResultAudio {
pub id: String,
pub audio_url: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub performer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub audio_duration: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -4,8 +4,12 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultCachedAudio {
pub id: String,
pub audio_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,9 +5,14 @@ pub struct InlineQueryResultCachedDocument {
pub id: String,
pub title: String,
pub document_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -4,9 +4,14 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultCachedGif {
pub id: String,
pub gif_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -4,9 +4,14 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultCachedMpeg4Gif {
pub id: String,
pub mpeg4_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -4,10 +4,16 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultCachedPhoto {
pub id: String,
pub photo_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -4,6 +4,8 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
pub struct InlineQueryResultCachedSticker {
pub id: String,
pub sticker_file_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,9 +5,14 @@ pub struct InlineQueryResultCachedVideo {
pub id: String,
pub video_file_id: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,8 +5,12 @@ pub struct InlineQueryResultCachedVoice {
pub id: String,
pub voice_file_id: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,11 +5,18 @@ pub struct InlineQueryResultContact {
pub id: String,
pub phone_number: String,
pub first_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub vcard: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_height: Option<i32>,
}

View file

@ -4,14 +4,22 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultDocument {
pub id: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
pub document_url: String,
pub mime_type: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_height: Option<i32>,
}

View file

@ -4,5 +4,6 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultGame {
pub id: String,
pub game_short_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
}

View file

@ -4,13 +4,21 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultGif {
pub id: String,
pub gif_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub gif_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub gif_height: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub gif_duration: Option<i32>,
pub thumb_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -6,11 +6,16 @@ pub struct InlineQueryResultLocation {
pub latitude: f64,
pub longitude: f64,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub live_period: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_height: Option<i32>,
}

View file

@ -4,13 +4,21 @@ use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
pub struct InlineQueryResultMpeg4Gif {
pub id: String,
pub mpeg4_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub mpeg4_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mpeg4_height: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mpeg4_duration: Option<i32>,
pub thumb_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,12 +5,20 @@ pub struct InlineQueryResultPhoto {
pub id: String,
pub photo_url: String,
pub thumb_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_height: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -7,11 +7,18 @@ pub struct InlineQueryResultVenue {
pub longitude: f64,
pub title: String,
pub address: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb_height: Option<i32>,
}

View file

@ -7,12 +7,20 @@ pub struct InlineQueryResultVideo {
pub mime_type: String,
pub thumb_url: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_width: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_height: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_duration: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}

View file

@ -5,9 +5,14 @@ pub struct InlineQueryResultVoice {
pub id: String,
pub voice_url: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub voice_duration: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContent>,
}