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.
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.
List all tags.
Sourcepub async fn refresh_custom_fields(&mut self) -> Result<(), Error>
pub async fn refresh_custom_fields(&mut self) -> Result<(), Error>
List all custom fields.
Sourcepub async fn refresh_correspondents(&mut self) -> Result<(), Error>
pub async fn refresh_correspondents(&mut self) -> Result<(), Error>
List all correspondents.
Sourcepub async fn refresh_document_types(&mut self) -> Result<(), Error>
pub async fn refresh_document_types(&mut self) -> Result<(), Error>
List all document types.
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.
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 find_tag_by_name(&self, name: &str) -> Option<&Tag>
pub fn document_types(&self) -> &HashMap<DocumentTypeId, 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>
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