From 78de48bfd68b399b462424a0834cef132fdc8fe7 Mon Sep 17 00:00:00 2001 From: EdJoPaTo Date: Tue, 17 Sep 2024 20:17:57 +0200 Subject: [PATCH] style: group imports (#217) * style: group imports requires nightly for `cargo fmt` (`cargo +nightly fmt`). Without nightly it prints warnings but continues to work. * style: inline async_trait --- .github/workflows/rust.yml | 32 ++---- examples/api_trait_implementation.rs | 10 +- examples/async_custom_client.rs | 4 +- examples/async_file_upload.rs | 3 +- examples/async_get_me.rs | 3 +- examples/async_reply_to_message_updates.rs | 9 +- examples/custom_client.rs | 4 +- examples/get_me.rs | 3 +- examples/inline_keyboard.rs | 9 +- examples/reply_keyboard.rs | 9 +- examples/reply_to_message_updates.rs | 8 +- rustfmt.toml | 8 ++ src/api_params.rs | 9 +- src/client_reqwest.rs | 10 +- src/client_ureq.rs | 107 ++++++--------------- src/error.rs | 3 +- src/objects.rs | 6 +- src/response.rs | 3 +- src/trait_async.rs | 63 +++--------- src/trait_sync.rs | 60 +++--------- 20 files changed, 121 insertions(+), 242 deletions(-) create mode 100644 rustfmt.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a337a2b..422a604 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,7 +1,8 @@ -name: Test and Build Rust +name: Rust on: push: + branches-ignore: ["dependabot/**"] pull_request: workflow_dispatch: schedule: @@ -12,16 +13,13 @@ jobs: rustfmt: runs-on: ubuntu-latest steps: - - name: Setup Rust - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: stable components: rustfmt - uses: actions/checkout@v4 - run: cargo fmt --check --verbose clippy: - name: Clippy ${{ matrix.toolchain }} runs-on: ubuntu-latest continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }} strategy: @@ -34,9 +32,8 @@ jobs: env: RUSTFLAGS: --deny warnings steps: - - name: Setup Rust + - uses: dtolnay/rust-toolchain@master id: rust - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} components: clippy @@ -50,7 +47,6 @@ jobs: - run: cargo doc --offline --all-features --no-deps features: - name: Features ${{ matrix.toolchain }} ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -65,16 +61,11 @@ jobs: env: RUSTFLAGS: --allow unknown-lints --deny warnings steps: - - name: Setup Rust + - uses: dtolnay/rust-toolchain@master id: rust - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} - - - name: Install cargo-hack - uses: taiki-e/install-action@v2 - with: - tool: cargo-hack + - uses: taiki-e/install-action@cargo-hack - uses: actions/checkout@v4 - run: cargo fetch @@ -90,7 +81,6 @@ jobs: run: cargo hack --keep-going --feature-powerset --no-dev-deps check --offline test: - name: Test ${{ matrix.toolchain }} ${{ matrix.os }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.toolchain == 'nightly' }} strategy: @@ -105,9 +95,8 @@ jobs: - macos-latest - windows-latest steps: - - name: Setup Rust + - uses: dtolnay/rust-toolchain@master id: rust - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} - uses: actions/checkout@v4 @@ -149,11 +138,9 @@ jobs: env: RUSTFLAGS: --deny warnings steps: - - name: Setup Rust + - uses: dtolnay/rust-toolchain@stable id: rust - uses: dtolnay/rust-toolchain@master with: - toolchain: stable targets: ${{ matrix.triple }} - name: Install cargo tools @@ -169,5 +156,4 @@ jobs: key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }} path: target/ - - name: Build - run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --all-features --target ${{ matrix.triple }} + - run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --all-features --target ${{ matrix.triple }} diff --git a/examples/api_trait_implementation.rs b/examples/api_trait_implementation.rs index 68dacb6..aa973a9 100644 --- a/examples/api_trait_implementation.rs +++ b/examples/api_trait_implementation.rs @@ -1,9 +1,11 @@ -use frankenstein::ErrorResponse; -use frankenstein::SendMessageParams; -use frankenstein::TelegramApi; -use isahc::{prelude::*, Request}; use std::path::PathBuf; +use frankenstein::api_params::SendMessageParams; +use frankenstein::response::ErrorResponse; +use frankenstein::TelegramApi; +use isahc::prelude::*; +use isahc::Request; + static TOKEN: &str = "TOKEN"; static BASE_API_URL: &str = "https://api.telegram.org/bot"; static CHAT_ID: i64 = 1; diff --git a/examples/async_custom_client.rs b/examples/async_custom_client.rs index fd1ecfc..9e9e98f 100644 --- a/examples/async_custom_client.rs +++ b/examples/async_custom_client.rs @@ -1,7 +1,7 @@ -use frankenstein::AsyncApi; -use frankenstein::AsyncTelegramApi; use std::time::Duration; +use frankenstein::{AsyncApi, AsyncTelegramApi}; + static TOKEN: &str = "API_TOKEN"; static BASE_API_URL: &str = "https://api.telegram.org/bot"; diff --git a/examples/async_file_upload.rs b/examples/async_file_upload.rs index 2d7bee9..58e6a1e 100644 --- a/examples/async_file_upload.rs +++ b/examples/async_file_upload.rs @@ -1,6 +1,5 @@ use frankenstein::api_params::SendPhotoParams; -use frankenstein::AsyncApi; -use frankenstein::AsyncTelegramApi; +use frankenstein::{AsyncApi, AsyncTelegramApi}; static TOKEN: &str = "TOKEN"; static CHAT_ID: i64 = 1; diff --git a/examples/async_get_me.rs b/examples/async_get_me.rs index 6a69d06..ef0e104 100644 --- a/examples/async_get_me.rs +++ b/examples/async_get_me.rs @@ -1,5 +1,4 @@ -use frankenstein::AsyncApi; -use frankenstein::AsyncTelegramApi; +use frankenstein::{AsyncApi, AsyncTelegramApi}; static TOKEN: &str = "API_TOKEN"; diff --git a/examples/async_reply_to_message_updates.rs b/examples/async_reply_to_message_updates.rs index 40681a2..9c8abd1 100644 --- a/examples/async_reply_to_message_updates.rs +++ b/examples/async_reply_to_message_updates.rs @@ -1,9 +1,6 @@ -use frankenstein::AsyncTelegramApi; -use frankenstein::GetUpdatesParams; -use frankenstein::Message; -use frankenstein::ReplyParameters; -use frankenstein::SendMessageParams; -use frankenstein::{AsyncApi, UpdateContent}; +use frankenstein::api_params::{GetUpdatesParams, ReplyParameters, SendMessageParams}; +use frankenstein::objects::{Message, UpdateContent}; +use frankenstein::{AsyncApi, AsyncTelegramApi}; static TOKEN: &str = "API_TOKEN"; diff --git a/examples/custom_client.rs b/examples/custom_client.rs index 4a6b462..009e91a 100644 --- a/examples/custom_client.rs +++ b/examples/custom_client.rs @@ -1,7 +1,7 @@ -use frankenstein::Api; -use frankenstein::TelegramApi; use std::time::Duration; +use frankenstein::{Api, TelegramApi}; + static TOKEN: &str = "API_TOKEN"; static BASE_API_URL: &str = "https://api.telegram.org/bot"; diff --git a/examples/get_me.rs b/examples/get_me.rs index 1ca279f..7ce6198 100644 --- a/examples/get_me.rs +++ b/examples/get_me.rs @@ -1,5 +1,4 @@ -use frankenstein::Api; -use frankenstein::TelegramApi; +use frankenstein::{Api, TelegramApi}; static TOKEN: &str = "API_TOKEN"; diff --git a/examples/inline_keyboard.rs b/examples/inline_keyboard.rs index 7dae94f..32b178d 100644 --- a/examples/inline_keyboard.rs +++ b/examples/inline_keyboard.rs @@ -1,9 +1,6 @@ -use frankenstein::Api; -use frankenstein::InlineKeyboardButton; -use frankenstein::InlineKeyboardMarkup; -use frankenstein::ReplyMarkup; -use frankenstein::SendMessageParams; -use frankenstein::TelegramApi; +use frankenstein::api_params::{ReplyMarkup, SendMessageParams}; +use frankenstein::objects::{InlineKeyboardButton, InlineKeyboardMarkup}; +use frankenstein::{Api, TelegramApi}; // replace with your token static TOKEN: &str = "TOKEN"; diff --git a/examples/reply_keyboard.rs b/examples/reply_keyboard.rs index 9780a7f..2014347 100644 --- a/examples/reply_keyboard.rs +++ b/examples/reply_keyboard.rs @@ -1,9 +1,6 @@ -use frankenstein::Api; -use frankenstein::KeyboardButton; -use frankenstein::ReplyKeyboardMarkup; -use frankenstein::ReplyMarkup; -use frankenstein::SendMessageParams; -use frankenstein::TelegramApi; +use frankenstein::api_params::{ReplyMarkup, SendMessageParams}; +use frankenstein::objects::{KeyboardButton, ReplyKeyboardMarkup}; +use frankenstein::{Api, TelegramApi}; // replace with your token static TOKEN: &str = "TOKEN"; diff --git a/examples/reply_to_message_updates.rs b/examples/reply_to_message_updates.rs index 8531c34..dcbf262 100644 --- a/examples/reply_to_message_updates.rs +++ b/examples/reply_to_message_updates.rs @@ -1,8 +1,6 @@ -use frankenstein::GetUpdatesParams; -use frankenstein::ReplyParameters; -use frankenstein::SendMessageParams; -use frankenstein::TelegramApi; -use frankenstein::{Api, UpdateContent}; +use frankenstein::api_params::{GetUpdatesParams, ReplyParameters, SendMessageParams}; +use frankenstein::objects::UpdateContent; +use frankenstein::{Api, TelegramApi}; static TOKEN: &str = "API_TOKEN"; diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..d3f9cda --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,8 @@ +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md +format_code_in_doc_comments=true +format_macro_matchers=true +group_imports="StdExternalCrate" +imports_granularity="Module" +normalize_doc_attributes=true +reorder_impl_items=true +use_field_init_shorthand=true diff --git a/src/api_params.rs b/src/api_params.rs index df6e2ae..a171d93 100644 --- a/src/api_params.rs +++ b/src/api_params.rs @@ -1,5 +1,10 @@ //! Parameters to Telegram API methods. +use std::path::PathBuf; + +use macro_rules_attribute::apply; +use serde::{Deserialize, Serialize}; + use crate::macros::builder; use crate::objects::{ AllowedUpdate, BotCommand, ChatAdministratorRights, ChatPermissions, ForceReply, @@ -19,10 +24,6 @@ use crate::objects::{ WebAppInfo, }; use crate::ParseMode; -use macro_rules_attribute::apply; -use serde::Deserialize; -use serde::Serialize; -use std::path::PathBuf; #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(untagged)] diff --git a/src/client_reqwest.rs b/src/client_reqwest.rs index 812a9bd..26ced41 100644 --- a/src/client_reqwest.rs +++ b/src/client_reqwest.rs @@ -1,13 +1,15 @@ -use crate::trait_async::AsyncTelegramApi; -use crate::Error; +use std::path::PathBuf; +use std::time::Duration; + use async_trait::async_trait; use bon::Builder; use reqwest::multipart; use serde_json::Value; -use std::path::PathBuf; -use std::time::Duration; use tokio::fs::File; +use crate::trait_async::AsyncTelegramApi; +use crate::Error; + /// Asynchronous [`AsyncTelegramApi`] client implementation with [`reqwest`]. #[derive(Debug, Clone, Builder)] #[must_use = "API needs to be used in order to be useful"] diff --git a/src/client_ureq.rs b/src/client_ureq.rs index 14ebc18..af2785b 100644 --- a/src/client_ureq.rs +++ b/src/client_ureq.rs @@ -1,12 +1,14 @@ -use crate::trait_sync::TelegramApi; -use crate::Error; +use std::path::PathBuf; +use std::time::Duration; + use bon::Builder; use multipart::client::lazy::Multipart; use serde_json::Value; -use std::path::PathBuf; -use std::time::Duration; use ureq::Response; +use crate::trait_sync::TelegramApi; +use crate::Error; + /// Synchronous [`TelegramApi`] client implementation with [`ureq`]. #[derive(Debug, Clone, Builder)] #[must_use = "API needs to be used in order to be useful"] @@ -142,80 +144,29 @@ impl TelegramApi for Api { #[cfg(test)] mod tests { use super::*; - use crate::api_params::AnswerCallbackQueryParams; - use crate::api_params::AnswerInlineQueryParams; - use crate::api_params::BanChatMemberParams; - use crate::api_params::BotCommandScope; - use crate::api_params::BotCommandScopeChat; - use crate::api_params::ChatAction; - use crate::api_params::ChatId; - use crate::api_params::CopyMessageParams; - use crate::api_params::CreateChatInviteLinkParams; - use crate::api_params::DeleteChatPhotoParams; - use crate::api_params::DeleteChatStickerSetParams; - use crate::api_params::DeleteMessageParams; - use crate::api_params::DeleteMyCommandsParams; - use crate::api_params::DeleteWebhookParams; - use crate::api_params::EditChatInviteLinkParams; - use crate::api_params::EditMessageCaptionParams; - use crate::api_params::EditMessageLiveLocationParams; - use crate::api_params::EditMessageMediaParams; - use crate::api_params::EditMessageTextParams; - use crate::api_params::ExportChatInviteLinkParams; - use crate::api_params::FileUpload; - use crate::api_params::ForwardMessageParams; - use crate::api_params::GetChatAdministratorsParams; - use crate::api_params::GetChatMemberCountParams; - use crate::api_params::GetChatMemberParams; - use crate::api_params::GetChatParams; - use crate::api_params::GetFileParams; - use crate::api_params::GetMyCommandsParams; - use crate::api_params::GetStickerSetParams; - use crate::api_params::GetUpdatesParams; - use crate::api_params::GetUserProfilePhotosParams; - use crate::api_params::InlineQueryResult; - use crate::api_params::InputFile; - use crate::api_params::InputMedia; - use crate::api_params::InputMediaPhoto; - use crate::api_params::LeaveChatParams; - use crate::api_params::Media; - use crate::api_params::PinChatMessageParams; - use crate::api_params::PromoteChatMemberParams; - use crate::api_params::RestrictChatMemberParams; - use crate::api_params::RevokeChatInviteLinkParams; - use crate::api_params::SendAnimationParams; - use crate::api_params::SendAudioParams; - use crate::api_params::SendChatActionParams; - use crate::api_params::SendContactParams; - use crate::api_params::SendDiceParams; - use crate::api_params::SendDocumentParams; - use crate::api_params::SendLocationParams; - use crate::api_params::SendMediaGroupParams; - use crate::api_params::SendMessageParams; - use crate::api_params::SendPhotoParams; - use crate::api_params::SendPollParams; - use crate::api_params::SendStickerParams; - use crate::api_params::SendVenueParams; - use crate::api_params::SendVideoNoteParams; - use crate::api_params::SendVideoParams; - use crate::api_params::SendVoiceParams; - use crate::api_params::SetChatAdministratorCustomTitleParams; - use crate::api_params::SetChatDescriptionParams; - use crate::api_params::SetChatPermissionsParams; - use crate::api_params::SetChatPhotoParams; - use crate::api_params::SetChatStickerSetParams; - use crate::api_params::SetChatTitleParams; - use crate::api_params::SetMyCommandsParams; - use crate::api_params::SetWebhookParams; - use crate::api_params::StopMessageLiveLocationParams; - use crate::api_params::StopPollParams; - use crate::api_params::UnbanChatMemberParams; - use crate::api_params::UnpinChatMessageParams; - use crate::objects::AllowedUpdate; - use crate::objects::BotCommand; - use crate::objects::ChatPermissions; - use crate::objects::InlineQueryResultVenue; - use crate::objects::InputPollOption; + use crate::api_params::{ + AnswerCallbackQueryParams, AnswerInlineQueryParams, BanChatMemberParams, BotCommandScope, + BotCommandScopeChat, ChatAction, ChatId, CopyMessageParams, CreateChatInviteLinkParams, + DeleteChatPhotoParams, DeleteChatStickerSetParams, DeleteMessageParams, + DeleteMyCommandsParams, DeleteWebhookParams, EditChatInviteLinkParams, + EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, + EditMessageTextParams, ExportChatInviteLinkParams, FileUpload, ForwardMessageParams, + GetChatAdministratorsParams, GetChatMemberCountParams, GetChatMemberParams, GetChatParams, + GetFileParams, GetMyCommandsParams, GetStickerSetParams, GetUpdatesParams, + GetUserProfilePhotosParams, InlineQueryResult, InputFile, InputMedia, InputMediaPhoto, + LeaveChatParams, Media, PinChatMessageParams, PromoteChatMemberParams, + RestrictChatMemberParams, RevokeChatInviteLinkParams, SendAnimationParams, SendAudioParams, + SendChatActionParams, SendContactParams, SendDiceParams, SendDocumentParams, + SendLocationParams, SendMediaGroupParams, SendMessageParams, SendPhotoParams, + SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, + SendVoiceParams, SetChatAdministratorCustomTitleParams, SetChatDescriptionParams, + SetChatPermissionsParams, SetChatPhotoParams, SetChatStickerSetParams, SetChatTitleParams, + SetMyCommandsParams, SetWebhookParams, StopMessageLiveLocationParams, StopPollParams, + UnbanChatMemberParams, UnpinChatMessageParams, + }; + use crate::objects::{ + AllowedUpdate, BotCommand, ChatPermissions, InlineQueryResultVenue, InputPollOption, + }; #[test] fn new_sets_correct_url() { diff --git a/src/error.rs b/src/error.rs index 02e6b16..da9a336 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,7 @@ -use crate::response::ErrorResponse; use serde::{Deserialize, Serialize}; +use crate::response::ErrorResponse; + #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, thiserror::Error)] #[non_exhaustive] #[serde(untagged)] diff --git a/src/objects.rs b/src/objects.rs index 0b87edb..1835cc6 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -1,11 +1,13 @@ //! Objects returned or used with the Telegram API. #![allow(deprecated)] + +use macro_rules_attribute::apply; +use serde::{Deserialize, Serialize}; + use crate::api_params::FileUpload; use crate::macros::builder; use crate::ParseMode; -use macro_rules_attribute::apply; -use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] diff --git a/src/response.rs b/src/response.rs index f2b2a4e..0efa806 100644 --- a/src/response.rs +++ b/src/response.rs @@ -4,9 +4,10 @@ #![allow(clippy::module_name_repetitions)] -use crate::objects::{Message, ResponseParameters}; use serde::{Deserialize, Serialize}; +use crate::objects::{Message, ResponseParameters}; + #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct MethodResponse { /// Always true diff --git a/src/trait_async.rs b/src/trait_async.rs index 8ed0a9b..cf550fa 100644 --- a/src/trait_async.rs +++ b/src/trait_async.rs @@ -1,51 +1,20 @@ -use crate::api_params::AddStickerToSetParams; -use crate::api_params::CreateNewStickerSetParams; -use crate::api_params::EditMessageMediaParams; -use crate::api_params::FileUpload; -use crate::api_params::InputMedia; -use crate::api_params::Media; -use crate::api_params::SendAnimationParams; -use crate::api_params::SendAudioParams; -use crate::api_params::SendDocumentParams; -use crate::api_params::SendMediaGroupParams; -use crate::api_params::SendPhotoParams; -use crate::api_params::SendStickerParams; -use crate::api_params::SendVideoNoteParams; -use crate::api_params::SendVideoParams; -use crate::api_params::SendVoiceParams; -use crate::api_params::SetChatPhotoParams; -use crate::api_params::SetStickerSetThumbnailParams; -use crate::api_params::UploadStickerFileParams; -use crate::objects::BotCommand; -use crate::objects::BotDescription; -use crate::objects::BotName; -use crate::objects::BotShortDescription; -use crate::objects::BusinessConnection; -use crate::objects::ChatAdministratorRights; -use crate::objects::ChatFullInfo; -use crate::objects::ChatInviteLink; -use crate::objects::ChatMember; -use crate::objects::File as FileObject; -use crate::objects::ForumTopic; -use crate::objects::GameHighScore; -use crate::objects::InputSticker; -use crate::objects::MenuButton; -use crate::objects::Message; -use crate::objects::MessageId; -use crate::objects::Poll; -use crate::objects::SentWebAppMessage; -use crate::objects::StarTransactions; -use crate::objects::Sticker; -use crate::objects::StickerSet; -use crate::objects::Update; -use crate::objects::User; -use crate::objects::UserChatBoosts; -use crate::objects::UserProfilePhotos; -use crate::objects::WebhookInfo; -use crate::response::{MessageOrBool, MethodResponse}; -use async_trait::async_trait; use std::path::PathBuf; +use crate::api_params::{ + AddStickerToSetParams, CreateNewStickerSetParams, EditMessageMediaParams, FileUpload, + InputMedia, Media, SendAnimationParams, SendAudioParams, SendDocumentParams, + SendMediaGroupParams, SendPhotoParams, SendStickerParams, SendVideoNoteParams, SendVideoParams, + SendVoiceParams, SetChatPhotoParams, SetStickerSetThumbnailParams, UploadStickerFileParams, +}; +use crate::objects::{ + BotCommand, BotDescription, BotName, BotShortDescription, BusinessConnection, + ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, File as FileObject, + ForumTopic, GameHighScore, InputSticker, MenuButton, Message, MessageId, Poll, + SentWebAppMessage, StarTransactions, Sticker, StickerSet, Update, User, UserChatBoosts, + UserProfilePhotos, WebhookInfo, +}; +use crate::response::{MessageOrBool, MethodResponse}; + macro_rules! request { ($name:ident, $return:ty) => { paste::paste! { @@ -79,7 +48,7 @@ macro_rules! request_nb { } } -#[async_trait] +#[async_trait::async_trait] pub trait AsyncTelegramApi where Self: Sync, diff --git a/src/trait_sync.rs b/src/trait_sync.rs index f5d827f..f81047c 100644 --- a/src/trait_sync.rs +++ b/src/trait_sync.rs @@ -1,50 +1,20 @@ -use crate::api_params::AddStickerToSetParams; -use crate::api_params::CreateNewStickerSetParams; -use crate::api_params::EditMessageMediaParams; -use crate::api_params::FileUpload; -use crate::api_params::InputMedia; -use crate::api_params::Media; -use crate::api_params::SendAnimationParams; -use crate::api_params::SendAudioParams; -use crate::api_params::SendDocumentParams; -use crate::api_params::SendMediaGroupParams; -use crate::api_params::SendPhotoParams; -use crate::api_params::SendStickerParams; -use crate::api_params::SendVideoNoteParams; -use crate::api_params::SendVideoParams; -use crate::api_params::SendVoiceParams; -use crate::api_params::SetChatPhotoParams; -use crate::api_params::SetStickerSetThumbnailParams; -use crate::api_params::UploadStickerFileParams; -use crate::objects::BotCommand; -use crate::objects::BotDescription; -use crate::objects::BotName; -use crate::objects::BotShortDescription; -use crate::objects::BusinessConnection; -use crate::objects::ChatAdministratorRights; -use crate::objects::ChatFullInfo; -use crate::objects::ChatInviteLink; -use crate::objects::ChatMember; -use crate::objects::File as FileObject; -use crate::objects::ForumTopic; -use crate::objects::GameHighScore; -use crate::objects::InputSticker; -use crate::objects::MenuButton; -use crate::objects::Message; -use crate::objects::MessageId; -use crate::objects::Poll; -use crate::objects::SentWebAppMessage; -use crate::objects::StarTransactions; -use crate::objects::Sticker; -use crate::objects::StickerSet; -use crate::objects::Update; -use crate::objects::User; -use crate::objects::UserChatBoosts; -use crate::objects::UserProfilePhotos; -use crate::objects::WebhookInfo; -use crate::response::{MessageOrBool, MethodResponse}; use std::path::PathBuf; +use crate::api_params::{ + AddStickerToSetParams, CreateNewStickerSetParams, EditMessageMediaParams, FileUpload, + InputMedia, Media, SendAnimationParams, SendAudioParams, SendDocumentParams, + SendMediaGroupParams, SendPhotoParams, SendStickerParams, SendVideoNoteParams, SendVideoParams, + SendVoiceParams, SetChatPhotoParams, SetStickerSetThumbnailParams, UploadStickerFileParams, +}; +use crate::objects::{ + BotCommand, BotDescription, BotName, BotShortDescription, BusinessConnection, + ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, File as FileObject, + ForumTopic, GameHighScore, InputSticker, MenuButton, Message, MessageId, Poll, + SentWebAppMessage, StarTransactions, Sticker, StickerSet, Update, User, UserChatBoosts, + UserProfilePhotos, WebhookInfo, +}; +use crate::response::{MessageOrBool, MethodResponse}; + macro_rules! request { ($name:ident, $return:ty) => { paste::paste! {