use of com.google.api.ads.adwords.axis.v201809.cm.FeedItemPage in project googleads-java-lib by googleads.
the class MigrateToExtensionSettings method getFeedItems.
/**
* Returns the feed items for a feed.
*/
private static List<FeedItem> getFeedItems(AdWordsServicesInterface adWordsServices, AdWordsSession session, Feed feed) throws RemoteException {
// Get the FeedItemService.
FeedItemServiceInterface feedItemService = adWordsServices.get(session, FeedItemServiceInterface.class);
String query = String.format("SELECT FeedItemId, AttributeValues WHERE Status = 'ENABLED' AND FeedId = %d", feed.getId());
List<FeedItem> feedItems = new ArrayList<>();
int offset = 0;
FeedItemPage feedItemPage;
do {
String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE);
feedItemPage = feedItemService.query(pageQuery);
if (feedItemPage.getEntries() != null) {
feedItems.addAll(Arrays.asList(feedItemPage.getEntries()));
}
offset += PAGE_SIZE;
} while (offset < feedItemPage.getTotalNumEntries());
return feedItems;
}
Aggregations