Skip to main content

cloudreve_api/api/v4/models/
dav.rs

1//! WebDAV account models for Cloudreve API v4
2
3use serde::{Deserialize, Serialize};
4
5/// WebDAV account information
6#[derive(Debug, Serialize, Deserialize, Clone)]
7pub struct DavAccount {
8    pub id: String,
9    pub created_at: String,
10    pub name: String,
11    pub uri: String,
12    pub password: String,
13    pub options: String,
14}
15
16/// Request to create or update a WebDAV account
17#[derive(Debug, Serialize)]
18pub struct CreateDavAccountRequest {
19    /// Root folder path (will be converted to URI format internally)
20    ///
21    /// Can be:
22    /// - Absolute path: "/folder"
23    /// - Relative path: "folder"
24    /// - Already formatted URI: "cloudreve://my/folder"
25    pub uri: String,
26    /// Account annotation (1-255 characters)
27    pub name: String,
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub readonly: Option<bool>,
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub proxy: Option<bool>,
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub disable_sys_files: Option<bool>,
34}
35
36/// Pagination metadata for list responses
37#[derive(Debug, Serialize, Deserialize, Clone)]
38pub struct Pagination {
39    pub page: i32,
40    pub page_size: i32,
41    pub total_items: Option<i64>,
42    pub next_page_token: Option<String>,
43}
44
45/// Response for listing WebDAV accounts
46#[derive(Debug, Serialize, Deserialize)]
47pub struct DavAccountsResponse {
48    pub accounts: Vec<DavAccount>,
49    pub pagination: Pagination,
50}