pub struct UserClient { /* private fields */ }Expand description
The client to acsess user information
§Returns:
The desired information as the inbuild UserResult enum type
Implementations§
Source§impl UserClient
impl UserClient
Sourcepub fn new(auth: String) -> UserClient
pub fn new(auth: String) -> UserClient
Creates a new UserClient object
What this function does is initialize all of the values for the client to use
This function must be directly called after UserClient (ex: UserClient::new(auth))
§Parameters
auth: String - The revolt authentication token of the user
Sourcepub fn fetch_self(&mut self) -> &mut Self
pub fn fetch_self(&mut self) -> &mut Self
Fetchs the data of the currently authenticated user
Sets the UserResult enum to UserResult::User
Sourcepub fn fetch_user(&mut self, target: &str) -> &mut Self
pub fn fetch_user(&mut self, target: &str) -> &mut Self
Fetchs a user’s data
Sets the UserResult enum to UserResult::User
§Parameters:
target: &str - The userid of the user you want data for on revolt
Sourcepub fn fetch_user_flags(&mut self, target: &str) -> &mut Self
pub fn fetch_user_flags(&mut self, target: &str) -> &mut Self
Fetchs the flags of a user
Flags are information about the users account status on revolt
- 1: Suspended
- 2: Deleted
- 4: Banned
Sets the UserResult enum to UserResult::UsersFlags
§Parameters:
target: &str - The userid of the user you want data for on revolt
Sourcepub fn fetch_default_avatar(&mut self, target: &str) -> &mut Self
pub fn fetch_default_avatar(&mut self, target: &str) -> &mut Self
Returns the binary data of a persons avatar
This function in pair with ‘avatar’ in UserResult will return a string that you will have to parse to form an image
§Parameters:
target: &str - The id of the user that you want the avatar of
Sourcepub fn fetch_user_profile(&mut self, target: &str) -> &mut Self
pub fn fetch_user_profile(&mut self, target: &str) -> &mut Self
Fetchs the profile data of a user
§Parameters:
target: &str - The id of the user that you want to fetch the profile of
Sourcepub fn fetch_mutuals(&mut self, target: &str) -> &mut Self
pub fn fetch_mutuals(&mut self, target: &str) -> &mut Self
Fetches the mutual users and servers of a person
§Parameters:
target: &str - The user id of the person you want to compare
Sourcepub fn friend(&mut self, target: &str) -> &mut Self
pub fn friend(&mut self, target: &str) -> &mut Self
Accepts or denies a friend request
§Prameters:
target: &str - The persons whoes friend request you want to accep/deny
Note
If you do .put() after it will accept the request, .del() will deny it or remove the friend
Sourcepub fn block(&mut self, target: &str) -> &mut Self
pub fn block(&mut self, target: &str) -> &mut Self
Blocks or unblocks a user
§Prameters:
target: &str - The person who you want to block/unblock
Note
If you do .put() it will block the user, .del() will unblock them
Sourcepub fn friend_request(&mut self, target: &str) -> &mut Self
pub fn friend_request(&mut self, target: &str) -> &mut Self
Sends a friend request to a user
§Prameters:
target: &str - The username and discrimeter of the user you want to send a friend request to
ex: “Bird#9223”
Sourcepub fn get(&mut self) -> UserResult
pub fn get(&mut self) -> UserResult
Runs the client for a get request
This function makes the request, applies rate limits, and caches/retrives values from the cache
§Retruns:
This function returns a UserResult enum that can be printed out or used to get more specific data from the json data provided
Sourcepub fn patch(&mut self) -> UserResult
pub fn patch(&mut self) -> UserResult
Runs the client for a patch request
This function makes the request, applies rate limits, sends the data, and returns the result
§Retruns:
This function returns a UserResult enum that can be printed out or used to get more specific data from the json data provided
Sourcepub fn put(&mut self) -> UserResult
pub fn put(&mut self) -> UserResult
Runs the client for a put request
This function makes the request, applies rate limits, and returns the result
§Retruns:
This function returns a UserResult enum that can be printed out or used to get more specific data from the json data provided
Sourcepub fn del(&mut self) -> UserResult
pub fn del(&mut self) -> UserResult
Runs the client for a delete request
This function makes the request, applies rate limits, and returns the result
§Retruns:
This function returns a UserResult enum that can be printed out or used to get more specific data from the json data provided
Sourcepub fn post(&mut self) -> UserResult
pub fn post(&mut self) -> UserResult
Runs the client for a post request
This function makes the request, applies rate limits, sends the data, and returns the result
§Retruns:
This function returns a UserResult enum that can be printed out or used to get more specific data from the json data provided
Trait Implementations§
Source§impl Clone for UserClient
impl Clone for UserClient
Source§fn clone(&self) -> UserClient
fn clone(&self) -> UserClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more