cloudreve_api/api/v4/models/
user.rs

1//! User management models for Cloudreve API v4
2
3use serde::{Deserialize, Serialize};
4
5/// Storage quota information
6#[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/// User settings
15#[derive(Debug, Serialize, Deserialize)]
16pub struct UserSettings {
17    pub theme: Option<String>,
18    pub language: Option<String>,
19    pub timezone: Option<String>,
20}
21
22/// Update profile request
23#[derive(Debug, Serialize)]
24pub struct UpdateProfileRequest<'a> {
25    pub nickname: Option<&'a str>,
26    pub email: Option<&'a str>,
27    pub avatar: Option<&'a str>,
28}
29
30/// Change password request
31#[derive(Debug, Serialize)]
32pub struct ChangePasswordRequest<'a> {
33    pub old_password: &'a str,
34    pub new_password: &'a str,
35}
36
37/// Search user request
38#[derive(Debug, Serialize)]
39pub struct SearchUserRequest<'a> {
40    pub query: &'a str,
41    pub page: Option<u32>,
42    pub page_size: Option<u32>,
43}
44
45/// Update user setting request
46#[derive(Debug, Serialize)]
47pub struct UpdateUserSettingRequest<'a> {
48    pub key: &'a str,
49    pub value: &'a str,
50}
51
52/// Credit change record
53#[derive(Debug, Serialize, Deserialize)]
54pub struct CreditChangeRecord {
55    pub id: String,
56    pub amount: i64,
57    pub reason: String,
58    pub created_at: String,
59}
60
61/// Payment record
62#[derive(Debug, Serialize, Deserialize)]
63pub struct PaymentRecord {
64    pub id: String,
65    pub amount: f64,
66    pub method: String,
67    pub status: String,
68    pub created_at: String,
69    pub transaction_id: Option<String>,
70}