pub struct HttpClient {
pub client: Client,
pub retry_client: ClientWithMiddleware,
}
Expand description
HTTP Client to send HTTP Requests and read the responses.
Fields§
§client: Client
The wrapped lib client
retry_client: ClientWithMiddleware
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn try_new(config: &HttpClientConfiguration) -> Result<Self, ApiError>
pub fn try_new(config: &HttpClientConfiguration) -> Result<Self, ApiError>
Instantiates a new HttpClient
given the provided HttpClientConfiguration
.
Sourcepub async fn post<T: Serialize + ?Sized>(
&self,
url: &str,
body: &T,
) -> Result<HttpResponse, ApiError>
pub async fn post<T: Serialize + ?Sized>( &self, url: &str, body: &T, ) -> Result<HttpResponse, ApiError>
Sends an HTTP POST
Sourcepub async fn post_multipart<T: Debug + Serialize>(
&self,
url: &str,
body: &T,
filepath: &str,
) -> Result<HttpResponse, ApiError>
pub async fn post_multipart<T: Debug + Serialize>( &self, url: &str, body: &T, filepath: &str, ) -> Result<HttpResponse, ApiError>
Sends an HTTP POST with multipart form data
Sourcepub async fn empty_post(&self, url: &str) -> Result<HttpResponse, ApiError>
pub async fn empty_post(&self, url: &str) -> Result<HttpResponse, ApiError>
Sends an HTTP POST without any body
Sourcepub async fn put<T: Serialize>(
&self,
url: &str,
body: &T,
) -> Result<HttpResponse, ApiError>
pub async fn put<T: Serialize>( &self, url: &str, body: &T, ) -> Result<HttpResponse, ApiError>
Sends an HTTP PUT
Sourcepub async fn put_multipart<T: Debug + Serialize>(
&self,
url: &str,
body: &T,
filepath: &str,
) -> Result<HttpResponse, ApiError>
pub async fn put_multipart<T: Debug + Serialize>( &self, url: &str, body: &T, filepath: &str, ) -> Result<HttpResponse, ApiError>
Sends an HTTP PUT with multipart form data
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more