/// <summary>Snippet for DeleteWebhookAsync</summary> public async Task DeleteWebhookResourceNamesAsync() { // Snippet: DeleteWebhookAsync(WebhookName, CallSettings) // Additional: DeleteWebhookAsync(WebhookName, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) WebhookName name = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); // Make the request await webhooksClient.DeleteWebhookAsync(name); // End snippet }
/// <summary>Snippet for DeleteWebhookAsync</summary> public async Task DeleteWebhookAsync() { // Snippet: DeleteWebhookAsync(string, CallSettings) // Additional: DeleteWebhookAsync(string, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/webhooks/[WEBHOOK]"; // Make the request await webhooksClient.DeleteWebhookAsync(name); // End snippet }
/// <summary>Snippet for UpdateWebhookAsync</summary> public async Task UpdateWebhookAsync() { // Snippet: UpdateWebhookAsync(Webhook, FieldMask, CallSettings) // Additional: UpdateWebhookAsync(Webhook, FieldMask, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) Webhook webhook = new Webhook(); FieldMask updateMask = new FieldMask(); // Make the request Webhook response = await webhooksClient.UpdateWebhookAsync(webhook, updateMask); // End snippet }
/// <summary>Snippet for CreateWebhookAsync</summary> public async Task CreateWebhookResourceNamesAsync() { // Snippet: CreateWebhookAsync(AgentName, Webhook, CallSettings) // Additional: CreateWebhookAsync(AgentName, Webhook, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) AgentName parent = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"); Webhook webhook = new Webhook(); // Make the request Webhook response = await webhooksClient.CreateWebhookAsync(parent, webhook); // End snippet }
/// <summary>Snippet for CreateWebhookAsync</summary> public async Task CreateWebhookAsync() { // Snippet: CreateWebhookAsync(string, Webhook, CallSettings) // Additional: CreateWebhookAsync(string, Webhook, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]"; Webhook webhook = new Webhook(); // Make the request Webhook response = await webhooksClient.CreateWebhookAsync(parent, webhook); // End snippet }
/// <summary>Snippet for ListWebhooks</summary> public async Task ListWebhooksRequestObjectAsync() { // Snippet: ListWebhooksAsync(ListWebhooksRequest, CallSettings) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) ListWebhooksRequest request = new ListWebhooksRequest { ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), }; // Make the request PagedAsyncEnumerable <ListWebhooksResponse, Webhook> response = webhooksClient.ListWebhooksAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Webhook item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListWebhooksResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Webhook item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Webhook> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Webhook item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for GetWebhookAsync</summary> public async Task GetWebhookRequestObjectAsync() { // Snippet: GetWebhookAsync(GetWebhookRequest, CallSettings) // Additional: GetWebhookAsync(GetWebhookRequest, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) GetWebhookRequest request = new GetWebhookRequest { WebhookName = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"), }; // Make the request Webhook response = await webhooksClient.GetWebhookAsync(request); // End snippet }
/// <summary>Snippet for UpdateWebhookAsync</summary> public async Task UpdateWebhookRequestObjectAsync() { // Snippet: UpdateWebhookAsync(UpdateWebhookRequest, CallSettings) // Additional: UpdateWebhookAsync(UpdateWebhookRequest, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) UpdateWebhookRequest request = new UpdateWebhookRequest { Webhook = new Webhook(), UpdateMask = new FieldMask(), }; // Make the request Webhook response = await webhooksClient.UpdateWebhookAsync(request); // End snippet }
/// <summary>Snippet for CreateWebhookAsync</summary> public async Task CreateWebhookRequestObjectAsync() { // Snippet: CreateWebhookAsync(CreateWebhookRequest, CallSettings) // Additional: CreateWebhookAsync(CreateWebhookRequest, CancellationToken) // Create client WebhooksClient webhooksClient = await WebhooksClient.CreateAsync(); // Initialize request argument(s) CreateWebhookRequest request = new CreateWebhookRequest { ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), Webhook = new Webhook(), }; // Make the request Webhook response = await webhooksClient.CreateWebhookAsync(request); // End snippet }