diff options
author | Cyborus <cyborus@noreply.codeberg.org> | 2024-03-20 19:09:31 +0100 |
---|---|---|
committer | Cyborus <cyborus@noreply.codeberg.org> | 2024-03-20 19:09:31 +0100 |
commit | 96b92daf235985c17f19af0f0f19c20055d78f09 (patch) | |
tree | 445b0f8a7db46cfd09080084aab0d9d17dc40b38 /src/user.rs | |
parent | Merge pull request 'add missing `parent` field to `Repository`' (#36) from pa... (diff) | |
parent | correct tag creation success status code to `201` (diff) | |
download | forgejo-api-96b92daf235985c17f19af0f0f19c20055d78f09.tar.xz forgejo-api-96b92daf235985c17f19af0f0f19c20055d78f09.zip |
Merge pull request 'Auto-generate API' (#38) from autogen into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-api/pulls/38
Diffstat (limited to 'src/user.rs')
-rw-r--r-- | src/user.rs | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/user.rs b/src/user.rs deleted file mode 100644 index a99a5e2..0000000 --- a/src/user.rs +++ /dev/null @@ -1,59 +0,0 @@ -use super::*; - -/// User operations. -impl Forgejo { - /// Returns info about the authorized user. - pub async fn myself(&self) -> Result<User, ForgejoError> { - self.get("user").await - } - - /// Returns info about the specified user. - pub async fn get_user(&self, user: &str) -> Result<Option<User>, ForgejoError> { - self.get_opt(&format!("users/{user}/")).await - } - - /// Gets the list of users that follow the specified user. - pub async fn get_followers(&self, user: &str) -> Result<Option<Vec<User>>, ForgejoError> { - self.get_opt(&format!("users/{user}/followers/")).await - } - - /// Gets the list of users the specified user is following. - pub async fn get_following(&self, user: &str) -> Result<Option<Vec<User>>, ForgejoError> { - self.get_opt(&format!("users/{user}/following/")).await - } -} - -#[derive(serde::Deserialize, Debug, PartialEq)] -pub struct User { - pub active: bool, - pub avatar_url: Url, - #[serde(with = "time::serde::rfc3339")] - pub created: time::OffsetDateTime, - pub description: String, - pub email: String, - pub followers_count: u64, - pub following_count: u64, - pub full_name: String, - pub id: u64, - pub is_admin: bool, - pub language: String, - #[serde(with = "time::serde::rfc3339")] - pub last_login: time::OffsetDateTime, - pub location: String, - pub login: String, - pub login_name: String, - pub prohibit_login: bool, - pub restricted: bool, - pub starred_repos_count: u64, - pub website: String, -} - -#[derive(serde::Deserialize, Debug, PartialEq)] -pub enum UserVisibility { - #[serde(rename = "public")] - Public, - #[serde(rename = "limited")] - Limited, - #[serde(rename = "private")] - Private, -} |