| GitHub Repository | Product Reference |
Service Description: Provides methods for handling AdUnit objects.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
AdUnitName name = AdUnitName.of("[NETWORK_CODE]", "[AD_UNIT]");
AdUnit response = adUnitServiceClient.getAdUnit(name);
}
Note: close() needs to be called on the AdUnitServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetAdUnit |
Retrieves an |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAdUnits |
Lists |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAdUnitSizes |
Lists |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAdUnit |
Creates an |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateAdUnit |
Updates an |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchCreateAdUnits |
Creates |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchUpdateAdUnits |
Batch updates |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchActivateAdUnits |
Batch activates |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchDeactivateAdUnits |
Deactivates a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchArchiveAdUnits |
Archives a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of AdUnitServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AdUnitServiceSettings adUnitServiceSettings =
AdUnitServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create(adUnitServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AdUnitServiceSettings adUnitServiceSettings =
AdUnitServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create(adUnitServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final AdUnitServiceClient create()Constructs an instance of AdUnitServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AdUnitServiceSettings settings)
public static final AdUnitServiceClient create(AdUnitServiceSettings settings)Constructs an instance of AdUnitServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
AdUnitServiceSettings |
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AdUnitServiceStub stub)
public static final AdUnitServiceClient create(AdUnitServiceStub stub)Constructs an instance of AdUnitServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AdUnitServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
AdUnitServiceStub |
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient |
|
Constructors
AdUnitServiceClient(AdUnitServiceSettings settings)
protected AdUnitServiceClient(AdUnitServiceSettings settings)Constructs an instance of AdUnitServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
AdUnitServiceSettings |
AdUnitServiceClient(AdUnitServiceStub stub)
protected AdUnitServiceClient(AdUnitServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
AdUnitServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
batchActivateAdUnits(@Nullable NetworkName parent, List<String> names)
public final BatchActivateAdUnitsResponse batchActivateAdUnits(@Nullable NetworkName parent, List<String> names)Batch activates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchActivateAdUnitsResponse response =
adUnitServiceClient.batchActivateAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdUnitsResponse |
|
batchActivateAdUnits(BatchActivateAdUnitsRequest request)
public final BatchActivateAdUnitsResponse batchActivateAdUnits(BatchActivateAdUnitsRequest request)Batch activates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchActivateAdUnitsRequest request =
BatchActivateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchActivateAdUnitsResponse response = adUnitServiceClient.batchActivateAdUnits(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchActivateAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdUnitsResponse |
|
batchActivateAdUnits(String parent, List<String> names)
public final BatchActivateAdUnitsResponse batchActivateAdUnits(String parent, List<String> names)Batch activates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchActivateAdUnitsResponse response =
adUnitServiceClient.batchActivateAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdUnitsResponse |
|
batchActivateAdUnitsCallable()
public final UnaryCallable<BatchActivateAdUnitsRequest,BatchActivateAdUnitsResponse> batchActivateAdUnitsCallable()Batch activates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchActivateAdUnitsRequest request =
BatchActivateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchActivateAdUnitsResponse> future =
adUnitServiceClient.batchActivateAdUnitsCallable().futureCall(request);
// Do something.
BatchActivateAdUnitsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchActivateAdUnitsRequest,BatchActivateAdUnitsResponse> |
|
batchArchiveAdUnits(@Nullable NetworkName parent, List<String> names)
public final BatchArchiveAdUnitsResponse batchArchiveAdUnits(@Nullable NetworkName parent, List<String> names)Archives a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchArchiveAdUnitsResponse response = adUnitServiceClient.batchArchiveAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchArchiveAdUnitsResponse |
|
batchArchiveAdUnits(BatchArchiveAdUnitsRequest request)
public final BatchArchiveAdUnitsResponse batchArchiveAdUnits(BatchArchiveAdUnitsRequest request)Archives a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchArchiveAdUnitsRequest request =
BatchArchiveAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchArchiveAdUnitsResponse response = adUnitServiceClient.batchArchiveAdUnits(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchArchiveAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchArchiveAdUnitsResponse |
|
batchArchiveAdUnits(String parent, List<String> names)
public final BatchArchiveAdUnitsResponse batchArchiveAdUnits(String parent, List<String> names)Archives a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchArchiveAdUnitsResponse response = adUnitServiceClient.batchArchiveAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchArchiveAdUnitsResponse |
|
batchArchiveAdUnitsCallable()
public final UnaryCallable<BatchArchiveAdUnitsRequest,BatchArchiveAdUnitsResponse> batchArchiveAdUnitsCallable()Archives a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchArchiveAdUnitsRequest request =
BatchArchiveAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchArchiveAdUnitsResponse> future =
adUnitServiceClient.batchArchiveAdUnitsCallable().futureCall(request);
// Do something.
BatchArchiveAdUnitsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchArchiveAdUnitsRequest,BatchArchiveAdUnitsResponse> |
|
batchCreateAdUnits(@Nullable NetworkName parent, List<CreateAdUnitRequest> requests)
public final BatchCreateAdUnitsResponse batchCreateAdUnits(@Nullable NetworkName parent, List<CreateAdUnitRequest> requests)Creates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<CreateAdUnitRequest> requests = new ArrayList<>();
BatchCreateAdUnitsResponse response =
adUnitServiceClient.batchCreateAdUnits(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<CreateAdUnitRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdUnitsResponse |
|
batchCreateAdUnits(BatchCreateAdUnitsRequest request)
public final BatchCreateAdUnitsResponse batchCreateAdUnits(BatchCreateAdUnitsRequest request)Creates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchCreateAdUnitsRequest request =
BatchCreateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateAdUnitRequest>())
.build();
BatchCreateAdUnitsResponse response = adUnitServiceClient.batchCreateAdUnits(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchCreateAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdUnitsResponse |
|
batchCreateAdUnits(String parent, List<CreateAdUnitRequest> requests)
public final BatchCreateAdUnitsResponse batchCreateAdUnits(String parent, List<CreateAdUnitRequest> requests)Creates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<CreateAdUnitRequest> requests = new ArrayList<>();
BatchCreateAdUnitsResponse response =
adUnitServiceClient.batchCreateAdUnits(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<CreateAdUnitRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdUnitsResponse |
|
batchCreateAdUnitsCallable()
public final UnaryCallable<BatchCreateAdUnitsRequest,BatchCreateAdUnitsResponse> batchCreateAdUnitsCallable()Creates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchCreateAdUnitsRequest request =
BatchCreateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateAdUnitRequest>())
.build();
ApiFuture<BatchCreateAdUnitsResponse> future =
adUnitServiceClient.batchCreateAdUnitsCallable().futureCall(request);
// Do something.
BatchCreateAdUnitsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchCreateAdUnitsRequest,BatchCreateAdUnitsResponse> |
|
batchDeactivateAdUnits(@Nullable NetworkName parent, List<String> names)
public final BatchDeactivateAdUnitsResponse batchDeactivateAdUnits(@Nullable NetworkName parent, List<String> names)Deactivates a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchDeactivateAdUnitsResponse response =
adUnitServiceClient.batchDeactivateAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdUnitsResponse |
|
batchDeactivateAdUnits(BatchDeactivateAdUnitsRequest request)
public final BatchDeactivateAdUnitsResponse batchDeactivateAdUnits(BatchDeactivateAdUnitsRequest request)Deactivates a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchDeactivateAdUnitsRequest request =
BatchDeactivateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchDeactivateAdUnitsResponse response = adUnitServiceClient.batchDeactivateAdUnits(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchDeactivateAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdUnitsResponse |
|
batchDeactivateAdUnits(String parent, List<String> names)
public final BatchDeactivateAdUnitsResponse batchDeactivateAdUnits(String parent, List<String> names)Deactivates a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchDeactivateAdUnitsResponse response =
adUnitServiceClient.batchDeactivateAdUnits(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The resource names of the |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdUnitsResponse |
|
batchDeactivateAdUnitsCallable()
public final UnaryCallable<BatchDeactivateAdUnitsRequest,BatchDeactivateAdUnitsResponse> batchDeactivateAdUnitsCallable()Deactivates a list of AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchDeactivateAdUnitsRequest request =
BatchDeactivateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchDeactivateAdUnitsResponse> future =
adUnitServiceClient.batchDeactivateAdUnitsCallable().futureCall(request);
// Do something.
BatchDeactivateAdUnitsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchDeactivateAdUnitsRequest,BatchDeactivateAdUnitsResponse> |
|
batchUpdateAdUnits(@Nullable NetworkName parent, List<UpdateAdUnitRequest> requests)
public final BatchUpdateAdUnitsResponse batchUpdateAdUnits(@Nullable NetworkName parent, List<UpdateAdUnitRequest> requests)Batch updates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<UpdateAdUnitRequest> requests = new ArrayList<>();
BatchUpdateAdUnitsResponse response =
adUnitServiceClient.batchUpdateAdUnits(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<UpdateAdUnitRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdUnitsResponse |
|
batchUpdateAdUnits(BatchUpdateAdUnitsRequest request)
public final BatchUpdateAdUnitsResponse batchUpdateAdUnits(BatchUpdateAdUnitsRequest request)Batch updates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchUpdateAdUnitsRequest request =
BatchUpdateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateAdUnitRequest>())
.build();
BatchUpdateAdUnitsResponse response = adUnitServiceClient.batchUpdateAdUnits(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchUpdateAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdUnitsResponse |
|
batchUpdateAdUnits(String parent, List<UpdateAdUnitRequest> requests)
public final BatchUpdateAdUnitsResponse batchUpdateAdUnits(String parent, List<UpdateAdUnitRequest> requests)Batch updates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<UpdateAdUnitRequest> requests = new ArrayList<>();
BatchUpdateAdUnitsResponse response =
adUnitServiceClient.batchUpdateAdUnits(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<UpdateAdUnitRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdUnitsResponse |
|
batchUpdateAdUnitsCallable()
public final UnaryCallable<BatchUpdateAdUnitsRequest,BatchUpdateAdUnitsResponse> batchUpdateAdUnitsCallable()Batch updates AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
BatchUpdateAdUnitsRequest request =
BatchUpdateAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateAdUnitRequest>())
.build();
ApiFuture<BatchUpdateAdUnitsResponse> future =
adUnitServiceClient.batchUpdateAdUnitsCallable().futureCall(request);
// Do something.
BatchUpdateAdUnitsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchUpdateAdUnitsRequest,BatchUpdateAdUnitsResponse> |
|
close()
public final void close()createAdUnit(@Nullable NetworkName parent, AdUnit adUnit)
public final AdUnit createAdUnit(@Nullable NetworkName parent, AdUnit adUnit)Creates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
AdUnit adUnit = AdUnit.newBuilder().build();
AdUnit response = adUnitServiceClient.createAdUnit(parent, adUnit);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where this |
adUnit |
AdUnitRequired. The |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
createAdUnit(CreateAdUnitRequest request)
public final AdUnit createAdUnit(CreateAdUnitRequest request)Creates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
CreateAdUnitRequest request =
CreateAdUnitRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setAdUnit(AdUnit.newBuilder().build())
.build();
AdUnit response = adUnitServiceClient.createAdUnit(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateAdUnitRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
createAdUnit(String parent, AdUnit adUnit)
public final AdUnit createAdUnit(String parent, AdUnit adUnit)Creates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
AdUnit adUnit = AdUnit.newBuilder().build();
AdUnit response = adUnitServiceClient.createAdUnit(parent, adUnit);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this |
adUnit |
AdUnitRequired. The |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
createAdUnitCallable()
public final UnaryCallable<CreateAdUnitRequest,AdUnit> createAdUnitCallable()Creates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
CreateAdUnitRequest request =
CreateAdUnitRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setAdUnit(AdUnit.newBuilder().build())
.build();
ApiFuture<AdUnit> future = adUnitServiceClient.createAdUnitCallable().futureCall(request);
// Do something.
AdUnit response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateAdUnitRequest,AdUnit> |
|
getAdUnit(@Nullable AdUnitName name)
public final AdUnit getAdUnit(@Nullable AdUnitName name)Retrieves an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
AdUnitName name = AdUnitName.of("[NETWORK_CODE]", "[AD_UNIT]");
AdUnit response = adUnitServiceClient.getAdUnit(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdUnitNameRequired. The resource name of the AdUnit. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
getAdUnit(GetAdUnitRequest request)
public final AdUnit getAdUnit(GetAdUnitRequest request)Retrieves an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
GetAdUnitRequest request =
GetAdUnitRequest.newBuilder()
.setName(AdUnitName.of("[NETWORK_CODE]", "[AD_UNIT]").toString())
.build();
AdUnit response = adUnitServiceClient.getAdUnit(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetAdUnitRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
getAdUnit(String name)
public final AdUnit getAdUnit(String name)Retrieves an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String name = AdUnitName.of("[NETWORK_CODE]", "[AD_UNIT]").toString();
AdUnit response = adUnitServiceClient.getAdUnit(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the AdUnit. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
getAdUnitCallable()
public final UnaryCallable<GetAdUnitRequest,AdUnit> getAdUnitCallable()Retrieves an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
GetAdUnitRequest request =
GetAdUnitRequest.newBuilder()
.setName(AdUnitName.of("[NETWORK_CODE]", "[AD_UNIT]").toString())
.build();
ApiFuture<AdUnit> future = adUnitServiceClient.getAdUnitCallable().futureCall(request);
// Do something.
AdUnit response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetAdUnitRequest,AdUnit> |
|
getSettings()
public final @Nullable AdUnitServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdUnitServiceSettings |
|
getStub()
public AdUnitServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
AdUnitServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listAdUnitSizes(@Nullable NetworkName parent)
public final AdUnitServiceClient.ListAdUnitSizesPagedResponse listAdUnitSizes(@Nullable NetworkName parent)Lists AdUnitSize objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (AdUnitSize element : adUnitServiceClient.listAdUnitSizes(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent, which owns this collection of AdUnitSizes. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitSizesPagedResponse |
|
listAdUnitSizes(ListAdUnitSizesRequest request)
public final AdUnitServiceClient.ListAdUnitSizesPagedResponse listAdUnitSizes(ListAdUnitSizesRequest request)Lists AdUnitSize objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitSizesRequest request =
ListAdUnitSizesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (AdUnitSize element : adUnitServiceClient.listAdUnitSizes(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdUnitSizesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitSizesPagedResponse |
|
listAdUnitSizes(String parent)
public final AdUnitServiceClient.ListAdUnitSizesPagedResponse listAdUnitSizes(String parent)Lists AdUnitSize objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (AdUnitSize element : adUnitServiceClient.listAdUnitSizes(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of AdUnitSizes. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitSizesPagedResponse |
|
listAdUnitSizesCallable()
public final UnaryCallable<ListAdUnitSizesRequest,ListAdUnitSizesResponse> listAdUnitSizesCallable()Lists AdUnitSize objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitSizesRequest request =
ListAdUnitSizesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListAdUnitSizesResponse response =
adUnitServiceClient.listAdUnitSizesCallable().call(request);
for (AdUnitSize element : response.getAdUnitSizesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdUnitSizesRequest,ListAdUnitSizesResponse> |
|
listAdUnitSizesPagedCallable()
public final UnaryCallable<ListAdUnitSizesRequest,AdUnitServiceClient.ListAdUnitSizesPagedResponse> listAdUnitSizesPagedCallable()Lists AdUnitSize objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitSizesRequest request =
ListAdUnitSizesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<AdUnitSize> future =
adUnitServiceClient.listAdUnitSizesPagedCallable().futureCall(request);
// Do something.
for (AdUnitSize element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdUnitSizesRequest,ListAdUnitSizesPagedResponse> |
|
listAdUnits(@Nullable NetworkName parent)
public final AdUnitServiceClient.ListAdUnitsPagedResponse listAdUnits(@Nullable NetworkName parent)Lists AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (AdUnit element : adUnitServiceClient.listAdUnits(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent, which owns this collection of AdUnits. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitsPagedResponse |
|
listAdUnits(ListAdUnitsRequest request)
public final AdUnitServiceClient.ListAdUnitsPagedResponse listAdUnits(ListAdUnitsRequest request)Lists AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitsRequest request =
ListAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (AdUnit element : adUnitServiceClient.listAdUnits(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdUnitsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitsPagedResponse |
|
listAdUnits(String parent)
public final AdUnitServiceClient.ListAdUnitsPagedResponse listAdUnits(String parent)Lists AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (AdUnit element : adUnitServiceClient.listAdUnits(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of AdUnits. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdUnitServiceClient.ListAdUnitsPagedResponse |
|
listAdUnitsCallable()
public final UnaryCallable<ListAdUnitsRequest,ListAdUnitsResponse> listAdUnitsCallable()Lists AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitsRequest request =
ListAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListAdUnitsResponse response = adUnitServiceClient.listAdUnitsCallable().call(request);
for (AdUnit element : response.getAdUnitsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdUnitsRequest,ListAdUnitsResponse> |
|
listAdUnitsPagedCallable()
public final UnaryCallable<ListAdUnitsRequest,AdUnitServiceClient.ListAdUnitsPagedResponse> listAdUnitsPagedCallable()Lists AdUnit objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
ListAdUnitsRequest request =
ListAdUnitsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<AdUnit> future = adUnitServiceClient.listAdUnitsPagedCallable().futureCall(request);
// Do something.
for (AdUnit element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdUnitsRequest,ListAdUnitsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateAdUnit(AdUnit adUnit, FieldMask updateMask)
public final AdUnit updateAdUnit(AdUnit adUnit, FieldMask updateMask)Updates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
AdUnit adUnit = AdUnit.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
AdUnit response = adUnitServiceClient.updateAdUnit(adUnit, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
adUnit |
AdUnitRequired. The The |
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
updateAdUnit(UpdateAdUnitRequest request)
public final AdUnit updateAdUnit(UpdateAdUnitRequest request)Updates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
UpdateAdUnitRequest request =
UpdateAdUnitRequest.newBuilder()
.setAdUnit(AdUnit.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
AdUnit response = adUnitServiceClient.updateAdUnit(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateAdUnitRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdUnit |
|
updateAdUnitCallable()
public final UnaryCallable<UpdateAdUnitRequest,AdUnit> updateAdUnitCallable()Updates an AdUnit object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.create()) {
UpdateAdUnitRequest request =
UpdateAdUnitRequest.newBuilder()
.setAdUnit(AdUnit.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<AdUnit> future = adUnitServiceClient.updateAdUnitCallable().futureCall(request);
// Do something.
AdUnit response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateAdUnitRequest,AdUnit> |
|