Skip to content

Commit 31faea5

Browse files
authored
Changes for release v24_2. (#890)
1 parent 9dc7ebd commit 31faea5

8,554 files changed

Lines changed: 230197 additions & 312672 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
43.1.0 - 2026-034-22
1+
43.2.0 - 2026-06-24
2+
-------------------
3+
- Add support for v24_2 of the Google Ads API.
4+
5+
43.1.0 - 2026-05-13
26
-------------------
37
- Add support for v24_1 of the Google Ads API.
48

5-
43.0.0 - 2026-034-22
9+
43.0.0 - 2026-04-22
610
-------------------
711
- Add support for v24 of the Google Ads API.
812
- Remove support for v20 of the Google Ads API.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ This project hosts the Java client library for the Google Ads API.
1818
<dependency>
1919
<groupId>com.google.api-ads</groupId>
2020
<artifactId>google-ads</artifactId>
21-
<version>43.1.0</version>
21+
<version>43.2.0</version>
2222
</dependency>
2323

2424
## Gradle dependency
2525

26-
implementation 'com.google.api-ads:google-ads:43.1.0'
26+
implementation 'com.google.api-ads:google-ads:43.2.0'
2727

2828
## Documentation
2929

google-ads-examples/src/main/java/com/google/ads/googleads/examples/accountmanagement/InviteUserWithAccessRole.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,24 @@ private void runExample(
110110
MutateCustomerUserAccessInvitationResponse response =
111111
client.mutateCustomerUserAccessInvitation(String.valueOf(customerId), operation);
112112

113-
// Prints some information about the result.
114-
System.out.printf(
115-
"Customer user access invitation was sent for customerId = "
116-
+ "%d to email address = '%s' and access role = '%s'. The invitation resource "
117-
+ "name is '%s'.%n",
118-
customerId, emailAddress, accessRole, response.getResult().getResourceName());
113+
if (response.getResult().getMultiPartyAuthReview().isEmpty()) {
114+
// A multi-party auth review was not triggered.
115+
System.out.printf(
116+
"Customer user access invitation was sent for customerId = "
117+
+ "%d to email address = '%s' and access role = '%s'. The invitation resource "
118+
+ "name is '%s'.%n",
119+
customerId, emailAddress, accessRole, response.getResult().getResourceName());
120+
} else {
121+
// A multi-party auth review was triggered. See
122+
// FetchAndApprovePendingMultiPartyAuthReviews.java for an example on how to fetch
123+
// and approve an MPA auth review.
124+
System.out.printf(
125+
"A multi-party auth review was triggered. The MPA review resource name is %s. "
126+
+ "Ask a second administrator to approve this request to send user access invitation. "
127+
+ "See FetchAndApprovePendingMultiPartyAuthReviews.java for an example on "
128+
+ "how to approve an MPA auth review using the API.%n",
129+
response.getResult().getMultiPartyAuthReview());
130+
}
119131
}
120132
// [END invite_user_with_access_role]
121133
}

