public abstract class DocumentUnderstandingServiceClient
DocumentUnderstandingService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.DocumentAI.V1Beta2Assembly
Google.Cloud.DocumentAI.V1Beta2.dll
Remarks
Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.
Properties
BatchProcessDocumentsOperationsClient
public virtual OperationsClient BatchProcessDocumentsOperationsClient { get; }
The long-running operations client for BatchProcessDocuments
.
Type | Description |
OperationsClient |
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the DocumentUnderstandingService service, which is a host of "us-documentai.googleapis.com" and a port of 443.
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default DocumentUnderstandingService scopes.
Type | Description |
IReadOnlyList<String> |
The default DocumentUnderstandingService scopes are:
GrpcClient
public virtual DocumentUnderstandingService.DocumentUnderstandingServiceClient GrpcClient { get; }
The underlying gRPC DocumentUnderstandingService client
Type | Description |
DocumentUnderstandingService.DocumentUnderstandingServiceClient |
Methods
BatchProcessDocuments(BatchProcessDocumentsRequest, CallSettings)
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> BatchProcessDocuments(BatchProcessDocumentsRequest request, CallSettings callSettings = null)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
request | BatchProcessDocumentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Operation<BatchProcessDocumentsResponse, OperationMetadata> | The RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.Create();
// Initialize request argument(s)
BatchProcessDocumentsRequest request = new BatchProcessDocumentsRequest
{
Requests =
{
new ProcessDocumentRequest(),
},
Parent = "",
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = documentUnderstandingServiceClient.BatchProcessDocuments(request);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = documentUnderstandingServiceClient.PollOnceBatchProcessDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
BatchProcessDocuments(IEnumerable<ProcessDocumentRequest>, CallSettings)
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> BatchProcessDocuments(IEnumerable<ProcessDocumentRequest> requests, CallSettings callSettings = null)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
requests | IEnumerable<ProcessDocumentRequest> Required. Individual requests for each document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Operation<BatchProcessDocumentsResponse, OperationMetadata> | The RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.Create();
// Initialize request argument(s)
IEnumerable<ProcessDocumentRequest> requests = new ProcessDocumentRequest[]
{
new ProcessDocumentRequest(),
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = documentUnderstandingServiceClient.BatchProcessDocuments(requests);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = documentUnderstandingServiceClient.PollOnceBatchProcessDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
BatchProcessDocumentsAsync(BatchProcessDocumentsRequest, CallSettings)
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(BatchProcessDocumentsRequest request, CallSettings callSettings = null)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
request | BatchProcessDocumentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
BatchProcessDocumentsRequest request = new BatchProcessDocumentsRequest
{
Requests =
{
new ProcessDocumentRequest(),
},
Parent = "",
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = await documentUnderstandingServiceClient.BatchProcessDocumentsAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = await documentUnderstandingServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
BatchProcessDocumentsAsync(BatchProcessDocumentsRequest, CancellationToken)
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(BatchProcessDocumentsRequest request, CancellationToken cancellationToken)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
request | BatchProcessDocumentsRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Type | Description |
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
BatchProcessDocumentsRequest request = new BatchProcessDocumentsRequest
{
Requests =
{
new ProcessDocumentRequest(),
},
Parent = "",
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = await documentUnderstandingServiceClient.BatchProcessDocumentsAsync(request);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = await documentUnderstandingServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest>, CallSettings)
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest> requests, CallSettings callSettings = null)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
requests | IEnumerable<ProcessDocumentRequest> Required. Individual requests for each document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<ProcessDocumentRequest> requests = new ProcessDocumentRequest[]
{
new ProcessDocumentRequest(),
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = await documentUnderstandingServiceClient.BatchProcessDocumentsAsync(requests);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = await documentUnderstandingServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest>, CancellationToken)
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest> requests, CancellationToken cancellationToken)
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Name | Description |
requests | IEnumerable<ProcessDocumentRequest> Required. Individual requests for each document. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Type | Description |
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<ProcessDocumentRequest> requests = new ProcessDocumentRequest[]
{
new ProcessDocumentRequest(),
};
// Make the request
Operation<BatchProcessDocumentsResponse, OperationMetadata> response = await documentUnderstandingServiceClient.BatchProcessDocumentsAsync(requests);
// Poll until the returned long-running operation is complete
Operation<BatchProcessDocumentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessDocumentsResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchProcessDocumentsResponse, OperationMetadata> retrievedResponse = await documentUnderstandingServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
BatchProcessDocumentsResponse retrievedResult = retrievedResponse.Result;
}
Create()
public static DocumentUnderstandingServiceClient Create()
Synchronously creates a DocumentUnderstandingServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentUnderstandingServiceClientBuilder.
Type | Description |
DocumentUnderstandingServiceClient | The created DocumentUnderstandingServiceClient. |
CreateAsync(CancellationToken)
public static Task<DocumentUnderstandingServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a DocumentUnderstandingServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentUnderstandingServiceClientBuilder.
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Type | Description |
Task<DocumentUnderstandingServiceClient> | The task representing the created DocumentUnderstandingServiceClient. |
PollOnceBatchProcessDocuments(String, CallSettings)
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> PollOnceBatchProcessDocuments(string operationName, CallSettings callSettings = null)
Poll an operation once, using an operationName
from a previous invocation of BatchProcessDocuments
.
Name | Description |
operationName | String The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Operation<BatchProcessDocumentsResponse, OperationMetadata> | The result of polling the operation. |
PollOnceBatchProcessDocumentsAsync(String, CallSettings)
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> PollOnceBatchProcessDocumentsAsync(string operationName, CallSettings callSettings = null)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
BatchProcessDocuments
.
Name | Description |
operationName | String The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> | A task representing the result of polling the operation. |
ProcessDocument(ProcessDocumentRequest, CallSettings)
public virtual Document ProcessDocument(ProcessDocumentRequest request, CallSettings callSettings = null)
Processes a single document.
Name | Description |
request | ProcessDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Document | The RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.Create();
// Initialize request argument(s)
ProcessDocumentRequest request = new ProcessDocumentRequest
{
InputConfig = new InputConfig(),
OutputConfig = new OutputConfig(),
DocumentType = "",
TableExtractionParams = new TableExtractionParams(),
FormExtractionParams = new FormExtractionParams(),
EntityExtractionParams = new EntityExtractionParams(),
OcrParams = new OcrParams(),
AutomlParams = new AutoMlParams(),
Parent = "",
};
// Make the request
Document response = documentUnderstandingServiceClient.ProcessDocument(request);
ProcessDocumentAsync(ProcessDocumentRequest, CallSettings)
public virtual Task<Document> ProcessDocumentAsync(ProcessDocumentRequest request, CallSettings callSettings = null)
Processes a single document.
Name | Description |
request | ProcessDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Type | Description |
Task<Document> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessDocumentRequest request = new ProcessDocumentRequest
{
InputConfig = new InputConfig(),
OutputConfig = new OutputConfig(),
DocumentType = "",
TableExtractionParams = new TableExtractionParams(),
FormExtractionParams = new FormExtractionParams(),
EntityExtractionParams = new EntityExtractionParams(),
OcrParams = new OcrParams(),
AutomlParams = new AutoMlParams(),
Parent = "",
};
// Make the request
Document response = await documentUnderstandingServiceClient.ProcessDocumentAsync(request);
ProcessDocumentAsync(ProcessDocumentRequest, CancellationToken)
public virtual Task<Document> ProcessDocumentAsync(ProcessDocumentRequest request, CancellationToken cancellationToken)
Processes a single document.
Name | Description |
request | ProcessDocumentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Type | Description |
Task<Document> | A Task containing the RPC response. |
// Create client
DocumentUnderstandingServiceClient documentUnderstandingServiceClient = await DocumentUnderstandingServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessDocumentRequest request = new ProcessDocumentRequest
{
InputConfig = new InputConfig(),
OutputConfig = new OutputConfig(),
DocumentType = "",
TableExtractionParams = new TableExtractionParams(),
FormExtractionParams = new FormExtractionParams(),
EntityExtractionParams = new EntityExtractionParams(),
OcrParams = new OcrParams(),
AutomlParams = new AutoMlParams(),
Parent = "",
};
// Make the request
Document response = await documentUnderstandingServiceClient.ProcessDocumentAsync(request);
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.