Skip to main content

paperless_api/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod client;
4pub mod correspondent;
5pub mod custom_field;
6pub mod document;
7pub mod document_type;
8pub mod id;
9pub mod note;
10pub mod share_link;
11pub mod storage_path;
12pub mod tag;
13pub mod task;
14pub mod user;
15pub mod util;
16pub mod workflow;
17
18pub use client::{PaperlessClient, RefreshData};
19pub use correspondent::Correspondent;
20pub use custom_field::{CustomField, DocumentCustomField};
21pub use document::Document;
22pub use document_type::DocumentType;
23pub use share_link::ShareLink;
24pub use storage_path::StoragePath;
25pub use tag::Tag;
26pub use task::Task;
27pub use user::User;
28pub use workflow::Workflow;
29
30#[derive(Debug, thiserror::Error)]
31pub enum Error {
32    #[error("response error: status code {status_code}, body: {body}")]
33    Response { status_code: u16, body: String },
34
35    #[error(transparent)]
36    Request(#[from] Box<dyn std::error::Error + Send + Sync + 'static>),
37
38    #[error("other error: {0}")]
39    Other(String),
40
41    #[error("invalid json: {0}")]
42    InvalidJson(String),
43
44    #[error("not found")]
45    NotFound,
46
47    #[error("not changeable")]
48    NotChangeable,
49
50    #[error("already deleted")]
51    AlreadyDeleted,
52}
53
54type Result<T> = std::result::Result<T, Error>;