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> { ) -> ResponseResult<T> {
let mut response = client let mut response = client
.post(&method_url(TELEGRAM_API_URL, token, method_name)) .post(&method_url(TELEGRAM_API_URL, token, method_name))
.apply(|request_builder| { .apply(|request_builder| match params {
params.map_or_else( Some(params) => request_builder.multipart(params),
|| request_builder, None => request_builder,
|params| request_builder.multipart(params),
)
}) })
.send() .send()
.compat() .compat()

View file

@ -1,5 +1,6 @@
use crate::core::requests::ResponseResult; use crate::core::network;
use crate::core::{network::request, network::request, types::User}; use crate::core::requests::{Request, RequestFuture, RequestInfo, ResponseResult};
use crate::core::types::User;
#[derive(Debug, Constructor)] #[derive(Debug, Constructor)]
pub struct GetMe { pub struct GetMe {
@ -10,6 +11,8 @@ impl Request for GetMe {
type ReturnValue = User; type ReturnValue = User;
fn send(self) -> RequestFuture<ResponseResult<Self::ReturnValue>> { 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::requests::form_builder::FormBuilder;
use crate::core::{network::request, network::request, types::Message}; use crate::core::requests::{ChatId, Request, RequestFuture, RequestInfo, ResponseResult};
use crate::core::{network, types::Message};
#[derive(Debug, TypedBuilder)] #[derive(Debug, TypedBuilder)]
pub struct SendMessage { 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()) .add_if_some("reply_to_message_id", self.reply_to_message_id.as_ref())
.build(); .build();
request( network::request(
&self.info.client, &self.info.client,
&self.info.token, &self.info.token,
"sendMessage", "sendMessage",