/// <summary>Snippet for PromoteCampaignDraft</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void PromoteCampaignDraftRequestObject()
        {
            // Create client
            CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
            // Initialize request argument(s)
            PromoteCampaignDraftRequest request = new PromoteCampaignDraftRequest
            {
                CampaignDraft = "",
                ValidateOnly  = false,
            };
            // Make the request
            Operation <Empty, Empty> response = campaignDraftServiceClient.PromoteCampaignDraft(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Empty> completedResponse = response.PollUntilCompleted();
            // 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 = campaignDraftServiceClient.PollOncePromoteCampaignDraft(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;
            }
        }
Esempio n. 2
0
        /// <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>
        /// Creates the campaign draft.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="baseCampaignId">The base campaign ID.</param>
        /// <returns></returns>
        private static string CreateCampaignDraft(GoogleAdsClient client, long customerId,
                                                  long baseCampaignId)
        {
            // Get the CampaignDraftService.
            CampaignDraftServiceClient campaignDraftService =
                client.GetService(Services.V4.CampaignDraftService);

            CampaignDraft campaignDraft = new CampaignDraft()
            {
                BaseCampaign = ResourceNames.Campaign(customerId, baseCampaignId),
                Name         = "Campaign Draft #" + ExampleUtilities.GetRandomString(),
            };

            CampaignDraftOperation operation = new CampaignDraftOperation()
            {
                Create = campaignDraft
            };

            MutateCampaignDraftsResponse response = campaignDraftService.MutateCampaignDrafts(
                customerId.ToString(), new CampaignDraftOperation[] { operation });

            string draftResourceName = response.Results[0].ResourceName;

            Console.WriteLine($"Campaign with resource ID = '{draftResourceName}' was added.");
            return(draftResourceName);
        }
Esempio n. 4
0
        /// <summary>Snippet for PromoteCampaignDraft</summary>
        public void PromoteCampaignDraft()
        {
            // Snippet: PromoteCampaignDraft(string, CallSettings)
            // Create client
            CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
            // Initialize request argument(s)
            string campaignDraft = "";
            // Make the request
            Operation <Empty, Empty> response = campaignDraftServiceClient.PromoteCampaignDraft(campaignDraft);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Empty> completedResponse = response.PollUntilCompleted();
            // 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 = campaignDraftServiceClient.PollOncePromoteCampaignDraft(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 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 GetCampaignDraft</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCampaignDraft()
 {
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/campaignDrafts/[CAMPAIGN_DRAFT]";
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(resourceName);
 }
 /// <summary>Snippet for GetCampaignDraft</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCampaignDraftResourceNames()
 {
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     CampaignDraftName resourceName = CampaignDraftName.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]");
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(resourceName);
 }
Esempio n. 8
0
        /// <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.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]");
            // Make the request
            CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(resourceName);
        }
Esempio n. 9
0
        /// <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);
        }
Esempio n. 10
0
 /// <summary>Snippet for GetCampaignDraft</summary>
 public void GetCampaignDraftResourceNames()
 {
     // Snippet: GetCampaignDraft(CampaignDraftName, CallSettings)
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     CampaignDraftName resourceName = CampaignDraftName.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]");
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(resourceName);
     // End snippet
 }
Esempio n. 11
0
 /// <summary>Snippet for GetCampaignDraft</summary>
 public void GetCampaignDraft()
 {
     // Snippet: GetCampaignDraft(string, CallSettings)
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/campaignDrafts/[BASE_CAMPAIGN_ID]~[DRAFT_ID]";
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(resourceName);
     // End snippet
 }
Esempio n. 12
0
 /// <summary>Snippet for GetCampaignDraft</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCampaignDraftRequestObject()
 {
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     GetCampaignDraftRequest request = new GetCampaignDraftRequest
     {
         ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerCampaignDraft("[CUSTOMER]", "[CAMPAIGN_DRAFT]"),
     };
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(request);
 }
 /// <summary>Snippet for MutateCampaignDrafts</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCampaignDrafts()
 {
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     IEnumerable <CampaignDraftOperation> operations = new CampaignDraftOperation[]
     {
         new CampaignDraftOperation(),
     };
     // Make the request
     MutateCampaignDraftsResponse response = campaignDraftServiceClient.MutateCampaignDrafts(customerId, operations);
 }
Esempio n. 14
0
        /// <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.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]"),
            };
            // Make the request
            CampaignDraft response = await campaignDraftServiceClient.GetCampaignDraftAsync(request);
        }
Esempio n. 15
0
        /// <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
        }
