pub trait ApiClient: ApiClientCore {
Show 17 methods
// Provided methods
fn create_get_request<P, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
) -> Result<RequestBuilder, HttpClientError>
where P: RequestPath,
K: AsRef<str>,
V: AsRef<str> { ... }
fn create_post_request<P, B, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
json_body: &B,
) -> Result<RequestBuilder, HttpClientError>
where P: RequestPath,
B: Serialize + ?Sized,
K: AsRef<str>,
V: AsRef<str> { ... }
fn create_delete_request<P, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
) -> Result<RequestBuilder, HttpClientError>
where P: RequestPath,
K: AsRef<str>,
V: AsRef<str> { ... }
fn create_patch_request<P, B, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
json_body: &B,
) -> Result<RequestBuilder, HttpClientError>
where P: RequestPath,
B: Serialize + ?Sized,
K: AsRef<str>,
V: AsRef<str> { ... }
fn send_get_request<'life0, 'life1, 'async_trait, P, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn send_post_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn send_delete_request<'life0, 'life1, 'async_trait, P, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn send_patch_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn get_json<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_response<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn post_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn delete_json<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn patch_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn get_json_from<'life0, 'async_trait, T, S>(
&'life0 self,
endpoint: S,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where for<'a> T: Deserialize<'a> + 'async_trait,
S: AsRef<str> + Sync + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn post_json_data_to<'life0, 'life1, 'async_trait, B, T, S>(
&'life0 self,
endpoint: S,
json_body: &'life1 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
S: AsRef<str> + Sync + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn delete_json_from<'life0, 'async_trait, T, S>(
&'life0 self,
endpoint: S,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where for<'a> T: Deserialize<'a> + 'async_trait,
S: AsRef<str> + Sync + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn patch_json_data_at<'life0, 'life1, 'async_trait, B, T, S>(
&'life0 self,
endpoint: S,
json_body: &'life1 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
where B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
S: AsRef<str> + Sync + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Common usage functionality for the http client.
These functions allow for cleaner downstream usage free of type parameters and unneeded imports.
Provided Methods§
Sourcefn create_get_request<P, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
) -> Result<RequestBuilder, HttpClientError>
fn create_get_request<P, K, V>( &self, path: P, params: Params<'_, K, V>, ) -> Result<RequestBuilder, HttpClientError>
Create an HTTP GET Request with the provided path and parameters
Sourcefn create_post_request<P, B, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
json_body: &B,
) -> Result<RequestBuilder, HttpClientError>
fn create_post_request<P, B, K, V>( &self, path: P, params: Params<'_, K, V>, json_body: &B, ) -> Result<RequestBuilder, HttpClientError>
Create an HTTP POST Request with the provided path, parameters, and json body
Sourcefn create_delete_request<P, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
) -> Result<RequestBuilder, HttpClientError>
fn create_delete_request<P, K, V>( &self, path: P, params: Params<'_, K, V>, ) -> Result<RequestBuilder, HttpClientError>
Create an HTTP DELETE Request with the provided path and parameters
Sourcefn create_patch_request<P, B, K, V>(
&self,
path: P,
params: Params<'_, K, V>,
json_body: &B,
) -> Result<RequestBuilder, HttpClientError>
fn create_patch_request<P, B, K, V>( &self, path: P, params: Params<'_, K, V>, json_body: &B, ) -> Result<RequestBuilder, HttpClientError>
Create an HTTP PATCH Request with the provided path, parameters, and json body
Sourcefn send_get_request<'life0, 'life1, 'async_trait, P, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
fn send_get_request<'life0, 'life1, 'async_trait, P, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, ) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
Create and send an HTTP GET Request with the provided path and parameters
Sourcefn send_post_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
fn send_post_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, json_body: &'life2 B, ) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
Create and send an HTTP POST Request with the provided path, parameters, and json data
Sourcefn send_delete_request<'life0, 'life1, 'async_trait, P, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
fn send_delete_request<'life0, 'life1, 'async_trait, P, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, ) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
Create and send an HTTP DELETE Request with the provided path and parameters
Sourcefn send_patch_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
fn send_patch_request<'life0, 'life1, 'life2, 'async_trait, P, B, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, json_body: &'life2 B, ) -> Pin<Box<dyn Future<Output = Result<Response, HttpClientError>> + Send + 'async_trait>>
Create and send an HTTP PATCH Request with the provided path, parameters, and json data
Sourcefn get_json<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn get_json<'life0, 'life1, 'async_trait, P, T, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
‘get’ json data from the segment-defined path, e.g. ["api", "v1", "mixnodes"], with tuple
defined key-value parameters, e.g. [("since", "12345")]. Attempt to parse the response
into the provided type T.
Sourcefn get_response<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn get_response<'life0, 'life1, 'async_trait, P, T, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
‘get’ data from the segment-defined path, e.g. ["api", "v1", "mixnodes"], with tuple
defined key-value parameters, e.g. [("since", "12345")]. Attempt to parse the response
into the provided type T based on the content type header
Sourcefn post_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>where
P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn post_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>where
P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
‘post’ json data to the segment-defined path, e.g. ["api", "v1", "mixnodes"], with tuple
defined key-value parameters, e.g. [("since", "12345")]. Attempt to parse the response
into the provided type T.
Sourcefn delete_json<'life0, 'life1, 'async_trait, P, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn delete_json<'life0, 'life1, 'async_trait, P, T, K, V>( &'life0 self, path: P, params: Params<'life1, K, V>, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
‘delete’ json data from the segment-defined path, e.g. ["api", "v1", "mixnodes"], with
tuple defined key-value parameters, e.g. [("since", "12345")]. Attempt to parse the
response into the provided type T.
Sourcefn patch_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>where
P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn patch_json<'life0, 'life1, 'life2, 'async_trait, P, B, T, K, V>(
&'life0 self,
path: P,
params: Params<'life1, K, V>,
json_body: &'life2 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>where
P: RequestPath + Send + Sync + 'async_trait,
B: Serialize + ?Sized + Sync + 'async_trait,
for<'a> T: Deserialize<'a> + 'async_trait,
K: AsRef<str> + Sync + 'async_trait,
V: AsRef<str> + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
‘patch’ json data at the segment-defined path, e.g. ["api", "v1", "mixnodes"], with tuple
defined key-value parameters, e.g. [("since", "12345")]. Attempt to parse the response
into the provided type T.
Sourcefn get_json_from<'life0, 'async_trait, T, S>(
&'life0 self,
endpoint: S,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn get_json_from<'life0, 'async_trait, T, S>( &'life0 self, endpoint: S, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
get json data from the provided absolute endpoint, e.g. "/api/v1/mixnodes?since=12345".
Attempt to parse the response into the provided type T.
Sourcefn post_json_data_to<'life0, 'life1, 'async_trait, B, T, S>(
&'life0 self,
endpoint: S,
json_body: &'life1 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn post_json_data_to<'life0, 'life1, 'async_trait, B, T, S>( &'life0 self, endpoint: S, json_body: &'life1 B, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
post json data to the provided absolute endpoint, e.g. "/api/v1/mixnodes?since=12345".
Attempt to parse the response into the provided type T.
Sourcefn delete_json_from<'life0, 'async_trait, T, S>(
&'life0 self,
endpoint: S,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn delete_json_from<'life0, 'async_trait, T, S>( &'life0 self, endpoint: S, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
delete json data from the provided absolute endpoint, e.g.
"/api/v1/mixnodes?since=12345". Attempt to parse the response into the provided type T.
Sourcefn patch_json_data_at<'life0, 'life1, 'async_trait, B, T, S>(
&'life0 self,
endpoint: S,
json_body: &'life1 B,
) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
fn patch_json_data_at<'life0, 'life1, 'async_trait, B, T, S>( &'life0 self, endpoint: S, json_body: &'life1 B, ) -> Pin<Box<dyn Future<Output = Result<T, HttpClientError>> + Send + 'async_trait>>
patch json data at the provided absolute endpoint, e.g. "/api/v1/mixnodes?since=12345".
Attempt to parse the response into the provided type T.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.