pub struct DocumentProcessorService { /* private fields */ }Expand description
Implements a client for the Cloud Document AI API.
§Example
let client = DocumentProcessorService::builder().build().await?;
// use `client` to make requests to the Cloud Document AI API.§Service Description
Service to call Document AI to process documents according to the processor’s definition. Processors are built using state-of-the-art Google AI such as natural language, computer vision, and translation to extract structured information from unstructured or semi-structured documents.
§Configuration
To configure DocumentProcessorService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://documentai.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
DocumentProcessorService holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap DocumentProcessorService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl DocumentProcessorService
impl DocumentProcessorService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for DocumentProcessorService.
let client = DocumentProcessorService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: DocumentProcessorService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: DocumentProcessorService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn process_document(&self) -> ProcessDocument
pub fn process_document(&self) -> ProcessDocument
Processes a single document.
Sourcepub fn batch_process_documents(&self) -> BatchProcessDocuments
pub fn batch_process_documents(&self) -> BatchProcessDocuments
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn fetch_processor_types(&self) -> FetchProcessorTypes
pub fn fetch_processor_types(&self) -> FetchProcessorTypes
Fetches processor types. Note that we don’t use ListProcessorTypes here, because it isn’t paginated.
Sourcepub fn list_processor_types(&self) -> ListProcessorTypes
pub fn list_processor_types(&self) -> ListProcessorTypes
Lists the processor types that exist.
Sourcepub fn get_processor_type(&self) -> GetProcessorType
pub fn get_processor_type(&self) -> GetProcessorType
Gets a processor type detail.
Sourcepub fn list_processors(&self) -> ListProcessors
pub fn list_processors(&self) -> ListProcessors
Lists all processors which belong to this project.
Sourcepub fn get_processor(&self) -> GetProcessor
pub fn get_processor(&self) -> GetProcessor
Gets a processor detail.
Sourcepub fn train_processor_version(&self) -> TrainProcessorVersion
pub fn train_processor_version(&self) -> TrainProcessorVersion
Trains a new processor version. Operation metadata is returned as TrainProcessorVersionMetadata.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn get_processor_version(&self) -> GetProcessorVersion
pub fn get_processor_version(&self) -> GetProcessorVersion
Gets a processor version detail.
Sourcepub fn list_processor_versions(&self) -> ListProcessorVersions
pub fn list_processor_versions(&self) -> ListProcessorVersions
Lists all versions of a processor.
Sourcepub fn delete_processor_version(&self) -> DeleteProcessorVersion
pub fn delete_processor_version(&self) -> DeleteProcessorVersion
Deletes the processor version, all artifacts under the processor version will be deleted.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn deploy_processor_version(&self) -> DeployProcessorVersion
pub fn deploy_processor_version(&self) -> DeployProcessorVersion
Deploys the processor version.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn undeploy_processor_version(&self) -> UndeployProcessorVersion
pub fn undeploy_processor_version(&self) -> UndeployProcessorVersion
Undeploys the processor version.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn create_processor(&self) -> CreateProcessor
pub fn create_processor(&self) -> CreateProcessor
Creates a processor from the
ProcessorType provided. The
processor will be at ENABLED state by default after its creation. Note
that this method requires the documentai.processors.create permission on
the project, which is highly privileged. A user or service account with
this permission can create new processors that can interact with any gcs
bucket in your project.
Sourcepub fn delete_processor(&self) -> DeleteProcessor
pub fn delete_processor(&self) -> DeleteProcessor
Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn enable_processor(&self) -> EnableProcessor
pub fn enable_processor(&self) -> EnableProcessor
Enables a processor
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn disable_processor(&self) -> DisableProcessor
pub fn disable_processor(&self) -> DisableProcessor
Disables a processor
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn set_default_processor_version(&self) -> SetDefaultProcessorVersion
pub fn set_default_processor_version(&self) -> SetDefaultProcessorVersion
Set the default (active) version of a Processor that will be used in ProcessDocument and BatchProcessDocuments.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn review_document(&self) -> ReviewDocument
pub fn review_document(&self) -> ReviewDocument
Send a document for Human Review. The input document should be processed by the specified processor.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn evaluate_processor_version(&self) -> EvaluateProcessorVersion
pub fn evaluate_processor_version(&self) -> EvaluateProcessorVersion
Evaluates a ProcessorVersion against annotated documents, producing an Evaluation.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn get_evaluation(&self) -> GetEvaluation
pub fn get_evaluation(&self) -> GetEvaluation
Retrieves a specific evaluation.
Sourcepub fn list_evaluations(&self) -> ListEvaluations
pub fn list_evaluations(&self) -> ListEvaluations
Retrieves a set of evaluations for a given processor version.
Sourcepub fn list_locations(&self) -> ListLocations
pub fn list_locations(&self) -> ListLocations
Lists information about the supported locations for this service.
Sourcepub fn get_location(&self) -> GetLocation
pub fn get_location(&self) -> GetLocation
Gets information about a location.
Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Provides the Operations service functionality in this service.
Trait Implementations§
Source§impl Clone for DocumentProcessorService
impl Clone for DocumentProcessorService
Source§fn clone(&self) -> DocumentProcessorService
fn clone(&self) -> DocumentProcessorService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more