/// <summary>Snippet for GetExtensionFeedItem</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetExtensionFeedItem()
 {
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/extensionFeedItems/[FEED_ITEM_ID]";
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(resourceName);
 }
 /// <summary>Snippet for GetExtensionFeedItem</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetExtensionFeedItemResourceNames()
 {
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     ExtensionFeedItemName resourceName = ExtensionFeedItemName.FromCustomerFeedItem("[CUSTOMER_ID]", "[FEED_ITEM_ID]");
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(resourceName);
 }
        /// <summary>Snippet for GetExtensionFeedItemAsync</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 GetExtensionFeedItemResourceNamesAsync()
        {
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            ExtensionFeedItemName resourceName = ExtensionFeedItemName.FromCustomerExtensionFeedItem("[CUSTOMER]", "[EXTENSION_FEED_ITEM]");
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(resourceName);
        }
Ejemplo n.º 4
0
        /// <summary>Snippet for GetExtensionFeedItemAsync</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 GetExtensionFeedItemAsync()
        {
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/extensionFeedItems/[EXTENSION_FEED_ITEM]";
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(resourceName);
        }
Ejemplo n.º 5
0
 /// <summary>Snippet for GetExtensionFeedItem</summary>
 public void GetExtensionFeedItemResourceNames()
 {
     // Snippet: GetExtensionFeedItem(ExtensionFeedItemName, CallSettings)
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     ExtensionFeedItemName resourceName = ExtensionFeedItemName.FromCustomerExtensionFeedItem("[CUSTOMER]", "[EXTENSION_FEED_ITEM]");
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(resourceName);
     // End snippet
 }
Ejemplo n.º 6
0
 /// <summary>Snippet for GetExtensionFeedItem</summary>
 public void GetExtensionFeedItem()
 {
     // Snippet: GetExtensionFeedItem(string, CallSettings)
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/extensionFeedItems/[EXTENSION_FEED_ITEM]";
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(resourceName);
     // End snippet
 }
Ejemplo n.º 7
0
 /// <summary>Snippet for GetExtensionFeedItem</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetExtensionFeedItemRequestObject()
 {
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     GetExtensionFeedItemRequest request = new GetExtensionFeedItemRequest
     {
         ResourceNameAsExtensionFeedItemName = ExtensionFeedItemName.FromCustomerExtensionFeedItem("[CUSTOMER]", "[EXTENSION_FEED_ITEM]"),
     };
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(request);
 }
Ejemplo n.º 8
0
 /// <summary>Snippet for MutateExtensionFeedItems</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateExtensionFeedItems()
 {
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     IEnumerable <ExtensionFeedItemOperation> operations = new ExtensionFeedItemOperation[]
     {
         new ExtensionFeedItemOperation(),
     };
     // Make the request
     MutateExtensionFeedItemsResponse response = extensionFeedItemServiceClient.MutateExtensionFeedItems(customerId, operations);
 }
