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, Default, Clone, Deserialize, Serialize, CreateDto, UpdateDto, Item)]
12#[api_info(endpoint = "correspondents")]
13pub struct Correspondent {
14    /// Unique identifier of the correspondent.
15    #[dto(skip)]
16    pub id: crate::id::CorrespondentId,
17
18    /// Slug of the correspondent.
19    #[dto(skip)]
20    pub slug: String,
21
22    /// Name of the correspondent.
23    pub name: String,
24
25    /// Matching pattern for the tag.
26    #[serde(rename = "match")]
27    pub match_pattern: String,
28
29    /// Matching algorithm for the tag.
30    pub matching_algorithm: MatchAlgorithm,
31
32    /// Whether the tag matching is case-insensitive.
33    pub is_insensitive: bool,
34
35    /// The number of documents associated with this correspondent.
36    #[dto(skip)]
37    #[serde(default)]
38    pub document_count: u32,
39
40    /// The user who owns this correspondent, if any.
41    pub owner: Option<crate::id::UserId>,
42
43    /// The permissions for this correspondent.
44    #[dto(skip)]
45    #[serde(flatten)]
46    pub permissions: ItemPermissions,
47}