Skip to main content

paperless_api/metadata/
storage_path.rs

1//! Types related to storage paths.
2
3use serde::{Deserialize, Serialize};
4
5use paperless_api_macros::{CreateDto, Item, UpdateDto};
6
7use super::MatchAlgorithm;
8use super::permission::ItemPermissions;
9
10/// A storage path.
11#[derive(Debug, Clone, Deserialize, Serialize, CreateDto, UpdateDto, Item)]
12#[api_info(endpoint = "storage_paths")]
13pub struct StoragePath {
14    /// Unique identifier of the storage path.
15    #[dto(skip)]
16    pub id: crate::id::StoragePathId,
17
18    /// Slug of the storage path.
19    #[dto(skip)]
20    pub slug: String,
21
22    /// Name of the storage path.
23    pub name: String,
24    pub path: String,
25
26    /// Matching pattern for the storage path.
27    #[serde(rename = "match")]
28    pub match_pattern: Option<String>,
29
30    /// Matching algorithm for the storage path.
31    pub matching_algorithm: MatchAlgorithm,
32
33    /// Whether the storage path matching is case-insensitive.
34    pub is_insensitive: bool,
35
36    /// The number of documents associated with this storage path.
37    #[dto(skip)]
38    #[serde(default)]
39    pub document_count: u32,
40
41    /// The user who owns this storage path, if any.
42    pub owner: Option<crate::id::UserId>,
43
44    /// The permissions for this storage path.
45    #[dto(skip)]
46    #[serde(flatten)]
47    pub permissions: ItemPermissions,
48}