Struct square_api_client::http::client::HttpClient
source · 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 copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more