Exemple #1
0
        /// <summary>Snippet for BatchUpdateIntentsAsync</summary>
        public async Task BatchUpdateIntentsAsync_RequestObject()
        {
            // Snippet: BatchUpdateIntentsAsync(BatchUpdateIntentsRequest,CallSettings)
            // Create client
            IntentsClient intentsClient = await IntentsClient.CreateAsync();

            // Initialize request argument(s)
            BatchUpdateIntentsRequest request = new BatchUpdateIntentsRequest
            {
                ParentAsProjectAgentName = new ProjectAgentName("[PROJECT]"),
                LanguageCode             = "",
            };
            // Make the request
            Operation <BatchUpdateIntentsResponse, Struct> response =
                await intentsClient.BatchUpdateIntentsAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <BatchUpdateIntentsResponse, Struct> completedResponse =
                await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            BatchUpdateIntentsResponse 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 <BatchUpdateIntentsResponse, Struct> retrievedResponse =
                await intentsClient.PollOnceBatchUpdateIntentsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchUpdateIntentsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }