/// <summary>Snippet for MutateFeedItemSetLinks</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateFeedItemSetLinks() { // Create client FeedItemSetLinkServiceClient feedItemSetLinkServiceClient = FeedItemSetLinkServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <FeedItemSetLinkOperation> operations = new FeedItemSetLinkOperation[] { new FeedItemSetLinkOperation(), }; // Make the request MutateFeedItemSetLinksResponse response = feedItemSetLinkServiceClient.MutateFeedItemSetLinks(customerId, operations); }
/// <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">ID of the feed associated with the feed item set.</param> /// <param name="feedItemSetId">ID of the feed item set.</param> /// <param name="feedItemId">ID of the feed item to link to the set.</param> public void Run(GoogleAdsClient client, long customerId, long feedId, long feedItemSetId, long feedItemId) { // Get the FeedItemSetLinkService. FeedItemSetLinkServiceClient feedItemSetLinkService = client.GetService( Services.V10.FeedItemSetLinkService); // Creates a new feed item set link that binds the specified feed item set and feed // item. string feedItemSetResourceName = ResourceNames.FeedItemSet(customerId, feedId, feedItemSetId); string feedItemResourceName = ResourceNames.FeedItem(customerId, feedId, feedItemId); FeedItemSetLink feedItemSetLink = new FeedItemSetLink() { FeedItemSet = feedItemSetResourceName, FeedItem = feedItemResourceName }; // Constructs a feed item set link operation. FeedItemSetLinkOperation operation = new FeedItemSetLinkOperation() { Create = feedItemSetLink }; try { // Issues a mutate request to add the feed item set link on the server. MutateFeedItemSetLinksResponse response = feedItemSetLinkService.MutateFeedItemSetLinks(customerId.ToString(), new[] { operation }); // Prints some information about the created feed item set link. foreach (MutateFeedItemSetLinkResult result in response.Results) { Console.WriteLine($"Created a feed item set link with resource name " + $"'{result.ResourceName}' that links feed item set " + $"'{feedItemSetResourceName}' to feed item '{feedItemResourceName}'."); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
/// <summary>Snippet for MutateFeedItemSetLinksAsync</summary> public async Task MutateFeedItemSetLinksAsync() { // Snippet: MutateFeedItemSetLinksAsync(string, IEnumerable<FeedItemSetLinkOperation>, CallSettings) // Additional: MutateFeedItemSetLinksAsync(string, IEnumerable<FeedItemSetLinkOperation>, CancellationToken) // Create client FeedItemSetLinkServiceClient feedItemSetLinkServiceClient = await FeedItemSetLinkServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <FeedItemSetLinkOperation> operations = new FeedItemSetLinkOperation[] { new FeedItemSetLinkOperation(), }; // Make the request MutateFeedItemSetLinksResponse response = await feedItemSetLinkServiceClient.MutateFeedItemSetLinksAsync(customerId, operations); // End snippet }