paperless_api/tag.rs
1use serde::Deserialize;
2
3use crate::{id::TagId, util::MatchAlgorithm};
4
5/// A document tag
6#[derive(Debug, Clone, Deserialize)]
7pub struct Tag {
8 /// Unique identifier of the tag.
9 pub id: TagId,
10
11 /// Slug of the tag.
12 pub slug: String,
13
14 /// Name of the tag.
15 pub name: String,
16
17 /// Color of the tag, in hex format.
18 pub color: String,
19
20 /// Color of the text on the tag, in hex format.
21 pub text_color: String,
22
23 /// Matching pattern for the tag.
24 #[serde(rename = "match")]
25 pub match_pattern: Option<String>,
26
27 /// Matching algorithm for the tag.
28 pub matching_algorithm: Option<MatchAlgorithm>,
29
30 /// Whether the tag is case-insensitive.
31 pub is_insensitive: bool,
32
33 /// Whether the tag is an inbox tag.
34 pub is_inbox_tag: bool,
35
36 /// Number of documents associated with this tag.
37 pub document_count: u32,
38
39 /// Owner of the tag.
40 pub owner: Option<crate::id::UserId>,
41
42 /// Whether the user can change the tag.
43 pub user_can_change: bool,
44
45 /// Parent tag of this tag.
46 pub parent: Option<TagId>,
47
48 /// Children tags of this tag.
49 pub children: Vec<Box<Tag>>,
50}