use of com.google.api.ads.adwords.axis.v201809.cm.CampaignFeedPage in project googleads-java-lib by googleads.
the class MigrateToExtensionSettings method getCampaignFeeds.
/**
* Returns the campaign feeds that use a particular feed for a particular placeholder type.
*/
private static List<CampaignFeed> getCampaignFeeds(AdWordsServicesInterface adWordsServices, AdWordsSession session, Feed feed, int placeholderType) throws RemoteException {
// Get the CampaignFeedService.
CampaignFeedServiceInterface campaignFeedService = adWordsServices.get(session, CampaignFeedServiceInterface.class);
String query = String.format("SELECT CampaignId, MatchingFunction, PlaceholderTypes WHERE Status = 'ENABLED' " + "AND FeedId = %d AND PlaceholderTypes CONTAINS_ANY [%d]", feed.getId(), placeholderType);
List<CampaignFeed> campaignFeeds = new ArrayList<>();
int offset = 0;
CampaignFeedPage campaignFeedPage;
do {
String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE);
campaignFeedPage = campaignFeedService.query(pageQuery);
if (campaignFeedPage.getEntries() != null) {
campaignFeeds.addAll(Arrays.asList(campaignFeedPage.getEntries()));
}
offset += PAGE_SIZE;
} while (offset < campaignFeedPage.getTotalNumEntries());
return campaignFeeds;
}
Aggregations