/// <summary>Snippet for AsyncBatchAnnotateFilesAsync</summary> public async Task AsyncBatchAnnotateFilesAsync() { // Snippet: AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CallSettings) // Additional: AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CancellationToken) // Create client ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync(); // Initialize request argument(s) IEnumerable <AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[] { new AsyncAnnotateFileRequest(), }; // Make the request Operation <AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(requests); // Poll until the returned long-running operation is complete Operation <AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result AsyncBatchAnnotateFilesResponse 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 <AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for AsyncBatchAnnotateFiles</summary> public void AsyncBatchAnnotateFilesRequestObject() { // Snippet: AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest, CallSettings) // Create client ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create(); // Initialize request argument(s) AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest { Requests = { new AsyncAnnotateFileRequest(), }, Parent = "", }; // Make the request Operation <AsyncBatchAnnotateFilesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateFiles(request); // Poll until the returned long-running operation is complete Operation <AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result AsyncBatchAnnotateFilesResponse 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 <AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateFiles(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result; } // End snippet }