Prettify src/requests.rs and src/types.rs

This commit is contained in:
Temirkhan Myrzamadi 2019-10-17 14:02:36 +06:00
parent 65a61a1849
commit 07ad965562
2 changed files with 115 additions and 111 deletions

View file

@ -1,30 +1,38 @@
//! Raw API functions.
use async_trait::async_trait;
use serde::de::DeserializeOwned;
use async_trait::async_trait;
use crate::RequestError;
pub use self::{
answer_pre_checkout_query::AnswerPreCheckoutQuery,
answer_shipping_query::AnswerShippingQuery,
edit_message_live_location::EditMessageLiveLocation,
forward_message::ForwardMessage, get_chat::GetChat, get_file::GetFile,
get_me::GetMe, get_updates::GetUpdates,
get_user_profile_photos::GetUserProfilePhotos,
kick_chat_member::KickChatMember, pin_chat_message::PinChatMessage,
promote_chat_member::PromoteChatMember,
restrict_chat_member::RestrictChatMember, send_animation::SendAnimation,
send_audio::SendAudio, send_chat_action::SendChatAction,
send_contact::SendContact, send_document::SendDocument,
send_location::SendLocation, send_media_group::SendMediaGroup,
send_message::SendMessage, send_photo::SendPhoto, send_poll::SendPoll,
send_venue::SendVenue, send_video::SendVideo,
send_video_note::SendVideoNote, send_voice::SendVoice,
stop_message_live_location::StopMessageLiveLocation,
unban_chat_member::UnbanChatMember, unpin_chat_message::UnpinChatMessage,
};
pub use answer_pre_checkout_query::*;
pub use answer_shipping_query::*;
pub use edit_message_live_location::*;
pub use forward_message::*;
pub use get_chat::*;
pub use get_file::*;
pub use get_me::*;
pub use get_updates::*;
pub use get_user_profile_photos::*;
pub use kick_chat_member::*;
pub use pin_chat_message::*;
pub use promote_chat_member::*;
pub use restrict_chat_member::*;
pub use send_animation::*;
pub use send_audio::*;
pub use send_chat_action::*;
pub use send_contact::*;
pub use send_document::*;
pub use send_location::*;
pub use send_media_group::*;
pub use send_message::*;
pub use send_photo::*;
pub use send_poll::*;
pub use send_venue::*;
pub use send_video::*;
pub use send_video_note::*;
pub use send_voice::*;
pub use stop_message_live_location::*;
pub use unban_chat_member::*;
pub use unpin_chat_message::*;
mod form_builder;
mod utils;
@ -61,7 +69,7 @@ mod unban_chat_member;
mod unpin_chat_message;
/// A type that is returned from `Request::send_boxed`.
pub type ResponseResult<T> = Result<T, RequestError>;
pub type ResponseResult<T> = Result<T, crate::RequestError>;
/// A request that can be sent to Telegram.
#[async_trait]

View file

