pub struct HttpClient {
pub url: Uri,
pub api_key: Option<String>,
pub retry: Option<(usize, Duration)>,
}Fields§
§url: Uri§api_key: Option<String>§retry: Option<(usize, Duration)>Implementations§
Source§impl HttpClient
impl HttpClient
pub async fn request<T>(
&self,
endpoint: &str,
method: Method,
content_type: ContentType,
body: Option<&T>,
) -> Result<Response<Incoming>>where
T: Serialize,
pub async fn get<R>(&self, endpoint: &str) -> Result<R>where
R: DeserializeOwned,
pub async fn get_str(&self, endpoint: &str) -> Result<String>
pub async fn get_bytes(&self, endpoint: &str) -> Result<Bytes>
pub async fn post_json<T, R>(&self, endpoint: &str, body: &T) -> Result<R>where
R: DeserializeOwned,
T: Serialize,
Trait Implementations§
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