/// <summary>Snippet for GetFeedItemSet</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetFeedItemSetResourceNames() { // Create client FeedItemSetServiceClient feedItemSetServiceClient = FeedItemSetServiceClient.Create(); // Initialize request argument(s) FeedItemSetName resourceName = FeedItemSetName.FromCustomerFeedFeedItemSet("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_ITEM_SET_ID]"); // Make the request FeedItemSet response = feedItemSetServiceClient.GetFeedItemSet(resourceName); }
/// <summary>Snippet for GetFeedItemSet</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetFeedItemSet() { // Create client FeedItemSetServiceClient feedItemSetServiceClient = FeedItemSetServiceClient.Create(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/feedItemSets/[FEED_ID]~[FEED_ITEM_SET_ID]"; // Make the request FeedItemSet response = feedItemSetServiceClient.GetFeedItemSet(resourceName); }
/// <summary>Snippet for GetFeedItemSetAsync</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 GetFeedItemSetRequestObjectAsync() { // Create client FeedItemSetServiceClient feedItemSetServiceClient = await FeedItemSetServiceClient.CreateAsync(); // Initialize request argument(s) GetFeedItemSetRequest request = new GetFeedItemSetRequest { ResourceNameAsFeedItemSetName = FeedItemSetName.FromCustomerFeedFeedItemSet("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_ITEM_SET_ID]"), }; // Make the request FeedItemSet response = await feedItemSetServiceClient.GetFeedItemSetAsync(request); }
/// <summary>Snippet for GetFeedItemSetAsync</summary> public async Task GetFeedItemSetAsync() { // Snippet: GetFeedItemSetAsync(string, CallSettings) // Additional: GetFeedItemSetAsync(string, CancellationToken) // Create client FeedItemSetServiceClient feedItemSetServiceClient = await FeedItemSetServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/feedItemSets/[FEED_ID]~[FEED_ITEM_SET_ID]"; // Make the request FeedItemSet response = await feedItemSetServiceClient.GetFeedItemSetAsync(resourceName); // End snippet }
/// <summary>Snippet for GetFeedItemSet</summary> public void GetFeedItemSetRequestObject() { // Snippet: GetFeedItemSet(GetFeedItemSetRequest, CallSettings) // Create client FeedItemSetServiceClient feedItemSetServiceClient = FeedItemSetServiceClient.Create(); // Initialize request argument(s) GetFeedItemSetRequest request = new GetFeedItemSetRequest { ResourceNameAsFeedItemSetName = FeedItemSetName.FromCustomerFeedFeedItemSet("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_ITEM_SET_ID]"), }; // Make the request FeedItemSet response = feedItemSetServiceClient.GetFeedItemSet(request); // End snippet }
/// <summary>Snippet for GetFeedItemSetAsync</summary> public async Task GetFeedItemSetResourceNamesAsync() { // Snippet: GetFeedItemSetAsync(FeedItemSetName, CallSettings) // Additional: GetFeedItemSetAsync(FeedItemSetName, CancellationToken) // Create client FeedItemSetServiceClient feedItemSetServiceClient = await FeedItemSetServiceClient.CreateAsync(); // Initialize request argument(s) FeedItemSetName resourceName = FeedItemSetName.FromCustomerFeedFeedItemSet("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_ITEM_SET_ID]"); // Make the request FeedItemSet response = await feedItemSetServiceClient.GetFeedItemSetAsync(resourceName); // End snippet }
/// <summary> /// Runs the code example. /// </summary> /// <param name="client">The Google Ads API client.</param> /// <param name="customerId">The Google Ads customer ID for which the call is made.</param> /// <param name="feedId">The Feed ID for creating the feed item set.</param> public void Run(GoogleAdsClient client, long customerId, long feedId) { // Get the FeedItemSetService. FeedItemSetServiceClient feedItemService = client.GetService( Services.V6.FeedItemSetService); FeedItemSet feedItemSet = new FeedItemSet() { Feed = ResourceNames.Feed(customerId, feedId), DisplayName = "Feed Item Set #" + ExampleUtilities.GetRandomString(), }; // A feed item set can be created as a dynamic set by setting an optional filter // field below. If your feed is a location extension, uncomment the code that calls // DynamicLocationSetFilter. If instead your feed is an affiliate extension, // uncomment the code that sets the DynamicAffiliateLocationSetFilter instead. // 1) Location extension. //feedItemSet.DynamicLocationSetFilter = new DynamicLocationSetFilter() //{ // // Dynamic location sets support filtering locations based on business name // // and/or labels. If both are specified, the feed item set will only include // // locations that satisfy both types of filters. // BusinessNameFilter = new BusinessNameFilter() // { // BusinessName = "INSERT_YOUR_BUSINESS_NAME_HERE", // FilterType = FeedItemSetStringFilterType.Exact, // }, // // Adds a filter by feed item label resource name. If multiple labels are // // specified, the feed item set will only include feed items with all of the // // specified labels. // Labels = { "INSERT_BUSINESS_LABEL_HERE" } //}; // 2) Affiliate extension. //feedItemSet.DynamicAffiliateLocationSetFilter = new DynamicAffiliateLocationSetFilter() //{ // ChainIds = { long.Parse("INSERT_CHAIN_ID_HERE") } //}; // Constructs an operation that will create a new feed item set. FeedItemSetOperation operation = new FeedItemSetOperation() { Create = feedItemSet }; try { // Issues a mutate request to add the feed item set on the server. MutateFeedItemSetsResponse response = feedItemService.MutateFeedItemSets(customerId.ToString(), new[] { operation }); // Prints the resource names of the added feed item sets. foreach (MutateFeedItemSetResult addedFeedItemSet in response.Results) { Console.WriteLine("Created a feed item set with resource name " + $"'{addedFeedItemSet.ResourceName}'"); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }