gusto_api/
current_user.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct CurrentUser {
5    pub client: Client,
6}
7
8impl CurrentUser {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        CurrentUser { client }
12    }
13
14    /**
15     * Get the current user.
16     *
17     * This function performs a `GET` to the `/v1/me` endpoint.
18     *
19     * Returns information pertaining to the user associated with the provided access token.
20     */
21    pub async fn get_me(&self) -> ClientResult<crate::Response<crate::types::CurrentUser>> {
22        let url = self.client.url("/v1/me", None);
23        self.client
24            .get(
25                &url,
26                crate::Message {
27                    body: None,
28                    content_type: None,
29                },
30            )
31            .await
32    }
33}