pub struct Client { /* private fields */ }
Expand description
The main client used for making requests.
Client
stores an async Reqwest client as well as the associated
base url and possible authorization details for the REST server.
Implementations§
Source§impl Client
impl Client
Sourcepub fn from_hyper<S: ToString>(
inner: HyperClient<HttpsConnector<HttpConnector>>,
base_url: S,
) -> Self
pub fn from_hyper<S: ToString>( inner: HyperClient<HttpsConnector<HttpConnector>>, base_url: S, ) -> Self
Create a new Client
from an existing Hyper Client.
Sourcepub fn bearer_auth<S: ToString>(self, token: S) -> Self
pub fn bearer_auth<S: ToString>(self, token: S) -> Self
Enable bearer authentication for the client
Sourcepub fn basic_auth<T: Into<Option<S>>, S: ToString>(
self,
user: S,
pass: T,
) -> Self
pub fn basic_auth<T: Into<Option<S>>, S: ToString>( self, user: S, pass: T, ) -> Self
Enable basic authentication for the client
Sourcepub fn query_auth<S: ToString>(self, pairs: Vec<(S, S)>) -> Self
pub fn query_auth<S: ToString>(self, pairs: Vec<(S, S)>) -> Self
Enable query authentication for the client
Sourcepub fn header_auth<S: ToString>(self, pairs: Vec<(S, S)>) -> Self
pub fn header_auth<S: ToString>(self, pairs: Vec<(S, S)>) -> Self
Enable custom header authentication for the client
pub fn default_headers(self, default_headers: HeaderMap<HeaderValue>) -> Self
Trait Implementations§
Source§impl<R: Request + 'static> Service<R> for Client
impl<R: Request + 'static> Service<R> for Client
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more