Class AdSpotServiceClient (0.54.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   AdSpotName name = AdSpotName.of("[NETWORK_CODE]", "[AD_SPOT]");
   AdSpot response = adSpotServiceClient.getAdSpot(name);
 }
 

Note: close() needs to be called on the AdSpotServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetAdSpot

Retrieves an AdSpot object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getAdSpot(GetAdSpotRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getAdSpot(AdSpotName name)

  • getAdSpot(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getAdSpotCallable()

ListAdSpots

Lists AdSpot objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listAdSpots(ListAdSpotsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listAdSpots(NetworkName parent)

  • listAdSpots(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listAdSpotsPagedCallable()

  • listAdSpotsCallable()

CreateAdSpot

Creates an AdSpot object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createAdSpot(CreateAdSpotRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createAdSpot(NetworkName parent, AdSpot adSpot)

  • createAdSpot(String parent, AdSpot adSpot)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createAdSpotCallable()

BatchCreateAdSpots

Batch creates AdSpot objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchCreateAdSpots(NetworkName parent, List<CreateAdSpotRequest> requests)

  • batchCreateAdSpots(String parent, List<CreateAdSpotRequest> requests)

  • batchCreateAdSpots(BatchCreateAdSpotsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchCreateAdSpotsCallable()

UpdateAdSpot

Updates an AdSpot object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateAdSpot(UpdateAdSpotRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateAdSpot(AdSpot adSpot, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateAdSpotCallable()

BatchUpdateAdSpots

Batch updates AdSpot objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchUpdateAdSpots(NetworkName parent, List<UpdateAdSpotRequest> requests)

  • batchUpdateAdSpots(String parent, List<UpdateAdSpotRequest> requests)

  • batchUpdateAdSpots(BatchUpdateAdSpotsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchUpdateAdSpotsCallable()

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 AdSpotServiceSettings 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
 AdSpotServiceSettings adSpotServiceSettings =
     AdSpotServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create(adSpotServiceSettings);
 

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
 AdSpotServiceSettings adSpotServiceSettings =
     AdSpotServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create(adSpotServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > AdSpotServiceClient

Static Methods

create()

public static final AdSpotServiceClient create()

Constructs an instance of AdSpotServiceClient with default settings.

Returns
Type Description
AdSpotServiceClient
Exceptions
Type Description
IOException

create(AdSpotServiceSettings settings)

public static final AdSpotServiceClient create(AdSpotServiceSettings settings)

Constructs an instance of AdSpotServiceClient, 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 AdSpotServiceSettings
Returns
Type Description
AdSpotServiceClient
Exceptions
Type Description
IOException

create(AdSpotServiceStub stub)

public static final AdSpotServiceClient create(AdSpotServiceStub stub)

Constructs an instance of AdSpotServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AdSpotServiceSettings).

Parameter
Name Description
stub AdSpotServiceStub
Returns
Type Description
AdSpotServiceClient

Constructors

AdSpotServiceClient(AdSpotServiceSettings settings)

protected AdSpotServiceClient(AdSpotServiceSettings settings)

Constructs an instance of AdSpotServiceClient, 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 AdSpotServiceSettings

AdSpotServiceClient(AdSpotServiceStub stub)

protected AdSpotServiceClient(AdSpotServiceStub stub)
Parameter
Name Description
stub AdSpotServiceStub

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

batchCreateAdSpots(@Nullable NetworkName parent, List<CreateAdSpotRequest> requests)

public final BatchCreateAdSpotsResponse batchCreateAdSpots(@Nullable NetworkName parent, List<CreateAdSpotRequest> requests)

Batch creates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateAdSpotRequest> requests = new ArrayList<>();
   BatchCreateAdSpotsResponse response =
       adSpotServiceClient.batchCreateAdSpots(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where AdSpots will be created. Format: networks/{network_code} The parent field in the CreateAdSpotRequest must match this field.

requests List<CreateAdSpotRequest>

Required. The AdSpot objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateAdSpotsResponse

batchCreateAdSpots(BatchCreateAdSpotsRequest request)

public final BatchCreateAdSpotsResponse batchCreateAdSpots(BatchCreateAdSpotsRequest request)

Batch creates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   BatchCreateAdSpotsRequest request =
       BatchCreateAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateAdSpotRequest>())
           .build();
   BatchCreateAdSpotsResponse response = adSpotServiceClient.batchCreateAdSpots(request);
 }
 
Parameter
Name Description
request BatchCreateAdSpotsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchCreateAdSpotsResponse

batchCreateAdSpots(String parent, List<CreateAdSpotRequest> requests)

public final BatchCreateAdSpotsResponse batchCreateAdSpots(String parent, List<CreateAdSpotRequest> requests)

Batch creates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateAdSpotRequest> requests = new ArrayList<>();
   BatchCreateAdSpotsResponse response =
       adSpotServiceClient.batchCreateAdSpots(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where AdSpots will be created. Format: networks/{network_code} The parent field in the CreateAdSpotRequest must match this field.

requests List<CreateAdSpotRequest>

Required. The AdSpot objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateAdSpotsResponse

batchCreateAdSpotsCallable()

public final UnaryCallable<BatchCreateAdSpotsRequest,BatchCreateAdSpotsResponse> batchCreateAdSpotsCallable()

Batch creates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   BatchCreateAdSpotsRequest request =
       BatchCreateAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateAdSpotRequest>())
           .build();
   ApiFuture<BatchCreateAdSpotsResponse> future =
       adSpotServiceClient.batchCreateAdSpotsCallable().futureCall(request);
   // Do something.
   BatchCreateAdSpotsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateAdSpotsRequest,BatchCreateAdSpotsResponse>

batchUpdateAdSpots(@Nullable NetworkName parent, List<UpdateAdSpotRequest> requests)

public final BatchUpdateAdSpotsResponse batchUpdateAdSpots(@Nullable NetworkName parent, List<UpdateAdSpotRequest> requests)

Batch updates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateAdSpotRequest> requests = new ArrayList<>();
   BatchUpdateAdSpotsResponse response =
       adSpotServiceClient.batchUpdateAdSpots(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where AdSpots will be updated. Format: networks/{network_code} The parent field in the UpdateAdSpotRequest must match this field.

requests List<UpdateAdSpotRequest>

Required. The AdSpot objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateAdSpotsResponse

batchUpdateAdSpots(BatchUpdateAdSpotsRequest request)

public final BatchUpdateAdSpotsResponse batchUpdateAdSpots(BatchUpdateAdSpotsRequest request)

Batch updates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   BatchUpdateAdSpotsRequest request =
       BatchUpdateAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateAdSpotRequest>())
           .build();
   BatchUpdateAdSpotsResponse response = adSpotServiceClient.batchUpdateAdSpots(request);
 }
 
Parameter
Name Description
request BatchUpdateAdSpotsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchUpdateAdSpotsResponse

batchUpdateAdSpots(String parent, List<UpdateAdSpotRequest> requests)

public final BatchUpdateAdSpotsResponse batchUpdateAdSpots(String parent, List<UpdateAdSpotRequest> requests)

Batch updates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateAdSpotRequest> requests = new ArrayList<>();
   BatchUpdateAdSpotsResponse response =
       adSpotServiceClient.batchUpdateAdSpots(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where AdSpots will be updated. Format: networks/{network_code} The parent field in the UpdateAdSpotRequest must match this field.

requests List<UpdateAdSpotRequest>

Required. The AdSpot objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateAdSpotsResponse

batchUpdateAdSpotsCallable()

public final UnaryCallable<BatchUpdateAdSpotsRequest,BatchUpdateAdSpotsResponse> batchUpdateAdSpotsCallable()

Batch updates AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   BatchUpdateAdSpotsRequest request =
       BatchUpdateAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateAdSpotRequest>())
           .build();
   ApiFuture<BatchUpdateAdSpotsResponse> future =
       adSpotServiceClient.batchUpdateAdSpotsCallable().futureCall(request);
   // Do something.
   BatchUpdateAdSpotsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateAdSpotsRequest,BatchUpdateAdSpotsResponse>

close()

public final void close()

createAdSpot(@Nullable NetworkName parent, AdSpot adSpot)

public final AdSpot createAdSpot(@Nullable NetworkName parent, AdSpot adSpot)

Creates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   AdSpot adSpot = AdSpot.newBuilder().build();
   AdSpot response = adSpotServiceClient.createAdSpot(parent, adSpot);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where this AdSpot will be created. Format: networks/{network_code}

adSpot AdSpot

Required. The AdSpot to create.

Returns
Type Description
AdSpot

createAdSpot(CreateAdSpotRequest request)

public final AdSpot createAdSpot(CreateAdSpotRequest request)

Creates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   CreateAdSpotRequest request =
       CreateAdSpotRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setAdSpot(AdSpot.newBuilder().build())
           .build();
   AdSpot response = adSpotServiceClient.createAdSpot(request);
 }
 
Parameter
Name Description
request CreateAdSpotRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AdSpot

createAdSpot(String parent, AdSpot adSpot)

public final AdSpot createAdSpot(String parent, AdSpot adSpot)

Creates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   AdSpot adSpot = AdSpot.newBuilder().build();
   AdSpot response = adSpotServiceClient.createAdSpot(parent, adSpot);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where this AdSpot will be created. Format: networks/{network_code}

adSpot AdSpot

Required. The AdSpot to create.

Returns
Type Description
AdSpot

createAdSpotCallable()

public final UnaryCallable<CreateAdSpotRequest,AdSpot> createAdSpotCallable()

Creates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   CreateAdSpotRequest request =
       CreateAdSpotRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setAdSpot(AdSpot.newBuilder().build())
           .build();
   ApiFuture<AdSpot> future = adSpotServiceClient.createAdSpotCallable().futureCall(request);
   // Do something.
   AdSpot response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateAdSpotRequest,AdSpot>

getAdSpot(@Nullable AdSpotName name)

public final AdSpot getAdSpot(@Nullable AdSpotName name)

Retrieves an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   AdSpotName name = AdSpotName.of("[NETWORK_CODE]", "[AD_SPOT]");
   AdSpot response = adSpotServiceClient.getAdSpot(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdSpotName

Required. The resource name of the AdSpot. Format: networks/{network_code}/adSpots/{ad_spot_id}

Returns
Type Description
AdSpot

getAdSpot(GetAdSpotRequest request)

public final AdSpot getAdSpot(GetAdSpotRequest request)

Retrieves an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   GetAdSpotRequest request =
       GetAdSpotRequest.newBuilder()
           .setName(AdSpotName.of("[NETWORK_CODE]", "[AD_SPOT]").toString())
           .build();
   AdSpot response = adSpotServiceClient.getAdSpot(request);
 }
 
Parameter
Name Description
request GetAdSpotRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AdSpot

getAdSpot(String name)

public final AdSpot getAdSpot(String name)

Retrieves an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   String name = AdSpotName.of("[NETWORK_CODE]", "[AD_SPOT]").toString();
   AdSpot response = adSpotServiceClient.getAdSpot(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the AdSpot. Format: networks/{network_code}/adSpots/{ad_spot_id}

Returns
Type Description
AdSpot

getAdSpotCallable()

public final UnaryCallable<GetAdSpotRequest,AdSpot> getAdSpotCallable()

Retrieves an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   GetAdSpotRequest request =
       GetAdSpotRequest.newBuilder()
           .setName(AdSpotName.of("[NETWORK_CODE]", "[AD_SPOT]").toString())
           .build();
   ApiFuture<AdSpot> future = adSpotServiceClient.getAdSpotCallable().futureCall(request);
   // Do something.
   AdSpot response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetAdSpotRequest,AdSpot>

getSettings()

public final @Nullable AdSpotServiceSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdSpotServiceSettings

getStub()

public AdSpotServiceStub getStub()
Returns
Type Description
AdSpotServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listAdSpots(@Nullable NetworkName parent)

public final AdSpotServiceClient.ListAdSpotsPagedResponse listAdSpots(@Nullable NetworkName parent)

Lists AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (AdSpot element : adSpotServiceClient.listAdSpots(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent, which owns this collection of AdSpots. Format: networks/{network_code}

Returns
Type Description
AdSpotServiceClient.ListAdSpotsPagedResponse

listAdSpots(ListAdSpotsRequest request)

public final AdSpotServiceClient.ListAdSpotsPagedResponse listAdSpots(ListAdSpotsRequest request)

Lists AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   ListAdSpotsRequest request =
       ListAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (AdSpot element : adSpotServiceClient.listAdSpots(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListAdSpotsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AdSpotServiceClient.ListAdSpotsPagedResponse

listAdSpots(String parent)

public final AdSpotServiceClient.ListAdSpotsPagedResponse listAdSpots(String parent)

Lists AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (AdSpot element : adSpotServiceClient.listAdSpots(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent, which owns this collection of AdSpots. Format: networks/{network_code}

Returns
Type Description
AdSpotServiceClient.ListAdSpotsPagedResponse

listAdSpotsCallable()

public final UnaryCallable<ListAdSpotsRequest,ListAdSpotsResponse> listAdSpotsCallable()

Lists AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   ListAdSpotsRequest request =
       ListAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListAdSpotsResponse response = adSpotServiceClient.listAdSpotsCallable().call(request);
     for (AdSpot element : response.getAdSpotsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListAdSpotsRequest,ListAdSpotsResponse>

listAdSpotsPagedCallable()

public final UnaryCallable<ListAdSpotsRequest,AdSpotServiceClient.ListAdSpotsPagedResponse> listAdSpotsPagedCallable()

Lists AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   ListAdSpotsRequest request =
       ListAdSpotsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<AdSpot> future = adSpotServiceClient.listAdSpotsPagedCallable().futureCall(request);
   // Do something.
   for (AdSpot element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListAdSpotsRequest,ListAdSpotsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateAdSpot(AdSpot adSpot, FieldMask updateMask)

public final AdSpot updateAdSpot(AdSpot adSpot, FieldMask updateMask)

Updates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   AdSpot adSpot = AdSpot.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   AdSpot response = adSpotServiceClient.updateAdSpot(adSpot, updateMask);
 }
 
Parameters
Name Description
adSpot AdSpot

Required. The AdSpot to update.

The AdSpot's name is used to identify the AdSpot to update.

updateMask FieldMask

Optional. The list of fields to update.

Returns
Type Description
AdSpot

updateAdSpot(UpdateAdSpotRequest request)

public final AdSpot updateAdSpot(UpdateAdSpotRequest request)

Updates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   UpdateAdSpotRequest request =
       UpdateAdSpotRequest.newBuilder()
           .setAdSpot(AdSpot.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   AdSpot response = adSpotServiceClient.updateAdSpot(request);
 }
 
Parameter
Name Description
request UpdateAdSpotRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AdSpot

updateAdSpotCallable()

public final UnaryCallable<UpdateAdSpotRequest,AdSpot> updateAdSpotCallable()

Updates an AdSpot 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 (AdSpotServiceClient adSpotServiceClient = AdSpotServiceClient.create()) {
   UpdateAdSpotRequest request =
       UpdateAdSpotRequest.newBuilder()
           .setAdSpot(AdSpot.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<AdSpot> future = adSpotServiceClient.updateAdSpotCallable().futureCall(request);
   // Do something.
   AdSpot response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateAdSpotRequest,AdSpot>