From 3c65d34955562c6bfc691e534c1451e19e3bd391 Mon Sep 17 00:00:00 2001 From: Waffle Date: Thu, 19 Sep 2019 00:58:30 +0300 Subject: [PATCH] Add `#[serde(skip_serializing_if = "Option::is_none")]` to `InlineQueryResult*` optional fields --- src/core/types/inline_query_result_article.rs | 7 +++++++ src/core/types/inline_query_result_audio.rs | 6 ++++++ src/core/types/inline_query_result_cached_audio.rs | 4 ++++ src/core/types/inline_query_result_cached_document.rs | 5 +++++ src/core/types/inline_query_result_cached_gif.rs | 5 +++++ src/core/types/inline_query_result_cached_mpeg4_gif.rs | 5 +++++ src/core/types/inline_query_result_cached_photo.rs | 6 ++++++ src/core/types/inline_query_result_cached_sticker.rs | 2 ++ src/core/types/inline_query_result_cached_video.rs | 5 +++++ src/core/types/inline_query_result_cached_voice.rs | 4 ++++ src/core/types/inline_query_result_contact.rs | 7 +++++++ src/core/types/inline_query_result_document.rs | 8 ++++++++ src/core/types/inline_query_result_game.rs | 1 + src/core/types/inline_query_result_gif.rs | 8 ++++++++ src/core/types/inline_query_result_location.rs | 7 ++++++- src/core/types/inline_query_result_mpeg4_gif.rs | 8 ++++++++ src/core/types/inline_query_result_photo.rs | 8 ++++++++ src/core/types/inline_query_result_venue.rs | 7 +++++++ src/core/types/inline_query_result_video.rs | 8 ++++++++ src/core/types/inline_query_result_voice.rs | 5 +++++ 20 files changed, 115 insertions(+), 1 deletion(-) diff --git a/src/core/types/inline_query_result_article.rs b/src/core/types/inline_query_result_article.rs index 4020ac1f..b887c75d 100644 --- a/src/core/types/inline_query_result_article.rs +++ b/src/core/types/inline_query_result_article.rs @@ -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, /// Optional. URL of the result + #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, /// 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, /// Optional. Short description of the result + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, /// Optional. Url of the thumbnail for the result + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_url: Option, /// Optional. Thumbnail width + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_width: Option, /// Optional. Thumbnail height + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_height: Option, } diff --git a/src/core/types/inline_query_result_audio.rs b/src/core/types/inline_query_result_audio.rs index e0b22e62..ac8d40b8 100644 --- a/src/core/types/inline_query_result_audio.rs +++ b/src/core/types/inline_query_result_audio.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub performer: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub audio_duration: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_audio.rs b/src/core/types/inline_query_result_cached_audio.rs index 89497401..6975dbd6 100644 --- a/src/core/types/inline_query_result_cached_audio.rs +++ b/src/core/types/inline_query_result_cached_audio.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_document.rs b/src/core/types/inline_query_result_cached_document.rs index 26c194b9..c821ffa7 100644 --- a/src/core/types/inline_query_result_cached_document.rs +++ b/src/core/types/inline_query_result_cached_document.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_gif.rs b/src/core/types/inline_query_result_cached_gif.rs index 6ce10cdf..ab1dc7d6 100644 --- a/src/core/types/inline_query_result_cached_gif.rs +++ b/src/core/types/inline_query_result_cached_gif.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_mpeg4_gif.rs b/src/core/types/inline_query_result_cached_mpeg4_gif.rs index c8a101f2..8763142b 100644 --- a/src/core/types/inline_query_result_cached_mpeg4_gif.rs +++ b/src/core/types/inline_query_result_cached_mpeg4_gif.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_photo.rs b/src/core/types/inline_query_result_cached_photo.rs index 248590ab..f012b56d 100644 --- a/src/core/types/inline_query_result_cached_photo.rs +++ b/src/core/types/inline_query_result_cached_photo.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_sticker.rs b/src/core/types/inline_query_result_cached_sticker.rs index 25c85260..037cc670 100644 --- a/src/core/types/inline_query_result_cached_sticker.rs +++ b/src/core/types/inline_query_result_cached_sticker.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_video.rs b/src/core/types/inline_query_result_cached_video.rs index c880f106..2bebfdff 100644 --- a/src/core/types/inline_query_result_cached_video.rs +++ b/src/core/types/inline_query_result_cached_video.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_cached_voice.rs b/src/core/types/inline_query_result_cached_voice.rs index 08be2eed..e0ec1074 100644 --- a/src/core/types/inline_query_result_cached_voice.rs +++ b/src/core/types/inline_query_result_cached_voice.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_contact.rs b/src/core/types/inline_query_result_contact.rs index 88a22bd0..0c0d22b7 100644 --- a/src/core/types/inline_query_result_contact.rs +++ b/src/core/types/inline_query_result_contact.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub vcard: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_url: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_height: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_document.rs b/src/core/types/inline_query_result_document.rs index 99f7866b..7ff3bf44 100644 --- a/src/core/types/inline_query_result_document.rs +++ b/src/core/types/inline_query_result_document.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, pub document_url: String, pub mime_type: String, + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_url: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_height: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_game.rs b/src/core/types/inline_query_result_game.rs index d81643b4..942eb2b5 100644 --- a/src/core/types/inline_query_result_game.rs +++ b/src/core/types/inline_query_result_game.rs @@ -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, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_gif.rs b/src/core/types/inline_query_result_gif.rs index 0d884e6a..c86d634a 100644 --- a/src/core/types/inline_query_result_gif.rs +++ b/src/core/types/inline_query_result_gif.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub gif_height: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub gif_duration: Option, pub thumb_url: String, + #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_location.rs b/src/core/types/inline_query_result_location.rs index c4b5d296..09c034f5 100644 --- a/src/core/types/inline_query_result_location.rs +++ b/src/core/types/inline_query_result_location.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_url: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_height: Option, - } \ No newline at end of file diff --git a/src/core/types/inline_query_result_mpeg4_gif.rs b/src/core/types/inline_query_result_mpeg4_gif.rs index a7f33542..186cdba1 100644 --- a/src/core/types/inline_query_result_mpeg4_gif.rs +++ b/src/core/types/inline_query_result_mpeg4_gif.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub mpeg4_height: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub mpeg4_duration: Option, pub thumb_url: String, + #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_photo.rs b/src/core/types/inline_query_result_photo.rs index 85c94574..cf2b4b51 100644 --- a/src/core/types/inline_query_result_photo.rs +++ b/src/core/types/inline_query_result_photo.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub photo_height: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub caption: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_venue.rs b/src/core/types/inline_query_result_venue.rs index 724cd12f..e6beb38d 100644 --- a/src/core/types/inline_query_result_venue.rs +++ b/src/core/types/inline_query_result_venue.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub foursquare_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_url: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub thumb_height: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_video.rs b/src/core/types/inline_query_result_video.rs index c5b49731..566eea6d 100644 --- a/src/core/types/inline_query_result_video.rs +++ b/src/core/types/inline_query_result_video.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub video_width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub video_height: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub video_duration: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file diff --git a/src/core/types/inline_query_result_voice.rs b/src/core/types/inline_query_result_voice.rs index 169a1ca7..38d2de62 100644 --- a/src/core/types/inline_query_result_voice.rs +++ b/src/core/types/inline_query_result_voice.rs @@ -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, + #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub voice_duration: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_markup: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub input_message_content: Option, } \ No newline at end of file