/// <summary>Snippet for CreateCampaignExperimentAsync</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 CreateCampaignExperimentAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; CampaignExperiment campaignExperiment = new CampaignExperiment(); // Make the request Operation <Empty, CreateCampaignExperimentMetadata> response = await campaignExperimentServiceClient.CreateCampaignExperimentAsync(customerId, campaignExperiment); // Poll until the returned long-running operation is complete Operation <Empty, CreateCampaignExperimentMetadata> 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, CreateCampaignExperimentMetadata> retrievedResponse = await campaignExperimentServiceClient.PollOnceCreateCampaignExperimentAsync(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; } }
/// <summary>Snippet for PromoteCampaignExperimentAsync</summary> public async Task PromoteCampaignExperimentAsync() { // Snippet: PromoteCampaignExperimentAsync(string, CallSettings) // Additional: PromoteCampaignExperimentAsync(string, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string campaignExperiment = ""; // Make the request Operation <Empty, Empty> response = await campaignExperimentServiceClient.PromoteCampaignExperimentAsync(campaignExperiment); // Poll until the returned long-running operation is complete Operation <Empty, Empty> 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, Empty> retrievedResponse = await campaignExperimentServiceClient.PollOncePromoteCampaignExperimentAsync(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 PromoteCampaignExperimentAsync</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 PromoteCampaignExperimentRequestObjectAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) PromoteCampaignExperimentRequest request = new PromoteCampaignExperimentRequest { CampaignExperiment = "", ValidateOnly = false, }; // Make the request Operation <Empty, Empty> response = await campaignExperimentServiceClient.PromoteCampaignExperimentAsync(request); // Poll until the returned long-running operation is complete Operation <Empty, Empty> 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, Empty> retrievedResponse = await campaignExperimentServiceClient.PollOncePromoteCampaignExperimentAsync(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; } }
/// <summary>Snippet for GetCampaignExperimentAsync</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 GetCampaignExperimentAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/campaignExperiments/[CAMPAIGN_EXPERIMENT_ID]"; // Make the request CampaignExperiment response = await campaignExperimentServiceClient.GetCampaignExperimentAsync(resourceName); }
/// <summary>Snippet for GetCampaignExperimentAsync</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 GetCampaignExperimentResourceNamesAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) CampaignExperimentName resourceName = CampaignExperimentName.FromCustomerCampaignExperiment("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); // Make the request CampaignExperiment response = await campaignExperimentServiceClient.GetCampaignExperimentAsync(resourceName); }
/// <summary>Snippet for EndCampaignExperimentAsync</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 EndCampaignExperimentAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string campaignExperiment = ""; // Make the request await campaignExperimentServiceClient.EndCampaignExperimentAsync(campaignExperiment); }
/// <summary>Snippet for GraduateCampaignExperimentAsync</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 GraduateCampaignExperimentAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string campaignExperiment = ""; string campaignBudget = ""; // Make the request GraduateCampaignExperimentResponse response = await campaignExperimentServiceClient.GraduateCampaignExperimentAsync(campaignExperiment, campaignBudget); }
/// <summary>Snippet for EndCampaignExperimentAsync</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 EndCampaignExperimentRequestObjectAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) EndCampaignExperimentRequest request = new EndCampaignExperimentRequest { CampaignExperiment = "", }; // Make the request await campaignExperimentServiceClient.EndCampaignExperimentAsync(request); }
/// <summary>Snippet for MutateCampaignExperimentsAsync</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 MutateCampaignExperimentsAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <CampaignExperimentOperation> operations = new CampaignExperimentOperation[] { new CampaignExperimentOperation(), }; // Make the request MutateCampaignExperimentsResponse response = await campaignExperimentServiceClient.MutateCampaignExperimentsAsync(customerId, operations); }
/// <summary>Snippet for GraduateCampaignExperimentAsync</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 GraduateCampaignExperimentRequestObjectAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = "", CampaignBudget = "", }; // Make the request GraduateCampaignExperimentResponse response = await campaignExperimentServiceClient.GraduateCampaignExperimentAsync(request); }
/// <summary>Snippet for GetCampaignExperimentAsync</summary> public async Task GetCampaignExperimentResourceNamesAsync() { // Snippet: GetCampaignExperimentAsync(CampaignExperimentName, CallSettings) // Additional: GetCampaignExperimentAsync(CampaignExperimentName, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) CampaignExperimentName resourceName = CampaignExperimentName.FromCustomerCampaignExperiment("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); // Make the request CampaignExperiment response = await campaignExperimentServiceClient.GetCampaignExperimentAsync(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignExperimentAsync</summary> public async Task GetCampaignExperimentAsync() { // Snippet: GetCampaignExperimentAsync(string, CallSettings) // Additional: GetCampaignExperimentAsync(string, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/campaignExperiments/[CAMPAIGN_EXPERIMENT_ID]"; // Make the request CampaignExperiment response = await campaignExperimentServiceClient.GetCampaignExperimentAsync(resourceName); // End snippet }
/// <summary>Snippet for EndCampaignExperimentAsync</summary> public async Task EndCampaignExperimentAsync() { // Snippet: EndCampaignExperimentAsync(string, CallSettings) // Additional: EndCampaignExperimentAsync(string, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string campaignExperiment = ""; // Make the request await campaignExperimentServiceClient.EndCampaignExperimentAsync(campaignExperiment); // End snippet }
/// <summary>Snippet for GraduateCampaignExperimentAsync</summary> public async Task GraduateCampaignExperimentAsync() { // Snippet: GraduateCampaignExperimentAsync(string, string, CallSettings) // Additional: GraduateCampaignExperimentAsync(string, string, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string campaignExperiment = ""; string campaignBudget = ""; // Make the request GraduateCampaignExperimentResponse response = await campaignExperimentServiceClient.GraduateCampaignExperimentAsync(campaignExperiment, campaignBudget); // End snippet }
/// <summary>Snippet for ListCampaignExperimentAsyncErrorsAsync</summary> public async Task ListCampaignExperimentAsyncErrorsRequestObjectAsync() { // Snippet: ListCampaignExperimentAsyncErrorsAsync(ListCampaignExperimentAsyncErrorsRequest, CallSettings) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) ListCampaignExperimentAsyncErrorsRequest request = new ListCampaignExperimentAsyncErrorsRequest { ResourceNameAsCampaignExperimentName = CampaignExperimentName.FromCustomerCampaignExperiment("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"), }; // Make the request PagedAsyncEnumerable <ListCampaignExperimentAsyncErrorsResponse, Status> response = campaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Status 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((ListCampaignExperimentAsyncErrorsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Status 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 <Status> 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 (Status 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 EndCampaignExperimentAsync</summary> public async Task EndCampaignExperimentRequestObjectAsync() { // Snippet: EndCampaignExperimentAsync(EndCampaignExperimentRequest, CallSettings) // Additional: EndCampaignExperimentAsync(EndCampaignExperimentRequest, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) EndCampaignExperimentRequest request = new EndCampaignExperimentRequest { CampaignExperiment = "", }; // Make the request await campaignExperimentServiceClient.EndCampaignExperimentAsync(request); // End snippet }
/// <summary>Snippet for GraduateCampaignExperimentAsync</summary> public async Task GraduateCampaignExperimentRequestObjectAsync() { // Snippet: GraduateCampaignExperimentAsync(GraduateCampaignExperimentRequest, CallSettings) // Additional: GraduateCampaignExperimentAsync(GraduateCampaignExperimentRequest, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = "", CampaignBudget = "", }; // Make the request GraduateCampaignExperimentResponse response = await campaignExperimentServiceClient.GraduateCampaignExperimentAsync(request); // End snippet }
/// <summary>Snippet for MutateCampaignExperimentsAsync</summary> public async Task MutateCampaignExperimentsAsync() { // Snippet: MutateCampaignExperimentsAsync(string, IEnumerable<CampaignExperimentOperation>, CallSettings) // Additional: MutateCampaignExperimentsAsync(string, IEnumerable<CampaignExperimentOperation>, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <CampaignExperimentOperation> operations = new CampaignExperimentOperation[] { new CampaignExperimentOperation(), }; // Make the request MutateCampaignExperimentsResponse response = await campaignExperimentServiceClient.MutateCampaignExperimentsAsync(customerId, operations); // End snippet }
/// <summary>Snippet for MutateCampaignExperimentsAsync</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 MutateCampaignExperimentsRequestObjectAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) MutateCampaignExperimentsRequest request = new MutateCampaignExperimentsRequest { CustomerId = "", Operations = { new CampaignExperimentOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateCampaignExperimentsResponse response = await campaignExperimentServiceClient.MutateCampaignExperimentsAsync(request); }
/// <summary>Snippet for MutateCampaignExperimentsAsync</summary> public async Task MutateCampaignExperimentsRequestObjectAsync() { // Snippet: MutateCampaignExperimentsAsync(MutateCampaignExperimentsRequest, CallSettings) // Additional: MutateCampaignExperimentsAsync(MutateCampaignExperimentsRequest, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) MutateCampaignExperimentsRequest request = new MutateCampaignExperimentsRequest { CustomerId = "", Operations = { new CampaignExperimentOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateCampaignExperimentsResponse response = await campaignExperimentServiceClient.MutateCampaignExperimentsAsync(request); // End snippet }
/// <summary>Snippet for CreateCampaignExperimentAsync</summary> public async Task CreateCampaignExperimentRequestObjectAsync() { // Snippet: CreateCampaignExperimentAsync(CreateCampaignExperimentRequest, CallSettings) // Additional: CreateCampaignExperimentAsync(CreateCampaignExperimentRequest, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) CreateCampaignExperimentRequest request = new CreateCampaignExperimentRequest { CustomerId = "", CampaignExperiment = new CampaignExperiment(), ValidateOnly = false, }; // Make the request Operation <Empty, CreateCampaignExperimentMetadata> response = await campaignExperimentServiceClient.CreateCampaignExperimentAsync(request); // Poll until the returned long-running operation is complete Operation <Empty, CreateCampaignExperimentMetadata> 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, CreateCampaignExperimentMetadata> retrievedResponse = await campaignExperimentServiceClient.PollOnceCreateCampaignExperimentAsync(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 }