gitea_sdk/model/user.rs
1use serde::{Deserialize, Serialize};
2
3#[derive(Default, Debug, Clone, Serialize, Deserialize)]
4/// Represents a user's settings.
5pub struct UserSettings {
6 pub diff_view_style: String,
7 pub hide_activity: bool,
8 pub full_name: String,
9 pub hide_email: bool,
10 pub theme: String,
11 pub enable_repo_unit_hints: Option<bool>,
12 pub description: Option<String>,
13 pub language: Option<String>,
14 pub location: Option<String>,
15 pub pronouns: Option<String>,
16 pub website: Option<String>,
17}
18
19#[derive(Default, Debug, Clone, Serialize, Deserialize)]
20/// Represents an access token.
21pub struct AccessToken {
22 /// ID of the access token.
23 pub id: i64,
24 /// Name of the access token.
25 pub name: String,
26 /// The token's scopes.
27 pub scopes: Option<Vec<String>>,
28 /// The token's SHA1 hash. This is probably what you want to store to access the API.
29 pub sha1: String,
30 /// The token's last eight characters. Useful for verifying the token.
31 pub token_last_eight: String,
32}
33
34/// Represents a Gitea user.
35#[derive(Default, Debug, Clone, Serialize, Deserialize)]
36#[serde(default)]
37pub struct User {
38 /// Whether the user is active.
39 pub active: bool,
40 /// URL to the user's avatar.
41 pub avatar_url: String,
42 /// Date the user was created at.
43 pub created: String,
44 /// Description of the user (empty string if the user did not provide a discription).
45 pub description: String,
46 /// Email of the user.
47 pub email: String,
48 /// Number of followers the user has.
49 pub followers_count: i64,
50 /// Number of users the user is following.
51 pub following_count: i64,
52 /// Full name of the user.
53 pub full_name: String,
54 /// ID of the user.
55 pub id: i64,
56 /// Whether the user is an admin.
57 pub is_admin: bool,
58 /// Language the user speaks (empty string if the user did not specify any languaged).
59 pub language: String,
60 /// Date the user last logged in.
61 pub last_login: String,
62 /// Location of the user (empty string if the user did not provide a location).
63 pub location: String,
64 /// The user's username
65 pub login: String,
66 /// The user's authenticated sign-in name. Empty by default.
67 pub login_name: String,
68 /// Whether the user is prohibited from logging in.
69 pub prohibit_login: bool,
70 /// Pronouns of the user (empty string if the user did not provide any pronouns).
71 pub pronouns: String,
72 /// Whether the user is restricted.
73 pub restricted: bool,
74 /// Number of repositories the user has starred.
75 pub starred_repos_count: i64,
76 /// User visibility.
77 /// Can be one of "public", "limited", or "private".
78 pub visibility: String,
79 /// The user's website (empty string if the user did not provide a website).
80 pub website: String,
81}