Skip to main content

ClientCurrentUserExt

Trait ClientCurrentUserExt 

Source
pub trait ClientCurrentUserExt {
    // Required methods
    fn current_user_view(&self) -> CurrentUserView<'_>;
    fn current_user_groups(&self) -> CurrentUserGroups<'_>;
    fn current_user_ssh_key_list(&self) -> CurrentUserSshKeyList<'_>;
    fn current_user_ssh_key_create(&self) -> CurrentUserSshKeyCreate<'_>;
    fn current_user_ssh_key_view(&self) -> CurrentUserSshKeyView<'_>;
    fn current_user_ssh_key_delete(&self) -> CurrentUserSshKeyDelete<'_>;
}
Expand description

Information pertaining to the current user.

Required Methods§

Source

fn current_user_view(&self) -> CurrentUserView<'_>

Fetch user for current session

Sends a GET request to /v1/me

let response = client.current_user_view()
   .send()
   .await;
Source

fn current_user_groups(&self) -> CurrentUserGroups<'_>

Fetch current user’s groups

Sends a GET request to /v1/me/groups

Arguments:

  • limit: Maximum number of items returned by a single call
  • page_token: Token returned by previous call to retrieve the subsequent page
  • sort_by
let response = client.current_user_groups()
   .limit(limit)
   .page_token(page_token)
   .sort_by(sort_by)
   .send()
   .await;
Source

fn current_user_ssh_key_list(&self) -> CurrentUserSshKeyList<'_>

List SSH public keys

Lists SSH public keys for the currently authenticated user.

Sends a GET request to /v1/me/ssh-keys

Arguments:

  • limit: Maximum number of items returned by a single call
  • page_token: Token returned by previous call to retrieve the subsequent page
  • sort_by
let response = client.current_user_ssh_key_list()
   .limit(limit)
   .page_token(page_token)
   .sort_by(sort_by)
   .send()
   .await;
Source

fn current_user_ssh_key_create(&self) -> CurrentUserSshKeyCreate<'_>

Create SSH public key

Create an SSH public key for the currently authenticated user.

Sends a POST request to /v1/me/ssh-keys

let response = client.current_user_ssh_key_create()
   .body(body)
   .send()
   .await;
Source

fn current_user_ssh_key_view(&self) -> CurrentUserSshKeyView<'_>

Fetch SSH public key

Fetch SSH public key associated with the currently authenticated user.

Sends a GET request to /v1/me/ssh-keys/{ssh_key}

Arguments:

  • ssh_key: Name or ID of the SSH key
let response = client.current_user_ssh_key_view()
   .ssh_key(ssh_key)
   .send()
   .await;
Source

fn current_user_ssh_key_delete(&self) -> CurrentUserSshKeyDelete<'_>

Delete SSH public key

Delete an SSH public key associated with the currently authenticated user.

Sends a DELETE request to /v1/me/ssh-keys/{ssh_key}

Arguments:

  • ssh_key: Name or ID of the SSH key
let response = client.current_user_ssh_key_delete()
   .ssh_key(ssh_key)
   .send()
   .await;

Implementors§