/// <summary>Snippet for PromoteCampaignDraftAsync</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 PromoteCampaignDraftAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) string campaignDraft = ""; // Make the request Operation <Empty, Empty> response = await campaignDraftServiceClient.PromoteCampaignDraftAsync(campaignDraft); // 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 campaignDraftServiceClient.PollOncePromoteCampaignDraftAsync(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 PromoteCampaignDraftAsync</summary> public async Task PromoteCampaignDraftRequestObjectAsync() { // Snippet: PromoteCampaignDraftAsync(PromoteCampaignDraftRequest, CallSettings) // Additional: PromoteCampaignDraftAsync(PromoteCampaignDraftRequest, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) PromoteCampaignDraftRequest request = new PromoteCampaignDraftRequest { CampaignDraft = "", }; // Make the request Operation <Empty, Empty> response = await campaignDraftServiceClient.PromoteCampaignDraftAsync(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 campaignDraftServiceClient.PollOncePromoteCampaignDraftAsync(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 GetCampaignDraftAsync</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 GetCampaignDraftResourceNamesAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) CampaignDraftName resourceName = CampaignDraftName.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]"); // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(resourceName); }
/// <summary>Snippet for GetCampaignDraftAsync</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 GetCampaignDraftAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/campaignDrafts/[BASE_CAMPAIGN_ID]~[DRAFT_ID]"; // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(resourceName); }
/// <summary>Snippet for GetCampaignDraftAsync</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 GetCampaignDraftRequestObjectAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) GetCampaignDraftRequest request = new GetCampaignDraftRequest { ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]"), }; // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(request); }
/// <summary>Snippet for MutateCampaignDraftsAsync</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 MutateCampaignDraftsAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <CampaignDraftOperation> operations = new CampaignDraftOperation[] { new CampaignDraftOperation(), }; // Make the request MutateCampaignDraftsResponse response = await campaignDraftServiceClient.MutateCampaignDraftsAsync(customerId, operations); }
/// <summary>Snippet for GetCampaignDraftAsync</summary> public async Task GetCampaignDraftAsync() { // Snippet: GetCampaignDraftAsync(string, CallSettings) // Additional: GetCampaignDraftAsync(string, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/campaignDrafts/[CAMPAIGN_DRAFT]"; // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignDraftAsync</summary> public async Task GetCampaignDraftResourceNamesAsync() { // Snippet: GetCampaignDraftAsync(CampaignDraftName, CallSettings) // Additional: GetCampaignDraftAsync(CampaignDraftName, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) CampaignDraftName resourceName = CampaignDraftName.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]"); // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(resourceName); // End snippet }
/// <summary>Snippet for ListCampaignDraftAsyncErrorsAsync</summary> public async Task ListCampaignDraftAsyncErrorsRequestObjectAsync() { // Snippet: ListCampaignDraftAsyncErrorsAsync(ListCampaignDraftAsyncErrorsRequest, CallSettings) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) ListCampaignDraftAsyncErrorsRequest request = new ListCampaignDraftAsyncErrorsRequest { ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]"), }; // Make the request PagedAsyncEnumerable <ListCampaignDraftAsyncErrorsResponse, Status> response = campaignDraftServiceClient.ListCampaignDraftAsyncErrorsAsync(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((ListCampaignDraftAsyncErrorsResponse 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 GetCampaignDraftAsync</summary> public async Task GetCampaignDraftRequestObjectAsync() { // Snippet: GetCampaignDraftAsync(GetCampaignDraftRequest, CallSettings) // Additional: GetCampaignDraftAsync(GetCampaignDraftRequest, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) GetCampaignDraftRequest request = new GetCampaignDraftRequest { ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]"), }; // Make the request CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(request); // End snippet }
/// <summary>Snippet for MutateCampaignDraftsAsync</summary> public async Task MutateCampaignDraftsAsync() { // Snippet: MutateCampaignDraftsAsync(string, IEnumerable<CampaignDraftOperation>, CallSettings) // Additional: MutateCampaignDraftsAsync(string, IEnumerable<CampaignDraftOperation>, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <CampaignDraftOperation> operations = new CampaignDraftOperation[] { new CampaignDraftOperation(), }; // Make the request MutateCampaignDraftsResponse response = await campaignDraftServiceClient.MutateCampaignDraftsAsync(customerId, operations); // End snippet }
/// <summary>Snippet for MutateCampaignDraftsAsync</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 MutateCampaignDraftsRequestObjectAsync() { // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) MutateCampaignDraftsRequest request = new MutateCampaignDraftsRequest { CustomerId = "", Operations = { new CampaignDraftOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateCampaignDraftsResponse response = await campaignDraftServiceClient.MutateCampaignDraftsAsync(request); }
/// <summary>Snippet for MutateCampaignDraftsAsync</summary> public async Task MutateCampaignDraftsRequestObjectAsync() { // Snippet: MutateCampaignDraftsAsync(MutateCampaignDraftsRequest, CallSettings) // Additional: MutateCampaignDraftsAsync(MutateCampaignDraftsRequest, CancellationToken) // Create client CampaignDraftServiceClient campaignDraftServiceClient = await CampaignDraftServiceClient.CreateAsync(); // Initialize request argument(s) MutateCampaignDraftsRequest request = new MutateCampaignDraftsRequest { CustomerId = "", Operations = { new CampaignDraftOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateCampaignDraftsResponse response = await campaignDraftServiceClient.MutateCampaignDraftsAsync(request); // End snippet }