/// <summary>Snippet for ReviewDocumentAsync</summary> public async Task ReviewDocumentResourceNamesAsync() { // Snippet: ReviewDocumentAsync(HumanReviewConfigName, CallSettings) // Additional: ReviewDocumentAsync(HumanReviewConfigName, CancellationToken) // 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; } // End snippet }
/// <summary>Snippet for ReviewDocumentAsync</summary> public async Task ReviewDocumentRequestObjectAsync() { // Snippet: ReviewDocumentAsync(ReviewDocumentRequest, CallSettings) // Additional: ReviewDocumentAsync(ReviewDocumentRequest, CancellationToken) // 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; } // End snippet }