Skip to content

Commit d1a4f08

Browse files
Merge pull request #878 from googleads/smallIncentivesFixes
Fix type for IncentiveId
2 parents 9578020 + c102c29 commit d1a4f08

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

google-ads-examples/src/main/java/com/google/ads/googleads/examples/incentives/ApplyIncentive.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ private static class ApplyIncentiveParams extends CodeSampleParams {
4747
names = ArgumentNames.INCENTIVE_ID,
4848
required = true,
4949
description = "The ID of the incentive to apply.")
50-
private String incentiveId;
50+
private Long incentiveId;
5151

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

6768
GoogleAdsClient googleAdsClient = null;
@@ -102,13 +103,14 @@ public static void main(String[] args) throws IOException {
102103
* @param incentiveId the ID of the incentive to apply.
103104
* @param countryCode the country of the incentive.
104105
*/
105-
private void runExample(GoogleAdsClient googleAdsClient, long customerId, String incentiveId,
106+
private void runExample(GoogleAdsClient googleAdsClient, long customerId, long incentiveId,
106107
String countryCode) {
107108
try (IncentiveServiceClient incentiveServiceClient = googleAdsClient.getLatestVersion()
108109
.createIncentiveServiceClient()) {
109110
ApplyIncentiveRequest request = ApplyIncentiveRequest.newBuilder()
110111
.setCustomerId(String.valueOf(customerId))
111-
.setSelectedIncentiveId(Long.parseLong(incentiveId)).setCountryCode(countryCode).build();
112+
.setSelectedIncentiveId(incentiveId)
113+
.setCountryCode(countryCode).build();
112114
// Issues the request.
113115
ApplyIncentiveResponse response = incentiveServiceClient.applyIncentive(request);
114116

0 commit comments

Comments
 (0)