pub struct HttpClient { /* private fields */ }Implementations§
Source§impl HttpClient
impl HttpClient
pub fn new(base_url: &str, service_key: &str) -> Result<Self, Error>
pub fn base_url(&self) -> &str
pub async fn get(&self, path: &str) -> Result<Value, Error>
pub async fn get_with_query( &self, path: &str, query: &HashMap<String, String>, ) -> Result<Value, Error>
pub async fn post(&self, path: &str, body: &Value) -> Result<Value, Error>
pub async fn post_with_query( &self, path: &str, body: &Value, query: &HashMap<String, String>, ) -> Result<Value, Error>
pub async fn patch(&self, path: &str, body: &Value) -> Result<Value, Error>
pub async fn delete(&self, path: &str) -> Result<Value, Error>
pub async fn delete_with_body( &self, path: &str, body: &Value, ) -> Result<Value, Error>
Sourcepub async fn head(&self, path: &str) -> Result<bool, Error>
pub async fn head(&self, path: &str) -> Result<bool, Error>
HEAD request — returns true if the resource exists (2xx status).
pub async fn put(&self, path: &str, body: &Value) -> Result<Value, Error>
pub async fn put_with_query( &self, path: &str, body: &Value, query: &HashMap<String, String>, ) -> Result<Value, Error>
Sourcepub async fn upload_multipart(
&self,
path: &str,
key: &str,
data: Vec<u8>,
content_type: &str,
) -> Result<Value, Error>
pub async fn upload_multipart( &self, path: &str, key: &str, data: Vec<u8>, content_type: &str, ) -> Result<Value, Error>
Multipart file upload.
Auto Trait Implementations§
impl Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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