Esempio n. 16
0
 /// <summary>Snippet for GetCampaignDraft</summary>
 public void GetCampaignDraftRequestObject()
 {
     // Snippet: GetCampaignDraft(GetCampaignDraftRequest, CallSettings)
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     GetCampaignDraftRequest request = new GetCampaignDraftRequest
     {
         ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]"),
     };
     // Make the request
     CampaignDraft response = campaignDraftServiceClient.GetCampaignDraft(request);
     // End snippet
 }
Esempio n. 17
0
        /// <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
        }
Esempio n. 18
0
        /// <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
        }
Esempio n. 19
0
        /// <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
        }
Esempio n. 20
0
        /// <summary>Snippet for ListCampaignDraftAsyncErrors</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListCampaignDraftAsyncErrorsRequestObject()
        {
            // Create client
            CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
            // Initialize request argument(s)
            ListCampaignDraftAsyncErrorsRequest request = new ListCampaignDraftAsyncErrorsRequest
            {
                ResourceNameAsCampaignDraftName = CampaignDraftName.FromCustomerBaseCampaignDraft("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]"),
            };
            // Make the request
            PagedEnumerable <ListCampaignDraftAsyncErrorsResponse, Status> response = campaignDraftServiceClient.ListCampaignDraftAsyncErrors(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Status item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListCampaignDraftAsyncErrorsResponse page in response.AsRawResponses())
            {
                // 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 = response.ReadPage(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;
        }
Esempio n. 21
0
        /// <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 MutateCampaignDrafts</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCampaignDraftsRequestObject()
 {
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     MutateCampaignDraftsRequest request = new MutateCampaignDraftsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CampaignDraftOperation(),
         },
         PartialFailure = false,
         ValidateOnly   = false,
     };
     // Make the request
     MutateCampaignDraftsResponse response = campaignDraftServiceClient.MutateCampaignDrafts(request);
 }
Esempio n. 23
0
        /// <summary>Snippet for ListCampaignDraftAsyncErrors</summary>
        public void ListCampaignDraftAsyncErrors()
        {
            // Snippet: ListCampaignDraftAsyncErrors(string, string, int?, CallSettings)
            // Create client
            CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/campaignDrafts/[CAMPAIGN_DRAFT]";
            // Make the request
            PagedEnumerable <ListCampaignDraftAsyncErrorsResponse, Status> response = campaignDraftServiceClient.ListCampaignDraftAsyncErrors(resourceName);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Status item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListCampaignDraftAsyncErrorsResponse page in response.AsRawResponses())
            {
                // 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 = response.ReadPage(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
        }
Esempio n. 24
0
        /// <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,
                ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
            };
            // Make the request
            MutateCampaignDraftsResponse response = await campaignDraftServiceClient.MutateCampaignDraftsAsync(request);
        }
Esempio n. 25
0
 /// <summary>Snippet for MutateCampaignDrafts</summary>
 public void MutateCampaignDraftsRequestObject()
 {
     // Snippet: MutateCampaignDrafts(MutateCampaignDraftsRequest, CallSettings)
     // Create client
     CampaignDraftServiceClient campaignDraftServiceClient = CampaignDraftServiceClient.Create();
     // Initialize request argument(s)
     MutateCampaignDraftsRequest request = new MutateCampaignDraftsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CampaignDraftOperation(),
         },
         PartialFailure      = false,
         ValidateOnly        = false,
         ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
     };
     // Make the request
     MutateCampaignDraftsResponse response = campaignDraftServiceClient.MutateCampaignDrafts(request);
     // End snippet
 }
        /// <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
        }
Esempio n. 27
0
        /// <summary>
        /// Creates the campaign draft.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="baseCampaignId">The base campaign ID.</param>
        /// <returns>The resource name of the newly created campaign draft.</returns>
        internal static string CreateCampaignDraft(GoogleAdsClient client, long customerId,
                                                   long baseCampaignId)
        {
            // Get the CampaignDraftService.
            CampaignDraftServiceClient campaignDraftService =
                client.GetService(Services.V6.CampaignDraftService);

            CampaignDraft campaignDraft = new CampaignDraft()
            {
                BaseCampaign = ResourceNames.Campaign(customerId, baseCampaignId),
                Name         = "Campaign Draft #" + ExampleUtilities.GetRandomString(),
            };

            CampaignDraftOperation operation = new CampaignDraftOperation()
            {
                Create = campaignDraft
            };

            MutateCampaignDraftsResponse response = campaignDraftService.MutateCampaignDrafts(
                customerId.ToString(), new CampaignDraftOperation[] { operation });

            return(response.Results[0].ResourceName);
        }