Skip to main content

paperless_api/
lib.rs

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