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;
}Expand description
REST client trait for making HTTP requests.
This trait provides a way for users to supply their own HTTP client implementation for use with the SDK. The SDK will use this client for all HTTP operations including LNURL flows and chain service requests.
Required Methods§
Sourcefn 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 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 calledheaders: optional headers that will be set on the request
Sourcefn 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 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 calledheaders: the optional POST headersbody: the optional POST body
Sourcefn 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,
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 calledheaders: the optional DELETE headersbody: the optional DELETE body