Class DocumentProcessorServiceClient (1.3.0)

public abstract class DocumentProcessorServiceClient

DocumentProcessorService client wrapper, for convenient use.

Inheritance

Object > DocumentProcessorServiceClient

Namespace

Google.Cloud.DocumentAI.V1

Assembly

Google.Cloud.DocumentAI.V1.dll

Remarks

Service to call Cloud DocumentAI 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.

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 DocumentProcessorService service, which is a host of "documentai.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default DocumentProcessorService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default DocumentProcessorService scopes are:

GrpcClient

public virtual DocumentProcessorService.DocumentProcessorServiceClient GrpcClient { get; }

The underlying gRPC DocumentProcessorService client

Property Value
TypeDescription
DocumentProcessorService.DocumentProcessorServiceClient

ReviewDocumentOperationsClient

public virtual OperationsClient ReviewDocumentOperationsClient { get; }

The long-running operations client for ReviewDocument.

Property Value
TypeDescription
OperationsClient

Methods

BatchProcessDocuments(BatchProcessRequest, CallSettings)

public virtual Operation<BatchProcessResponse, BatchProcessMetadata> BatchProcessDocuments(BatchProcessRequest 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
requestBatchProcessRequest

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<BatchProcessResponse, BatchProcessMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
BatchProcessRequest request = new BatchProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InputDocuments = new BatchDocumentsInputConfig(),
    DocumentOutputConfig = new DocumentOutputConfig(),
};
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = documentProcessorServiceClient.BatchProcessDocuments(request);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceBatchProcessDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocuments(ProcessorName, CallSettings)