@ -1,92 +1,88 @@
//! Raw API structures.
pub use self::{
animation::Animation,
audio::Audio,
callback_game::CallbackGame,
callback_query::CallbackQuery,
chat::{Chat, ChatKind, NonPrivateChatKind},
chat_action::ChatAction,
chat_id::ChatId,
chat_member::{ChatMember, ChatMemberStatus},
chat_permissions::ChatPermissions,
chat_photo::ChatPhoto,
chosen_inline_result::ChosenInlineResult,
contact::Contact,
document::Document,
encrypted_credintials::EncryptedCredentials,
encrypted_passport_element::{
EncryptedPassportElement, EncryptedPassportElementKind,
},
file::File,
force_reply::ForceReply,
game::Game,
game_high_score::GameHighScore,
inline_keyboard_button::{InlineKeyboardButton, InlineKeyboardButtonKind},
inline_keyboard_markup::InlineKeyboardMarkup,
inline_query::InlineQuery,
inline_query_result::InlineQueryResult,
inline_query_result_article::InlineQueryResultArticle,
inline_query_result_audio::InlineQueryResultAudio,
inline_query_result_cached_audio::InlineQueryResultCachedAudio,
inline_query_result_cached_document::InlineQueryResultCachedDocument,
inline_query_result_cached_gif::InlineQueryResultCachedGif,
inline_query_result_cached_mpeg4_gif::InlineQueryResultCachedMpeg4Gif,
inline_query_result_cached_photo::InlineQueryResultCachedPhoto,
inline_query_result_cached_sticker::InlineQueryResultCachedSticker,
inline_query_result_cached_video::InlineQueryResultCachedVideo,
inline_query_result_cached_voice::InlineQueryResultCachedVoice,
inline_query_result_contact::InlineQueryResultContact,
inline_query_result_document::InlineQueryResultDocument,
inline_query_result_game::InlineQueryResultGame,
inline_query_result_gif::InlineQueryResultGif,
inline_query_result_location::InlineQueryResultLocation,
inline_query_result_mpeg4_gif::InlineQueryResultMpeg4Gif,
inline_query_result_photo::InlineQueryResultPhoto,
inline_query_result_venue::InlineQueryResultVenue,
inline_query_result_video::InlineQueryResultVideo,
inline_query_result_voice::InlineQueryResultVoice,
input_file::InputFile,
input_media::InputMedia,
input_message_content::InputMessageContent,
invoice::Invoice,
keyboard_button::KeyboardButton,
label_price::LabeledPrice,
location::Location,
login_url::LoginUrl,
mask_position::MaskPosition,
message::{
ForwardKind, ForwardedFrom, MediaKind, Message, MessageKind, Sender,
},
message_entity::MessageEntity,
order_info::OrderInfo,
parse_mode::ParseMode,
passport_data::PassportData,
passport_file::PassportFile,
photo_size::PhotoSize,
poll::{Poll, PollOption},
pre_checkout_query::PreCheckoutQuery,
reply_keyboard_markup::ReplyKeyboardMarkup,
reply_keyboard_remove::ReplyKeyboardRemove,
reply_markup::ReplyMarkup,
response_parameters::ResponseParameters,
send_invoice::SendInvoice,
shipping_address::ShippingAddress,
shipping_option::ShippingOption,
shipping_query::ShippingQuery,
sticker::Sticker,
sticker_set::StickerSet,
successful_payment::SuccessfulPayment,
unit_true::True,
update::{Update, UpdateKind},
user::User,
user_profile_photos::UserProfilePhotos,
venue::Venue,
video::Video,
video_note::VideoNote,
voice::Voice,
webhook_info::WebhookInfo,
};
pub use animation::*;
pub use audio::*;
pub use callback_game::*;
pub use callback_query::*;
pub use chat::*;
pub use chat_action::*;
pub use chat_id::*;
pub use chat_member::*;
pub use chat_permissions::*;
pub use chat_photo::*;
pub use chosen_inline_result::*;
pub use contact::*;
pub use document::*;
pub use file::*;
pub use force_reply::*;
pub use game::*;
pub use game_high_score::*;
pub use inline_keyboard_button::*;
pub use inline_keyboard_markup::*;
pub use input_file::*;
pub use input_media::*;
pub use input_message_content::*;
pub use invoice::*;
pub use keyboard_button::*;
pub use label_price::*;
pub use location::*;
pub use login_url::*;
pub use mask_position::*;
pub use message::*;
pub use message_entity::*;
pub use order_info::*;
pub use parse_mode::*;
pub use photo_size::*;
pub use poll::*;
pub use pre_checkout_query::*;
pub use reply_keyboard_markup::*;
pub use reply_keyboard_remove::*;
pub use reply_markup::*;
pub use response_parameters::*;
pub use send_invoice::*;
pub use shipping_address::*;
pub use shipping_option::*;
pub use shipping_query::*;
pub use sticker::*;
pub use sticker_set::*;
pub use successful_payment::*;
pub use unit_true::*;
pub use update::*;
pub use user::*;
pub use user_profile_photos::*;
pub use venue::*;
pub use video::*;
pub use video_note::*;
pub use voice::*;
pub use webhook_info::*;
pub use inline_query::*;
pub use inline_query_result::*;
pub use inline_query_result_article::*;
pub use inline_query_result_audio::*;
pub use inline_query_result_cached_audio::*;
pub use inline_query_result_cached_document::*;
pub use inline_query_result_cached_gif::*;
pub use inline_query_result_cached_mpeg4_gif::*;
pub use inline_query_result_cached_photo::*;
pub use inline_query_result_cached_sticker::*;
pub use inline_query_result_cached_video::*;
pub use inline_query_result_cached_voice::*;
pub use inline_query_result_contact::*;
pub use inline_query_result_document::*;
pub use inline_query_result_game::*;
pub use inline_query_result_gif::*;
pub use inline_query_result_location::*;
pub use inline_query_result_mpeg4_gif::*;
pub use inline_query_result_photo::*;
pub use inline_query_result_venue::*;
pub use inline_query_result_video::*;
pub use inline_query_result_voice::*;
pub use encrypted_credintials::*;
pub use encrypted_passport_element::*;
pub use passport_data::*;
pub use passport_file::*;
mod animation;
mod audio;