use crate::{Client, ClientError};
use rustify::Endpoint;
pub struct RequestBuilder<R> {
client: Client,
request: R,
}
impl<R: Endpoint> RequestBuilder<R> {
pub fn new(client: Client, request: R) -> RequestBuilder<R> {
Self { client, request }
}
pub fn build(self) -> R {
self.request
}
pub async fn send(self) -> Result<<R>::Response, ClientError> {
self.client.execute(self.request).await
}
pub(in crate::api) fn request_mut(&mut self) -> &mut R {
&mut self.request
}
}