1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use anyhow::Result;

use crate::Client;

pub struct CurrentUser {
    client: Client,
}

impl CurrentUser {
    #[doc(hidden)]
    pub fn new(client: Client) -> Self {
        CurrentUser { client }
    }

    /**
     * Get the current user.
     *
     * This function performs a `GET` to the `/v1/me` endpoint.
     *
     * Returns information pertaining to the user associated with the provided access token.
     */
    pub async fn get_me(&self) -> Result<crate::types::CurrentUser> {
        let url = "/v1/me".to_string();
        self.client.get(&url, None).await
    }
}