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
sourceimpl 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>(
&self,
url: &str,
body: &T
) -> Result<HttpResponse, ApiError>
pub async fn post<T: Serialize>(
&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
sourceimpl Clone for HttpClient
impl Clone for HttpClient
sourcefn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more