pub struct PaperlessClient { /* private fields */ }Expand description
Client to interact with Paperless.
Implementations§
Source§impl PaperlessClient
impl PaperlessClient
Sourcepub fn new(
base_url: &str,
token: &str,
headers: Option<&HashMap<String, String>>,
) -> Result<Self, String>
pub fn new( base_url: &str, token: &str, headers: Option<&HashMap<String, String>>, ) -> Result<Self, String>
Create a new Paperless client.
pub async fn refresh_all(&mut self) -> Result<(), Error>
Sourcepub async fn refresh(
&mut self,
data: impl IntoIterator<Item = RefreshData>,
) -> Result<(), Error>
pub async fn refresh( &mut self, data: impl IntoIterator<Item = RefreshData>, ) -> Result<(), Error>
Refresh selected cached metadata concurrently.
Get all documents with any of the given tags.
Sourcepub async fn get_document_by_id(
&self,
id: DocumentId,
) -> Result<Document, Error>
pub async fn get_document_by_id( &self, id: DocumentId, ) -> Result<Document, Error>
Get a document by its ID.
Sourcepub async fn get_task_status(
&self,
task_id: Option<&TaskId>,
task_name: Option<&str>,
acknowledged: Option<bool>,
) -> Result<Vec<Task>, Error>
pub async fn get_task_status( &self, task_id: Option<&TaskId>, task_name: Option<&str>, acknowledged: Option<bool>, ) -> Result<Vec<Task>, Error>
Get all tasks with optional filtering by ID, name, or acknowledged status.
pub fn get_workflows( &self, ) -> impl Future<Output = Result<Vec<Workflow>, Error>>
Sourcepub async fn upload_document(
&self,
file_path: &Path,
filename: &str,
) -> Result<TaskId, Error>
pub async fn upload_document( &self, file_path: &Path, filename: &str, ) -> Result<TaskId, Error>
Upload a document to Paperless.
Returns the task ID on success.
pub fn storage_paths(&self) -> &HashMap<StoragePathId, StoragePath>
pub fn find_tag_by_name(&self, name: &str) -> Option<&Tag>
pub fn document_types(&self) -> &HashMap<DocumentTypeId, DocumentType>
pub fn find_document_type_by_name(&self, name: &str) -> Option<&DocumentType>
pub fn correspondents(&self) -> &HashMap<CorrespondentId, Correspondent>
pub fn custom_fields(&self) -> &HashMap<CustomFieldId, CustomField>
pub fn find_custom_field_by_name(&self, name: &str) -> Option<&CustomField>
pub fn users(&self) -> &HashMap<UserId, User>
Trait Implementations§
Source§impl Clone for PaperlessClient
impl Clone for PaperlessClient
Source§fn clone(&self) -> PaperlessClient
fn clone(&self) -> PaperlessClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PaperlessClient
impl !RefUnwindSafe for PaperlessClient
impl Send for PaperlessClient
impl Sync for PaperlessClient
impl Unpin for PaperlessClient
impl UnsafeUnpin for PaperlessClient
impl !UnwindSafe for PaperlessClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more