use of com.google.api.ads.adwords.axis.v201809.cm.FeedPage in project googleads-java-lib by googleads.
the class MigrateToExtensionSettings method getFeeds.
/**
* Returns a list of all enabled feeds.
*/
private static List<Feed> getFeeds(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
String query = "SELECT Id, Name, Attributes WHERE Origin = 'USER' AND FeedStatus = 'ENABLED'";
List<Feed> feeds = new ArrayList<>();
int offset = 0;
FeedPage feedPage;
do {
String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE);
feedPage = feedService.query(pageQuery);
if (feedPage.getEntries() != null) {
feeds.addAll(Arrays.asList(feedPage.getEntries()));
}
offset += PAGE_SIZE;
} while (offset < feedPage.getTotalNumEntries());
return feeds;
}
Aggregations