use of com.google.api.ads.adwords.axis.v201809.cm.AdGroupBidModifierPage in project googleads-java-lib by googleads.
the class GetAdGroupBidModifier method runExample.
/**
* Runs the example.
*
* @param adWordsServices the services factory.
* @param session the session.
* @throws ApiException if the API request failed with one or more service errors.
* @throws RemoteException if the API request failed due to other errors.
*/
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the AdGroupBidModifierService.
AdGroupBidModifierServiceInterface adGroupBidModifierService = adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);
// Create selector.
Selector selector = new SelectorBuilder().fields(AdGroupBidModifierField.CampaignId, AdGroupBidModifierField.AdGroupId, AdGroupBidModifierField.BidModifier, AdGroupBidModifierField.Id).offset(0).limit(PAGE_SIZE).build();
AdGroupBidModifierPage page = adGroupBidModifierService.get(selector);
if (page.getEntries() != null) {
for (AdGroupBidModifier bidModifierResult : page.getEntries()) {
String bidModifierValue = bidModifierResult.getBidModifier() != null ? bidModifierResult.getBidModifier().toString() : "unset";
System.out.printf("Campaign ID %d, AdGroup ID %d, Criterion ID %d, " + "has ad group level modifier: %s%n", bidModifierResult.getCampaignId(), bidModifierResult.getAdGroupId(), bidModifierResult.getCriterion().getId(), bidModifierValue);
}
} else {
System.out.println("No ad group level bid modifiers were found.");
}
}
Aggregations