Skip to main content

paperless_api/metadata/
correspondent.rs

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