Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ private static class ApplyIncentiveParams extends CodeSampleParams {
names = ArgumentNames.INCENTIVE_ID,
required = true,
description = "The ID of the incentive to apply.")
private String incentiveId;
private Long incentiveId;

@Parameter(
names = ArgumentNames.COUNTRY_CODE,
required = true,
description = "The country for the incentive to apply.")
private String countryCode = "US";
}
Expand All @@ -61,7 +62,7 @@ public static void main(String[] args) throws IOException {
// Either pass the required parameters for this example on the command line, or insert them
// into the code here. See the parameter class definition above for more information.
params.customerId = Long.parseLong("INSERT_CUSTOMER_ID_HERE");
params.incentiveId = "INSERT_INCENTIVE_ID_HERE";
params.incentiveId = Long.parseLong("INSERT_INCENTIVE_ID_HERE");
}

GoogleAdsClient googleAdsClient = null;
Expand Down Expand Up @@ -102,13 +103,14 @@ public static void main(String[] args) throws IOException {
* @param incentiveId the ID of the incentive to apply.
* @param countryCode the country of the incentive.
*/
private void runExample(GoogleAdsClient googleAdsClient, long customerId, String incentiveId,
private void runExample(GoogleAdsClient googleAdsClient, long customerId, long incentiveId,
String countryCode) {
try (IncentiveServiceClient incentiveServiceClient = googleAdsClient.getLatestVersion()
.createIncentiveServiceClient()) {
ApplyIncentiveRequest request = ApplyIncentiveRequest.newBuilder()
.setCustomerId(String.valueOf(customerId))
.setSelectedIncentiveId(Long.parseLong(incentiveId)).setCountryCode(countryCode).build();
.setSelectedIncentiveId(incentiveId)
.setCountryCode(countryCode).build();
// Issues the request.
ApplyIncentiveResponse response = incentiveServiceClient.applyIncentive(request);

Expand Down