Trait github_rs::github::Users [] [src]

pub trait Users {
    fn get_user(&self) -> Result<User>;
    fn patch_user(&self, user: PatchUser) -> Result<User>;
    fn get_users_username(&self, username: &str) -> Result<User>;
    fn get_users(&self, user_id: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>;
    fn get_user_followers(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>;
    fn get_users_username_followers(&self, username: &str, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>;
    fn get_user_emails(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<Email>>;
    fn post_user_emails(&self, emails: Vec<String>) -> Result<Vec<Email>>;
    fn delete_user_emails(&self, emails: Vec<String>) -> Result<bool>;
    fn get_user_following(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>;
    fn get_user_following_username(&self, username: &str) -> Result<bool>;
    fn put_user_following_username(&self, username: &str) -> Result<bool>;
    fn delete_user_following_username(&self, username: &str) -> Result<bool>;
    fn get_users_username_following(&self, username: &str, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>;
    fn get_users_username_following_target_user(&self, username: &str, target_user: &str) -> Result<bool>;
    fn get_user_keys(&self) -> Result<Vec<SSHKey>>;
    fn get_user_keys_id(&self, id: u64) -> Result<Option<SSHKey>>;
    fn post_user_keys(&self, new_key: SSHKey) -> Result<SSHKey>;
    fn delete_user_keys(&self, id: u64) -> Result<bool>;
    fn get_users_username_keys(&self, username: &str) -> Result<Vec<SSHKey>>;
}

Trait used to define access to endpoints grouped under Users in the Github API specification

Required Methods

fn get_user(&self) -> Result<User>

Request Type:

GET

Endpoint:

/user

Description

Returns a User Struct for the authenticated user.

fn patch_user(&self, user: PatchUser) -> Result<User>

Request Type:

PATCH

Endpoint:

/user

Description

Returns a User struct of the authenticated user once their data has been updated

fn get_users_username(&self, username: &str) -> Result<User>

Request Type:

GET

Endpoint:

/users/:username/keys

Description

Returns a Vector of all SSHKeys from the username specified

fn get_users(&self, user_id: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>

Request Type:

GET

Endpoint:

/users

Description

Returns a vector of Users from the website. This is a paginated request to the endpoint.

fn get_user_followers(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>

Request Type:

GET

Endpoint:

/user/followers

Description

Returns a vector of Users followin the authenticated user. This is a paginated request to the endpoint.

fn get_users_username_followers(&self, username: &str, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>

Request Type:

GET

Endpoint:

/users/:username/followers

Description

Returns a vector of Users following the username passed into the function. This is a paginated request to the endpoint.

fn get_user_emails(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<Email>>

Request Type:

GET

Endpoint:

/user/emails

Description

Returns a vector of Emails of the authenticated user. This is a paginated request to the endpoint.

fn post_user_emails(&self, emails: Vec<String>) -> Result<Vec<Email>>

Request Type:

POST

Endpoint:

/user/emails

Description

Returns a vector of Emails when they've been added to the user's profile

fn delete_user_emails(&self, emails: Vec<String>) -> Result<bool>

Request Type:

DELETE

Endpoint:

/user/emails

Description

Returns a boolean value. True if the email(s) were deleted and false otherwise. The email strings must match verbatim for the corresponding email to be deleted.

fn get_user_following(&self, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>

Request Type:

GET

Endpoint:

/user/following

Description

Returns a vector of all Users the authenticated user is following. This is a paginated request to the endpoint.

fn get_user_following_username(&self, username: &str) -> Result<bool>

Request Type:

GET

Endpoint:

/user/following/:username

Description

Returns true if the authenticated user is following the username passed to the function and false otherwise.

fn put_user_following_username(&self, username: &str) -> Result<bool>

Request Type:

PUT

Endpoint:

/user/following/:username

Description

Returns true is the user is now following the given username and false otherwise

fn delete_user_following_username(&self, username: &str) -> Result<bool>

Request Type:

DELETE

Endpoint:

/user/following/:username

Description

Returns true if the authenticated user unfollowed the username passed in and false otherwise.

fn get_users_username_following(&self, username: &str, page_num: Option<u64>, per_page: Option<u64>) -> Result<Vec<User>>

Request Type:

GET

Endpoint:

/users/:username/following

Description

Returns a vector of Users that the given username is following. This is a paginated request to the endpoint.

fn get_users_username_following_target_user(&self, username: &str, target_user: &str) -> Result<bool>

Request Type:

GET

Endpoint:

/users/:username/following/:target_user

Description

Returns true is the username is following the target user and false otherwise.

fn get_user_keys(&self) -> Result<Vec<SSHKey>>

Request Type:

GET

Endpoint:

/user/keys

Description

Returns a Vector of all SSHKeys that the authenticate user might have.

fn get_user_keys_id(&self, id: u64) -> Result<Option<SSHKey>>

Request Type:

GET

Endpoint:

/user/keys/:id

Description

Returns an SSHKey to the user that is specified by id. If it does not exist a None value is returned.

fn post_user_keys(&self, new_key: SSHKey) -> Result<SSHKey>

Request Type:

POST

Endpoint:

/user/keys

Description

Creates a new SSH key sending it back if it worked out properly.

fn delete_user_keys(&self, id: u64) -> Result<bool>

Request Type:

DELETE

Endpoint:

/user/keys

Description

Returns a boolean value. True is the ssh key was deleted and false otherwise. The id number of the key is what is used to determine which one to delete.

fn get_users_username_keys(&self, username: &str) -> Result<Vec<SSHKey>>

Request Type:

GET

Endpoint:

/users/:username/keys

Description

Returns a Vector of all SSHKeys from the username specified

Implementors