Comment all the deprecated stuff

This commit is contained in:
Waffle 2019-11-04 22:45:14 +03:00
parent 1df08f02c7
commit 0a36537aa5
3 changed files with 97 additions and 90 deletions

View file

@ -1,6 +1,8 @@
use reqwest::Client;
mod api;
// TODO: commented due to WIP changes.
// See https://github.com/telebofr/telebofr/issues/81.
//mod api;
mod download;
/// A Telegram bot used to build requests.

View file

@ -4,7 +4,6 @@ use std::{
};
use futures::{stream, Stream, StreamExt};
use pin_project::pin_project;
use crate::{bot::Bot, types::Update, RequestError};
@ -140,7 +139,11 @@ pub fn polling<'a>(bot: &'a Bot) -> impl Updater<Error = RequestError> + 'a {
let stream = stream::unfold((bot, 0), |(bot, mut offset)| {
async move {
// this match converts Result<Vec<_>, _> -> Vec<Result<_, _>>
let updates = match bot.get_updates().offset(offset).send().await {
// TODO: for now `get_updates` are removed, but when we implement it
// back, we need to fix this code.
// See https://github.com/telebofr/telebofr/issues/81.
let updates: Result<Vec<Update>, RequestError> = todo!();
let updates = match /* bot.get_updates().offset(offset).send().await */ updates {
Ok(updates) => {
if let Some(upd) = updates.last() {
offset = upd.id + 1;

View file

@ -1,95 +1,97 @@
//! API requests.
pub use answer_callback_query::*;
pub use answer_pre_checkout_query::*;
pub use answer_shipping_query::*;
pub use delete_chat_photo::*;
pub use delete_chat_sticker_set::*;
pub use edit_message_live_location::*;
pub use export_chat_invite_link::*;
pub use forward_message::*;
pub use get_chat::*;
pub use get_chat_administrators::*;
pub use get_chat_member::*;
pub use get_chat_members_count::*;
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 leave_chat::*;
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 set_chat_description::*;
pub use set_chat_permissions::*;
pub use set_chat_photo::*;
pub use set_chat_sticker_set::*;
pub use set_chat_title::*;
pub use stop_message_live_location::*;
pub use unban_chat_member::*;
pub use unpin_chat_message::*;
// TODO: commented due to WIP changes.
// See https://github.com/telebofr/telebofr/issues/81.
//pub use answer_callback_query::*;
//pub use answer_pre_checkout_query::*;
//pub use answer_shipping_query::*;
//pub use delete_chat_photo::*;
//pub use delete_chat_sticker_set::*;
//pub use edit_message_live_location::*;
//pub use export_chat_invite_link::*;
//pub use forward_message::*;
//pub use get_chat::*;
//pub use get_chat_administrators::*;
//pub use get_chat_member::*;
//pub use get_chat_members_count::*;
//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 leave_chat::*;
//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 set_chat_description::*;
//pub use set_chat_permissions::*;
//pub use set_chat_photo::*;
//pub use set_chat_sticker_set::*;
//pub use set_chat_title::*;
//pub use stop_message_live_location::*;
//pub use unban_chat_member::*;
//pub use unpin_chat_message::*;
mod form_builder;
mod utils;
mod answer_callback_query;
mod answer_pre_checkout_query;
mod answer_shipping_query;
mod delete_chat_photo;
mod delete_chat_sticker_set;
mod edit_message_live_location;
mod export_chat_invite_link;
mod forward_message;
mod get_chat;
mod get_chat_administrators;
mod get_chat_member;
mod get_chat_members_count;
mod get_file;
mod get_me;
mod get_updates;
mod get_user_profile_photos;
mod kick_chat_member;
mod leave_chat;
mod pin_chat_message;
mod promote_chat_member;
mod restrict_chat_member;
mod send_animation;
mod send_audio;
mod send_chat_action;
mod send_contact;
mod send_document;
mod send_location;
mod send_media_group;
mod send_message;
mod send_photo;
mod send_poll;
mod send_venue;
mod send_video;
mod send_video_note;
mod send_voice;
mod set_chat_description;
mod set_chat_permissions;
mod set_chat_photo;
mod set_chat_sticker_set;
mod set_chat_title;
mod stop_message_live_location;
mod unban_chat_member;
mod unpin_chat_message;
//mod answer_callback_query;
//mod answer_pre_checkout_query;
//mod answer_shipping_query;
//mod delete_chat_photo;
//mod delete_chat_sticker_set;
//mod edit_message_live_location;
//mod export_chat_invite_link;
//mod forward_message;
//mod get_chat;
//mod get_chat_administrators;
//mod get_chat_member;
//mod get_chat_members_count;
//mod get_file;
//mod get_me;
//mod get_updates;
//mod get_user_profile_photos;
//mod kick_chat_member;
//mod leave_chat;
//mod pin_chat_message;
//mod promote_chat_member;
//mod restrict_chat_member;
//mod send_animation;
//mod send_audio;
//mod send_chat_action;
//mod send_contact;
//mod send_document;
//mod send_location;
//mod send_media_group;
//mod send_message;
//mod send_photo;
//mod send_poll;
//mod send_venue;
//mod send_video;
//mod send_video_note;
//mod send_voice;
//mod set_chat_description;
//mod set_chat_permissions;
//mod set_chat_photo;
//mod set_chat_sticker_set;
//mod set_chat_title;
//mod stop_message_live_location;
//mod unban_chat_member;
//mod unpin_chat_message;
use async_trait::async_trait;
use serde::de::DeserializeOwned;
@ -101,7 +103,7 @@ pub type ResponseResult<T> = Result<T, crate::RequestError>;
#[async_trait]
pub trait Request {
/// A type of response.
type Output: DeserializeOwned;
type Output: DeserializeOwned; // TODO: do we need this bound _here_?
/// Send this request.
async fn send_boxed(self) -> ResponseResult<Self::Output>;