コード例 #1
0
        /// <summary>Snippet for AsyncBatchAnnotateFiles</summary>
        public void AsyncBatchAnnotateFiles_RequestObject()
        {
            // Snippet: AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest,CallSettings)
            // Create client
            ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
            // Initialize request argument(s)
            AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
            {
                Requests = { },
            };
            // 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
        }