HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    // Required methods
    fn request<'life0, 'life1, 'life2, 'async_trait, T, R>(
        &'life0 self,
        method: Method,
        url: &'life1 str,
        headers: Option<HashMap<String, String>>,
        body: Option<&'life2 T>,
    ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'async_trait,
             R: for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn request_with_retry<'life0, 'life1, 'life2, 'async_trait, T, R>(
        &'life0 self,
        method: Method,
        url: &'life1 str,
        headers: Option<HashMap<String, String>>,
        body: Option<&'life2 T>,
        _max_retries: u32,
    ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + Clone + 'async_trait,
             R: for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn get<'life0, 'life1, 'async_trait, R>(
        &'life0 self,
        url: &'life1 str,
        headers: Option<HashMap<String, String>>,
    ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
       where R: for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn post<'life0, 'life1, 'life2, 'async_trait, T, R>(
        &'life0 self,
        url: &'life1 str,
        headers: Option<HashMap<String, String>>,
        body: &'life2 T,
    ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'async_trait,
             R: for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn put<'life0, 'life1, 'life2, 'async_trait, T, R>(
        &'life0 self,
        url: &'life1 str,
        headers: Option<HashMap<String, String>>,
        body: &'life2 T,
    ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'async_trait,
             R: for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

HTTP transport client abstraction, defining common HTTP operation interface

HTTP transport client abstraction defining generic HTTP operation interface

This trait defines the generic interface for all HTTP operations, allowing the adapter layer to avoid direct interaction with reqwest

Required Methods§

Source

fn request<'life0, 'life1, 'life2, 'async_trait, T, R>( &'life0 self, method: Method, url: &'life1 str, headers: Option<HashMap<String, String>>, body: Option<&'life2 T>, ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, R: for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send HTTP request

Source

fn request_with_retry<'life0, 'life1, 'life2, 'async_trait, T, R>( &'life0 self, method: Method, url: &'life1 str, headers: Option<HashMap<String, String>>, body: Option<&'life2 T>, _max_retries: u32, ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + Clone + 'async_trait, R: for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send HTTP request with retry

Provided Methods§

Source

fn get<'life0, 'life1, 'async_trait, R>( &'life0 self, url: &'life1 str, headers: Option<HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
where R: for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send GET request

Source

fn post<'life0, 'life1, 'life2, 'async_trait, T, R>( &'life0 self, url: &'life1 str, headers: Option<HashMap<String, String>>, body: &'life2 T, ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, R: for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send POST request

Source

fn put<'life0, 'life1, 'life2, 'async_trait, T, R>( &'life0 self, url: &'life1 str, headers: Option<HashMap<String, String>>, body: &'life2 T, ) -> Pin<Box<dyn Future<Output = Result<R, TransportError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, R: for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send PUT request

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.

Implementors§