pub struct HttpClient { /* private fields */ }Expand description
Minimal HTTP client for Discord API
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_captcha_handler<F, Fut>(self, handler: F) -> Self
pub fn with_captcha_handler<F, Fut>(self, handler: F) -> Self
Sets a captcha handler for this HTTP client
Sourcepub fn with_request_delay(self, delay: Duration) -> Self
pub fn with_request_delay(self, delay: Duration) -> Self
Sets the delay between requests (default 100ms)
Sourcepub fn with_max_rate_limit_retries(self, n: u32) -> Self
pub fn with_max_rate_limit_retries(self, n: u32) -> Self
Sets the maximum number of rate limit retries (default 3)
Sourcepub fn analytics_heartbeat_session_id(&self) -> String
pub fn analytics_heartbeat_session_id(&self) -> String
Returns the current analytics heartbeat session id.
The id rotates automatically every 30 minutes.
Sourcepub async fn post<T: Serialize>(
&self,
url: impl AsRef<str>,
body: T,
) -> Result<Value>
pub async fn post<T: Serialize>( &self, url: impl AsRef<str>, body: T, ) -> Result<Value>
Sends a POST request
Sourcepub async fn patch<T: Serialize>(
&self,
url: impl AsRef<str>,
body: T,
) -> Result<Value>
pub async fn patch<T: Serialize>( &self, url: impl AsRef<str>, body: T, ) -> Result<Value>
Sends a PATCH request
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a duplicate 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 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