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

            // Initialize request argument(s)
            BatchDeleteIntentsRequest request = new BatchDeleteIntentsRequest
            {
                ParentAsProjectAgentName = new ProjectAgentName("[PROJECT]"),
                Intents = { },
            };
            // Make the request
            Operation <Empty, Struct> response =
                await intentsClient.BatchDeleteIntentsAsync(request);

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

            // The long-running operation is now complete.

            // 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 <Empty, Struct> retrievedResponse =
                await intentsClient.PollOnceBatchDeleteIntentsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
Exemple #2
0
        /// <summary>Snippet for BatchDeleteIntentsAsync</summary>
        public async Task BatchDeleteIntentsAsync()
        {
            // Snippet: BatchDeleteIntentsAsync(ProjectAgentName,IEnumerable<Intent>,CallSettings)
            // Additional: BatchDeleteIntentsAsync(ProjectAgentName,IEnumerable<Intent>,CancellationToken)
            // Create client
            IntentsClient intentsClient = await IntentsClient.CreateAsync();

            // Initialize request argument(s)
            ProjectAgentName     parent  = new ProjectAgentName("[PROJECT]");
            IEnumerable <Intent> intents = new List <Intent>();
            // Make the request
            Operation <Empty, Struct> response =
                await intentsClient.BatchDeleteIntentsAsync(parent, intents);

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

            // The long-running operation is now complete.

            // 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 <Empty, Struct> retrievedResponse =
                await intentsClient.PollOnceBatchDeleteIntentsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }