pub trait HttpClient: Send + Sync {
// Required methods
fn get_with_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn post_json_with_token<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
body: &'life3 T,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where T: 'async_trait + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn upload_file<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
field_name: &'life3 str,
file_data: Vec<u8>,
filename: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn download_with_limit<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
max_size: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Trait for HTTP client operations.
Required Methods§
Sourcefn get_with_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_with_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Makes a GET request with token.
Sourcefn post_json_with_token<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
body: &'life3 T,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
fn post_json_with_token<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, endpoint: &'life1 str, token: &'life2 str, body: &'life3 T, ) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
Makes a POST request with JSON body and token.
Sourcefn upload_file<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
field_name: &'life3 str,
file_data: Vec<u8>,
filename: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn upload_file<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
field_name: &'life3 str,
file_data: Vec<u8>,
filename: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Uploads a file using multipart form data.
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.