Ejemplo n.º 9
0
        /// <summary>Snippet for GetExtensionFeedItemAsync</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 GetExtensionFeedItemRequestObjectAsync()
        {
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetExtensionFeedItemRequest request = new GetExtensionFeedItemRequest
            {
                ResourceNameAsExtensionFeedItemName = ExtensionFeedItemName.FromCustomerFeedItem("[CUSTOMER_ID]", "[FEED_ITEM_ID]"),
            };
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(request);
        }
        /// <summary>Snippet for GetExtensionFeedItemAsync</summary>
        public async Task GetExtensionFeedItemAsync()
        {
            // Snippet: GetExtensionFeedItemAsync(string, CallSettings)
            // Additional: GetExtensionFeedItemAsync(string, CancellationToken)
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/extensionFeedItems/[FEED_ITEM_ID]";
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(resourceName);

            // End snippet
        }
 /// <summary>Snippet for GetExtensionFeedItem</summary>
 public void GetExtensionFeedItemRequestObject()
 {
     // Snippet: GetExtensionFeedItem(GetExtensionFeedItemRequest, CallSettings)
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     GetExtensionFeedItemRequest request = new GetExtensionFeedItemRequest
     {
         ResourceNameAsExtensionFeedItemName = ExtensionFeedItemName.FromCustomerFeedItem("[CUSTOMER_ID]", "[FEED_ITEM_ID]"),
     };
     // Make the request
     ExtensionFeedItem response = extensionFeedItemServiceClient.GetExtensionFeedItem(request);
     // End snippet
 }
        /// <summary>Snippet for GetExtensionFeedItemAsync</summary>
        public async Task GetExtensionFeedItemResourceNamesAsync()
        {
            // Snippet: GetExtensionFeedItemAsync(ExtensionFeedItemName, CallSettings)
            // Additional: GetExtensionFeedItemAsync(ExtensionFeedItemName, CancellationToken)
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            ExtensionFeedItemName resourceName = ExtensionFeedItemName.FromCustomerFeedItem("[CUSTOMER_ID]", "[FEED_ITEM_ID]");
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(resourceName);

            // End snippet
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Runs the code example.
        /// </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="feedItemId">The feed item ID.</param>
        /// <param name="geoTargetConstantId">Geo target constant ID to add to the extension
        ///     feed item. Reverts to the United States (2840) if no value passed.</param>
        // [START AddGeoTarget]
        public void Run(GoogleAdsClient client, long customerId, long feedItemId,
                        long?geoTargetConstantId)
        {
            // Get the ExtensionFeedItemServiceClient.
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient =
                client.GetService(Services.V6.ExtensionFeedItemService);

            // Apply the default geo target constant ID (USA) if none was passed to the function.
            if (!geoTargetConstantId.HasValue)
            {
                geoTargetConstantId = 2840L;
            }

            // Creates an extension feed item using the specified feed item ID and geo target
            // constant ID for targeting.
            ExtensionFeedItem extensionFeedItem = new ExtensionFeedItem()
            {
                ResourceName = ResourceNames.ExtensionFeedItem(customerId, feedItemId),
                TargetedGeoTargetConstant = ResourceNames.GeoTargetConstant(geoTargetConstantId.Value)
            };

            // Constructs an operation that will update the extension feed item, using the
            // FieldMasks utility to derive the update mask. This mask tells the Google Ads API
            // which attributes of the extension feed item you want to change.
            ExtensionFeedItemOperation operation = new ExtensionFeedItemOperation()
            {
                Update     = extensionFeedItem,
                UpdateMask = FieldMasks.AllSetFieldsOf(extensionFeedItem)
            };

            try
            {
                // Issues a mutate request to update the extension feed item.
                MutateExtensionFeedItemsResponse response =
                    extensionFeedItemServiceClient.MutateExtensionFeedItems(customerId.ToString(),
                                                                            new[] { operation });

                // Prints the resource name of the updated extension feed item.
                Console.WriteLine("Updated extension feed item with resource name " +
                                  $"{response.Results.First().ResourceName}.");
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Runs the code example.
        /// </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="feedItemId">The feed item ID to update.</param>
        /// <param name="sitelinkText">The new sitelink text.</param>
        // [START UpdateSitelink]
        public void Run(GoogleAdsClient client, long customerId, long feedItemId,
                        string sitelinkText)
        {
            // Get the ExtensionFeedItemService.
            ExtensionFeedItemServiceClient extensionFeedItemService =
                client.GetService(Services.V6.ExtensionFeedItemService);

            // Create an extension feed item using the specified feed item ID and sitelink text.
            ExtensionFeedItem extensionFeedItem = new ExtensionFeedItem
            {
                ResourceName     = ResourceNames.ExtensionFeedItem(customerId, feedItemId),
                SitelinkFeedItem = new SitelinkFeedItem
                {
                    LinkText = sitelinkText
                }
            };

            // Construct an operation that will update the extension feed item using the FieldMasks
            // utilities to derive the update mask. This mask tells the Google Ads API which
            // attributes of the extension feed item you want to change.
            ExtensionFeedItemOperation extensionFeedItemOperation = new ExtensionFeedItemOperation
            {
                Update     = extensionFeedItem,
                UpdateMask = FieldMasks.AllSetFieldsOf(extensionFeedItem)
            };

            try
            {
                // Issue a mutate request to update the extension feed item.
                MutateExtensionFeedItemsResponse response =
                    extensionFeedItemService.MutateExtensionFeedItems(
                        customerId.ToString(), new[] { extensionFeedItemOperation });

                // Print the resource name of the updated extension feed item.
                Console.WriteLine("Updated extension feed item with resource name " +
                                  $"'{response.Results.First().ResourceName}'.");
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
Ejemplo n.º 15
0
        /// <summary>Snippet for GetExtensionFeedItemAsync</summary>
        public async Task GetExtensionFeedItemRequestObjectAsync()
        {
            // Snippet: GetExtensionFeedItemAsync(GetExtensionFeedItemRequest, CallSettings)
            // Additional: GetExtensionFeedItemAsync(GetExtensionFeedItemRequest, CancellationToken)
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetExtensionFeedItemRequest request = new GetExtensionFeedItemRequest
            {
                ResourceNameAsExtensionFeedItemName = ExtensionFeedItemName.FromCustomerExtensionFeedItem("[CUSTOMER]", "[EXTENSION_FEED_ITEM]"),
            };
            // Make the request
            ExtensionFeedItem response = await extensionFeedItemServiceClient.GetExtensionFeedItemAsync(request);

            // End snippet
        }
 /// <summary>Snippet for MutateExtensionFeedItems</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateExtensionFeedItemsRequestObject()
 {
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     MutateExtensionFeedItemsRequest request = new MutateExtensionFeedItemsRequest
     {
         CustomerId = "",
         Operations =
         {
             new ExtensionFeedItemOperation(),
         },
         PartialFailure = false,
         ValidateOnly   = false,
     };
     // Make the request
     MutateExtensionFeedItemsResponse response = extensionFeedItemServiceClient.MutateExtensionFeedItems(request);
 }
        /// <summary>Snippet for MutateExtensionFeedItemsAsync</summary>
        public async Task MutateExtensionFeedItemsAsync()
        {
            // Snippet: MutateExtensionFeedItemsAsync(string, IEnumerable<ExtensionFeedItemOperation>, CallSettings)
            // Additional: MutateExtensionFeedItemsAsync(string, IEnumerable<ExtensionFeedItemOperation>, CancellationToken)
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            IEnumerable <ExtensionFeedItemOperation> operations = new ExtensionFeedItemOperation[]
            {
                new ExtensionFeedItemOperation(),
            };
            // Make the request
            MutateExtensionFeedItemsResponse response = await extensionFeedItemServiceClient.MutateExtensionFeedItemsAsync(customerId, operations);

            // End snippet
        }
        /// <summary>Snippet for MutateExtensionFeedItemsAsync</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 MutateExtensionFeedItemsRequestObjectAsync()
        {
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateExtensionFeedItemsRequest request = new MutateExtensionFeedItemsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new ExtensionFeedItemOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = false,
                ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
            };
            // Make the request
            MutateExtensionFeedItemsResponse response = await extensionFeedItemServiceClient.MutateExtensionFeedItemsAsync(request);
        }
 /// <summary>Snippet for MutateExtensionFeedItems</summary>
 public void MutateExtensionFeedItemsRequestObject()
 {
     // Snippet: MutateExtensionFeedItems(MutateExtensionFeedItemsRequest, CallSettings)
     // Create client
     ExtensionFeedItemServiceClient extensionFeedItemServiceClient = ExtensionFeedItemServiceClient.Create();
     // Initialize request argument(s)
     MutateExtensionFeedItemsRequest request = new MutateExtensionFeedItemsRequest
     {
         CustomerId = "",
         Operations =
         {
             new ExtensionFeedItemOperation(),
         },
         PartialFailure      = false,
         ValidateOnly        = false,
         ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
     };
     // Make the request
     MutateExtensionFeedItemsResponse response = extensionFeedItemServiceClient.MutateExtensionFeedItems(request);
     // End snippet
 }
Ejemplo n.º 20
0
        /// <summary>Snippet for MutateExtensionFeedItemsAsync</summary>
        public async Task MutateExtensionFeedItemsRequestObjectAsync()
        {
            // Snippet: MutateExtensionFeedItemsAsync(MutateExtensionFeedItemsRequest, CallSettings)
            // Additional: MutateExtensionFeedItemsAsync(MutateExtensionFeedItemsRequest, CancellationToken)
            // Create client
            ExtensionFeedItemServiceClient extensionFeedItemServiceClient = await ExtensionFeedItemServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateExtensionFeedItemsRequest request = new MutateExtensionFeedItemsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new ExtensionFeedItemOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = false,
            };
            // Make the request
            MutateExtensionFeedItemsResponse response = await extensionFeedItemServiceClient.MutateExtensionFeedItemsAsync(request);

            // End snippet
        }
        /// <summary>
        /// Creates an image extension.
        /// </summary>
        /// <param name="client">The Google Ads API client.</param>
        /// <param name="customerId">The client customer ID.</param>
        /// <param name="imageAssetId">The ID of the image asset to be used for creating image
        /// extension.</param>
        /// <returns>Resource name of the newly created image extension.</returns>
        private static string CreateImageExtension(GoogleAdsClient client, long customerId,
                                                   long imageAssetId)
        {
            // Get the ExtensionFeedItemServiceClient.
            ExtensionFeedItemServiceClient extensionFeedItemService =
                client.GetService(Services.V10.ExtensionFeedItemService);

            // Creates the image feed item using the provided image.
            ImageFeedItem imageFeedItem = new ImageFeedItem()
            {
                ImageAsset = ResourceNames.Asset(customerId, imageAssetId)
            };

            // Creates an ExtensionFeedItem from the ImageFeedItem.
            ExtensionFeedItem extensionFeedItem = new ExtensionFeedItem()
            {
                ImageFeedItem = imageFeedItem
            };

            ExtensionFeedItemOperation operation = new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem
            };

            // Adds the ExtensionFeedItem.
            MutateExtensionFeedItemsResponse response =
                extensionFeedItemService.MutateExtensionFeedItems(customerId.ToString(),
                                                                  new[] { operation });

            // Displays the result.
            string resourceName = response.Results.First().ResourceName;

            Console.WriteLine($"Created an image extension with resource name '{resourceName}'.");

            return(resourceName);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Creates an extension feed item for price extension.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The customer ID for which the call is made.</param>
        /// <param name="campaignId">ID of the campaign to target.</param>
        /// <returns>the resource name of the newly created extension feed item.</returns>
        private string CreateExtensionFeedItem(GoogleAdsClient client, long customerId,
                                               long campaignId)
        {
            // Get the ExtensionFeedItemServiceClient.
            ExtensionFeedItemServiceClient extensionFeedItemService =
                client.GetService(Services.V3.ExtensionFeedItemService);

            // Creates the price extension feed item.
            PriceFeedItem priceFeedItem = new PriceFeedItem()
            {
                Type = PriceExtensionType.Services,
                // Optional: sets a qualifier text to show with the price extension.
                PriceQualifier      = PriceExtensionPriceQualifier.From,
                TrackingUrlTemplate = "http://tracker.example.com/?u={lpurl}",
                LanguageCode        = "en",
                // To create a price extension, at least three price offerings are needed.
                PriceOfferings =
                {
                    CreatePriceOffer(
                        "Scrubs",
                        "Body Scrub, Salt Scrub",
                        60000000, // 60 USD
                        "USD",
                        PriceExtensionPriceUnit.PerHour,
                        "http://www.example.com/scrubs",
                        "http://m.example.com/scrubs"),
                    CreatePriceOffer(
                        "Hair Cuts",
                        "Once a month",
                        75000000, // 75 USD
                        "USD",
                        PriceExtensionPriceUnit.PerMonth,
                        "http://www.example.com/haircuts",
                        "http://m.example.com/haircuts"),
                    CreatePriceOffer(
                        "Skin Care Package",
                        "Four times a month",
                        250000000, // 250 USD
                        "USD",
                        PriceExtensionPriceUnit.PerMonth,
                        "http://www.example.com/skincarepackage",
                        null)
                }
            };

            // Creates an extension feed item from the price feed item.
            ExtensionFeedItem extensionFeedItem = new ExtensionFeedItem()
            {
                ExtensionType    = ExtensionType.Price,
                PriceFeedItem    = priceFeedItem,
                TargetedCampaign = ResourceNames.Campaign(customerId, campaignId),
                AdSchedules      =
                {
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Sunday,      10,
                                         MinuteOfHour.Zero,                         18, MinuteOfHour.Zero),
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Saturday,    10,
                                         MinuteOfHour.Zero,                         22, MinuteOfHour.Zero)
                }
            };

            // Creates an operation to add the feed item.
            ExtensionFeedItemOperation operation = new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem
            };

            // Issues a mutate request to add the extension feed item and prints its information.
            MutateExtensionFeedItemsResponse response =
                extensionFeedItemService.MutateExtensionFeedItems(customerId.ToString(),
                                                                  new[] { operation });
            string resourceName = response.Results[0].ResourceName;

            Console.WriteLine($"Created extension feed item with resource name: {resourceName}.");
            return(resourceName);
        }
