forgejo_sdk/api/
user.rs

1use super::*;
2
3#[derive(Deserialize, Serialize, Debug, Clone)]
4pub struct User {
5    pub id: u64,
6    pub active: bool,
7    pub avatar_url: String,
8    pub created: String,
9    pub description: String,
10    pub email:String,
11    pub followers_count: usize,
12    pub following_count: usize,
13    pub full_name: String,
14    pub is_admin: bool,
15    pub language: String,
16    pub last_login: String,
17    pub location: String,
18    pub prohibit_login: bool,
19    pub restricted: bool,
20    pub starred_repo_count: usize,
21    pub visibility: String,
22    pub website: String
23}
24
25impl Client {
26    /// Get the user that is currently authenticated.
27    pub async fn get_current_user(&self) -> Result<User> {
28        self.get("/user").await
29    }
30
31    pub async fn get_user(&self, username: &str) -> Result<User> {
32        self.get(&format!("/users/{username}")).await
33    }
34}