public virtual Operation<BatchProcessResponse, BatchProcessMetadata> BatchProcessDocuments(ProcessorName name, 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
nameProcessorName

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchProcessResponse, BatchProcessMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = documentProcessorServiceClient.BatchProcessDocuments(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceBatchProcessDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocuments(String, CallSettings)

public virtual Operation<BatchProcessResponse, BatchProcessMetadata> BatchProcessDocuments(string name, 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
nameString

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchProcessResponse, BatchProcessMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = documentProcessorServiceClient.BatchProcessDocuments(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceBatchProcessDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(BatchProcessRequest, CallSettings)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(BatchProcessRequest 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
requestBatchProcessRequest

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<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
BatchProcessRequest request = new BatchProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InputDocuments = new BatchDocumentsInputConfig(),
    DocumentOutputConfig = new DocumentOutputConfig(),
};
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(BatchProcessRequest, CancellationToken)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(BatchProcessRequest 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
requestBatchProcessRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
BatchProcessRequest request = new BatchProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InputDocuments = new BatchDocumentsInputConfig(),
    DocumentOutputConfig = new DocumentOutputConfig(),
};
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(ProcessorName, CallSettings)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(ProcessorName name, 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
nameProcessorName

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(ProcessorName, CancellationToken)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(ProcessorName name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameProcessorName

Required. The processor resource name.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(String, CallSettings)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(string name, 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
nameString

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

BatchProcessDocumentsAsync(String, CancellationToken)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> BatchProcessDocumentsAsync(string name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameString

Required. The processor resource name.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchProcessResponse, BatchProcessMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(name);

// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchProcessResponse 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<BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchProcessResponse retrievedResult = retrievedResponse.Result;
}

Create()

public static DocumentProcessorServiceClient Create()

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

Returns
TypeDescription
DocumentProcessorServiceClient

The created DocumentProcessorServiceClient.

CreateAsync(CancellationToken)

public static Task<DocumentProcessorServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<DocumentProcessorServiceClient>

The task representing the created DocumentProcessorServiceClient.

PollOnceBatchProcessDocuments(String, CallSettings)

public virtual Operation<BatchProcessResponse, BatchProcessMetadata> 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<BatchProcessResponse, BatchProcessMetadata>

The result of polling the operation.

PollOnceBatchProcessDocumentsAsync(String, CallSettings)

public virtual Task<Operation<BatchProcessResponse, BatchProcessMetadata>> 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<BatchProcessResponse, BatchProcessMetadata>>

A task representing the result of polling the operation.

PollOnceReviewDocument(String, CallSettings)

public virtual Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> PollOnceReviewDocument(string operationName, CallSettings callSettings = null)

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

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<ReviewDocumentResponse, ReviewDocumentOperationMetadata>

The result of polling the operation.

PollOnceReviewDocumentAsync(String, CallSettings)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> PollOnceReviewDocumentAsync(string operationName, CallSettings callSettings = null)

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

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<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A task representing the result of polling the operation.

ProcessDocument(ProcessorName, CallSettings)

public virtual ProcessResponse ProcessDocument(ProcessorName name, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
nameProcessorName

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ProcessResponse

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
ProcessResponse response = documentProcessorServiceClient.ProcessDocument(name);

ProcessDocument(ProcessRequest, CallSettings)

public virtual ProcessResponse ProcessDocument(ProcessRequest request, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
requestProcessRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ProcessResponse

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
ProcessRequest request = new ProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InlineDocument = new Document(),
};
// Make the request
ProcessResponse response = documentProcessorServiceClient.ProcessDocument(request);

ProcessDocument(String, CallSettings)

public virtual ProcessResponse ProcessDocument(string name, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
nameString

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ProcessResponse

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
ProcessResponse response = documentProcessorServiceClient.ProcessDocument(name);

ProcessDocumentAsync(ProcessorName, CallSettings)

public virtual Task<ProcessResponse> ProcessDocumentAsync(ProcessorName name, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
nameProcessorName

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(name);

ProcessDocumentAsync(ProcessorName, CancellationToken)

public virtual Task<ProcessResponse> ProcessDocumentAsync(ProcessorName name, CancellationToken cancellationToken)

Processes a single document.

Parameters
NameDescription
nameProcessorName

Required. The processor resource name.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(name);

ProcessDocumentAsync(ProcessRequest, CallSettings)

public virtual Task<ProcessResponse> ProcessDocumentAsync(ProcessRequest request, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
requestProcessRequest

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<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessRequest request = new ProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InlineDocument = new Document(),
};
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(request);

ProcessDocumentAsync(ProcessRequest, CancellationToken)

public virtual Task<ProcessResponse> ProcessDocumentAsync(ProcessRequest request, CancellationToken cancellationToken)

Processes a single document.

Parameters
NameDescription
requestProcessRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ProcessRequest request = new ProcessRequest
{
    ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    SkipHumanReview = false,
    InlineDocument = new Document(),
};
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(request);

ProcessDocumentAsync(String, CallSettings)

public virtual Task<ProcessResponse> ProcessDocumentAsync(string name, CallSettings callSettings = null)

Processes a single document.

Parameters
NameDescription
nameString

Required. The processor resource name.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(name);

ProcessDocumentAsync(String, CancellationToken)

public virtual Task<ProcessResponse> ProcessDocumentAsync(string name, CancellationToken cancellationToken)

Processes a single document.

Parameters
NameDescription
nameString

Required. The processor resource name.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ProcessResponse>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]";
// Make the request
ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(name);

ReviewDocument(HumanReviewConfigName, CallSettings)

public virtual Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> ReviewDocument(HumanReviewConfigName humanReviewConfig, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigHumanReviewConfigName

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = documentProcessorServiceClient.ReviewDocument(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceReviewDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocument(ReviewDocumentRequest, CallSettings)

public virtual Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> ReviewDocument(ReviewDocumentRequest request, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
requestReviewDocumentRequest

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<ReviewDocumentResponse, ReviewDocumentOperationMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
ReviewDocumentRequest request = new ReviewDocumentRequest
{
    HumanReviewConfigAsHumanReviewConfigName = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    EnableSchemaValidation = false,
    InlineDocument = new Document(),
    Priority = ReviewDocumentRequest.Types.Priority.Default,
};
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = documentProcessorServiceClient.ReviewDocument(request);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceReviewDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocument(String, CallSettings)

public virtual Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> ReviewDocument(string humanReviewConfig, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigString

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>

The RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
// Initialize request argument(s)
string humanReviewConfig = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]/humanReviewConfig";
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = documentProcessorServiceClient.ReviewDocument(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceReviewDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(HumanReviewConfigName, CallSettings)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(HumanReviewConfigName humanReviewConfig, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigHumanReviewConfigName

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(HumanReviewConfigName, CancellationToken)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(HumanReviewConfigName humanReviewConfig, CancellationToken cancellationToken)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigHumanReviewConfigName

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(ReviewDocumentRequest, CallSettings)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(ReviewDocumentRequest request, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
requestReviewDocumentRequest

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<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ReviewDocumentRequest request = new ReviewDocumentRequest
{
    HumanReviewConfigAsHumanReviewConfigName = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    EnableSchemaValidation = false,
    InlineDocument = new Document(),
    Priority = ReviewDocumentRequest.Types.Priority.Default,
};
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(ReviewDocumentRequest, CancellationToken)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(ReviewDocumentRequest request, CancellationToken cancellationToken)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
requestReviewDocumentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
ReviewDocumentRequest request = new ReviewDocumentRequest
{
    HumanReviewConfigAsHumanReviewConfigName = HumanReviewConfigName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
    EnableSchemaValidation = false,
    InlineDocument = new Document(),
    Priority = ReviewDocumentRequest.Types.Priority.Default,
};
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(String, CallSettings)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(string humanReviewConfig, CallSettings callSettings = null)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigString

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string humanReviewConfig = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]/humanReviewConfig";
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

ReviewDocumentAsync(String, CancellationToken)

public virtual Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>> ReviewDocumentAsync(string humanReviewConfig, CancellationToken cancellationToken)

Send a document for Human Review. The input document should be processed by the specified processor.

Parameters
NameDescription
humanReviewConfigString

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata>>

A Task containing the RPC response.

Example
// Create client
DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();
// Initialize request argument(s)
string humanReviewConfig = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]/humanReviewConfig";
// Make the request
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> response = await documentProcessorServiceClient.ReviewDocumentAsync(humanReviewConfig);

// Poll until the returned long-running operation is complete
Operation<ReviewDocumentResponse, ReviewDocumentOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ReviewDocumentResponse 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<ReviewDocumentResponse, ReviewDocumentOperationMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceReviewDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ReviewDocumentResponse retrievedResult = retrievedResponse.Result;
}

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.