cloudreve_api/api/v4/models/
user.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Deserialize)]
7pub struct Quota {
8 pub used: u64,
9 pub total: u64,
10 #[serde(default)]
11 pub storage_pack_total: Option<u64>,
12}
13
14#[derive(Debug, Serialize, Deserialize, Default)]
16#[serde(default)]
17pub struct UserSettings {
18 #[serde(default)]
20 pub group_expires: Option<String>,
21
22 #[serde(default)]
24 pub open_id: Option<Vec<OpenIDInfo>>,
25
26 #[serde(default)]
28 pub version_retention_enabled: bool,
29
30 #[serde(default)]
32 pub version_retention_ext: Option<Vec<String>>,
33
34 #[serde(default)]
36 pub version_retention_max: Option<i64>,
37
38 #[serde(default)]
40 pub passwordless: bool,
41
42 #[serde(default)]
44 pub two_fa_enabled: bool,
45
46 #[serde(default)]
48 pub passkeys: Option<Vec<Passkey>>,
49
50 #[serde(default)]
52 pub login_activity: Option<Vec<LoginActivity>>,
53
54 #[serde(default)]
56 pub storage_packs: Vec<StoragePack>,
57
58 #[serde(default)]
60 pub credit: i64,
61
62 #[serde(default)]
64 pub disable_view_sync: bool,
65
66 #[serde(default)]
68 pub share_links_in_profile: Option<String>,
69}
70
71#[derive(Debug, Serialize, Deserialize, Default)]
73#[serde(default)]
74pub struct OpenIDInfo {
75 #[serde(default)]
76 pub provider: i32,
77 #[serde(default)]
78 pub linked_at: String,
79}
80
81#[derive(Debug, Serialize, Deserialize, Default)]
83#[serde(default)]
84pub struct Passkey {
85 #[serde(default)]
86 pub id: String,
87 #[serde(default)]
88 pub name: String,
89 #[serde(default)]
90 pub used_at: Option<String>,
91 #[serde(default)]
92 pub created_at: String,
93}
94
95#[derive(Debug, Serialize, Deserialize, Default)]
97#[serde(default)]
98pub struct LoginActivity {
99 #[serde(default)]
100 pub created_at: String,
101 #[serde(default)]
102 pub ip: String,
103 #[serde(default)]
104 pub browser: String,
105 #[serde(default)]
106 pub device: String,
107 #[serde(default)]
108 pub os: String,
109 #[serde(default)]
110 pub login_with: String,
111 #[serde(default)]
112 pub open_id_provider: i32,
113 #[serde(default)]
114 pub success: bool,
115 #[serde(default)]
116 pub webdav: bool,
117}
118
119#[derive(Debug, Serialize, Deserialize, Default)]
121#[serde(default)]
122pub struct StoragePack {
123 #[serde(default)]
124 pub name: String,
125 #[serde(default)]
126 pub active_since: String,
127 #[serde(default)]
128 pub expire_at: String,
129 #[serde(default)]
130 pub size: i64,
131}
132
133#[derive(Debug, Serialize)]
135pub struct UpdateProfileRequest<'a> {
136 pub nickname: Option<&'a str>,
137 pub email: Option<&'a str>,
138 pub avatar: Option<&'a str>,
139}
140
141#[derive(Debug, Serialize)]
143pub struct ChangePasswordRequest<'a> {
144 pub old_password: &'a str,
145 pub new_password: &'a str,
146}
147
148#[derive(Debug, Serialize)]
150pub struct SearchUserRequest<'a> {
151 pub query: &'a str,
152 pub page: Option<u32>,
153 pub page_size: Option<u32>,
154}
155
156#[derive(Debug, Serialize)]
158pub struct UpdateUserSettingRequest<'a> {
159 pub key: &'a str,
160 pub value: &'a str,
161}
162
163#[derive(Debug, Serialize, Deserialize)]
165pub struct CreditChangeRecord {
166 pub id: String,
167 pub amount: i64,
168 pub reason: String,
169 pub created_at: String,
170}
171
172#[derive(Debug, Serialize, Deserialize)]
174pub struct PaymentRecord {
175 pub id: String,
176 pub amount: f64,
177 pub method: String,
178 pub status: String,
179 pub created_at: String,
180 pub transaction_id: Option<String>,
181}