pub struct Documents {
pub client: Client,
}requests only.Fields§
§client: ClientImplementations§
Source§impl Documents
impl Documents
Sourcepub async fn list<'a>(
&'a self,
added_date_gt: Option<NaiveDate>,
added_date_gte: Option<NaiveDate>,
added_date_lt: Option<NaiveDate>,
added_date_lte: Option<NaiveDate>,
added_day: Option<f64>,
added_gt: Option<DateTime<Utc>>,
added_gte: Option<DateTime<Utc>>,
added_lt: Option<DateTime<Utc>>,
added_lte: Option<DateTime<Utc>>,
added_month: Option<f64>,
added_year: Option<f64>,
archive_serial_number: Option<i64>,
archive_serial_number_gt: Option<i64>,
archive_serial_number_gte: Option<i64>,
archive_serial_number_isnull: Option<bool>,
archive_serial_number_lt: Option<i64>,
archive_serial_number_lte: Option<i64>,
checksum_icontains: Option<String>,
checksum_iendswith: Option<String>,
checksum_iexact: Option<String>,
checksum_istartswith: Option<String>,
content_icontains: Option<String>,
content_iendswith: Option<String>,
content_iexact: Option<String>,
content_istartswith: Option<String>,
correspondent_id: Option<i64>,
correspondent_id_in: Option<Vec<i64>>,
correspondent_id_none: Option<i64>,
correspondent_isnull: Option<bool>,
correspondent_name_icontains: Option<String>,
correspondent_name_iendswith: Option<String>,
correspondent_name_iexact: Option<String>,
correspondent_name_istartswith: Option<String>,
created_date_gt: Option<NaiveDate>,
created_date_gte: Option<NaiveDate>,
created_date_lt: Option<NaiveDate>,
created_date_lte: Option<NaiveDate>,
created_day: Option<f64>,
created_gt: Option<NaiveDate>,
created_gte: Option<NaiveDate>,
created_lt: Option<NaiveDate>,
created_lte: Option<NaiveDate>,
created_month: Option<f64>,
created_year: Option<f64>,
custom_field_query: Option<String>,
custom_fields_icontains: Option<String>,
custom_fields_id_all: Option<i64>,
custom_fields_id_in: Option<i64>,
custom_fields_id_none: Option<i64>,
document_type_id: Option<i64>,
document_type_id_in: Option<Vec<i64>>,
document_type_id_none: Option<i64>,
document_type_isnull: Option<bool>,
document_type_name_icontains: Option<String>,
document_type_name_iendswith: Option<String>,
document_type_name_iexact: Option<String>,
document_type_name_istartswith: Option<String>,
fields: Option<Vec<String>>,
full_perms: Option<bool>,
has_custom_fields: Option<bool>,
id: Option<i64>,
id_in: Option<Vec<i64>>,
is_in_inbox: Option<bool>,
is_tagged: Option<bool>,
mime_type: Option<String>,
modified_date_gt: Option<NaiveDate>,
modified_date_gte: Option<NaiveDate>,
modified_date_lt: Option<NaiveDate>,
modified_date_lte: Option<NaiveDate>,
modified_day: Option<f64>,
modified_gt: Option<DateTime<Utc>>,
modified_gte: Option<DateTime<Utc>>,
modified_lt: Option<DateTime<Utc>>,
modified_lte: Option<DateTime<Utc>>,
modified_month: Option<f64>,
modified_year: Option<f64>,
ordering: Option<String>,
original_filename_icontains: Option<String>,
original_filename_iendswith: Option<String>,
original_filename_iexact: Option<String>,
original_filename_istartswith: Option<String>,
owner_id: Option<i64>,
owner_id_in: Option<Vec<i64>>,
owner_id_none: Option<i64>,
owner_isnull: Option<bool>,
page: Option<i64>,
page_size: Option<i64>,
query: Option<String>,
search: Option<String>,
shared_by_id: Option<bool>,
storage_path_id: Option<i64>,
storage_path_id_in: Option<Vec<i64>>,
storage_path_id_none: Option<i64>,
storage_path_isnull: Option<bool>,
storage_path_name_icontains: Option<String>,
storage_path_name_iendswith: Option<String>,
storage_path_name_iexact: Option<String>,
storage_path_name_istartswith: Option<String>,
tags_id: Option<i64>,
tags_id_all: Option<i64>,
tags_id_in: Option<i64>,
tags_id_none: Option<i64>,
tags_name_icontains: Option<String>,
tags_name_iendswith: Option<String>,
tags_name_iexact: Option<String>,
tags_name_istartswith: Option<String>,
title_icontains: Option<String>,
title_iendswith: Option<String>,
title_iexact: Option<String>,
title_istartswith: Option<String>,
title_content: Option<String>,
) -> Result<PaginatedDocumentList, Error>
pub async fn list<'a>( &'a self, added_date_gt: Option<NaiveDate>, added_date_gte: Option<NaiveDate>, added_date_lt: Option<NaiveDate>, added_date_lte: Option<NaiveDate>, added_day: Option<f64>, added_gt: Option<DateTime<Utc>>, added_gte: Option<DateTime<Utc>>, added_lt: Option<DateTime<Utc>>, added_lte: Option<DateTime<Utc>>, added_month: Option<f64>, added_year: Option<f64>, archive_serial_number: Option<i64>, archive_serial_number_gt: Option<i64>, archive_serial_number_gte: Option<i64>, archive_serial_number_isnull: Option<bool>, archive_serial_number_lt: Option<i64>, archive_serial_number_lte: Option<i64>, checksum_icontains: Option<String>, checksum_iendswith: Option<String>, checksum_iexact: Option<String>, checksum_istartswith: Option<String>, content_icontains: Option<String>, content_iendswith: Option<String>, content_iexact: Option<String>, content_istartswith: Option<String>, correspondent_id: Option<i64>, correspondent_id_in: Option<Vec<i64>>, correspondent_id_none: Option<i64>, correspondent_isnull: Option<bool>, correspondent_name_icontains: Option<String>, correspondent_name_iendswith: Option<String>, correspondent_name_iexact: Option<String>, correspondent_name_istartswith: Option<String>, created_date_gt: Option<NaiveDate>, created_date_gte: Option<NaiveDate>, created_date_lt: Option<NaiveDate>, created_date_lte: Option<NaiveDate>, created_day: Option<f64>, created_gt: Option<NaiveDate>, created_gte: Option<NaiveDate>, created_lt: Option<NaiveDate>, created_lte: Option<NaiveDate>, created_month: Option<f64>, created_year: Option<f64>, custom_field_query: Option<String>, custom_fields_icontains: Option<String>, custom_fields_id_all: Option<i64>, custom_fields_id_in: Option<i64>, custom_fields_id_none: Option<i64>, document_type_id: Option<i64>, document_type_id_in: Option<Vec<i64>>, document_type_id_none: Option<i64>, document_type_isnull: Option<bool>, document_type_name_icontains: Option<String>, document_type_name_iendswith: Option<String>, document_type_name_iexact: Option<String>, document_type_name_istartswith: Option<String>, fields: Option<Vec<String>>, full_perms: Option<bool>, has_custom_fields: Option<bool>, id: Option<i64>, id_in: Option<Vec<i64>>, is_in_inbox: Option<bool>, is_tagged: Option<bool>, mime_type: Option<String>, modified_date_gt: Option<NaiveDate>, modified_date_gte: Option<NaiveDate>, modified_date_lt: Option<NaiveDate>, modified_date_lte: Option<NaiveDate>, modified_day: Option<f64>, modified_gt: Option<DateTime<Utc>>, modified_gte: Option<DateTime<Utc>>, modified_lt: Option<DateTime<Utc>>, modified_lte: Option<DateTime<Utc>>, modified_month: Option<f64>, modified_year: Option<f64>, ordering: Option<String>, original_filename_icontains: Option<String>, original_filename_iendswith: Option<String>, original_filename_iexact: Option<String>, original_filename_istartswith: Option<String>, owner_id: Option<i64>, owner_id_in: Option<Vec<i64>>, owner_id_none: Option<i64>, owner_isnull: Option<bool>, page: Option<i64>, page_size: Option<i64>, query: Option<String>, search: Option<String>, shared_by_id: Option<bool>, storage_path_id: Option<i64>, storage_path_id_in: Option<Vec<i64>>, storage_path_id_none: Option<i64>, storage_path_isnull: Option<bool>, storage_path_name_icontains: Option<String>, storage_path_name_iendswith: Option<String>, storage_path_name_iexact: Option<String>, storage_path_name_istartswith: Option<String>, tags_id: Option<i64>, tags_id_all: Option<i64>, tags_id_in: Option<i64>, tags_id_none: Option<i64>, tags_name_icontains: Option<String>, tags_name_iendswith: Option<String>, tags_name_iexact: Option<String>, tags_name_istartswith: Option<String>, title_icontains: Option<String>, title_iendswith: Option<String>, title_iexact: Option<String>, title_istartswith: Option<String>, title_content: Option<String>, ) -> Result<PaginatedDocumentList, Error>
Perform a GET request to /api/documents/.
Document views including search
Parameters:
added_date_gt: Option<chrono::NaiveDate>added_date_gte: Option<chrono::NaiveDate>added_date_lt: Option<chrono::NaiveDate>added_date_lte: Option<chrono::NaiveDate>added_day: Option<f64>added_gt: Option<chrono::DateTime<chrono::Utc>>added_gte: Option<chrono::DateTime<chrono::Utc>>added_lt: Option<chrono::DateTime<chrono::Utc>>added_lte: Option<chrono::DateTime<chrono::Utc>>added_month: Option<f64>added_year: Option<f64>archive_serial_number: Option<i64>archive_serial_number_gt: Option<i64>archive_serial_number_gte: Option<i64>archive_serial_number_isnull: Option<bool>archive_serial_number_lt: Option<i64>archive_serial_number_lte: Option<i64>checksum_icontains: Option<String>checksum_iendswith: Option<String>checksum_iexact: Option<String>checksum_istartswith: Option<String>content_icontains: Option<String>content_iendswith: Option<String>content_iexact: Option<String>content_istartswith: Option<String>correspondent_id: Option<i64>correspondent_id_in: Option<Vec<i64>>: Multiple values may be separated by commas.correspondent_id_none: Option<i64>correspondent_isnull: Option<bool>correspondent_name_icontains: Option<String>correspondent_name_iendswith: Option<String>correspondent_name_iexact: Option<String>correspondent_name_istartswith: Option<String>created_date_gt: Option<chrono::NaiveDate>created_date_gte: Option<chrono::NaiveDate>created_date_lt: Option<chrono::NaiveDate>created_date_lte: Option<chrono::NaiveDate>created_day: Option<f64>created_gt: Option<chrono::NaiveDate>created_gte: Option<chrono::NaiveDate>created_lt: Option<chrono::NaiveDate>created_lte: Option<chrono::NaiveDate>created_month: Option<f64>created_year: Option<f64>custom_field_query: Option<String>custom_fields_icontains: Option<String>custom_fields_id_all: Option<i64>custom_fields_id_in: Option<i64>custom_fields_id_none: Option<i64>document_type_id: Option<i64>document_type_id_in: Option<Vec<i64>>: Multiple values may be separated by commas.document_type_id_none: Option<i64>document_type_isnull: Option<bool>document_type_name_icontains: Option<String>document_type_name_iendswith: Option<String>document_type_name_iexact: Option<String>document_type_name_istartswith: Option<String>fields: Option<Vec<String>>full_perms: Option<bool>has_custom_fields: Option<bool>: Has custom fieldid: Option<i64>id_in: Option<Vec<i64>>: Multiple values may be separated by commas.is_in_inbox: Option<bool>is_tagged: Option<bool>: Is taggedmime_type: Option<String>modified_date_gt: Option<chrono::NaiveDate>modified_date_gte: Option<chrono::NaiveDate>modified_date_lt: Option<chrono::NaiveDate>modified_date_lte: Option<chrono::NaiveDate>modified_day: Option<f64>modified_gt: Option<chrono::DateTime<chrono::Utc>>modified_gte: Option<chrono::DateTime<chrono::Utc>>modified_lt: Option<chrono::DateTime<chrono::Utc>>modified_lte: Option<chrono::DateTime<chrono::Utc>>modified_month: Option<f64>modified_year: Option<f64>ordering: Option<String>: Which field to use when ordering the results.original_filename_icontains: Option<String>original_filename_iendswith: Option<String>original_filename_iexact: Option<String>original_filename_istartswith: Option<String>owner_id: Option<i64>owner_id_in: Option<Vec<i64>>: Multiple values may be separated by commas.owner_id_none: Option<i64>owner_isnull: Option<bool>page: Option<i64>: A page number within the paginated result set.page_size: Option<i64>: Number of results to return per page.query: Option<String>: Advanced search query stringsearch: Option<String>: A search term.shared_by_id: Option<bool>storage_path_id: Option<i64>storage_path_id_in: Option<Vec<i64>>: Multiple values may be separated by commas.storage_path_id_none: Option<i64>storage_path_isnull: Option<bool>storage_path_name_icontains: Option<String>storage_path_name_iendswith: Option<String>storage_path_name_iexact: Option<String>storage_path_name_istartswith: Option<String>tags_id: Option<i64>tags_id_all: Option<i64>tags_id_in: Option<i64>tags_id_none: Option<i64>tags_name_icontains: Option<String>tags_name_iendswith: Option<String>tags_name_iexact: Option<String>tags_name_istartswith: Option<String>title_icontains: Option<String>title_iendswith: Option<String>title_iexact: Option<String>title_istartswith: Option<String>title_content: Option<String>
use futures_util::TryStreamExt;
async fn example_documents_list_stream() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let mut documents = client.documents();
let mut stream = documents.list_stream(
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(3.14 as f64),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(3.14 as f64),
Some(3.14 as f64),
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
Some(true),
Some(4 as i64),
Some(4 as i64),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(4 as i64),
Some(vec![4 as i64]),
Some(4 as i64),
Some(true),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(3.14 as f64),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(3.14 as f64),
Some(3.14 as f64),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
Some(vec![4 as i64]),
Some(4 as i64),
Some(true),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(vec!["some-string".to_string()]),
Some(true),
Some(true),
Some(4 as i64),
Some(vec![4 as i64]),
Some(true),
Some(true),
Some("some-string".to_string()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(chrono::Utc::now().date_naive()),
Some(3.14 as f64),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(chrono::Utc::now()),
Some(3.14 as f64),
Some(3.14 as f64),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(4 as i64),
Some(vec![4 as i64]),
Some(4 as i64),
Some(true),
Some(4 as i64),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(true),
Some(4 as i64),
Some(vec![4 as i64]),
Some(4 as i64),
Some(true),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
Some("some-string".to_string()),
);
loop {
match stream.try_next().await {
Ok(Some(item)) => {
println!("{:?}", item);
}
Ok(None) => {
break;
}
Err(err) => {
return Err(err.into());
}
}
}
Ok(())
}Sourcepub async fn retrieve<'a>(
&'a self,
doc_id: i64,
fields: Option<Vec<String>>,
full_perms: Option<bool>,
) -> Result<Document, Error>
pub async fn retrieve<'a>( &'a self, doc_id: i64, fields: Option<Vec<String>>, full_perms: Option<bool>, ) -> Result<Document, Error>
Perform a GET request to /api/documents/{doc_id}/.
Retrieve a single document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)fields: Option<Vec<String>>full_perms: Option<bool>
async fn example_documents_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Document = client
.documents()
.retrieve(4 as i64, Some(vec!["some-string".to_string()]), Some(true))
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn update<'a>(
&'a self,
doc_id: i64,
body: &DocumentRequest,
) -> Result<Document, Error>
pub async fn update<'a>( &'a self, doc_id: i64, body: &DocumentRequest, ) -> Result<Document, Error>
Perform a PUT request to /api/documents/{doc_id}/.
Pass a user object to serializer
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_update() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Document = client
.documents()
.update(
4 as i64,
&paperless_api_client::types::DocumentRequest {
correspondent: Some(4 as i64),
document_type: Some(4 as i64),
storage_path: Some(4 as i64),
title: Some("some-string".to_string()),
content: Some("some-string".to_string()),
tags: vec![4 as i64],
created: Some(chrono::Utc::now().date_naive()),
created_date: Some(chrono::Utc::now().date_naive()),
deleted_at: Some(chrono::Utc::now()),
archive_serial_number: Some(4 as i64),
owner: Some(4 as i64),
set_permissions: Some(paperless_api_client::types::SetPermissions {
view: Some(paperless_api_client::types::View {
users: Some(vec![4 as i64]),
groups: Some(vec![4 as i64]),
}),
change: Some(paperless_api_client::types::Change {
users: Some(vec![4 as i64]),
groups: Some(vec![4 as i64]),
}),
}),
custom_fields: Some(vec![paperless_api_client::types::CustomFieldInstanceRequest {
value: Some(serde_json::Value::String("some-string".to_string())),
field: 4 as i64,
}]),
remove_inbox_tags: Some(true),
},
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn destroy<'a>(&'a self, doc_id: i64) -> Result<(), Error>
pub async fn destroy<'a>(&'a self, doc_id: i64) -> Result<(), Error>
Perform a DELETE request to /api/documents/{doc_id}/.
Pass a user object to serializer
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_destroy() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
client.documents().destroy(4 as i64).await?;
Ok(())
}Sourcepub async fn partial_update<'a>(
&'a self,
doc_id: i64,
body: &PatchedDocumentRequest,
) -> Result<Document, Error>
pub async fn partial_update<'a>( &'a self, doc_id: i64, body: &PatchedDocumentRequest, ) -> Result<Document, Error>
Perform a PATCH request to /api/documents/{doc_id}/.
Pass a user object to serializer
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_partial_update() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Document = client
.documents()
.partial_update(
4 as i64,
&paperless_api_client::types::PatchedDocumentRequest {
correspondent: Some(4 as i64),
document_type: Some(4 as i64),
storage_path: Some(4 as i64),
title: Some("some-string".to_string()),
content: Some("some-string".to_string()),
tags: Some(vec![4 as i64]),
created: Some(chrono::Utc::now().date_naive()),
created_date: Some(chrono::Utc::now().date_naive()),
deleted_at: Some(chrono::Utc::now()),
archive_serial_number: Some(4 as i64),
owner: Some(4 as i64),
set_permissions: Some(paperless_api_client::types::SetPermissions {
view: Some(paperless_api_client::types::View {
users: Some(vec![4 as i64]),
groups: Some(vec![4 as i64]),
}),
change: Some(paperless_api_client::types::Change {
users: Some(vec![4 as i64]),
groups: Some(vec![4 as i64]),
}),
}),
custom_fields: Some(vec![paperless_api_client::types::CustomFieldInstanceRequest {
value: Some(serde_json::Value::String("some-string".to_string())),
field: 4 as i64,
}]),
remove_inbox_tags: Some(true),
},
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn download_retrieve<'a>(
&'a self,
doc_id: i64,
original: Option<bool>,
) -> Result<Bytes, Error>
pub async fn download_retrieve<'a>( &'a self, doc_id: i64, original: Option<bool>, ) -> Result<Bytes, Error>
Perform a GET request to /api/documents/{doc_id}/download/.
Download the document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)original: Option<bool>
async fn example_documents_download_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: bytes::Bytes = client
.documents()
.download_retrieve(4 as i64, Some(true))
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn email_create<'a>(
&'a self,
doc_id: i64,
body: &EmailRequestRequest,
) -> Result<EmailResponse, Error>
pub async fn email_create<'a>( &'a self, doc_id: i64, body: &EmailRequestRequest, ) -> Result<EmailResponse, Error>
Perform a POST request to /api/documents/{doc_id}/email/.
Email the document to one or more recipients as an attachment.
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_email_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::EmailResponse = client
.documents()
.email_create(
4 as i64,
&paperless_api_client::types::EmailRequestRequest {
addresses: "some-string".to_string(),
subject: "some-string".to_string(),
message: "some-string".to_string(),
use_archive_version: true,
},
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn history_list<'a>(
&'a self,
doc_id: i64,
page: Option<i64>,
page_size: Option<i64>,
) -> Result<PaginatedLogEntryList, Error>
pub async fn history_list<'a>( &'a self, doc_id: i64, page: Option<i64>, page_size: Option<i64>, ) -> Result<PaginatedLogEntryList, Error>
Perform a GET request to /api/documents/{doc_id}/history/.
View the document history
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)page: Option<i64>: A page number within the paginated result set.page_size: Option<i64>: Number of results to return per page.
use futures_util::TryStreamExt;
async fn example_documents_history_list_stream() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let mut documents = client.documents();
let mut stream = documents.history_list_stream(4 as i64, Some(4 as i64));
loop {
match stream.try_next().await {
Ok(Some(item)) => {
println!("{:?}", item);
}
Ok(None) => {
break;
}
Err(err) => {
return Err(err.into());
}
}
}
Ok(())
}Sourcepub async fn metadata_retrieve<'a>(
&'a self,
doc_id: i64,
) -> Result<Metadata, Error>
pub async fn metadata_retrieve<'a>( &'a self, doc_id: i64, ) -> Result<Metadata, Error>
Perform a GET request to /api/documents/{doc_id}/metadata/.
View the document metadata
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_metadata_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Metadata = client.documents().metadata_retrieve(4 as i64).await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn notes_list<'a>(
&'a self,
doc_id: i64,
id: Option<i64>,
page: Option<i64>,
page_size: Option<i64>,
) -> Result<PaginatedNotesList, Error>
pub async fn notes_list<'a>( &'a self, doc_id: i64, id: Option<i64>, page: Option<i64>, page_size: Option<i64>, ) -> Result<PaginatedNotesList, Error>
Perform a GET request to /api/documents/{doc_id}/notes/.
View, add, or delete notes for the document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)id: Option<i64>: Note ID to delete (used only for DELETE requests)page: Option<i64>: A page number within the paginated result set.page_size: Option<i64>: Number of results to return per page.
use futures_util::TryStreamExt;
async fn example_documents_notes_list_stream() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let mut documents = client.documents();
let mut stream = documents.notes_list_stream(4 as i64, Some(4 as i64), Some(4 as i64));
loop {
match stream.try_next().await {
Ok(Some(item)) => {
println!("{:?}", item);
}
Ok(None) => {
break;
}
Err(err) => {
return Err(err.into());
}
}
}
Ok(())
}Sourcepub async fn notes_create<'a>(
&'a self,
doc_id: i64,
id: Option<i64>,
page: Option<i64>,
page_size: Option<i64>,
body: &NoteCreateRequestRequest,
) -> Result<PaginatedNotesList, Error>
pub async fn notes_create<'a>( &'a self, doc_id: i64, id: Option<i64>, page: Option<i64>, page_size: Option<i64>, body: &NoteCreateRequestRequest, ) -> Result<PaginatedNotesList, Error>
Perform a POST request to /api/documents/{doc_id}/notes/.
View, add, or delete notes for the document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)id: Option<i64>: Note ID to delete (used only for DELETE requests)page: Option<i64>: A page number within the paginated result set.page_size: Option<i64>: Number of results to return per page.
async fn example_documents_notes_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::PaginatedNotesList = client
.documents()
.notes_create(
4 as i64,
Some(4 as i64),
Some(4 as i64),
Some(4 as i64),
&paperless_api_client::types::NoteCreateRequestRequest {
note: "some-string".to_string(),
},
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn notes_destroy<'a>(
&'a self,
doc_id: i64,
id: Option<i64>,
page: Option<i64>,
page_size: Option<i64>,
) -> Result<PaginatedNotesList, Error>
pub async fn notes_destroy<'a>( &'a self, doc_id: i64, id: Option<i64>, page: Option<i64>, page_size: Option<i64>, ) -> Result<PaginatedNotesList, Error>
Perform a DELETE request to /api/documents/{doc_id}/notes/.
View, add, or delete notes for the document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)id: Option<i64>: Note ID to delete (used only for DELETE requests)page: Option<i64>: A page number within the paginated result set.page_size: Option<i64>: Number of results to return per page.
async fn example_documents_notes_destroy() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::PaginatedNotesList = client
.documents()
.notes_destroy(4 as i64, Some(4 as i64), Some(4 as i64), Some(4 as i64))
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn preview_retrieve<'a>(&'a self, doc_id: i64) -> Result<Bytes, Error>
pub async fn preview_retrieve<'a>(&'a self, doc_id: i64) -> Result<Bytes, Error>
Perform a GET request to /api/documents/{doc_id}/preview/.
View the document preview
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_preview_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: bytes::Bytes = client.documents().preview_retrieve(4 as i64).await?;
println!("{:?}", result);
Ok(())
}Perform a GET request to /api/documents/{doc_id}/share_links/.
View share links for the document
Parameters:
doc_id: &'astr(required)
async fn example_documents_share_links() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: Vec<paperless_api_client::types::DocumentShareLinksResponse> =
client.documents().share_links("some-string").await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn suggestions_retrieve<'a>(
&'a self,
doc_id: i64,
) -> Result<Suggestions, Error>
pub async fn suggestions_retrieve<'a>( &'a self, doc_id: i64, ) -> Result<Suggestions, Error>
Perform a GET request to /api/documents/{doc_id}/suggestions/.
View suggestions for the document
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_suggestions_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Suggestions =
client.documents().suggestions_retrieve(4 as i64).await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn thumb_retrieve<'a>(&'a self, doc_id: i64) -> Result<Bytes, Error>
pub async fn thumb_retrieve<'a>(&'a self, doc_id: i64) -> Result<Bytes, Error>
Perform a GET request to /api/documents/{doc_id}/thumb/.
View the document thumbnail
Parameters:
doc_id: i64: A unique integer value identifying this document. (required)
async fn example_documents_thumb_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: bytes::Bytes = client.documents().thumb_retrieve(4 as i64).await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn bulk_download_create<'a>(
&'a self,
body: &BulkDownloadRequest,
) -> Result<BulkDownload, Error>
pub async fn bulk_download_create<'a>( &'a self, body: &BulkDownloadRequest, ) -> Result<BulkDownload, Error>
Perform a POST request to /api/documents/bulk_download/.
async fn example_documents_bulk_download_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::BulkDownload = client
.documents()
.bulk_download_create(&paperless_api_client::types::BulkDownloadRequest {
documents: vec![4 as i64],
content: Some(paperless_api_client::types::ContentEnum::Originals),
compression: Some(paperless_api_client::types::CompressionEnum::Bzip2),
follow_formatting: true,
})
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn bulk_edit<'a>(
&'a self,
body: &BulkEditRequest,
) -> Result<BulkEditDocumentsResult, Error>
pub async fn bulk_edit<'a>( &'a self, body: &BulkEditRequest, ) -> Result<BulkEditDocumentsResult, Error>
Perform a POST request to /api/documents/bulk_edit/.
Perform a bulk edit operation on a list of documents
See <https://docs.paperless-ngx.com/api/#bulk-editing|Further documentation> for more information.
async fn example_documents_bulk_edit() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::BulkEditDocumentsResult = client
.documents()
.bulk_edit(&paperless_api_client::types::BulkEditRequest {
documents: vec![4 as i64],
method: paperless_api_client::types::MethodEnum::SetPermissions,
parameters: Some(std::collections::HashMap::from([(
"some-key".to_string(),
serde_json::Value::String("some-string".to_string()),
)])),
})
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn next_asn_retrieve<'a>(&'a self) -> Result<i64, Error>
pub async fn next_asn_retrieve<'a>(&'a self) -> Result<i64, Error>
Perform a GET request to /api/documents/next_asn/.
Get the next available Archive Serial Number (ASN) for a new document
async fn example_documents_next_asn_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: i64 = client.documents().next_asn_retrieve().await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn post_create<'a>(
&'a self,
attachments: Vec<Attachment>,
body: &PostDocumentRequest,
) -> Result<String, Error>
pub async fn post_create<'a>( &'a self, attachments: Vec<Attachment>, body: &PostDocumentRequest, ) -> Result<String, Error>
Perform a POST request to /api/documents/post_document/.
Upload a document via the API
See <https://docs.paperless-ngx.com/api/#file-uploads|Further documentation> for more information.
async fn example_documents_post_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: String = client
.documents()
.post_create(
vec![paperless_api_client::types::multipart::Attachment {
name: "thing".to_string(),
filepath: Some("myfile.json".into()),
content_type: Some("application/json".to_string()),
data: std::fs::read("myfile.json").unwrap(),
}],
&paperless_api_client::types::PostDocumentRequest {
created: Some(chrono::Utc::now()),
document: bytes::Bytes::from("some-string"),
title: Some("some-string".to_string()),
correspondent: Some(4 as i64),
document_type: Some(4 as i64),
storage_path: Some(4 as i64),
tags: Some(vec![4 as i64]),
archive_serial_number: Some(4 as i64),
custom_fields: Some(vec![4 as i64]),
from_webui: Some(true),
},
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn selection_data_create<'a>(
&'a self,
attachments: Vec<Attachment>,
body: &DocumentListRequest,
) -> Result<SelectionData, Error>
pub async fn selection_data_create<'a>( &'a self, attachments: Vec<Attachment>, body: &DocumentListRequest, ) -> Result<SelectionData, Error>
Perform a POST request to /api/documents/selection_data/.
Get selection data for the selected documents
async fn example_documents_selection_data_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::SelectionData = client
.documents()
.selection_data_create(
vec![paperless_api_client::types::multipart::Attachment {
name: "thing".to_string(),
filepath: Some("myfile.json".into()),
content_type: Some("application/json".to_string()),
data: std::fs::read("myfile.json").unwrap(),
}],
&paperless_api_client::types::DocumentListRequest {
documents: vec![4 as i64],
},
)
.await?;
println!("{:?}", result);
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Documents
impl !RefUnwindSafe for Documents
impl Send for Documents
impl Sync for Documents
impl Unpin for Documents
impl !UnwindSafe for Documents
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more