google-ads-examples/src/main/java/com/google/ads/googleads/examples/accountmanagement/UpdateUserAccess.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,23 @@ private void modifyUserAccess(
196196
MutateCustomerUserAccessResponse response =
197197
userAccessServiceClient.mutateCustomerUserAccess(String.valueOf(customerId), operation);
198198

199-
// Prints the result.
200-
System.out.printf(
201-
"Successfully modified customer user access with resource name '%s' to access level"
202-
+ " '%s'.%n",
203-
response.getResult().getResourceName(), accessRole);
199+
if (response.getResult().getMultiPartyAuthReview().isEmpty()) {
200+
// A multi-party auth review was not triggered.
201+
System.out.printf(
202+
"Successfully modified customer user access with resource name '%s' to access level"
203+
+ " '%s'.%n",
204+
response.getResult().getResourceName(), accessRole);
205+
} else {
206+
// A multi-party auth review was triggered. See
207+
// FetchAndApprovePendingMultiPartyAuthReviews.java for an example on how to fetch
208+
// and approve an MPA auth review.
209+
System.out.printf(
210+
"A multi-party auth review was triggered. The MPA review resource name is %s. "
211+
+ "Ask a second administrator to approve this request make the requested user access "
212+
+ "changes. See FetchAndApprovePendingMultiPartyAuthReviews.java for an example "
213+
+ "on how to approve an MPA auth review using the API.%n",
214+
response.getResult().getMultiPartyAuthReview());
215+
}
204216
}
205217
}
206218
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.ads.googleads.examples.advancedoperations;
16+
17+
import com.beust.jcommander.Parameter;
18+
import com.google.ads.googleads.examples.utils.ArgumentNames;
19+
import com.google.ads.googleads.examples.utils.CodeSampleParams;
20+
import com.google.ads.googleads.lib.GoogleAdsClient;
21+
import com.google.ads.googleads.v24.enums.MultiPartyAuthOperationTypeEnum.MultiPartyAuthOperationType;
22+
import com.google.ads.googleads.v24.enums.MultiPartyAuthReviewStatusEnum.MultiPartyAuthReviewStatus;
23+
import com.google.ads.googleads.v24.enums.MultiPartyAuthReviewTargetResourceEnum.MultiPartyAuthReviewTargetResource;
24+
import com.google.ads.googleads.v24.errors.GoogleAdsError;
25+
import com.google.ads.googleads.v24.errors.GoogleAdsException;
26+
import com.google.ads.googleads.v24.errors.GoogleAdsFailure;
27+
import com.google.ads.googleads.v24.resources.CustomerUserAccessInvitation;
28+
import com.google.ads.googleads.v24.resources.CustomerUserAccessInvitationReview;
29+
import com.google.ads.googleads.v24.resources.CustomerUserAccessReview;
30+
import com.google.ads.googleads.v24.resources.MultiPartyAuthReview;
31+
import com.google.ads.googleads.v24.services.GoogleAdsRow;
32+
import com.google.ads.googleads.v24.services.GoogleAdsServiceClient;
33+
import com.google.ads.googleads.v24.services.GoogleAdsServiceClient.SearchPagedResponse;
34+
import com.google.ads.googleads.v24.services.MultiPartyAuthReviewServiceClient;
35+
import com.google.ads.googleads.v24.services.ResolveMultiPartyAuthReviewOperation;
36+
import com.google.ads.googleads.v24.services.ResolveMultiPartyAuthReviewResponse;
37+
import com.google.ads.googleads.v24.services.ResolveMultiPartyAuthReviewResultOrError;
38+
import com.google.ads.googleads.v24.utils.ErrorUtils;
39+
import java.io.FileNotFoundException;
40+
import java.io.IOException;
41+
import java.util.ArrayList;
42+
import java.util.Collections;
43+
import java.util.List;
44+
45+
/**
46+
* Fetches pending multi-party auth reviews for a customer account and approves them.
47+
*/
48+
public class FetchAndApprovePendingMultiPartyAuthReviews {
49+
50+
private static class FetchAndApprovePendingMultiPartyAuthReviewsParams extends CodeSampleParams {
51+
52+
@Parameter(names = ArgumentNames.CUSTOMER_ID, required = true)
53+
private Long customerId;
54+
}
55+
56+
public static void main(String[] args) {
57+
FetchAndApprovePendingMultiPartyAuthReviewsParams params =
58+
new FetchAndApprovePendingMultiPartyAuthReviewsParams();
59+
if (!params.parseArguments(args)) {
60+
params.customerId = Long.parseLong("INSERT_CUSTOMER_ID_HERE");
61+
}
62+
63+
GoogleAdsClient googleAdsClient = null;
64+
try {
65+
googleAdsClient = GoogleAdsClient.newBuilder().fromPropertiesFile().build();
66+
} catch (FileNotFoundException fnfe) {
67+
System.err.printf(
68+
"Failed to load GoogleAdsClient configuration from file. Exception: %s%n", fnfe);
69+
System.exit(1);
70+
} catch (IOException ioe) {
71+
System.err.printf("Failed to create GoogleAdsClient. Exception: %s%n", ioe);
72+
System.exit(1);
73+
}
74+
75+
try {
76+
new FetchAndApprovePendingMultiPartyAuthReviews().runExample(googleAdsClient, params.customerId);
77+
} catch (GoogleAdsException gae) {
78+
System.err.printf(
79+
"Request ID %s failed due to GoogleAdsException. Underlying errors:%n",
80+
gae.getRequestId());
81+
int i = 0;
82+
for (GoogleAdsError googleAdsError : gae.getGoogleAdsFailure().getErrorsList()) {
83+
System.err.printf(" Error %d: %s%n", i++, googleAdsError);
84+
}
85+
System.exit(1);
86+
}
87+
}
88+
89+
/**
90+
* Runs the example.
91+
*
92+
* @param client The Google Ads client.
93+
* @param customerId The Google Ads customer ID.
94+
*/
95+
private void runExample(GoogleAdsClient client, long customerId) {
96+
List<String> pendingReviews = fetchPendingMPAReviews(client, customerId);
97+
98+
if (!pendingReviews.isEmpty()) {
99+
// Multi party auth reviews can only be resolved one at a time. In this code
100+
// example, we illustrate approving the first pending review request.
101+
approveMPAReview(client, customerId, pendingReviews.get(0));
102+
}
103+
}
104+
105+
// [START approve_mpa_review]
106+
/**
107+
* Approves the MPA auth review.
108+
*
109+
* @param client The Google Ads client.
110+
* @param customerId The Google Ads customer ID.
111+
* @param pendingReview The pending multi-party auth review resource name to be approved.
112+
*/
113+
private void approveMPAReview(GoogleAdsClient client, long customerId, String pendingReview) {
114+
// Currently, you can only approve one request at a time. In addition, the approvals
115+
// can only be done by a second administrator.
116+
ResolveMultiPartyAuthReviewOperation operation =
117+
ResolveMultiPartyAuthReviewOperation.newBuilder()
118+
.setMultiPartyAuthReview(pendingReview)
119+
.setNewStatus(MultiPartyAuthReviewStatus.APPROVED)
120+
.build();
121+
122+
try (MultiPartyAuthReviewServiceClient mpaReviewService =
123+
client.getLatestVersion().createMultiPartyAuthReviewServiceClient()) {
124+
ResolveMultiPartyAuthReviewResponse response =
125+
mpaReviewService.resolveMultiPartyAuthReview(
126+
String.valueOf(customerId), Collections.singletonList(operation));
127+
128+
ResolveMultiPartyAuthReviewResultOrError resultOrError = response.getResultOrError(0);
129+
if (resultOrError.hasResult()) {
130+
System.out.printf(
131+
"Approved multi-party auth review: %s.%n",
132+
resultOrError.getResult().getMultiPartyAuthReview());
133+
if (resultOrError.getResult().hasCustomerUserAccessInvitation()) {
134+
System.out.printf(
135+
"New user invitation created: %s%n",
136+
resultOrError.getResult().getCustomerUserAccessInvitation());
137+
} else if (resultOrError.getResult().hasCustomerUserAccess()) {
138+
System.out.printf(
139+
"Affected customer user access resource: %s%n",
140+
resultOrError.getResult().getCustomerUserAccess());
141+
}
142+
} else if (resultOrError.hasPartialFailureError()) {
143+
GoogleAdsFailure failure =
144+
ErrorUtils.getInstance().getGoogleAdsFailure(resultOrError.getPartialFailureError());
145+
System.out.printf(
146+
"%d partial failure error(s) occurred%n",
147+
failure.getErrorsCount());
148+
}
149+
}
150+
}
151+
// [END approve_mpa_review]
152+
153+
// [START fetch_mpa_review]
154+
/**
155+
* Fetches the pending MPA reviews.
156+
*
157+
* @param client The Google Ads client.
158+
* @param customerId The Google Ads customer ID.
159+
* @return A list of resource names for the pending multi-party auth reviews.
160+
*/
161+
private List<String> fetchPendingMPAReviews(GoogleAdsClient client, long customerId) {
162+
List<String> pendingReviews = new ArrayList<>();
163+
164+
// Create a query that will retrieve all the pending MPA reviews.
165+
String query =
166+
"SELECT "
167+
+ "multi_party_auth_review.resource_name, "
168+
+ "multi_party_auth_review.review_id, "
169+
+ "multi_party_auth_review.creation_date_time, "
170+
+ "multi_party_auth_review.request_user_email, "
171+
+ "multi_party_auth_review.operation_type, "
172+
+ "multi_party_auth_review.justification, "
173+
+ "multi_party_auth_review.target_resource, "
174+
+ "multi_party_auth_review.customer_user_access_review.old_customer_user_access, "
175+
+ "multi_party_auth_review.customer_user_access_review.new_customer_user_access, "
176+
+ "multi_party_auth_review.customer_user_access_invitation_review.new_customer_user_access_invitation "
177+
+ "FROM multi_party_auth_review "
178+
+ "WHERE multi_party_auth_review.review_status = 'PENDING'";
179+
180+
try (GoogleAdsServiceClient googleAdsServiceClient =
181+
client.getLatestVersion().createGoogleAdsServiceClient()) {
182+
SearchPagedResponse response =
183+
googleAdsServiceClient.search(String.valueOf(customerId), query);
184+
185+
for (GoogleAdsRow googleAdsRow : response.iterateAll()) {
186+
MultiPartyAuthReview mpaReview = googleAdsRow.getMultiPartyAuthReview();
187+
System.out.printf(
188+
"%s created a pending multi-party auth review with ID %d "
189+
+ "at %s. This request is for target resource type = %s and operation type = "
190+
+ "%s. The justification is \"%s\".%n",
191+
mpaReview.getRequestUserEmail(),
192+
mpaReview.getMultiPartyAuthReviewId(),
193+
mpaReview.getCreationDateTime(),
194+
mpaReview.getTargetResource(),
195+
mpaReview.getOperationType(),
196+
mpaReview.getJustification());
197+
198+
if (mpaReview.getTargetResource() == MultiPartyAuthReviewTargetResource.CUSTOMER_USER_ACCESS) {
199+
CustomerUserAccessReview accessReview = mpaReview.getCustomerUserAccessReview();
200+
if (mpaReview.getOperationType() == MultiPartyAuthOperationType.UPDATE) {
201+
// When updating a customer user access, only the new access level is populated.
202+
System.out.printf(
203+
"Old resource name: %s, new access role: %s.%n",
204+
accessReview.getOldCustomerUserAccess(),
205+
accessReview.getNewCustomerUserAccess().getAccessRole());
206+
} else if (mpaReview.getOperationType() == MultiPartyAuthOperationType.REMOVE) {
207+
System.out.printf(
208+
"Old resource name: %s.%n", accessReview.getOldCustomerUserAccess());
209+
}
210+
} else if (mpaReview.getTargetResource()
211+
== MultiPartyAuthReviewTargetResource.CUSTOMER_USER_ACCESS_INVITATION) {
212+
CustomerUserAccessInvitation newInvite =
213+
mpaReview.getCustomerUserAccessInvitationReview().getNewCustomerUserAccessInvitation();
214+
System.out.printf(
215+
"Invitation email address: %s, Role: %s.%n",
216+
newInvite.getEmailAddress(), newInvite.getAccessRole());
217+
}
218+
219+
pendingReviews.add(mpaReview.getResourceName());
220+
}
221+
}
222+
return pendingReviews;
223+
}
224+
// [END fetch_mpa_review]
225+
}

0 commit comments

Comments
 (0)