pub struct Document { /* private fields */ }Expand description
Represents a document.
Changes made through mutating methods such as
set_title,
set_content,
add_tag, and
set_custom_field
are only tracked locally at first.
They are not sent to the Paperless server until
patch is called.
Implementations§
Source§impl Document
impl Document
Sourcepub fn id(&self) -> DocumentId
pub fn id(&self) -> DocumentId
Get the id of the document
Sourcepub fn original_file_name(&self) -> &str
pub fn original_file_name(&self) -> &str
Get the original file name of the document.
Sourcepub fn correspondent(&self) -> Option<CorrespondentId>
pub fn correspondent(&self) -> Option<CorrespondentId>
Get the correspondent id of the document.
Sourcepub fn document_type(&self) -> Option<DocumentTypeId>
pub fn document_type(&self) -> Option<DocumentTypeId>
Get the document type id of the document.
Sourcepub fn page_count(&self) -> u32
pub fn page_count(&self) -> u32
Get the number of pages in the document.
Get all tag-ids for the document.
Sourcepub fn custom_fields(&self) -> &[DocumentCustomField]
pub fn custom_fields(&self) -> &[DocumentCustomField]
Get all custom fields for the document.
pub fn remove_tag(&mut self, tag_id: TagId)
Sourcepub fn set_content(&mut self, content: &str)
pub fn set_content(&mut self, content: &str)
Set the content of the document.
Sourcepub fn set_custom_field(&mut self, field: CustomFieldId, value: &str)
pub fn set_custom_field(&mut self, field: CustomFieldId, value: &str)
Set a custom field for the document.
Sourcepub fn remove_custom_field(&mut self, field: CustomFieldId)
pub fn remove_custom_field(&mut self, field: CustomFieldId)
Remove a custom field from the document.
Sourcepub async fn reload(&mut self) -> Result<(), Error>
pub async fn reload(&mut self) -> Result<(), Error>
Refresh the document from the server.
This will discard any local changes and replace them with the server’s state.
Sourcepub async fn patch(&mut self) -> Result<(), Error>
pub async fn patch(&mut self) -> Result<(), Error>
Update the document on the server.
This applies the currently tracked local changes to the remote Paperless document.
Sourcepub async fn get_full_content(&mut self) -> Result<(), Error>
pub async fn get_full_content(&mut self) -> Result<(), Error>
Get the full content of the document, replacing any truncated content.