Show / Hide Table of Contents

Class DocumentUnderstandingServiceClient

DocumentUnderstandingService client wrapper, for convenient use.

Inheritance
System.Object
DocumentUnderstandingServiceClient
DocumentUnderstandingServiceClientImpl
Inherited Members
System.Object.ToString()
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Cloud.DocumentAI.V1Beta2
Assembly: Google.Cloud.DocumentAI.V1Beta2.dll
Syntax
public abstract class DocumentUnderstandingServiceClient
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

The long-running operations client for BatchProcessDocuments.

Declaration
public virtual OperationsClient BatchProcessDocumentsOperationsClient { get; }
Property Value
Type Description
OperationsClient

DefaultEndpoint

The default endpoint for the DocumentUnderstandingService service, which is a host of "us-documentai.googleapis.com" and a port of 443.

Declaration
public static string DefaultEndpoint { get; }
Property Value
Type Description
System.String

DefaultScopes

The default DocumentUnderstandingService scopes.

Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyList<System.String>
Remarks

The default DocumentUnderstandingService scopes are:

  • https://www.googleapis.com/auth/cloud-platform

GrpcClient

The underlying gRPC DocumentUnderstandingService client

Declaration
public virtual DocumentUnderstandingService.DocumentUnderstandingServiceClient GrpcClient { get; }
Property Value
Type Description
DocumentUnderstandingService.DocumentUnderstandingServiceClient

Methods

BatchProcessDocuments(BatchProcessDocumentsRequest, CallSettings)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> BatchProcessDocuments(BatchProcessDocumentsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
BatchProcessDocumentsRequest request

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Operation<BatchProcessDocumentsResponse, OperationMetadata>

The RPC response.

Sample code
// 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)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> BatchProcessDocuments(IEnumerable<ProcessDocumentRequest> requests, CallSettings callSettings = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ProcessDocumentRequest> requests

Required. Individual requests for each document.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Operation<BatchProcessDocumentsResponse, OperationMetadata>

The RPC response.

Sample code
// 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)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(BatchProcessDocumentsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
BatchProcessDocumentsRequest request

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
System.Threading.Tasks.Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Sample code
// 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)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(BatchProcessDocumentsRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
BatchProcessDocumentsRequest request

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

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken to use for this RPC.

Returns
Type Description
System.Threading.Tasks.Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Sample code
// 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)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest> requests, CallSettings callSettings = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ProcessDocumentRequest> requests

Required. Individual requests for each document.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
System.Threading.Tasks.Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Sample code
// 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)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Declaration
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> BatchProcessDocumentsAsync(IEnumerable<ProcessDocumentRequest> requests, CancellationToken cancellationToken)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ProcessDocumentRequest> requests

Required. Individual requests for each document.

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken to use for this RPC.

Returns
Type Description
System.Threading.Tasks.Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A Task containing the RPC response.

Sample code
// 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()

Synchronously creates a DocumentUnderstandingServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentUnderstandingServiceClientBuilder.

Declaration
public static DocumentUnderstandingServiceClient Create()
Returns
Type Description
DocumentUnderstandingServiceClient

The created DocumentUnderstandingServiceClient.

CreateAsync(CancellationToken)

Asynchronously creates a DocumentUnderstandingServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentUnderstandingServiceClientBuilder.

Declaration
public static Task<DocumentUnderstandingServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken to use while creating the client.

Returns
Type Description
System.Threading.Tasks.Task<DocumentUnderstandingServiceClient>

The task representing the created DocumentUnderstandingServiceClient.

PollOnceBatchProcessDocuments(String, CallSettings)

Poll an operation once, using an operationName from a previous invocation of BatchProcessDocuments .

Declaration
public virtual Operation<BatchProcessDocumentsResponse, OperationMetadata> PollOnceBatchProcessDocuments(string operationName, CallSettings callSettings = null)
Parameters
Type Name Description
System.String operationName

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Operation<BatchProcessDocumentsResponse, OperationMetadata>

The result of polling the operation.

PollOnceBatchProcessDocumentsAsync(String, CallSettings)

Asynchronously poll an operation once, using an operationName from a previous invocation of BatchProcessDocuments.

Declaration
public virtual Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>> PollOnceBatchProcessDocumentsAsync(string operationName, CallSettings callSettings = null)
Parameters
Type Name Description
System.String operationName

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
System.Threading.Tasks.Task<Operation<BatchProcessDocumentsResponse, OperationMetadata>>

A task representing the result of polling the operation.

ProcessDocument(ProcessDocumentRequest, CallSettings)

Processes a single document.

Declaration
public virtual Document ProcessDocument(ProcessDocumentRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ProcessDocumentRequest request

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Sample code
// 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)

Processes a single document.

Declaration
public virtual Task<Document> ProcessDocumentAsync(ProcessDocumentRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ProcessDocumentRequest request

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
System.Threading.Tasks.Task<Document>

A Task containing the RPC response.

Sample code
// 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)

Processes a single document.

Declaration
public virtual Task<Document> ProcessDocumentAsync(ProcessDocumentRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
ProcessDocumentRequest request

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

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken to use for this RPC.

Returns
Type Description
System.Threading.Tasks.Task<Document>

A Task containing the RPC response.

Sample code
// 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()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type Description
System.Threading.Tasks.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.

Back to top