Ejemplo n.º 23
0
        // [END AddSitelinks]

        /// <summary>
        /// Creates a list of ExtensionFeedItems.
        /// </summary>
        ///<param name="client">The Google Ads API client.</param>
        ///<param name="customerId">The client customer ID.</param>
        ///<param name="campaignResourceName">The resource name of the campaign to target.</param>
        // [START AddSitelinks_1]
        private static List <string> CreateExtensionFeedItems(GoogleAdsClient client,
                                                              long customerId, string campaignResourceName)
        {
            // Get the ExtensionFeedItemServiceClient.
            ExtensionFeedItemServiceClient extensionFeedItemService =
                client.GetService(Services.V6.ExtensionFeedItemService);

            SitelinkFeedItem sitelinkFeedItem1 = CreateSitelinkFeedItem(
                "Store Hours", "http://www.example.com/storehours");

            // Creates an ExtensionFeedItem from the SitelinkFeedItem.
            ExtensionFeedItem extensionFeedItem1 = new ExtensionFeedItem()
            {
                ExtensionType    = ExtensionType.Sitelink,
                SitelinkFeedItem = sitelinkFeedItem1,
                TargetedCampaign = campaignResourceName
            };

            List <ExtensionFeedItemOperation> operations = new List <ExtensionFeedItemOperation>();

            // Creates an ExtensionFeedItemOperation and adds it to the operations List.
            operations.Add(new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem1
            });

            SitelinkFeedItem sitelinkFeedItem2 = CreateSitelinkFeedItem(
                "Thanksgiving Specials", "http://www.example.com/thanksgiving");

            DateTime startTime = new DateTime(DateTime.Now.Year, 11, 20, 0, 0, 0);

            if (startTime < DateTime.Now)
            {
                // Move the startTime to next year if the current date is past November 20th.
                startTime = startTime.AddYears(1);
            }

            // Converts to a string in the required format.
            string startTimeString = startTime.ToString("yyyy-MM-dd hh:mm:ss");

            // Use the same year as startTime when creating endTime.
            DateTime endTime = new DateTime(startTime.Year, 11, 27, 23, 59, 59);

            string unitedStates = ResourceNames.GeoTargetConstant(2840);

            ExtensionFeedItem extensionFeedItem2 = new ExtensionFeedItem()
            {
                ExtensionType    = ExtensionType.Sitelink,
                SitelinkFeedItem = sitelinkFeedItem2,
                TargetedCampaign = campaignResourceName,

                // StartDateTime should be formatted in "yyyy-MM-dd hh:mm:ss" format.
                StartDateTime = startTime.ToString("yyyy-MM-dd hh:mm:ss"),

                // EndDateTime should be formatted in "yyyy-MM-dd hh:mm:ss" format.
                EndDateTime = endTime.ToString("yyyy-MM-dd hh:mm:ss"),

                // Targets this sitelink for United States only.
                // A list of country codes can be referenced here:
                // https://developers.google.com/adwords/api/docs/appendix/geotargeting
                TargetedGeoTargetConstant = ResourceNames.GeoTargetConstant(2840)
            };

            operations.Add(new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem2
            });

            SitelinkFeedItem sitelinkFeedItem3 = CreateSitelinkFeedItem(
                "Wifi available", "http://www.example.com/mobile/wifi");

            ExtensionFeedItem extensionFeedItem3 = new ExtensionFeedItem()
            {
                ExtensionType    = ExtensionType.Sitelink,
                SitelinkFeedItem = sitelinkFeedItem3,
                TargetedCampaign = campaignResourceName,
                Device           = FeedItemTargetDevice.Mobile,
                TargetedKeyword  = new KeywordInfo()
                {
                    Text      = "free wifi",
                    MatchType = KeywordMatchType.Broad
                }
            };

            operations.Add(new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem3
            });

            SitelinkFeedItem sitelinkFeedItem4 = CreateSitelinkFeedItem(
                "Happy hours", "http://www.example.com/happyhours");

            ExtensionFeedItem extensionFeedItem4 = new ExtensionFeedItem()
            {
                ExtensionType    = ExtensionType.Sitelink,
                SitelinkFeedItem = sitelinkFeedItem4,
                TargetedCampaign = campaignResourceName,
                AdSchedules      =
                {
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Monday,      18,
                                         MinuteOfHour.Zero,                         21, MinuteOfHour.Zero),
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Tuesday,     18,
                                         MinuteOfHour.Zero,                         21, MinuteOfHour.Zero),
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Wednesday,   18,
                                         MinuteOfHour.Zero,                         21, MinuteOfHour.Zero),
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Thursday,    18,
                                         MinuteOfHour.Zero,                         21, MinuteOfHour.Zero),
                    CreateAdScheduleInfo(DayOfWeekEnum.Types.DayOfWeek.Friday,      18,
                                         MinuteOfHour.Zero,                         21, MinuteOfHour.Zero),
                }
            };

            operations.Add(new ExtensionFeedItemOperation()
            {
                Create = extensionFeedItem4
            });

            // Adds the ExtensionFeedItem.
            MutateExtensionFeedItemsResponse response =
                extensionFeedItemService.MutateExtensionFeedItems(customerId.ToString(),
                                                                  operations);

            Console.WriteLine($"Added {response.Results.Count}:");

            List <string> resourceNames = new List <string>();

            foreach (MutateExtensionFeedItemResult result in response.Results)
            {
                Console.WriteLine($"Created ExtensionFeedItems with " +
                                  $"resource name '{result.ResourceName}'.");
                resourceNames.Add(result.ResourceName);
            }
            return(resourceNames);
        }