private static void createSiteLinksFeedItems(
AdWordsServices adWordsServices, AdWordsSession session, SiteLinksDataHolder siteLinksData)
throws Exception {
// Get the FeedItemService.
FeedItemServiceInterface feedItemService =
adWordsServices.get(session, FeedItemServiceInterface.class);
// Create operations to add FeedItems.
FeedItemOperation home =
newSiteLinkFeedItemAddOperation(siteLinksData, "Home", "http://www.example.com");
FeedItemOperation stores =
newSiteLinkFeedItemAddOperation(siteLinksData, "Stores", "http://www.example.com/stores");
FeedItemOperation onSale =
newSiteLinkFeedItemAddOperation(siteLinksData, "On Sale", "http://www.example.com/sale");
FeedItemOperation support =
newSiteLinkFeedItemAddOperation(siteLinksData, "Support", "http://www.example.com/support");
FeedItemOperation products =
newSiteLinkFeedItemAddOperation(siteLinksData, "Products", "http://www.example.com/prods");
FeedItemOperation aboutUs =
newSiteLinkFeedItemAddOperation(siteLinksData, "About Us", "http://www.example.com/about");
FeedItemOperation[] operations =
new FeedItemOperation[] {home, stores, onSale, support, products, aboutUs};
FeedItemReturnValue result = feedItemService.mutate(operations);
for (FeedItem item : result.getValue()) {
System.out.printf("FeedItem with feedItemId %d was added.\n", item.getFeedItemId());
siteLinksData.siteLinkFeedItemIds.add(item.getFeedItemId());
}
}