Class DocumentUnderstandingServiceClient (1.0.0-beta03)

public abstract class DocumentUnderstandingServiceClient

DocumentUnderstandingService client wrapper, for convenient use.

Inheritance

Object > DocumentUnderstandingServiceClient

Namespace

Google.Cloud.DocumentAI.V1Beta2

Assembly

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.

Property Value
TypeDescription
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.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default DocumentUnderstandingService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default DocumentUnderstandingService scopes are:

GrpcClient

public virtual DocumentUnderstandingService.DocumentUnderstandingServiceClient GrpcClient { get; }

The underlying gRPC DocumentUnderstandingService client

Property Value
TypeDescription
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.

Parameters
NameDescription
requestBatchProcessDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchProcessDocumentsResponse, OperationMetadata>

The RPC response.

Example
// 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.

Parameters
NameDescription
requestsIEnumerable<ProcessDocumentRequest>

Required. Individual requests for each document.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchProcessDocumentsResponse, OperationMetadata>

The RPC response.

Example
// 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.

Parameters
NameDescription
requestBatchProcessDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// 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.

Parameters
NameDescription
requestBatchProcessDocumentsRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// 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.

Parameters
NameDescription
requestsIEnumerable<ProcessDocumentRequest>

Required. Individual requests for each document.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// 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.

Parameters
NameDescription
requestsIEnumerable<ProcessDocumentRequest>

Required. Individual requests for each document.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// 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.

Returns
TypeDescription
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.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
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 .

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.

Parameters
NameDescription
requestProcessDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Example
// 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.

Parameters
NameDescription
requestProcessDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

A Task containing the RPC response.

Example
// 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.

Parameters
NameDescription
requestProcessDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Document>

A Task containing the RPC response.

Example
// 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.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

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.