Struct simplerusthttpsclient::HttpClient
source · pub struct HttpClient { /* private fields */ }
Implementations§
source§impl HttpClient
impl HttpClient
pub fn new( base_url: Url, tls_config: Option<TlsConfig<'static>>, default_headers: Option<HeaderMap> ) -> Self
pub async fn get<T: DeserializeOwned>( &self, endpoint: &str, extra_headers: Option<HeaderMap> ) -> Result<T>
pub async fn post<T: DeserializeOwned, U: Serialize>( &self, endpoint: &str, body: &U, extra_headers: Option<HeaderMap> ) -> Result<T>
pub async fn post_file_as_zip( &self, url: Url, path: &Path, multipart_file_name: Option<String>, extra_headers: Option<HeaderMap> ) -> Result<()>
pub async fn post_folder_as_zip( &self, url: Url, path: &Path, multipart_file_name: Option<String>, extra_headers: Option<HeaderMap> ) -> Result<()>
pub async fn post_file_path( &self, url: Url, path: &Path, multipart_file_name: Option<String>, extra_headers: Option<HeaderMap> ) -> Result<()>
pub async fn post_file_buffer( &self, url: Url, name: String, bytes: &'static [u8], multipart_file_name: Option<String>, extra_headers: Option<HeaderMap> ) -> Result<()>
pub async fn send_multipart_form<T: DeserializeOwned>( &self, url: Url, multipart_form: Form, extra_headers: Option<HeaderMap> ) -> Result<T>
pub async fn get_file_buffer( &self, url: Url, extra_headers: Option<HeaderMap> ) -> Result<Bytes>
pub async fn get_file_to_path( &self, url: Url, path: &Path, extra_headers: Option<HeaderMap> ) -> Result<()>
pub async fn get_archive_to_dir( &self, url: Url, archive_type: &ArchiveType, dir: &Path, extra_headers: Option<HeaderMap> ) -> Result<()>
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 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§
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