PromotionServiceInterface promotionService =
adWordsServices.get(session, PromotionServiceInterface.class);
int offset = 0;
Selector selector = new SelectorBuilder()
.fields("PromotionId",
"Name",
"Status",
"DestinationUrl",
"StreetAddressVisible",
"CallTrackingEnabled",
"ContentNetworkOptedOut",
"Budget",
"PromotionCriteria",
"RemainingBudget",
"Creatives",
"CampaignIds")
.offset(offset)
.limit(PAGE_SIZE)
.build();
List<Promotion> promotions = Lists.newArrayList();
PromotionPage page;
do {
// Get all promotions for the business
page = promotionService.get(selector);
// Display promotions
if (page.getTotalNumEntries() > 0) {
for (Promotion promotion : page.getEntries()) {
System.out.printf("Express promotion found with ID %d and name '%s'%n", promotion.getId(),
promotion.getName());
promotions.add(promotion);
}
} else {
System.out.println("No promotions were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
return promotions;
}