Add simple::{Payload, Request}

This commit is contained in:
Waffle 2019-11-05 00:00:26 +03:00
parent b02f10e73c
commit 7868d9c832

View file

@ -175,3 +175,30 @@ pub mod multipart {
} }
} }
} }
pub mod simple {
use serde::de::DeserializeOwned;
use reqwest::multipart;
use crate::{Bot, network};
use super::{ResponseResult, Method};
pub struct Request<'b, M> {
pub(crate) bot: &'b Bot,
marker: std::marker::PhantomData<M>,
}
impl<M> Request<'_, M>
where
M: Method,
M::Output: DeserializeOwned,
{
pub async fn send(&self) -> ResponseResult<M::Output> {
network::request_simple(
self.bot.client(),
self.bot.token(),
M::METHOD,
).await
}
}
}