From af9cf93c76d9a629a8912f015cd109fbc08e26c6 Mon Sep 17 00:00:00 2001 From: Waffle Date: Sat, 21 Sep 2019 00:02:37 +0300 Subject: [PATCH] Remove `core` module --- src/bot/mod.rs | 11 ++--- src/core/mod.rs | 3 -- src/lib.rs | 5 ++- src/{core => }/network/mod.rs | 2 +- .../requests/answer_pre_checkout_query.rs | 2 +- .../requests/answer_shipping_query.rs | 6 +-- .../requests/edit_message_live_location.rs | 6 +-- src/{core => }/requests/form_builder.rs | 2 +- src/{core => }/requests/forward_message.rs | 2 +- src/{core => }/requests/get_chat.rs | 6 +-- src/{core => }/requests/get_file.rs | 6 +-- src/{core => }/requests/get_me.rs | 2 +- .../requests/get_user_profile_photos.rs | 2 +- src/{core => }/requests/kick_chat_member.rs | 2 +- src/{core => }/requests/mod.rs | 0 .../requests/restrict_chat_member.rs | 2 +- src/{core => }/requests/send_audio.rs | 8 ++-- src/{core => }/requests/send_chat_action.rs | 4 +- src/{core => }/requests/send_contact.rs | 6 +-- src/{core => }/requests/send_location.rs | 2 +- src/{core => }/requests/send_media_group.rs | 2 +- src/{core => }/requests/send_message.rs | 8 ++-- src/{core => }/requests/send_photo.rs | 8 ++-- src/{core => }/requests/send_poll.rs | 6 +-- src/{core => }/requests/send_venue.rs | 6 +-- .../requests/stop_message_live_location.rs | 2 +- src/{core => }/requests/unban_chat_member.rs | 2 +- src/{core => }/requests/utils.rs | 0 src/{core => }/types/animation.rs | 2 +- src/{core => }/types/audio.rs | 6 +-- src/{core => }/types/callback_game.rs | 0 src/{core => }/types/callback_query.rs | 8 ++-- src/{core => }/types/chat.rs | 4 +- src/{core => }/types/chat_member.rs | 10 ++--- src/{core => }/types/chat_permissions.rs | 0 src/{core => }/types/chat_photo.rs | 0 src/{core => }/types/chosen_inline_result.rs | 2 +- src/{core => }/types/contact.rs | 0 src/{core => }/types/document.rs | 2 +- src/{core => }/types/file.rs | 0 src/{core => }/types/force_reply.rs | 0 src/{core => }/types/game.rs | 2 +- src/{core => }/types/game_high_score.rs | 4 +- .../types/inline_keyboard_button.rs | 2 +- .../types/inline_keyboard_markup.rs | 4 +- src/{core => }/types/inline_query.rs | 2 +- src/{core => }/types/inline_query_result.rs | 8 ++-- .../types/inline_query_result_article.rs | 2 +- .../types/inline_query_result_audio.rs | 4 +- .../types/inline_query_result_cached_audio.rs | 4 +- .../inline_query_result_cached_document.rs | 4 +- .../types/inline_query_result_cached_gif.rs | 4 +- .../inline_query_result_cached_mpeg4_gif.rs | 4 +- .../types/inline_query_result_cached_photo.rs | 4 +- .../inline_query_result_cached_sticker.rs | 2 +- .../types/inline_query_result_cached_video.rs | 4 +- .../types/inline_query_result_cached_voice.rs | 4 +- .../types/inline_query_result_contact.rs | 2 +- .../types/inline_query_result_document.rs | 4 +- .../types/inline_query_result_game.rs | 2 +- .../types/inline_query_result_gif.rs | 4 +- .../types/inline_query_result_location.rs | 2 +- .../types/inline_query_result_mpeg4_gif.rs | 4 +- .../types/inline_query_result_photo.rs | 4 +- .../types/inline_query_result_venue.rs | 2 +- .../types/inline_query_result_video.rs | 4 +- .../types/inline_query_result_voice.rs | 4 +- src/{core => }/types/input_file.rs | 0 src/{core => }/types/input_media.rs | 40 +++++++++---------- src/{core => }/types/input_message_content.rs | 8 ++-- src/{core => }/types/invoice.rs | 0 src/{core => }/types/keyboard_button.rs | 0 src/{core => }/types/label_price.rs | 0 src/{core => }/types/location.rs | 0 src/{core => }/types/login_url.rs | 0 src/{core => }/types/mask_position.rs | 0 src/{core => }/types/message.rs | 11 ++--- src/{core => }/types/message_entity.rs | 2 +- src/{core => }/types/mod.rs | 0 src/{core => }/types/not_implemented_types.rs | 0 src/{core => }/types/order_info.rs | 2 +- src/{core => }/types/parse_mode.rs | 0 src/{core => }/types/photo_size.rs | 0 src/{core => }/types/poll.rs | 0 src/{core => }/types/pre_checkout_query.rs | 2 +- src/{core => }/types/reply_keyboard_markup.rs | 2 +- src/{core => }/types/reply_keyboard_remove.rs | 0 src/{core => }/types/reply_markup.rs | 2 +- src/{core => }/types/response_parameters.rs | 0 src/{core => }/types/send_invoice.rs | 4 +- src/{core => }/types/shipping_address.rs | 0 src/{core => }/types/shipping_option.rs | 2 +- src/{core => }/types/shipping_query.rs | 2 +- src/{core => }/types/sticker.rs | 2 +- src/{core => }/types/sticker_set.rs | 2 +- src/{core => }/types/successful_payment.rs | 2 +- src/{core => }/types/update.rs | 2 +- src/{core => }/types/user.rs | 0 src/{core => }/types/user_profile_photos.rs | 4 +- src/{core => }/types/venue.rs | 2 +- src/{core => }/types/video.rs | 2 +- src/{core => }/types/video_note.rs | 2 +- src/{core => }/types/voice.rs | 0 src/{core => }/types/webhook_info.rs | 0 104 files changed, 153 insertions(+), 179 deletions(-) delete mode 100644 src/core/mod.rs rename src/{core => }/network/mod.rs (99%) rename src/{core => }/requests/answer_pre_checkout_query.rs (99%) rename src/{core => }/requests/answer_shipping_query.rs (96%) rename src/{core => }/requests/edit_message_live_location.rs (96%) rename src/{core => }/requests/form_builder.rs (99%) rename src/{core => }/requests/forward_message.rs (99%) rename src/{core => }/requests/get_chat.rs (87%) rename src/{core => }/requests/get_file.rs (94%) rename src/{core => }/requests/get_me.rs (97%) rename src/{core => }/requests/get_user_profile_photos.rs (93%) rename src/{core => }/requests/kick_chat_member.rs (92%) rename src/{core => }/requests/mod.rs (100%) rename src/{core => }/requests/restrict_chat_member.rs (78%) rename src/{core => }/requests/send_audio.rs (97%) rename src/{core => }/requests/send_chat_action.rs (97%) rename src/{core => }/requests/send_contact.rs (97%) rename src/{core => }/requests/send_location.rs (99%) rename src/{core => }/requests/send_media_group.rs (99%) rename src/{core => }/requests/send_message.rs (95%) rename src/{core => }/requests/send_photo.rs (96%) rename src/{core => }/requests/send_poll.rs (96%) rename src/{core => }/requests/send_venue.rs (97%) rename src/{core => }/requests/stop_message_live_location.rs (99%) rename src/{core => }/requests/unban_chat_member.rs (78%) rename src/{core => }/requests/utils.rs (100%) rename src/{core => }/types/animation.rs (98%) rename src/{core => }/types/audio.rs (93%) rename src/{core => }/types/callback_game.rs (100%) rename src/{core => }/types/callback_query.rs (88%) rename src/{core => }/types/chat.rs (97%) rename src/{core => }/types/chat_member.rs (97%) rename src/{core => }/types/chat_permissions.rs (100%) rename src/{core => }/types/chat_photo.rs (100%) rename src/{core => }/types/chosen_inline_result.rs (95%) rename src/{core => }/types/contact.rs (100%) rename src/{core => }/types/document.rs (87%) rename src/{core => }/types/file.rs (100%) rename src/{core => }/types/force_reply.rs (100%) rename src/{core => }/types/game.rs (94%) rename src/{core => }/types/game_high_score.rs (89%) rename src/{core => }/types/inline_keyboard_button.rs (98%) rename src/{core => }/types/inline_keyboard_markup.rs (97%) rename src/{core => }/types/inline_query.rs (91%) rename src/{core => }/types/inline_query_result.rs (95%) rename src/{core => }/types/inline_query_result_article.rs (94%) rename src/{core => }/types/inline_query_result_audio.rs (89%) rename src/{core => }/types/inline_query_result_cached_audio.rs (86%) rename src/{core => }/types/inline_query_result_cached_document.rs (88%) rename src/{core => }/types/inline_query_result_cached_gif.rs (87%) rename src/{core => }/types/inline_query_result_cached_mpeg4_gif.rs (87%) rename src/{core => }/types/inline_query_result_cached_photo.rs (89%) rename src/{core => }/types/inline_query_result_cached_sticker.rs (84%) rename src/{core => }/types/inline_query_result_cached_video.rs (88%) rename src/{core => }/types/inline_query_result_cached_voice.rs (86%) rename src/{core => }/types/inline_query_result_contact.rs (92%) rename src/{core => }/types/inline_query_result_document.rs (91%) rename src/{core => }/types/inline_query_result_game.rs (84%) rename src/{core => }/types/inline_query_result_gif.rs (91%) rename src/{core => }/types/inline_query_result_location.rs (91%) rename src/{core => }/types/inline_query_result_mpeg4_gif.rs (91%) rename src/{core => }/types/inline_query_result_photo.rs (92%) rename src/{core => }/types/inline_query_result_venue.rs (92%) rename src/{core => }/types/inline_query_result_video.rs (91%) rename src/{core => }/types/inline_query_result_voice.rs (88%) rename src/{core => }/types/input_file.rs (100%) rename src/{core => }/types/input_media.rs (89%) rename src/{core => }/types/input_message_content.rs (96%) rename src/{core => }/types/invoice.rs (100%) rename src/{core => }/types/keyboard_button.rs (100%) rename src/{core => }/types/label_price.rs (100%) rename src/{core => }/types/location.rs (100%) rename src/{core => }/types/login_url.rs (100%) rename src/{core => }/types/mask_position.rs (100%) rename src/{core => }/types/message.rs (98%) rename src/{core => }/types/message_entity.rs (96%) rename src/{core => }/types/mod.rs (100%) rename src/{core => }/types/not_implemented_types.rs (100%) rename src/{core => }/types/order_info.rs (83%) rename src/{core => }/types/parse_mode.rs (100%) rename src/{core => }/types/photo_size.rs (100%) rename src/{core => }/types/poll.rs (100%) rename src/{core => }/types/pre_checkout_query.rs (87%) rename src/{core => }/types/reply_keyboard_markup.rs (97%) rename src/{core => }/types/reply_keyboard_remove.rs (100%) rename src/{core => }/types/reply_markup.rs (92%) rename src/{core => }/types/response_parameters.rs (100%) rename src/{core => }/types/send_invoice.rs (90%) rename src/{core => }/types/shipping_address.rs (100%) rename src/{core => }/types/shipping_option.rs (95%) rename src/{core => }/types/shipping_query.rs (80%) rename src/{core => }/types/sticker.rs (86%) rename src/{core => }/types/sticker_set.rs (86%) rename src/{core => }/types/successful_payment.rs (91%) rename src/{core => }/types/update.rs (88%) rename src/{core => }/types/user.rs (100%) rename src/{core => }/types/user_profile_photos.rs (64%) rename src/{core => }/types/venue.rs (95%) rename src/{core => }/types/video.rs (94%) rename src/{core => }/types/video_note.rs (94%) rename src/{core => }/types/voice.rs (100%) rename src/{core => }/types/webhook_info.rs (100%) diff --git a/src/bot/mod.rs b/src/bot/mod.rs index bb55f28a..5f048744 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -1,8 +1,8 @@ use reqwest::r#async::Client; -use crate::core::network::{download_file, download_file_stream}; -use crate::core::requests::get_file::GetFile; -use crate::core::{ +use crate::network::{download_file, download_file_stream}; +use crate::requests::get_file::GetFile; +use crate::{ requests::{ edit_message_live_location::EditMessageLiveLocation, forward_message::ForwardMessage, get_me::GetMe, send_audio::SendAudio, @@ -58,10 +58,11 @@ impl Bot { /// ```no_run /// use async_telegram_bot::{ /// bot::Bot, - /// core::{requests::Request, types::File as TgFile}, + /// requests::Request, + /// types::File as TgFile, /// }; /// use tokio::fs::File; - /// # use async_telegram_bot::core::requests::RequestError; + /// # use async_telegram_bot::requests::RequestError; /// /// # async fn run() -> Result<(), Box> { /// let bot = Bot::new("TOKEN"); diff --git a/src/core/mod.rs b/src/core/mod.rs deleted file mode 100644 index bf462606..00000000 --- a/src/core/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub(crate) mod network; -pub mod requests; -pub mod types; diff --git a/src/lib.rs b/src/lib.rs index b916367d..a81abb4d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,11 @@ extern crate derive_more; #[macro_use] extern crate serde; +mod network; + pub mod bot; -pub mod core; pub mod errors; +pub mod requests; +pub mod types; pub use errors::DownloadError; diff --git a/src/core/network/mod.rs b/src/network/mod.rs similarity index 99% rename from src/core/network/mod.rs rename to src/network/mod.rs index 47d9f245..d45333d2 100644 --- a/src/core/network/mod.rs +++ b/src/network/mod.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ requests::{RequestError, ResponseResult}, types::ResponseParameters, }; diff --git a/src/core/requests/answer_pre_checkout_query.rs b/src/requests/answer_pre_checkout_query.rs similarity index 99% rename from src/core/requests/answer_pre_checkout_query.rs rename to src/requests/answer_pre_checkout_query.rs index f494ead8..03a26263 100644 --- a/src/core/requests/answer_pre_checkout_query.rs +++ b/src/requests/answer_pre_checkout_query.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{Request, RequestContext, RequestFuture, ResponseResult}, }; diff --git a/src/core/requests/answer_shipping_query.rs b/src/requests/answer_shipping_query.rs similarity index 96% rename from src/core/requests/answer_shipping_query.rs rename to src/requests/answer_shipping_query.rs index c66860c9..b0c26841 100644 --- a/src/core/requests/answer_shipping_query.rs +++ b/src/requests/answer_shipping_query.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::ShippingOption; +use crate::types::ShippingOption; #[derive(Debug, Clone, Serialize)] /// If you sent an invoice requesting a shipping address and the parameter diff --git a/src/core/requests/edit_message_live_location.rs b/src/requests/edit_message_live_location.rs similarity index 96% rename from src/core/requests/edit_message_live_location.rs rename to src/requests/edit_message_live_location.rs index 3d1171d8..8f43c504 100644 --- a/src/core/requests/edit_message_live_location.rs +++ b/src/requests/edit_message_live_location.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::{Message, ReplyMarkup}; +use crate::types::{Message, ReplyMarkup}; use serde::Serialize; #[derive(Debug, Clone, Serialize)] diff --git a/src/core/requests/form_builder.rs b/src/requests/form_builder.rs similarity index 99% rename from src/core/requests/form_builder.rs rename to src/requests/form_builder.rs index d9bd8b69..36ffe440 100644 --- a/src/core/requests/form_builder.rs +++ b/src/requests/form_builder.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use crate::core::{ +use crate::{ requests::{utils, ChatId}, types::{InputMedia, ParseMode}, }; diff --git a/src/core/requests/forward_message.rs b/src/requests/forward_message.rs similarity index 99% rename from src/core/requests/forward_message.rs rename to src/requests/forward_message.rs index ec24a7e3..c7091738 100644 --- a/src/core/requests/forward_message.rs +++ b/src/requests/forward_message.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, diff --git a/src/core/requests/get_chat.rs b/src/requests/get_chat.rs similarity index 87% rename from src/core/requests/get_chat.rs rename to src/requests/get_chat.rs index eecf2711..60651b6f 100644 --- a/src/core/requests/get_chat.rs +++ b/src/requests/get_chat.rs @@ -1,6 +1,6 @@ -use crate::core::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request}; -use crate::core::types::Chat; -use crate::core::network; +use crate::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request}; +use crate::types::Chat; +use crate::network; /// Use this method to get up to date information about the chat /// (current name of the user for one-on-one conversations, diff --git a/src/core/requests/get_file.rs b/src/requests/get_file.rs similarity index 94% rename from src/core/requests/get_file.rs rename to src/requests/get_file.rs index 9ab0788d..79995532 100644 --- a/src/core/requests/get_file.rs +++ b/src/requests/get_file.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::File; +use crate::types::File; /// Use this method to get basic info about a file and prepare it for /// downloading. For the moment, bots can download files of up to 20MB in size. diff --git a/src/core/requests/get_me.rs b/src/requests/get_me.rs similarity index 97% rename from src/core/requests/get_me.rs rename to src/requests/get_me.rs index 343b36e4..c933db9e 100644 --- a/src/core/requests/get_me.rs +++ b/src/requests/get_me.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{Request, RequestContext, RequestFuture, ResponseResult}, types::User, diff --git a/src/core/requests/get_user_profile_photos.rs b/src/requests/get_user_profile_photos.rs similarity index 93% rename from src/core/requests/get_user_profile_photos.rs rename to src/requests/get_user_profile_photos.rs index 0c6311ec..7123151b 100644 --- a/src/core/requests/get_user_profile_photos.rs +++ b/src/requests/get_user_profile_photos.rs @@ -1,4 +1,4 @@ -use crate::core::requests::RequestContext; +use crate::requests::RequestContext; //TODO: complete implementation after user_profile_fotos will be added to // types/mod.rs diff --git a/src/core/requests/kick_chat_member.rs b/src/requests/kick_chat_member.rs similarity index 92% rename from src/core/requests/kick_chat_member.rs rename to src/requests/kick_chat_member.rs index 41d6dbc5..b33616ce 100644 --- a/src/core/requests/kick_chat_member.rs +++ b/src/requests/kick_chat_member.rs @@ -1,4 +1,4 @@ -use crate::core::requests::RequestContext; +use crate::requests::RequestContext; //TODO:: need implementation /// Use this method to kick a user from a group, a supergroup or a channel. In /// the case of supergroups and channels, the user will not be able to return to diff --git a/src/core/requests/mod.rs b/src/requests/mod.rs similarity index 100% rename from src/core/requests/mod.rs rename to src/requests/mod.rs diff --git a/src/core/requests/restrict_chat_member.rs b/src/requests/restrict_chat_member.rs similarity index 78% rename from src/core/requests/restrict_chat_member.rs rename to src/requests/restrict_chat_member.rs index 161f45ab..6957922b 100644 --- a/src/core/requests/restrict_chat_member.rs +++ b/src/requests/restrict_chat_member.rs @@ -1,4 +1,4 @@ -use crate::core::requests::RequestContext; +use crate::requests::RequestContext; //TODO:: need implementation #[derive(Debug, Clone, Serialize)] diff --git a/src/core/requests/send_audio.rs b/src/requests/send_audio.rs similarity index 97% rename from src/core/requests/send_audio.rs rename to src/requests/send_audio.rs index 7580b7ce..77bc7da1 100644 --- a/src/core/requests/send_audio.rs +++ b/src/requests/send_audio.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::form_builder::FormBuilder, requests::{ @@ -32,10 +32,10 @@ pub struct SendAudio<'a> { /// if you want Telegram apps to show [bold, italic, fixed-width text /// or inline URLs] in the media caption. /// - /// [Markdown]: crate::core::types::ParseMode::Markdown - /// [Html]: crate::core::types::ParseMode::Html + /// [Markdown]: crate::types::ParseMode::Markdown + /// [Html]: crate::types::ParseMode::Html /// [bold, italic, fixed-width text or inline URLs]: - /// crate::core::types::ParseMode + /// crate::types::ParseMode pub parse_mode: Option, /// Duration of the audio in seconds pub duration: Option, diff --git a/src/core/requests/send_chat_action.rs b/src/requests/send_chat_action.rs similarity index 97% rename from src/core/requests/send_chat_action.rs rename to src/requests/send_chat_action.rs index 9b9bf940..67abc758 100644 --- a/src/core/requests/send_chat_action.rs +++ b/src/requests/send_chat_action.rs @@ -1,5 +1,5 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, }; diff --git a/src/core/requests/send_contact.rs b/src/requests/send_contact.rs similarity index 97% rename from src/core/requests/send_contact.rs rename to src/requests/send_contact.rs index a064dd21..4631b00b 100644 --- a/src/core/requests/send_contact.rs +++ b/src/requests/send_contact.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::{Message, ReplyMarkup}; +use crate::types::{Message, ReplyMarkup}; /// Use this method to send phone contacts. /// returned. diff --git a/src/core/requests/send_location.rs b/src/requests/send_location.rs similarity index 99% rename from src/core/requests/send_location.rs rename to src/requests/send_location.rs index 9dd8af1b..0596a32f 100644 --- a/src/core/requests/send_location.rs +++ b/src/requests/send_location.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, diff --git a/src/core/requests/send_media_group.rs b/src/requests/send_media_group.rs similarity index 99% rename from src/core/requests/send_media_group.rs rename to src/requests/send_media_group.rs index d95d4234..360dfc84 100644 --- a/src/core/requests/send_media_group.rs +++ b/src/requests/send_media_group.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network::request_multipart, requests::{ form_builder::FormBuilder, ChatId, Request, RequestContext, diff --git a/src/core/requests/send_message.rs b/src/requests/send_message.rs similarity index 95% rename from src/core/requests/send_message.rs rename to src/requests/send_message.rs index 2539c04d..f4f04636 100644 --- a/src/core/requests/send_message.rs +++ b/src/requests/send_message.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, @@ -23,10 +23,10 @@ pub struct SendMessage<'a> { /// if you want Telegram apps to show [bold, italic, fixed-width text /// or inline URLs] in the media caption. /// - /// [Markdown]: crate::core::types::ParseMode::Markdown - /// [Html]: crate::core::types::ParseMode::Html + /// [Markdown]: crate::types::ParseMode::Markdown + /// [Html]: crate::types::ParseMode::Html /// [bold, italic, fixed-width text or inline URLs]: - /// crate::core::types::ParseMode + /// crate::types::ParseMode #[serde(skip_serializing_if = "Option::is_none")] pub parse_mode: Option, /// Disables link previews for links in this message diff --git a/src/core/requests/send_photo.rs b/src/requests/send_photo.rs similarity index 96% rename from src/core/requests/send_photo.rs rename to src/requests/send_photo.rs index 69f1e5d7..b4e09152 100644 --- a/src/core/requests/send_photo.rs +++ b/src/requests/send_photo.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{ form_builder::FormBuilder, ChatId, Request, RequestContext, @@ -30,10 +30,10 @@ pub struct SendPhoto<'a> { /// if you want Telegram apps to show [bold, italic, fixed-width text /// or inline URLs] in the media caption. /// - /// [Markdown]: crate::core::types::ParseMode::Markdown - /// [Html]: crate::core::types::ParseMode::Html + /// [Markdown]: crate::types::ParseMode::Markdown + /// [Html]: crate::types::ParseMode::Html /// [bold, italic, fixed-width text or inline URLs]: - /// crate::core::types::ParseMode + /// crate::types::ParseMode pub parse_mode: Option, /// Sends the message silently. Users will receive a notification with no /// sound. diff --git a/src/core/requests/send_poll.rs b/src/requests/send_poll.rs similarity index 96% rename from src/core/requests/send_poll.rs rename to src/requests/send_poll.rs index 92a11901..b20e527b 100644 --- a/src/core/requests/send_poll.rs +++ b/src/requests/send_poll.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::{Message, ReplyMarkup}; +use crate::types::{Message, ReplyMarkup}; /// 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. diff --git a/src/core/requests/send_venue.rs b/src/requests/send_venue.rs similarity index 97% rename from src/core/requests/send_venue.rs rename to src/requests/send_venue.rs index cdb5fb90..14bfe1e6 100644 --- a/src/core/requests/send_venue.rs +++ b/src/requests/send_venue.rs @@ -1,8 +1,8 @@ -use crate::core::network; -use crate::core::requests::{ +use crate::network; +use crate::requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, }; -use crate::core::types::{Message, ReplyMarkup}; +use crate::types::{Message, ReplyMarkup}; /// Use this method to send information about a venue. /// Message is returned. diff --git a/src/core/requests/stop_message_live_location.rs b/src/requests/stop_message_live_location.rs similarity index 99% rename from src/core/requests/stop_message_live_location.rs rename to src/requests/stop_message_live_location.rs index 5fb62a54..809200d7 100644 --- a/src/core/requests/stop_message_live_location.rs +++ b/src/requests/stop_message_live_location.rs @@ -1,4 +1,4 @@ -use crate::core::{ +use crate::{ network, requests::{ ChatId, Request, RequestContext, RequestFuture, ResponseResult, diff --git a/src/core/requests/unban_chat_member.rs b/src/requests/unban_chat_member.rs similarity index 78% rename from src/core/requests/unban_chat_member.rs rename to src/requests/unban_chat_member.rs index 8f833b9b..d7a9b436 100644 --- a/src/core/requests/unban_chat_member.rs +++ b/src/requests/unban_chat_member.rs @@ -1,4 +1,4 @@ -use crate::core::requests::RequestContext; +use crate::requests::RequestContext; //TODO:: need implementation #[derive(Debug, Clone, Serialize)] diff --git a/src/core/requests/utils.rs b/src/requests/utils.rs similarity index 100% rename from src/core/requests/utils.rs rename to src/requests/utils.rs diff --git a/src/core/types/animation.rs b/src/types/animation.rs similarity index 98% rename from src/core/types/animation.rs rename to src/types/animation.rs index 5d2ceff1..ec3b92f9 100644 --- a/src/core/types/animation.rs +++ b/src/types/animation.rs @@ -1,4 +1,4 @@ -use crate::core::types::PhotoSize; +use crate::types::PhotoSize; #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] /// This object represents an animation file (GIF or H.264/MPEG-4 AVC video diff --git a/src/core/types/audio.rs b/src/types/audio.rs similarity index 93% rename from src/core/types/audio.rs rename to src/types/audio.rs index 66cc0878..fa17e27d 100644 --- a/src/core/types/audio.rs +++ b/src/types/audio.rs @@ -1,4 +1,4 @@ -use crate::core::types::PhotoSize; +use crate::types::PhotoSize; #[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)] pub struct Audio { @@ -42,8 +42,8 @@ mod tests { file_id: "id".to_string(), width: 320, height: 320, - file_size: Some(3452) - }) + file_size: Some(3452), + }), }; let actual = serde_json::from_str::