paperless_api/tag.rs
1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
4#[repr(transparent)]
5pub struct TagId(pub i32);
6
7/// A document tag
8#[derive(Debug, Clone, Deserialize)]
9pub struct Tag {
10 /// Unique identifier of the tag.
11 pub id: TagId,
12
13 /// Name of the tag.
14 pub name: String,
15
16 /// Number of documents associated with this tag.
17 pub document_count: i32,
18}
19
20impl std::fmt::Display for TagId {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 write!(f, "{}", self.0)
23 }
24}