pub struct HttpClient { /* private fields */ }Implementations§
Source§impl HttpClient
impl HttpClient
pub async fn fetch_self(&self) -> Result<User, HttpError>
pub async fn fetch_user(&self, id: &str) -> Result<User, HttpError>
pub fn edit_user<'a>( &'a self, user_id: impl Into<String>, ) -> EditUserBuilder<'a>
pub async fn request_edit_user( &self, user_id: &str, data: DataEditUser, ) -> Result<User, HttpError>
pub async fn fetch_dms(&self) -> Result<Vec<Channel>, HttpError>
Source§impl HttpClient
impl HttpClient
pub fn new(token: String) -> Self
Sourcepub async fn request<B, Q, T>(
&self,
route: Route<'_>,
body: Option<B>,
query: Option<&Q>,
) -> Result<T, HttpError>
pub async fn request<B, Q, T>( &self, route: Route<'_>, body: Option<B>, query: Option<&Q>, ) -> Result<T, HttpError>
The “Master” request function. It handles URL generation, Authentication, Error Checking, and Parsing.
route: The Route enum (provides path and HTTP method).body: Optional JSON body (for POST/PATCH).query: Optional Query params (for GET/DELETE).
pub async fn get<T: DeserializeOwned>( &self, route: Route<'_>, ) -> Result<T, HttpError>
pub async fn execute<B: Serialize, T: DeserializeOwned>( &self, route: Route<'_>, body: B, ) -> Result<T, HttpError>
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 (const: unstable) · 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 !UnwindSafe for HttpClient
impl Freeze for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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