This commit is contained in:
Waffle 2019-09-21 01:05:48 +03:00
parent f95ea5ee31
commit ec4d23626a
6 changed files with 10 additions and 22 deletions

View file

@ -1,8 +1,10 @@
use futures::StreamExt;
use reqwest::r#async::{Chunk, Client};
use tokio::{
io::{AsyncWrite, AsyncWriteExt},
stream::Stream,
};
use bytes::Buf;
use crate::{
network::{file_url, TELEGRAM_API_URL},
@ -27,7 +29,7 @@ where
Ok(())
}
pub(crate) async fn download_file_stream(
pub async fn download_file_stream(
client: &Client,
token: &str,
path: &str,

View file

@ -2,23 +2,9 @@ mod download;
mod request;
mod telegram_response;
use apply::Apply;
use bytes::Buf;
use futures::StreamExt;
use reqwest::{
r#async::{multipart::Form, Chunk, Client, Response},
StatusCode,
};
use serde::{de::DeserializeOwned, Serialize};
use tokio::{
io::{AsyncWrite, AsyncWriteExt},
stream::Stream,
};
use crate::{
requests::ResponseResult, types::ResponseParameters, DownloadError,
RequestError,
};
pub use download::{download_file, download_file_stream};
pub use request::{request_json, request_multipart};
pub use telegram_response::TelegramResponse;
pub const TELEGRAM_API_URL: &str = "https://api.telegram.org";

View file

@ -3,7 +3,7 @@ use reqwest::r#async::{multipart::Form, Client, Response};
use serde::{de::DeserializeOwned, Serialize};
use crate::{
network::{method_url, TELEGRAM_API_URL},
network::{method_url, TELEGRAM_API_URL, TelegramResponse},
requests::ResponseResult,
RequestError,
};

View file

@ -6,7 +6,7 @@ use crate::{
#[derive(Deserialize)]
#[serde(untagged)]
enum TelegramResponse<R> {
pub enum TelegramResponse<R> {
Ok {
/// A dummy field. Used only for deserialization.
#[allow(dead_code)]

View file

@ -14,7 +14,7 @@ pub use self::{
file::File,
force_reply::ForceReply,
game::Game,
game_high_score,
game_high_score::GameHighScore,
inline_keyboard_button::{InlineKeyboardButton, InlineKeyboardButtonKind},
inline_keyboard_markup::InlineKeyboardMarkup,
inline_query::InlineQuery,

View file

@ -1,6 +1,6 @@
use crate::types::Sticker;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
#[derive(Debug, Deserialize, PartialEq, Clone)]
pub struct StickerSet {
pub name: String,
pub title: String,