/// <summary>Snippet for DeleteVersionAsync</summary> public async Task DeleteVersionRequestObjectAsync() { // Snippet: DeleteVersionAsync(DeleteVersionRequest, CallSettings) // Additional: DeleteVersionAsync(DeleteVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) DeleteVersionRequest request = new DeleteVersionRequest { Name = "", }; // Make the request Operation <Empty, OperationMetadataV1> response = await versionsClient.DeleteVersionAsync(request); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty 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 <Empty, OperationMetadataV1> retrievedResponse = await versionsClient.PollOnceDeleteVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for LoadVersionAsync</summary> public async Task LoadVersionResourceNamesAsync() { // Snippet: LoadVersionAsync(VersionName, CallSettings) // Additional: LoadVersionAsync(VersionName, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) VersionName name = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); // Make the request Operation <Empty, Struct> response = await versionsClient.LoadVersionAsync(name); // Poll until the returned long-running operation is complete Operation <Empty, Struct> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty 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 <Empty, Struct> retrievedResponse = await versionsClient.PollOnceLoadVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CreateVersionAsync</summary> public async Task CreateVersionResourceNamesAsync() { // Snippet: CreateVersionAsync(FlowName, Version, CallSettings) // Additional: CreateVersionAsync(FlowName, Version, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); gcdcv::Version version = new gcdcv::Version(); // Make the request Operation <gcdcv::Version, CreateVersionOperationMetadata> response = await versionsClient.CreateVersionAsync(parent, version); // Poll until the returned long-running operation is complete Operation <gcdcv::Version, CreateVersionOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result gcdcv::Version 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 <gcdcv::Version, CreateVersionOperationMetadata> retrievedResponse = await versionsClient.PollOnceCreateVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result gcdcv::Version retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for UpdateVersionAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task UpdateVersionRequestObjectAsync() { // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) UpdateVersionRequest request = new UpdateVersionRequest { Name = "", Version = new Version(), UpdateMask = new FieldMask(), }; // Make the request Operation <Version, OperationMetadataV1> response = await versionsClient.UpdateVersionAsync(request); // Poll until the returned long-running operation is complete Operation <Version, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Version 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 <Version, OperationMetadataV1> retrievedResponse = await versionsClient.PollOnceUpdateVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Version retrievedResult = retrievedResponse.Result; } }
/// <summary>Snippet for GetVersionAsync</summary> public async Task GetVersionAsync() { // Snippet: GetVersionAsync(string, CallSettings) // Additional: GetVersionAsync(string, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/agent/versions/[VERSION]"; // Make the request gcdv::Version response = await versionsClient.GetVersionAsync(name); // End snippet }
/// <summary>Snippet for DeleteVersionAsync</summary> public async Task DeleteVersionAsync() { // Snippet: DeleteVersionAsync(string, CallSettings) // Additional: DeleteVersionAsync(string, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/flows/[FLOW]/versions/[VERSION]"; // Make the request await versionsClient.DeleteVersionAsync(name); // End snippet }
/// <summary>Snippet for DeleteVersionAsync</summary> public async Task DeleteVersionResourceNamesAsync() { // Snippet: DeleteVersionAsync(VersionName, CallSettings) // Additional: DeleteVersionAsync(VersionName, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) VersionName name = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); // Make the request await versionsClient.DeleteVersionAsync(name); // End snippet }
/// <summary>Snippet for GetVersionAsync</summary> public async Task GetVersionResourceNamesAsync() { // Snippet: GetVersionAsync(VersionName, CallSettings) // Additional: GetVersionAsync(VersionName, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) VersionName name = VersionName.FromProjectVersion("[PROJECT]", "[VERSION]"); // Make the request gcdv::Version response = await versionsClient.GetVersionAsync(name); // End snippet }
/// <summary>Snippet for CompareVersionsAsync</summary> public async Task CompareVersionsAsync() { // Snippet: CompareVersionsAsync(string, CallSettings) // Additional: CompareVersionsAsync(string, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) string baseVersion = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/flows/[FLOW]/versions/[VERSION]"; // Make the request CompareVersionsResponse response = await versionsClient.CompareVersionsAsync(baseVersion); // End snippet }
/// <summary>Snippet for GetVersionAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetVersionRequestObjectAsync() { // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) GetVersionRequest request = new GetVersionRequest { Name = "", View = VersionView.Basic, }; // Make the request Version response = await versionsClient.GetVersionAsync(request); }
/// <summary>Snippet for ListVersionsAsync</summary> public async Task ListVersionsRequestObjectAsync() { // Snippet: ListVersionsAsync(ListVersionsRequest, CallSettings) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) ListVersionsRequest request = new ListVersionsRequest { Parent = "", View = VersionView.Basic, }; // Make the request PagedAsyncEnumerable <ListVersionsResponse, gcav::Version> response = versionsClient.ListVersionsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((gcav::Version 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((ListVersionsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (gcav::Version 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 <gcav::Version> 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 (gcav::Version 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 CreateVersionAsync</summary> public async Task CreateVersionAsync() { // Snippet: CreateVersionAsync(string, Version, CallSettings) // Additional: CreateVersionAsync(string, Version, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/agent"; gcdv::Version version = new gcdv::Version(); // Make the request gcdv::Version response = await versionsClient.CreateVersionAsync(parent, version); // End snippet }
/// <summary>Snippet for CreateVersionAsync</summary> public async Task CreateVersionResourceNamesAsync() { // Snippet: CreateVersionAsync(AgentName, Version, CallSettings) // Additional: CreateVersionAsync(AgentName, Version, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) AgentName parent = AgentName.FromProject("[PROJECT]"); gcdv::Version version = new gcdv::Version(); // Make the request gcdv::Version response = await versionsClient.CreateVersionAsync(parent, version); // End snippet }
/// <summary>Snippet for UpdateVersionAsync</summary> public async Task UpdateVersionAsync() { // Snippet: UpdateVersionAsync(Version, FieldMask, CallSettings) // Additional: UpdateVersionAsync(Version, FieldMask, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) gcdcv::Version version = new gcdcv::Version(); FieldMask updateMask = new FieldMask(); // Make the request gcdcv::Version response = await versionsClient.UpdateVersionAsync(version, updateMask); // End snippet }
/// <summary>Snippet for GetVersionAsync</summary> public async Task GetVersionRequestObjectAsync() { // Snippet: GetVersionAsync(GetVersionRequest, CallSettings) // Additional: GetVersionAsync(GetVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) GetVersionRequest request = new GetVersionRequest { VersionName = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"), }; // Make the request gcdcv::Version response = await versionsClient.GetVersionAsync(request); // End snippet }
/// <summary>Snippet for DeleteVersionAsync</summary> public async Task DeleteVersionRequestObjectAsync() { // Snippet: DeleteVersionAsync(DeleteVersionRequest, CallSettings) // Additional: DeleteVersionAsync(DeleteVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) DeleteVersionRequest request = new DeleteVersionRequest { VersionName = VersionName.FromProjectVersion("[PROJECT]", "[VERSION]"), }; // Make the request await versionsClient.DeleteVersionAsync(request); // End snippet }
/// <summary>Snippet for ListVersionsAsync</summary> public async Task ListVersionsResourceNamesAsync() { // Snippet: ListVersionsAsync(FlowName, string, int?, CallSettings) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); // Make the request PagedAsyncEnumerable <ListVersionsResponse, gcdcv::Version> response = versionsClient.ListVersionsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((gcdcv::Version 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((ListVersionsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (gcdcv::Version 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 <gcdcv::Version> 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 (gcdcv::Version 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 CreateVersionAsync</summary> public async Task CreateVersionRequestObjectAsync() { // Snippet: CreateVersionAsync(CreateVersionRequest, CallSettings) // Additional: CreateVersionAsync(CreateVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) CreateVersionRequest request = new CreateVersionRequest { ParentAsAgentName = AgentName.FromProject("[PROJECT]"), Version = new gcdv::Version(), }; // Make the request gcdv::Version response = await versionsClient.CreateVersionAsync(request); // End snippet }
/// <summary>Snippet for UpdateVersionAsync</summary> public async Task UpdateVersionRequestObjectAsync() { // Snippet: UpdateVersionAsync(UpdateVersionRequest, CallSettings) // Additional: UpdateVersionAsync(UpdateVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) UpdateVersionRequest request = new UpdateVersionRequest { Version = new gcdcv::Version(), UpdateMask = new FieldMask(), }; // Make the request gcdcv::Version response = await versionsClient.UpdateVersionAsync(request); // End snippet }
/// <summary>Snippet for GetVersionAsync</summary> public async Task GetVersionRequestObjectAsync() { // Snippet: GetVersionAsync(GetVersionRequest, CallSettings) // Additional: GetVersionAsync(GetVersionRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) GetVersionRequest request = new GetVersionRequest { Name = "", View = VersionView.Basic, }; // Make the request gcav::Version response = await versionsClient.GetVersionAsync(request); // End snippet }
/// <summary>Snippet for CompareVersionsAsync</summary> public async Task CompareVersionsRequestObjectAsync() { // Snippet: CompareVersionsAsync(CompareVersionsRequest, CallSettings) // Additional: CompareVersionsAsync(CompareVersionsRequest, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) CompareVersionsRequest request = new CompareVersionsRequest { BaseVersionAsVersionName = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"), TargetVersionAsVersionName = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"), LanguageCode = "", }; // Make the request CompareVersionsResponse response = await versionsClient.CompareVersionsAsync(request); // End snippet }