Skip to main content

paperless_api/
task.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
4#[repr(transparent)]
5pub struct TaskId(pub String);
6
7/// A paperless task
8#[derive(Debug, Clone, Deserialize)]
9pub struct Task {
10    pub id: i32,
11    pub task_id: TaskId,
12
13    #[serde(rename = "task_name")]
14    pub name: String,
15
16    pub owner: i32,
17    pub status: String,
18    pub acknowledged: bool,
19    pub result: Option<String>,
20    pub related_document: Option<String>,
21}
22
23impl std::fmt::Display for TaskId {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        write!(f, "{}", self.0)
26    }
27}