From 51703b16b10e0f077be68997617a923fa6331df9 Mon Sep 17 00:00:00 2001 From: Waffle Date: Mon, 30 Dec 2019 13:14:19 +0300 Subject: [PATCH] Remove `#[macro_use]` and use `use` instead --- src/errors.rs | 2 ++ src/lib.rs | 7 ------- src/network/telegram_response.rs | 1 + src/requests/payloads/add_sticker_to_set.rs | 1 + src/requests/payloads/answer_callback_query.rs | 2 ++ src/requests/payloads/answer_inline_query.rs | 2 ++ src/requests/payloads/answer_pre_checkout_query.rs | 2 ++ src/requests/payloads/answer_shipping_query.rs | 2 ++ src/requests/payloads/create_new_sticker_set.rs | 1 + src/requests/payloads/delete_chat_photo.rs | 4 +++- src/requests/payloads/delete_chat_sticker_set.rs | 2 ++ src/requests/payloads/delete_message.rs | 2 ++ src/requests/payloads/delete_sticker_from_set.rs | 2 ++ src/requests/payloads/delete_webhook.rs | 2 ++ src/requests/payloads/edit_message_caption.rs | 2 ++ src/requests/payloads/edit_message_caption_inline.rs | 5 ++--- src/requests/payloads/edit_message_live_location.rs | 2 ++ src/requests/payloads/edit_message_live_location_inline.rs | 1 + src/requests/payloads/edit_message_media.rs | 1 + src/requests/payloads/edit_message_media_inline.rs | 1 + src/requests/payloads/edit_message_reply_markup.rs | 2 ++ src/requests/payloads/edit_message_reply_markup_inline.rs | 1 + src/requests/payloads/edit_message_text.rs | 2 ++ src/requests/payloads/edit_message_text_inline.rs | 2 ++ src/requests/payloads/export_chat_invite_link.rs | 2 ++ src/requests/payloads/forward_message.rs | 2 ++ src/requests/payloads/get_chat.rs | 2 ++ src/requests/payloads/get_chat_administrators.rs | 2 ++ src/requests/payloads/get_chat_member.rs | 2 ++ src/requests/payloads/get_chat_members_count.rs | 2 ++ src/requests/payloads/get_file.rs | 2 ++ src/requests/payloads/get_game_high_scores.rs | 2 ++ src/requests/payloads/get_game_high_scores_inline.rs | 2 ++ src/requests/payloads/get_me.rs | 1 + src/requests/payloads/get_sticker_set.rs | 2 ++ src/requests/payloads/get_updates.rs | 2 ++ src/requests/payloads/get_user_profile_photos.rs | 2 ++ src/requests/payloads/get_webhook_info.rs | 4 +++- src/requests/payloads/kick_chat_member.rs | 2 ++ src/requests/payloads/leave_chat.rs | 2 ++ src/requests/payloads/pin_chat_message.rs | 4 +++- src/requests/payloads/promote_chat_member.rs | 4 +++- src/requests/payloads/restrict_chat_member.rs | 2 ++ src/requests/payloads/send_animation.rs | 1 + src/requests/payloads/send_audio.rs | 1 + src/requests/payloads/send_chat_action.rs | 2 ++ src/requests/payloads/send_contact.rs | 2 ++ src/requests/payloads/send_document.rs | 1 + src/requests/payloads/send_game.rs | 2 ++ src/requests/payloads/send_invoice.rs | 4 +++- src/requests/payloads/send_location.rs | 2 ++ src/requests/payloads/send_media_group.rs | 1 + src/requests/payloads/send_message.rs | 2 ++ src/requests/payloads/send_photo.rs | 1 + src/requests/payloads/send_poll.rs | 4 +++- src/requests/payloads/send_sticker.rs | 1 + src/requests/payloads/send_venue.rs | 2 ++ src/requests/payloads/send_video.rs | 1 + src/requests/payloads/send_video_note.rs | 1 + src/requests/payloads/send_voice.rs | 1 + src/requests/payloads/set_chat_description.rs | 2 ++ src/requests/payloads/set_chat_permissions.rs | 2 ++ src/requests/payloads/set_chat_photo.rs | 2 ++ src/requests/payloads/set_chat_sticker_set.rs | 2 ++ src/requests/payloads/set_chat_title.rs | 2 ++ src/requests/payloads/set_game_score.rs | 2 ++ src/requests/payloads/set_game_score_inline.rs | 1 + src/requests/payloads/set_sticker_position_in_set.rs | 2 ++ src/requests/payloads/set_webhook.rs | 2 ++ src/requests/payloads/stop_message_live_location.rs | 2 ++ src/requests/payloads/stop_message_live_location_inline.rs | 2 +- src/requests/payloads/stop_poll.rs | 5 +++-- src/requests/payloads/unban_chat_member.rs | 2 ++ src/requests/payloads/unpin_chat_message.rs | 2 ++ src/requests/payloads/upload_sticker_file.rs | 2 ++ src/types/animation.rs | 2 ++ src/types/audio.rs | 2 ++ src/types/callback_query.rs | 2 ++ src/types/chat.rs | 2 ++ src/types/chat_action.rs | 2 ++ src/types/chat_id.rs | 3 +++ src/types/chat_member.rs | 2 ++ src/types/chat_permissions.rs | 2 ++ src/types/chat_photo.rs | 2 ++ src/types/chosen_inline_result.rs | 2 ++ src/types/contact.rs | 2 ++ src/types/document.rs | 2 ++ src/types/encrypted_credentials.rs | 2 ++ src/types/encrypted_passport_element.rs | 2 ++ src/types/file.rs | 2 ++ src/types/force_reply.rs | 2 ++ src/types/game.rs | 2 +- src/types/game_high_score.rs | 2 +- src/types/inline_keyboard_button.rs | 2 ++ src/types/inline_keyboard_markup.rs | 2 ++ src/types/inline_query.rs | 2 ++ src/types/inline_query_result.rs | 3 +++ src/types/inline_query_result_article.rs | 2 ++ src/types/inline_query_result_audio.rs | 2 ++ src/types/inline_query_result_cached_audio.rs | 2 ++ src/types/inline_query_result_cached_document.rs | 2 ++ src/types/inline_query_result_cached_gif.rs | 2 ++ src/types/inline_query_result_cached_mpeg4_gif.rs | 2 ++ src/types/inline_query_result_cached_photo.rs | 2 ++ src/types/inline_query_result_cached_sticker.rs | 2 ++ src/types/inline_query_result_cached_video.rs | 2 ++ src/types/inline_query_result_cached_voice.rs | 2 ++ src/types/inline_query_result_contact.rs | 2 ++ src/types/inline_query_result_document.rs | 2 ++ src/types/inline_query_result_game.rs | 2 ++ src/types/inline_query_result_gif.rs | 2 ++ src/types/inline_query_result_location.rs | 2 ++ src/types/inline_query_result_mpeg4_gif.rs | 2 ++ src/types/inline_query_result_photo.rs | 2 ++ src/types/inline_query_result_venue.rs | 2 ++ src/types/inline_query_result_video.rs | 2 ++ src/types/inline_query_result_voice.rs | 2 ++ src/types/input_file.rs | 4 +++- src/types/input_media.rs | 2 ++ src/types/input_message_content.rs | 2 +- src/types/invoice.rs | 2 ++ src/types/keyboard_button.rs | 2 ++ src/types/label_price.rs | 2 ++ src/types/location.rs | 2 ++ src/types/login_url.rs | 2 ++ src/types/mask_position.rs | 2 ++ src/types/message.rs | 2 ++ src/types/message_entity.rs | 2 ++ src/types/order_info.rs | 2 ++ src/types/passport_data.rs | 2 ++ src/types/passport_file.rs | 2 ++ src/types/photo_size.rs | 2 ++ src/types/poll.rs | 2 ++ src/types/pre_checkout_query.rs | 2 ++ src/types/reply_keyboard_markup.rs | 2 ++ src/types/reply_keyboard_remove.rs | 2 ++ src/types/reply_markup.rs | 2 ++ src/types/response_parameters.rs | 2 ++ src/types/send_invoice.rs | 2 ++ src/types/shipping_address.rs | 2 ++ src/types/shipping_option.rs | 2 ++ src/types/shipping_query.rs | 2 ++ src/types/sticker.rs | 2 ++ src/types/sticker_set.rs | 2 ++ src/types/successful_payment.rs | 2 ++ src/types/update.rs | 2 ++ src/types/user.rs | 2 ++ src/types/user_profile_photos.rs | 2 ++ src/types/venue.rs | 2 ++ src/types/video.rs | 2 ++ src/types/video_note.rs | 2 ++ src/types/voice.rs | 2 ++ src/types/webhook_info.rs | 2 ++ 153 files changed, 292 insertions(+), 23 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index e8c1ae21..800453c1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,6 @@ +use derive_more::From; use reqwest::StatusCode; +use thiserror::Error; // #[derive(Debug, Error, From)] diff --git a/src/lib.rs b/src/lib.rs index 1d14fbaa..fb15a2e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,13 +5,6 @@ html_favicon_url = "https://github.com/teloxide/teloxide/raw/dev/ICON.png" )] -#[macro_use] -extern crate derive_more; -#[macro_use] -extern crate serde; -#[macro_use] -extern crate thiserror; - pub use bot::Bot; pub use errors::{DownloadError, RequestError}; diff --git a/src/network/telegram_response.rs b/src/network/telegram_response.rs index 82185c0c..a54b0f77 100644 --- a/src/network/telegram_response.rs +++ b/src/network/telegram_response.rs @@ -1,4 +1,5 @@ use reqwest::StatusCode; +use serde::Deserialize; use crate::{ requests::ResponseResult, diff --git a/src/requests/payloads/add_sticker_to_set.rs b/src/requests/payloads/add_sticker_to_set.rs index 17aee206..21ab6133 100644 --- a/src/requests/payloads/add_sticker_to_set.rs +++ b/src/requests/payloads/add_sticker_to_set.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/answer_callback_query.rs b/src/requests/payloads/answer_callback_query.rs index 02c01741..ab9a99a2 100644 --- a/src/requests/payloads/answer_callback_query.rs +++ b/src/requests/payloads/answer_callback_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::True, diff --git a/src/requests/payloads/answer_inline_query.rs b/src/requests/payloads/answer_inline_query.rs index 69a56583..6de79a0f 100644 --- a/src/requests/payloads/answer_inline_query.rs +++ b/src/requests/payloads/answer_inline_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::InlineQueryResult, diff --git a/src/requests/payloads/answer_pre_checkout_query.rs b/src/requests/payloads/answer_pre_checkout_query.rs index fa7381d6..1970f981 100644 --- a/src/requests/payloads/answer_pre_checkout_query.rs +++ b/src/requests/payloads/answer_pre_checkout_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::True, diff --git a/src/requests/payloads/answer_shipping_query.rs b/src/requests/payloads/answer_shipping_query.rs index 6734cd8f..8c11e3b6 100644 --- a/src/requests/payloads/answer_shipping_query.rs +++ b/src/requests/payloads/answer_shipping_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ShippingOption, True}, diff --git a/src/requests/payloads/create_new_sticker_set.rs b/src/requests/payloads/create_new_sticker_set.rs index 396ecd43..7e599b24 100644 --- a/src/requests/payloads/create_new_sticker_set.rs +++ b/src/requests/payloads/create_new_sticker_set.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/delete_chat_photo.rs b/src/requests/payloads/delete_chat_photo.rs index cae67d7d..02a680ab 100644 --- a/src/requests/payloads/delete_chat_photo.rs +++ b/src/requests/payloads/delete_chat_photo.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::{ChatId, True}, }; -use crate::types::{ChatId, True}; /// Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/delete_chat_sticker_set.rs b/src/requests/payloads/delete_chat_sticker_set.rs index c279f217..8ecf702c 100644 --- a/src/requests/payloads/delete_chat_sticker_set.rs +++ b/src/requests/payloads/delete_chat_sticker_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/delete_message.rs b/src/requests/payloads/delete_message.rs index f585376a..6fe9a596 100644 --- a/src/requests/payloads/delete_message.rs +++ b/src/requests/payloads/delete_message.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/delete_sticker_from_set.rs b/src/requests/payloads/delete_sticker_from_set.rs index 5b8b7157..11edb2e1 100644 --- a/src/requests/payloads/delete_sticker_from_set.rs +++ b/src/requests/payloads/delete_sticker_from_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::True, diff --git a/src/requests/payloads/delete_webhook.rs b/src/requests/payloads/delete_webhook.rs index 903b72ff..fe988ce9 100644 --- a/src/requests/payloads/delete_webhook.rs +++ b/src/requests/payloads/delete_webhook.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::True, diff --git a/src/requests/payloads/edit_message_caption.rs b/src/requests/payloads/edit_message_caption.rs index e965537d..c0cc2584 100644 --- a/src/requests/payloads/edit_message_caption.rs +++ b/src/requests/payloads/edit_message_caption.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ParseMode, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/edit_message_caption_inline.rs b/src/requests/payloads/edit_message_caption_inline.rs index e0b5a6a5..cfe99d20 100644 --- a/src/requests/payloads/edit_message_caption_inline.rs +++ b/src/requests/payloads/edit_message_caption_inline.rs @@ -1,10 +1,9 @@ - +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, - types::{ParseMode, InlineKeyboardMarkup}, + types::{ParseMode, InlineKeyboardMarkup, Message}, }; -use crate::types::Message; /// Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/edit_message_live_location.rs b/src/requests/payloads/edit_message_live_location.rs index dc87bae3..c7993b6b 100644 --- a/src/requests/payloads/edit_message_live_location.rs +++ b/src/requests/payloads/edit_message_live_location.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/edit_message_live_location_inline.rs b/src/requests/payloads/edit_message_live_location_inline.rs index a1c742ab..c7d48724 100644 --- a/src/requests/payloads/edit_message_live_location_inline.rs +++ b/src/requests/payloads/edit_message_live_location_inline.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, diff --git a/src/requests/payloads/edit_message_media.rs b/src/requests/payloads/edit_message_media.rs index d827c45c..c9b9deaa 100644 --- a/src/requests/payloads/edit_message_media.rs +++ b/src/requests/payloads/edit_message_media.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/edit_message_media_inline.rs b/src/requests/payloads/edit_message_media_inline.rs index 83cffc58..fde5adfc 100644 --- a/src/requests/payloads/edit_message_media_inline.rs +++ b/src/requests/payloads/edit_message_media_inline.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/edit_message_reply_markup.rs b/src/requests/payloads/edit_message_reply_markup.rs index 0a38d486..5d0a401c 100644 --- a/src/requests/payloads/edit_message_reply_markup.rs +++ b/src/requests/payloads/edit_message_reply_markup.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/edit_message_reply_markup_inline.rs b/src/requests/payloads/edit_message_reply_markup_inline.rs index d93d1556..2f35f728 100644 --- a/src/requests/payloads/edit_message_reply_markup_inline.rs +++ b/src/requests/payloads/edit_message_reply_markup_inline.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, diff --git a/src/requests/payloads/edit_message_text.rs b/src/requests/payloads/edit_message_text.rs index 512b2ead..24f19922 100644 --- a/src/requests/payloads/edit_message_text.rs +++ b/src/requests/payloads/edit_message_text.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ParseMode, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/edit_message_text_inline.rs b/src/requests/payloads/edit_message_text_inline.rs index 4d3ed7ed..40a87eea 100644 --- a/src/requests/payloads/edit_message_text_inline.rs +++ b/src/requests/payloads/edit_message_text_inline.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ParseMode, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/export_chat_invite_link.rs b/src/requests/payloads/export_chat_invite_link.rs index 182a24e5..f0cd91c9 100644 --- a/src/requests/payloads/export_chat_invite_link.rs +++ b/src/requests/payloads/export_chat_invite_link.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::ChatId, diff --git a/src/requests/payloads/forward_message.rs b/src/requests/payloads/forward_message.rs index 568f0c7b..0fd04c67 100644 --- a/src/requests/payloads/forward_message.rs +++ b/src/requests/payloads/forward_message.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, Message}, diff --git a/src/requests/payloads/get_chat.rs b/src/requests/payloads/get_chat.rs index 929c914a..76d56d6f 100644 --- a/src/requests/payloads/get_chat.rs +++ b/src/requests/payloads/get_chat.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, Chat}, diff --git a/src/requests/payloads/get_chat_administrators.rs b/src/requests/payloads/get_chat_administrators.rs index f8d2fd77..f61f1245 100644 --- a/src/requests/payloads/get_chat_administrators.rs +++ b/src/requests/payloads/get_chat_administrators.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ChatMember}, diff --git a/src/requests/payloads/get_chat_member.rs b/src/requests/payloads/get_chat_member.rs index 58162dd7..0d0aab63 100644 --- a/src/requests/payloads/get_chat_member.rs +++ b/src/requests/payloads/get_chat_member.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ChatMember}, diff --git a/src/requests/payloads/get_chat_members_count.rs b/src/requests/payloads/get_chat_members_count.rs index e87e8722..9848fdd5 100644 --- a/src/requests/payloads/get_chat_members_count.rs +++ b/src/requests/payloads/get_chat_members_count.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::ChatId, diff --git a/src/requests/payloads/get_file.rs b/src/requests/payloads/get_file.rs index d7614efa..471388ae 100644 --- a/src/requests/payloads/get_file.rs +++ b/src/requests/payloads/get_file.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::File, diff --git a/src/requests/payloads/get_game_high_scores.rs b/src/requests/payloads/get_game_high_scores.rs index 16ac1a3d..34909bed 100644 --- a/src/requests/payloads/get_game_high_scores.rs +++ b/src/requests/payloads/get_game_high_scores.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::GameHighScore, diff --git a/src/requests/payloads/get_game_high_scores_inline.rs b/src/requests/payloads/get_game_high_scores_inline.rs index 666142f1..1c07ce12 100644 --- a/src/requests/payloads/get_game_high_scores_inline.rs +++ b/src/requests/payloads/get_game_high_scores_inline.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::GameHighScore, diff --git a/src/requests/payloads/get_me.rs b/src/requests/payloads/get_me.rs index b2ab1f45..8fe95879 100644 --- a/src/requests/payloads/get_me.rs +++ b/src/requests/payloads/get_me.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, types::User, diff --git a/src/requests/payloads/get_sticker_set.rs b/src/requests/payloads/get_sticker_set.rs index b6660a73..75b0a6f0 100644 --- a/src/requests/payloads/get_sticker_set.rs +++ b/src/requests/payloads/get_sticker_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::StickerSet, diff --git a/src/requests/payloads/get_updates.rs b/src/requests/payloads/get_updates.rs index 343826fe..e3c92cee 100644 --- a/src/requests/payloads/get_updates.rs +++ b/src/requests/payloads/get_updates.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::Update, diff --git a/src/requests/payloads/get_user_profile_photos.rs b/src/requests/payloads/get_user_profile_photos.rs index ba564a00..6ef61b56 100644 --- a/src/requests/payloads/get_user_profile_photos.rs +++ b/src/requests/payloads/get_user_profile_photos.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::UserProfilePhotos, diff --git a/src/requests/payloads/get_webhook_info.rs b/src/requests/payloads/get_webhook_info.rs index f3a1a124..33653301 100644 --- a/src/requests/payloads/get_webhook_info.rs +++ b/src/requests/payloads/get_webhook_info.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::WebhookInfo, }; -use crate::types::WebhookInfo; /// Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. #[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize, Default)] diff --git a/src/requests/payloads/kick_chat_member.rs b/src/requests/payloads/kick_chat_member.rs index 5c51b910..741e4e52 100644 --- a/src/requests/payloads/kick_chat_member.rs +++ b/src/requests/payloads/kick_chat_member.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/leave_chat.rs b/src/requests/payloads/leave_chat.rs index dfd2549e..88651193 100644 --- a/src/requests/payloads/leave_chat.rs +++ b/src/requests/payloads/leave_chat.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/pin_chat_message.rs b/src/requests/payloads/pin_chat_message.rs index 50116da6..b3cc9736 100644 --- a/src/requests/payloads/pin_chat_message.rs +++ b/src/requests/payloads/pin_chat_message.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::{ChatId, True}, }; -use crate::types::{ChatId, True}; /// Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/promote_chat_member.rs b/src/requests/payloads/promote_chat_member.rs index 8cbb707f..2e70cc3e 100644 --- a/src/requests/payloads/promote_chat_member.rs +++ b/src/requests/payloads/promote_chat_member.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::{ChatId, True}, }; -use crate::types::{ChatId, True}; /// Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/restrict_chat_member.rs b/src/requests/payloads/restrict_chat_member.rs index 62044448..8fdba379 100644 --- a/src/requests/payloads/restrict_chat_member.rs +++ b/src/requests/payloads/restrict_chat_member.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ChatPermissions, True}, diff --git a/src/requests/payloads/send_animation.rs b/src/requests/payloads/send_animation.rs index 9bc35764..c48fe4bb 100644 --- a/src/requests/payloads/send_animation.rs +++ b/src/requests/payloads/send_animation.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_audio.rs b/src/requests/payloads/send_audio.rs index 9291c9d2..d99461d1 100644 --- a/src/requests/payloads/send_audio.rs +++ b/src/requests/payloads/send_audio.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_chat_action.rs b/src/requests/payloads/send_chat_action.rs index 3f38a842..2088714d 100644 --- a/src/requests/payloads/send_chat_action.rs +++ b/src/requests/payloads/send_chat_action.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/send_contact.rs b/src/requests/payloads/send_contact.rs index e3d9e84f..63ed0884 100644 --- a/src/requests/payloads/send_contact.rs +++ b/src/requests/payloads/send_contact.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ReplyMarkup, Message}, diff --git a/src/requests/payloads/send_document.rs b/src/requests/payloads/send_document.rs index c0eedd66..d81d821b 100644 --- a/src/requests/payloads/send_document.rs +++ b/src/requests/payloads/send_document.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_game.rs b/src/requests/payloads/send_game.rs index 1faa13a5..1a4ef7e4 100644 --- a/src/requests/payloads/send_game.rs +++ b/src/requests/payloads/send_game.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/send_invoice.rs b/src/requests/payloads/send_invoice.rs index ff30e6ae..5e361394 100644 --- a/src/requests/payloads/send_invoice.rs +++ b/src/requests/payloads/send_invoice.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::{LabeledPrice, InlineKeyboardMarkup, Message}, }; -use crate::types::{LabeledPrice, InlineKeyboardMarkup, Message}; /// Use this method to send invoices. On success, the sent Message is returned. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/send_location.rs b/src/requests/payloads/send_location.rs index 07f2d54b..238c707d 100644 --- a/src/requests/payloads/send_location.rs +++ b/src/requests/payloads/send_location.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ReplyMarkup, Message}, diff --git a/src/requests/payloads/send_media_group.rs b/src/requests/payloads/send_media_group.rs index 740a148b..730cd60c 100644 --- a/src/requests/payloads/send_media_group.rs +++ b/src/requests/payloads/send_media_group.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_message.rs b/src/requests/payloads/send_message.rs index e9c247ee..194b94fe 100644 --- a/src/requests/payloads/send_message.rs +++ b/src/requests/payloads/send_message.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, Message, ParseMode, ReplyMarkup}, diff --git a/src/requests/payloads/send_photo.rs b/src/requests/payloads/send_photo.rs index 167b85e1..8abb1994 100644 --- a/src/requests/payloads/send_photo.rs +++ b/src/requests/payloads/send_photo.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_poll.rs b/src/requests/payloads/send_poll.rs index ae20e48e..c4ba84a6 100644 --- a/src/requests/payloads/send_poll.rs +++ b/src/requests/payloads/send_poll.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, + types::{ChatId, ReplyMarkup, Message}, }; -use crate::types::{ChatId, ReplyMarkup, Message}; /// Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/send_sticker.rs b/src/requests/payloads/send_sticker.rs index 7f41e4d1..c27fcd41 100644 --- a/src/requests/payloads/send_sticker.rs +++ b/src/requests/payloads/send_sticker.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_venue.rs b/src/requests/payloads/send_venue.rs index ae5565fc..3b8e06d5 100644 --- a/src/requests/payloads/send_venue.rs +++ b/src/requests/payloads/send_venue.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ReplyMarkup, Message}, diff --git a/src/requests/payloads/send_video.rs b/src/requests/payloads/send_video.rs index 42dd0a07..877f5afe 100644 --- a/src/requests/payloads/send_video.rs +++ b/src/requests/payloads/send_video.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_video_note.rs b/src/requests/payloads/send_video_note.rs index 83489642..e05719c9 100644 --- a/src/requests/payloads/send_video_note.rs +++ b/src/requests/payloads/send_video_note.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/send_voice.rs b/src/requests/payloads/send_voice.rs index 747c8439..c72a9be2 100644 --- a/src/requests/payloads/send_voice.rs +++ b/src/requests/payloads/send_voice.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use reqwest::multipart::Form; use crate::{ diff --git a/src/requests/payloads/set_chat_description.rs b/src/requests/payloads/set_chat_description.rs index 53d69615..615592be 100644 --- a/src/requests/payloads/set_chat_description.rs +++ b/src/requests/payloads/set_chat_description.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/set_chat_permissions.rs b/src/requests/payloads/set_chat_permissions.rs index f3cdb91c..e2e79e9a 100644 --- a/src/requests/payloads/set_chat_permissions.rs +++ b/src/requests/payloads/set_chat_permissions.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, ChatPermissions, True}, diff --git a/src/requests/payloads/set_chat_photo.rs b/src/requests/payloads/set_chat_photo.rs index bb7fe687..5cd98587 100644 --- a/src/requests/payloads/set_chat_photo.rs +++ b/src/requests/payloads/set_chat_photo.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, InputFile, True}, diff --git a/src/requests/payloads/set_chat_sticker_set.rs b/src/requests/payloads/set_chat_sticker_set.rs index c9aa8284..fd8cca2c 100644 --- a/src/requests/payloads/set_chat_sticker_set.rs +++ b/src/requests/payloads/set_chat_sticker_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/set_chat_title.rs b/src/requests/payloads/set_chat_title.rs index adea9de5..0bd92f9b 100644 --- a/src/requests/payloads/set_chat_title.rs +++ b/src/requests/payloads/set_chat_title.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/set_game_score.rs b/src/requests/payloads/set_game_score.rs index d8ed3f8d..eea7281f 100644 --- a/src/requests/payloads/set_game_score.rs +++ b/src/requests/payloads/set_game_score.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{Message, ChatId}, diff --git a/src/requests/payloads/set_game_score_inline.rs b/src/requests/payloads/set_game_score_inline.rs index 09ebb9fd..04602a8e 100644 --- a/src/requests/payloads/set_game_score_inline.rs +++ b/src/requests/payloads/set_game_score_inline.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, diff --git a/src/requests/payloads/set_sticker_position_in_set.rs b/src/requests/payloads/set_sticker_position_in_set.rs index 17914bf9..d42ea1a4 100644 --- a/src/requests/payloads/set_sticker_position_in_set.rs +++ b/src/requests/payloads/set_sticker_position_in_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::True, diff --git a/src/requests/payloads/set_webhook.rs b/src/requests/payloads/set_webhook.rs index c377ccf2..7c2aaf6a 100644 --- a/src/requests/payloads/set_webhook.rs +++ b/src/requests/payloads/set_webhook.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{InputFile, True}, diff --git a/src/requests/payloads/stop_message_live_location.rs b/src/requests/payloads/stop_message_live_location.rs index c30d5b07..b6551fe5 100644 --- a/src/requests/payloads/stop_message_live_location.rs +++ b/src/requests/payloads/stop_message_live_location.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, InlineKeyboardMarkup, Message}, diff --git a/src/requests/payloads/stop_message_live_location_inline.rs b/src/requests/payloads/stop_message_live_location_inline.rs index 01c630cb..70b54cb2 100644 --- a/src/requests/payloads/stop_message_live_location_inline.rs +++ b/src/requests/payloads/stop_message_live_location_inline.rs @@ -1,4 +1,4 @@ - +use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, diff --git a/src/requests/payloads/stop_poll.rs b/src/requests/payloads/stop_poll.rs index 76760039..6fc75bfc 100644 --- a/src/requests/payloads/stop_poll.rs +++ b/src/requests/payloads/stop_poll.rs @@ -1,8 +1,9 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, - types::{ChatId, InlineKeyboardMarkup}, + types::{ChatId, InlineKeyboardMarkup, Poll}, }; -use crate::types::Poll; /// Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. #[serde_with_macros::skip_serializing_none] diff --git a/src/requests/payloads/unban_chat_member.rs b/src/requests/payloads/unban_chat_member.rs index 054d66c8..bc176ecc 100644 --- a/src/requests/payloads/unban_chat_member.rs +++ b/src/requests/payloads/unban_chat_member.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/unpin_chat_message.rs b/src/requests/payloads/unpin_chat_message.rs index 58ac16d7..a03a9d96 100644 --- a/src/requests/payloads/unpin_chat_message.rs +++ b/src/requests/payloads/unpin_chat_message.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, diff --git a/src/requests/payloads/upload_sticker_file.rs b/src/requests/payloads/upload_sticker_file.rs index 6d0af61c..13996cba 100644 --- a/src/requests/payloads/upload_sticker_file.rs +++ b/src/requests/payloads/upload_sticker_file.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::{ requests::{dynamic, json, Method}, types::{InputFile, File}, diff --git a/src/types/animation.rs b/src/types/animation.rs index 435f8c45..9e2048bc 100644 --- a/src/types/animation.rs +++ b/src/types/animation.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represents an animation file (GIF or H.264/MPEG-4 AVC video diff --git a/src/types/audio.rs b/src/types/audio.rs index 7d5dcb46..7f508b33 100644 --- a/src/types/audio.rs +++ b/src/types/audio.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represents an audio file to be treated as music by the Telegram diff --git a/src/types/callback_query.rs b/src/types/callback_query.rs index 10b1a126..092b4f76 100644 --- a/src/types/callback_query.rs +++ b/src/types/callback_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{Message, User}; /// This object represents an incoming callback query from a callback button in diff --git a/src/types/chat.rs b/src/types/chat.rs index 82b4c3fb..51420ed5 100644 --- a/src/types/chat.rs +++ b/src/types/chat.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{ChatPermissions, ChatPhoto, Message}; /// This object represents a chat. diff --git a/src/types/chat_action.rs b/src/types/chat_action.rs index 77493edd..730df5c6 100644 --- a/src/types/chat_action.rs +++ b/src/types/chat_action.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] #[serde(rename_all = "snake_case")] pub enum ChatAction { diff --git a/src/types/chat_id.rs b/src/types/chat_id.rs index 73e95942..5b8c03b9 100644 --- a/src/types/chat_id.rs +++ b/src/types/chat_id.rs @@ -1,3 +1,6 @@ +use derive_more::{Display, From}; +use serde::{Deserialize, Serialize}; + /// A unique identifier for the target chat or username of the target channel /// (in the format `@channelusername`). #[derive( diff --git a/src/types/chat_member.rs b/src/types/chat_member.rs index f13c4f37..71c24c09 100644 --- a/src/types/chat_member.rs +++ b/src/types/chat_member.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::User; /// This object contains information about one member of the chat. diff --git a/src/types/chat_permissions.rs b/src/types/chat_permissions.rs index 0542cec0..8ccee7ac 100644 --- a/src/types/chat_permissions.rs +++ b/src/types/chat_permissions.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// Describes actions that a non-administrator user is allowed to take in a /// chat. /// diff --git a/src/types/chat_photo.rs b/src/types/chat_photo.rs index 5c0a7d36..f7e5a9ec 100644 --- a/src/types/chat_photo.rs +++ b/src/types/chat_photo.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a chat photo. /// /// [The official docs](https://core.telegram.org/bots/api#chatphoto). diff --git a/src/types/chosen_inline_result.rs b/src/types/chosen_inline_result.rs index 16ced5f5..cbe3ebf2 100644 --- a/src/types/chosen_inline_result.rs +++ b/src/types/chosen_inline_result.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{Location, User}; /// Represents a [result] of an inline query that was chosen by the user and diff --git a/src/types/contact.rs b/src/types/contact.rs index 7aaddd18..d464e453 100644 --- a/src/types/contact.rs +++ b/src/types/contact.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a phone contact. /// /// [The official docs](https://core.telegram.org/bots/api#contact). diff --git a/src/types/document.rs b/src/types/document.rs index 0a741614..0e4b154f 100644 --- a/src/types/document.rs +++ b/src/types/document.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represents a general file (as opposed to [photos], [voice diff --git a/src/types/encrypted_credentials.rs b/src/types/encrypted_credentials.rs index 19374388..9bfd98c7 100644 --- a/src/types/encrypted_credentials.rs +++ b/src/types/encrypted_credentials.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// Contains data required for decrypting and authenticating /// [`EncryptedPassportElement`]. See the [Telegram Passport Documentation] for /// a complete description of the data decryption and authentication processes. diff --git a/src/types/encrypted_passport_element.rs b/src/types/encrypted_passport_element.rs index c83ed40b..b9fadbf0 100644 --- a/src/types/encrypted_passport_element.rs +++ b/src/types/encrypted_passport_element.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use super::PassportFile; /// Contains information about documents or other Telegram Passport elements diff --git a/src/types/file.rs b/src/types/file.rs index 3dfa26e1..a753d7cc 100644 --- a/src/types/file.rs +++ b/src/types/file.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a file ready to be downloaded. The file can be /// downloaded via the link `https://api.telegram.org/file/bot/`. /// It is guaranteed that the link will be valid for at least 1 hour. When the diff --git a/src/types/force_reply.rs b/src/types/force_reply.rs index 38e17453..351dc01b 100644 --- a/src/types/force_reply.rs +++ b/src/types/force_reply.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::True; /// Upon receiving a message with this object, Telegram clients will display a diff --git a/src/types/game.rs b/src/types/game.rs index b056b7f7..3aa44323 100644 --- a/src/types/game.rs +++ b/src/types/game.rs @@ -1,4 +1,4 @@ -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use crate::types::{Animation, MessageEntity, PhotoSize}; diff --git a/src/types/game_high_score.rs b/src/types/game_high_score.rs index 23a30f3e..c99d6cf9 100644 --- a/src/types/game_high_score.rs +++ b/src/types/game_high_score.rs @@ -1,4 +1,4 @@ -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use crate::types::user::User; diff --git a/src/types/inline_keyboard_button.rs b/src/types/inline_keyboard_button.rs index f1046372..6ad53ad0 100644 --- a/src/types/inline_keyboard_button.rs +++ b/src/types/inline_keyboard_button.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents one button of an inline keyboard. /// /// [The official docs](https://core.telegram.org/bots/api#inlinekeyboardbutton). diff --git a/src/types/inline_keyboard_markup.rs b/src/types/inline_keyboard_markup.rs index 964c0c89..3aff467c 100644 --- a/src/types/inline_keyboard_markup.rs +++ b/src/types/inline_keyboard_markup.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::InlineKeyboardButton; /// This object represents an [inline keyboard] that appears right next to the diff --git a/src/types/inline_query.rs b/src/types/inline_query.rs index c0e5d1ca..11ee35d7 100644 --- a/src/types/inline_query.rs +++ b/src/types/inline_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{Location, User}; /// This object represents an incoming inline query. When the user sends an diff --git a/src/types/inline_query_result.rs b/src/types/inline_query_result.rs index 7a481205..c1c63c6c 100644 --- a/src/types/inline_query_result.rs +++ b/src/types/inline_query_result.rs @@ -1,5 +1,8 @@ #![allow(clippy::large_enum_variant)] +use derive_more::From; +use serde::{Deserialize, Serialize}; + use crate::types::{ InlineQueryResultArticle, InlineQueryResultAudio, InlineQueryResultCachedAudio, InlineQueryResultCachedDocument, diff --git a/src/types/inline_query_result_article.rs b/src/types/inline_query_result_article.rs index 26bca3eb..14c65eac 100644 --- a/src/types/inline_query_result_article.rs +++ b/src/types/inline_query_result_article.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// Represents a link to an article or web page. diff --git a/src/types/inline_query_result_audio.rs b/src/types/inline_query_result_audio.rs index 9d457a32..4a45e22b 100644 --- a/src/types/inline_query_result_audio.rs +++ b/src/types/inline_query_result_audio.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to an MP3 audio file. By default, this audio file will be diff --git a/src/types/inline_query_result_cached_audio.rs b/src/types/inline_query_result_cached_audio.rs index 54bfe1b0..d2e9e483 100644 --- a/src/types/inline_query_result_cached_audio.rs +++ b/src/types/inline_query_result_cached_audio.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to an MP3 audio file stored on the Telegram servers. By diff --git a/src/types/inline_query_result_cached_document.rs b/src/types/inline_query_result_cached_document.rs index 8ca938fd..d56d3d5b 100644 --- a/src/types/inline_query_result_cached_document.rs +++ b/src/types/inline_query_result_cached_document.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a file stored on the Telegram servers. By default, this diff --git a/src/types/inline_query_result_cached_gif.rs b/src/types/inline_query_result_cached_gif.rs index 9bd97b06..40bef7ae 100644 --- a/src/types/inline_query_result_cached_gif.rs +++ b/src/types/inline_query_result_cached_gif.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to an animated GIF file stored on the Telegram servers. By diff --git a/src/types/inline_query_result_cached_mpeg4_gif.rs b/src/types/inline_query_result_cached_mpeg4_gif.rs index b0c1e669..e08e2993 100644 --- a/src/types/inline_query_result_cached_mpeg4_gif.rs +++ b/src/types/inline_query_result_cached_mpeg4_gif.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a video animation (H.264/MPEG-4 AVC video without diff --git a/src/types/inline_query_result_cached_photo.rs b/src/types/inline_query_result_cached_photo.rs index 23e2830a..8a081027 100644 --- a/src/types/inline_query_result_cached_photo.rs +++ b/src/types/inline_query_result_cached_photo.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a photo stored on the Telegram servers. By default, diff --git a/src/types/inline_query_result_cached_sticker.rs b/src/types/inline_query_result_cached_sticker.rs index 4024b323..98e4064a 100644 --- a/src/types/inline_query_result_cached_sticker.rs +++ b/src/types/inline_query_result_cached_sticker.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// Represents a link to a sticker stored on the Telegram servers. By default, diff --git a/src/types/inline_query_result_cached_video.rs b/src/types/inline_query_result_cached_video.rs index 65922091..c60ab75d 100644 --- a/src/types/inline_query_result_cached_video.rs +++ b/src/types/inline_query_result_cached_video.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a video file stored on the Telegram servers. By diff --git a/src/types/inline_query_result_cached_voice.rs b/src/types/inline_query_result_cached_voice.rs index 2b527002..8d7bac7e 100644 --- a/src/types/inline_query_result_cached_voice.rs +++ b/src/types/inline_query_result_cached_voice.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a voice message stored on the Telegram servers. By diff --git a/src/types/inline_query_result_contact.rs b/src/types/inline_query_result_contact.rs index c016eeca..4e737af8 100644 --- a/src/types/inline_query_result_contact.rs +++ b/src/types/inline_query_result_contact.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// Represents a contact with a phone number. By default, this contact will be diff --git a/src/types/inline_query_result_document.rs b/src/types/inline_query_result_document.rs index 68a4aa61..5bea12e3 100644 --- a/src/types/inline_query_result_document.rs +++ b/src/types/inline_query_result_document.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a file. By default, this file will be sent by the user diff --git a/src/types/inline_query_result_game.rs b/src/types/inline_query_result_game.rs index e64d16fa..8add4c5b 100644 --- a/src/types/inline_query_result_game.rs +++ b/src/types/inline_query_result_game.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::InlineKeyboardMarkup; /// Represents a [game]. diff --git a/src/types/inline_query_result_gif.rs b/src/types/inline_query_result_gif.rs index aa96b940..440b1ccb 100644 --- a/src/types/inline_query_result_gif.rs +++ b/src/types/inline_query_result_gif.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to an animated GIF file. By default, this animated GIF diff --git a/src/types/inline_query_result_location.rs b/src/types/inline_query_result_location.rs index 79c39dc9..979174fb 100644 --- a/src/types/inline_query_result_location.rs +++ b/src/types/inline_query_result_location.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// Represents a location on a map. By default, the location will be sent by the diff --git a/src/types/inline_query_result_mpeg4_gif.rs b/src/types/inline_query_result_mpeg4_gif.rs index ccc48b6e..602c210c 100644 --- a/src/types/inline_query_result_mpeg4_gif.rs +++ b/src/types/inline_query_result_mpeg4_gif.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a video animation (H.264/MPEG-4 AVC video without diff --git a/src/types/inline_query_result_photo.rs b/src/types/inline_query_result_photo.rs index df8f0e0b..02de2bf1 100644 --- a/src/types/inline_query_result_photo.rs +++ b/src/types/inline_query_result_photo.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a photo. By default, this photo will be sent by the diff --git a/src/types/inline_query_result_venue.rs b/src/types/inline_query_result_venue.rs index 982a6fe2..bddb88b4 100644 --- a/src/types/inline_query_result_venue.rs +++ b/src/types/inline_query_result_venue.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// Represents a venue. By default, the venue will be sent by the user. diff --git a/src/types/inline_query_result_video.rs b/src/types/inline_query_result_video.rs index 1721f76d..aed7fdad 100644 --- a/src/types/inline_query_result_video.rs +++ b/src/types/inline_query_result_video.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a page containing an embedded video player or a video diff --git a/src/types/inline_query_result_voice.rs b/src/types/inline_query_result_voice.rs index fc2227c7..d18a1ac6 100644 --- a/src/types/inline_query_result_voice.rs +++ b/src/types/inline_query_result_voice.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// Represents a link to a voice recording in an .ogg container encoded with diff --git a/src/types/input_file.rs b/src/types/input_file.rs index 1476a934..8d70c0c7 100644 --- a/src/types/input_file.rs +++ b/src/types/input_file.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use std::path::PathBuf; /// This object represents the contents of a file to be uploaded. @@ -60,7 +62,7 @@ impl From for Option { } } -impl serde::Serialize for InputFile { +impl Serialize for InputFile { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/src/types/input_media.rs b/src/types/input_media.rs index dff0d954..82648e09 100644 --- a/src/types/input_media.rs +++ b/src/types/input_media.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{InputFile, ParseMode}; // TODO: should variants use new-type? diff --git a/src/types/input_message_content.rs b/src/types/input_message_content.rs index 1a9b231a..6e844b59 100644 --- a/src/types/input_message_content.rs +++ b/src/types/input_message_content.rs @@ -1,4 +1,4 @@ -use serde::Serialize; +use serde::{Deserialize, Serialize}; use crate::types::ParseMode; diff --git a/src/types/invoice.rs b/src/types/invoice.rs index a4768e4c..ea402268 100644 --- a/src/types/invoice.rs +++ b/src/types/invoice.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object contains basic information about an invoice. /// /// [The official docs](https://core.telegram.org/bots/api#invoice). diff --git a/src/types/keyboard_button.rs b/src/types/keyboard_button.rs index 6efb2e98..4cb99624 100644 --- a/src/types/keyboard_button.rs +++ b/src/types/keyboard_button.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents one button of the reply keyboard. For filter text /// buttons String can be used instead of this object to specify text of the /// button. Optional fields are mutually exclusive. diff --git a/src/types/label_price.rs b/src/types/label_price.rs index 7774e440..22e3f9cd 100644 --- a/src/types/label_price.rs +++ b/src/types/label_price.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a portion of the price for goods or services. /// /// [The official docs](https://core.telegram.org/bots/api#labeledprice). diff --git a/src/types/location.rs b/src/types/location.rs index f1541be4..dbfafac5 100644 --- a/src/types/location.rs +++ b/src/types/location.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a point on the map. #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct Location { diff --git a/src/types/login_url.rs b/src/types/login_url.rs index 9feec06d..4d17d46b 100644 --- a/src/types/login_url.rs +++ b/src/types/login_url.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a parameter of the inline keyboard button used to /// automatically authorize a user. Serves as a great replacement for the /// [Telegram Login Widget] when the user is coming from Telegram. All the user diff --git a/src/types/mask_position.rs b/src/types/mask_position.rs index 3d905ce2..88f83eb7 100644 --- a/src/types/mask_position.rs +++ b/src/types/mask_position.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object describes the position on faces where a mask should be placed by /// default. /// diff --git a/src/types/message.rs b/src/types/message.rs index 5020b4b8..cc20d55e 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -1,5 +1,7 @@ #![allow(clippy::large_enum_variant)] +use serde::{Deserialize, Serialize}; + use crate::types::{ Animation, Audio, Chat, Contact, Document, Game, InlineKeyboardMarkup, Invoice, Location, MessageEntity, PassportData, PhotoSize, Poll, Sticker, diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index 1e4dda7d..d6372a4c 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::User; /// This object represents one special entity in a text message. For example, diff --git a/src/types/order_info.rs b/src/types/order_info.rs index 3c56b1a5..7d7742f3 100644 --- a/src/types/order_info.rs +++ b/src/types/order_info.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::ShippingAddress; /// This object represents information about an order. diff --git a/src/types/passport_data.rs b/src/types/passport_data.rs index e05c98d2..c1416af3 100644 --- a/src/types/passport_data.rs +++ b/src/types/passport_data.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use super::{EncryptedCredentials, EncryptedPassportElement}; /// Contains information about Telegram Passport data shared with the bot by the diff --git a/src/types/passport_file.rs b/src/types/passport_file.rs index cfdddcaf..cc5228c7 100644 --- a/src/types/passport_file.rs +++ b/src/types/passport_file.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a file uploaded to Telegram Passport. Currently all /// Telegram Passport files are in JPEG format when decrypted and don't exceed /// 10MB. diff --git a/src/types/photo_size.rs b/src/types/photo_size.rs index 0c4d1be6..775193b0 100644 --- a/src/types/photo_size.rs +++ b/src/types/photo_size.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents one size of a photo or a [file]/[sticker] thumbnail. /// /// [file]: crate::types::Document diff --git a/src/types/poll.rs b/src/types/poll.rs index e9f4138a..1cf82576 100644 --- a/src/types/poll.rs +++ b/src/types/poll.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object contains information about a poll. /// /// [The official docs](https://core.telegram.org/bots/api#poll). diff --git a/src/types/pre_checkout_query.rs b/src/types/pre_checkout_query.rs index 61bac96d..94145fc6 100644 --- a/src/types/pre_checkout_query.rs +++ b/src/types/pre_checkout_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{OrderInfo, User}; /// This object contains information about an incoming pre-checkout query. diff --git a/src/types/reply_keyboard_markup.rs b/src/types/reply_keyboard_markup.rs index d7ac209c..c0adda79 100644 --- a/src/types/reply_keyboard_markup.rs +++ b/src/types/reply_keyboard_markup.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::KeyboardButton; /// This object represents a [custom keyboard] with reply options (see diff --git a/src/types/reply_keyboard_remove.rs b/src/types/reply_keyboard_remove.rs index 45ec1339..1c8a4b5f 100644 --- a/src/types/reply_keyboard_remove.rs +++ b/src/types/reply_keyboard_remove.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::True; /// Upon receiving a message with this object, Telegram clients will remove the diff --git a/src/types/reply_markup.rs b/src/types/reply_markup.rs index 3db4f1d6..fd7a7306 100644 --- a/src/types/reply_markup.rs +++ b/src/types/reply_markup.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{ ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, }; diff --git a/src/types/response_parameters.rs b/src/types/response_parameters.rs index ca796f09..f885d36c 100644 --- a/src/types/response_parameters.rs +++ b/src/types/response_parameters.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// Contains information about why a request was unsuccessful. /// /// [The official docs](https://core.telegram.org/bots/api#responseparameters). diff --git a/src/types/send_invoice.rs b/src/types/send_invoice.rs index e7952ebb..046f4c8d 100644 --- a/src/types/send_invoice.rs +++ b/src/types/send_invoice.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{ChatId, InlineKeyboardMarkup, LabeledPrice}; #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] diff --git a/src/types/shipping_address.rs b/src/types/shipping_address.rs index 59ea2bd3..490c1586 100644 --- a/src/types/shipping_address.rs +++ b/src/types/shipping_address.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a shipping address. /// /// [The official docs](https://core.telegram.org/bots/api#shippingaddress). diff --git a/src/types/shipping_option.rs b/src/types/shipping_option.rs index b631973c..597592a9 100644 --- a/src/types/shipping_option.rs +++ b/src/types/shipping_option.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::LabeledPrice; /// This object represents one shipping option. diff --git a/src/types/shipping_query.rs b/src/types/shipping_query.rs index 7f99f7af..63e33850 100644 --- a/src/types/shipping_query.rs +++ b/src/types/shipping_query.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{ShippingAddress, User}; /// This object contains information about an incoming shipping query. diff --git a/src/types/sticker.rs b/src/types/sticker.rs index 93d1b028..49cf26bd 100644 --- a/src/types/sticker.rs +++ b/src/types/sticker.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::{MaskPosition, PhotoSize}; /// This object represents a sticker. diff --git a/src/types/sticker_set.rs b/src/types/sticker_set.rs index 9219d90c..612b83f8 100644 --- a/src/types/sticker_set.rs +++ b/src/types/sticker_set.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::Sticker; /// This object represents a sticker set. diff --git a/src/types/successful_payment.rs b/src/types/successful_payment.rs index 8519d0be..2f38327c 100644 --- a/src/types/successful_payment.rs +++ b/src/types/successful_payment.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::OrderInfo; /// This object contains basic information about a successful payment. diff --git a/src/types/update.rs b/src/types/update.rs index b49a1254..5f3b9d7c 100644 --- a/src/types/update.rs +++ b/src/types/update.rs @@ -1,5 +1,7 @@ #![allow(clippy::large_enum_variant)] +use serde::{Deserialize, Serialize}; + use crate::types::{CallbackQuery, ChosenInlineResult, InlineQuery, Message}; /// This [object] represents an incoming update. diff --git a/src/types/user.rs b/src/types/user.rs index 2ed37bcb..d7fafd02 100644 --- a/src/types/user.rs +++ b/src/types/user.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a Telegram user or bot. /// /// [The official docs](https://core.telegram.org/bots/api#user). diff --git a/src/types/user_profile_photos.rs b/src/types/user_profile_photos.rs index 0c40b554..9af7b401 100644 --- a/src/types/user_profile_photos.rs +++ b/src/types/user_profile_photos.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represent a user's profile pictures. diff --git a/src/types/venue.rs b/src/types/venue.rs index d7f70fac..998f244a 100644 --- a/src/types/venue.rs +++ b/src/types/venue.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::Location; /// This object represents a venue. diff --git a/src/types/video.rs b/src/types/video.rs index f92dc52d..eaf0876a 100644 --- a/src/types/video.rs +++ b/src/types/video.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represents a video file. diff --git a/src/types/video_note.rs b/src/types/video_note.rs index a4ee4c88..e8ef5572 100644 --- a/src/types/video_note.rs +++ b/src/types/video_note.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::types::PhotoSize; /// This object represents a [video message] (available in Telegram apps as of diff --git a/src/types/voice.rs b/src/types/voice.rs index ee47f461..d37b8efb 100644 --- a/src/types/voice.rs +++ b/src/types/voice.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// This object represents a voice note. /// /// [The official docs](https://core.telegram.org/bots/api#voice). diff --git a/src/types/webhook_info.rs b/src/types/webhook_info.rs index 07995be4..826a57ae 100644 --- a/src/types/webhook_info.rs +++ b/src/types/webhook_info.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// Contains information about the current status of a webhook. /// /// [The official docs](https://core.telegram.org/bots/api#webhookinfo).