Documents

Struct Documents 

Source
pub struct Documents {
    pub client: Client,
}
Available on crate feature requests only.

Fields§

§client: Client

Implementations§

Source§

impl Documents

Source

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 field
  • id: Option<i64>
  • id_in: Option<Vec<i64>>: Multiple values may be separated by commas.
  • is_in_inbox: Option<bool>
  • is_tagged: Option<bool>: Is tagged
  • mime_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 string
  • search: 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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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§

Source§

impl Clone for Documents

Source§

fn clone(&self) -> Documents

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Documents

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult<T> for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more