RestClient

Trait RestClient 

Source
pub trait RestClient: Send + Sync {
    // Required methods
    fn get_request<'life0, 'async_trait>(
        &'life0 self,
        url: String,
        headers: Option<HashMap<String, String>>,
    ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn post_request<'life0, 'async_trait>(
        &'life0 self,
        url: String,
        headers: Option<HashMap<String, String>>,
        body: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_request<'life0, 'async_trait>(
        &'life0 self,
        url: String,
        headers: Option<HashMap<String, String>>,
        body: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn get_request<'life0, 'async_trait>( &'life0 self, url: String, headers: Option<HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Makes a GET request and logs on DEBUG.

§Arguments
  • url: the URL on which GET will be called
  • headers: optional headers that will be set on the request
Source

fn post_request<'life0, 'async_trait>( &'life0 self, url: String, headers: Option<HashMap<String, String>>, body: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Makes a POST request, and logs on DEBUG.

§Arguments
  • url: the URL on which POST will be called
  • headers: the optional POST headers
  • body: the optional POST body
Source

fn delete_request<'life0, 'async_trait>( &'life0 self, url: String, headers: Option<HashMap<String, String>>, body: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<RestResponse, ServiceConnectivityError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Makes a DELETE request, and logs on DEBUG.

§Arguments
  • url: the URL on which DELETE will be called
  • headers: the optional DELETE headers
  • body: the optional DELETE body

Implementors§