pub struct ApiClient { /* private fields */ }Implementations§
Source§impl ApiClient
impl ApiClient
pub fn new(base_url: impl Into<String>) -> Self
pub fn with_token(self, token: String) -> Self
pub async fn get_json<TResp>(
&self,
path: &str,
extra_headers: Option<&[(&str, &str)]>,
params: Option<&[(&str, &str)]>,
) -> Result<TResp, Box<dyn Error + Send + Sync>>where
TResp: DeserializeOwned,
pub async fn post_json<TBody, TResp>( &self, path: &str, body: &TBody, extra_headers: Option<&[(&str, &str)]>, params: Option<&[(&str, &str)]>, ) -> Result<TResp, Box<dyn Error + Send + Sync>>
pub async fn post_form<TForm, TResp>( &self, path: &str, form: &TForm, extra_headers: Option<&[(&str, &str)]>, params: Option<&[(&str, &str)]>, ) -> Result<TResp, Box<dyn Error + Send + Sync>>
pub async fn put_json<TBody, TResp>( &self, path: &str, body: &TBody, extra_headers: Option<&[(&str, &str)]>, params: Option<&[(&str, &str)]>, ) -> Result<TResp, Box<dyn Error + Send + Sync>>
pub async fn put_form<TForm, TResp>( &self, path: &str, form: &TForm, extra_headers: Option<&[(&str, &str)]>, params: Option<&[(&str, &str)]>, ) -> Result<TResp, Box<dyn Error + Send + Sync>>
pub async fn delete_json<TResp>(
&self,
path: &str,
extra_headers: Option<&[(&str, &str)]>,
params: Option<&[(&str, &str)]>,
) -> Result<TResp, Box<dyn Error + Send + Sync>>where
TResp: DeserializeOwned,
Auto Trait Implementations§
impl Freeze for ApiClient
impl !RefUnwindSafe for ApiClient
impl Send for ApiClient
impl Sync for ApiClient
impl Unpin for ApiClient
impl UnsafeUnpin for ApiClient
impl !UnwindSafe for ApiClient
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