use elicitation::elicit_newtype;
use elicitation_derive::reflect_methods;
use crate::RequestBuilder;
elicit_newtype!(reqwest::Client, as Client);
impl Client {
pub fn new() -> Self {
reqwest::Client::new().into()
}
}
impl Default for Client {
fn default() -> Self {
Self::new()
}
}
#[reflect_methods]
impl Client {
pub fn get<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.get(url).into()
}
pub fn post<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.post(url).into()
}
pub fn put<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.put(url).into()
}
pub fn delete<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.delete(url).into()
}
pub fn patch<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.patch(url).into()
}
pub fn head<U>(&self, url: U) -> RequestBuilder
where
U: elicitation::Elicitation + schemars::JsonSchema + reqwest::IntoUrl,
{
self.0.head(url).into()
}
}