Skip to main content

paperless_api/
lib.rs

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