1use crate::client::{Client, decode_response};
4use crate::errors::Error;
5use crate::types::*;
6
7impl Client {
8 pub async fn list_users(&self, opts: Option<&QueryOptions>) -> Result<UserPrefsArray, Error> {
10 let path = "/search/users";
11 let resp = self.send_get(&path, opts).await?;
12 decode_response(resp).await
13 }
14
15 pub async fn get_authenticated(&self) -> Result<User, Error> {
17 let path = "/user";
18 let resp = self.send_get(&path, None).await?;
19 decode_response(resp).await
20 }
21
22 pub async fn get_users(&self, account_id: f64) -> Result<User, Error> {
24 let path = format!("/user/{}", account_id);
25 let resp = self.send_get(&path, None).await?;
26 decode_response(resp).await
27 }
28
29 pub async fn get_by_username(&self, username: &str) -> Result<User, Error> {
31 let path = format!("/users/{}", username);
32 let resp = self.send_get(&path, None).await?;
33 decode_response(resp).await
34 }
35}