forgejo-sdk 0.1.0

An SDK for the Forgejo REST API
Documentation
use super::*;

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct User {
    pub id: u64,
    pub active: bool,
    pub avatar_url: String,
    pub created: String,
    pub description: String,
    pub email:String,
    pub followers_count: usize,
    pub following_count: usize,
    pub full_name: String,
    pub is_admin: bool,
    pub language: String,
    pub last_login: String,
    pub location: String,
    pub prohibit_login: bool,
    pub restricted: bool,
    pub starred_repo_count: usize,
    pub visibility: String,
    pub website: String
}

impl Client {
    /// Get the user that is currently authenticated.
    pub async fn get_current_user(&self) -> Result<User> {
        self.get("/user").await
    }

    pub async fn get_user(&self, username: &str) -> Result<User> {
        self.get(&format!("/users/{username}")).await
    }
}