Fix the compilation errors

This commit is contained in:
Temirkhan Myrzamadi 2019-09-03 20:39:49 +06:00
parent 383ea99e81
commit d71c4d39a0
3 changed files with 13 additions and 11 deletions

View file

@ -40,11 +40,9 @@ pub async fn request<T: DeserializeOwned>(
) -> ResponseResult<T> {
let mut response = client
.post(&method_url(TELEGRAM_API_URL, token, method_name))
.apply(|request_builder| {
params.map_or_else(
|| request_builder,
|params| request_builder.multipart(params),
)
.apply(|request_builder| match params {
Some(params) => request_builder.multipart(params),
None => request_builder,
})
.send()
.compat()

View file

@ -1,5 +1,6 @@
use crate::core::requests::ResponseResult;
use crate::core::{network::request, network::request, types::User};
use crate::core::network;
use crate::core::requests::{Request, RequestFuture, RequestInfo, ResponseResult};
use crate::core::types::User;
#[derive(Debug, Constructor)]
pub struct GetMe {
@ -10,6 +11,8 @@ impl Request for GetMe {
type ReturnValue = User;
fn send(self) -> RequestFuture<ResponseResult<Self::ReturnValue>> {
Box::new(async move { request(&self.info.client, &self.info.token, "getMe", None).await })
Box::new(async move {
network::request(&self.info.client, &self.info.token, "getMe", None).await
})
}
}

View file

@ -1,5 +1,6 @@
use crate::core::requests::ResponseResult;
use crate::core::{network::request, network::request, types::Message};
use crate::core::requests::form_builder::FormBuilder;
use crate::core::requests::{ChatId, Request, RequestFuture, RequestInfo, ResponseResult};
use crate::core::{network, types::Message};
#[derive(Debug, TypedBuilder)]
pub struct SendMessage {
@ -37,7 +38,7 @@ impl Request for SendMessage {
.add_if_some("reply_to_message_id", self.reply_to_message_id.as_ref())
.build();
request(
network::request(
&self.info.client,
&self.info.token,
"sendMessage",