pub trait HttpClient: Sync {
type Request: HttpRequest + Send;
// Required methods
fn execute(
&self,
request: Self::Request,
body: &[u8],
) -> Result<HttpRequestResultRaw, Error>;
fn new_request(&self, url: &str) -> Self::Request;
// Provided methods
fn update_token(&self, _old_token: Arc<String>) -> Result<bool, Error> { ... }
fn token(&self) -> Option<Arc<String>> { ... }
fn path_root(&self) -> Option<&str> { ... }
fn team_select(&self) -> Option<&TeamSelect> { ... }
}Expand description
The base HTTP synchronous client trait.
Required Associated Types§
Sourcetype Request: HttpRequest + Send
type Request: HttpRequest + Send
The concrete type of request supported by the client.
Required Methods§
Sourcefn execute(
&self,
request: Self::Request,
body: &[u8],
) -> Result<HttpRequestResultRaw, Error>
fn execute( &self, request: Self::Request, body: &[u8], ) -> Result<HttpRequestResultRaw, Error>
Make a HTTP request.
Sourcefn new_request(&self, url: &str) -> Self::Request
fn new_request(&self, url: &str) -> Self::Request
Create a new request instance for the given URL. It should be a POST request.
Provided Methods§
Sourcefn update_token(&self, _old_token: Arc<String>) -> Result<bool, Error>
fn update_token(&self, _old_token: Arc<String>) -> Result<bool, Error>
Attempt to update the current authentication token. The previously fetched token is given
as a way to avoid repeat updates in case of a race. If the update is successful, return
true and the current request will be retried with a newly-fetched token. Return false if
authentication is not supported, or return an error if the update operation fails.
Sourcefn team_select(&self) -> Option<&TeamSelect>
fn team_select(&self) -> Option<&TeamSelect>
The alternate user or team context currently set, if any.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl HttpClient for AppAuthDefaultClient
Available on crate feature default_client only.
impl HttpClient for AppAuthDefaultClient
Available on crate feature
default_client only.type Request = UreqRequest
Source§impl HttpClient for NoauthDefaultClient
Available on crate feature default_client only.
impl HttpClient for NoauthDefaultClient
Available on crate feature
default_client only.type Request = UreqRequest
Source§impl HttpClient for TeamAuthDefaultClient
Available on crate feature default_client only.
impl HttpClient for TeamAuthDefaultClient
Available on crate feature
default_client only.type Request = UreqRequest
Source§impl HttpClient for UserAuthDefaultClient
Available on crate feature default_client only.
impl HttpClient for UserAuthDefaultClient
Available on crate feature
default_client only.