Class CreativeServiceClient (0.62.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   CreativeName name = CreativeName.of("[NETWORK_CODE]", "[CREATIVE]");
   Creative response = creativeServiceClient.getCreative(name);
 }
 

Note: close() needs to be called on the CreativeServiceClient 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

GetCreative

Retrieves a Creative object.

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

  • getCreative(GetCreativeRequest request)

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

  • getCreative(CreativeName name)

  • getCreative(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.

  • getCreativeCallable()

ListCreatives

Lists Creative objects.

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

  • listCreatives(ListCreativesRequest request)

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

  • listCreatives(NetworkName parent)

  • listCreatives(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.

  • listCreativesPagedCallable()

  • listCreativesCallable()

CreateCreative

Creates a Creative object.

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

  • createCreative(CreateCreativeRequest request)

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

  • createCreative(NetworkName parent, Creative creative)

  • createCreative(String parent, Creative creative)

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

  • createCreativeCallable()

UpdateCreative

Updates a Creative object.

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

  • updateCreative(UpdateCreativeRequest request)

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

  • updateCreative(Creative creative, 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.

  • updateCreativeCallable()

BatchCreateCreatives

Creates Creative objects.

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

  • batchCreateCreatives(NetworkName parent, List<CreateCreativeRequest> requests)

  • batchCreateCreatives(String parent, List<CreateCreativeRequest> requests)

  • batchCreateCreatives(BatchCreateCreativesRequest request)

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

  • batchCreateCreativesCallable()

BatchUpdateCreatives

Batch updates Creative objects.

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

  • batchUpdateCreatives(NetworkName parent, List<UpdateCreativeRequest> requests)

  • batchUpdateCreatives(String parent, List<UpdateCreativeRequest> requests)

  • batchUpdateCreatives(BatchUpdateCreativesRequest request)

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

  • batchUpdateCreativesCallable()

BatchActivateCreatives

Batch activates Creative objects.

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

  • batchActivateCreatives(BatchActivateCreativesRequest request)

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

  • batchActivateCreatives(NetworkName parent, List<String> names)

  • batchActivateCreatives(String parent, List<String> names)

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

  • batchActivateCreativesCallable()

BatchDeactivateCreatives

Deactivates a list of Creative objects.

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

  • batchDeactivateCreatives(BatchDeactivateCreativesRequest request)

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

  • batchDeactivateCreatives(NetworkName parent, List<String> names)

  • batchDeactivateCreatives(String parent, List<String> names)

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

  • batchDeactivateCreativesCallable()

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 CreativeServiceSettings 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
 CreativeServiceSettings creativeServiceSettings =
     CreativeServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CreativeServiceClient creativeServiceClient =
     CreativeServiceClient.create(creativeServiceSettings);
 

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
 CreativeServiceSettings creativeServiceSettings =
     CreativeServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 CreativeServiceClient creativeServiceClient =
     CreativeServiceClient.create(creativeServiceSettings);
 

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

Inheritance

java.lang.Object > CreativeServiceClient

Static Methods

create()

public static final CreativeServiceClient create()

Constructs an instance of CreativeServiceClient with default settings.

Returns
Type Description
CreativeServiceClient
Exceptions
Type Description
IOException

create(CreativeServiceSettings settings)

public static final CreativeServiceClient create(CreativeServiceSettings settings)

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

create(CreativeServiceStub stub)

public static final CreativeServiceClient create(CreativeServiceStub stub)

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

Parameter
Name Description
stub CreativeServiceStub
Returns
Type Description
CreativeServiceClient

Constructors

CreativeServiceClient(CreativeServiceSettings settings)

protected CreativeServiceClient(CreativeServiceSettings settings)

Constructs an instance of CreativeServiceClient, 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 CreativeServiceSettings

CreativeServiceClient(CreativeServiceStub stub)

protected CreativeServiceClient(CreativeServiceStub stub)
Parameter
Name Description
stub CreativeServiceStub

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

batchActivateCreatives(@Nullable NetworkName parent, List<String> names)

public final BatchActivateCreativesResponse batchActivateCreatives(@Nullable NetworkName parent, List<String> names)

Batch activates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchActivateCreativesResponse response =
       creativeServiceClient.batchActivateCreatives(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Creatives to activate. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
BatchActivateCreativesResponse

batchActivateCreatives(BatchActivateCreativesRequest request)

public final BatchActivateCreativesResponse batchActivateCreatives(BatchActivateCreativesRequest request)

Batch activates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchActivateCreativesRequest request =
       BatchActivateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchActivateCreativesResponse response =
       creativeServiceClient.batchActivateCreatives(request);
 }
 
Parameter
Name Description
request BatchActivateCreativesRequest

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

Returns
Type Description
BatchActivateCreativesResponse

batchActivateCreatives(String parent, List<String> names)

public final BatchActivateCreativesResponse batchActivateCreatives(String parent, List<String> names)

Batch activates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchActivateCreativesResponse response =
       creativeServiceClient.batchActivateCreatives(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Creatives to activate. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
BatchActivateCreativesResponse

batchActivateCreativesCallable()

public final UnaryCallable<BatchActivateCreativesRequest,BatchActivateCreativesResponse> batchActivateCreativesCallable()

Batch activates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchActivateCreativesRequest request =
       BatchActivateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchActivateCreativesResponse> future =
       creativeServiceClient.batchActivateCreativesCallable().futureCall(request);
   // Do something.
   BatchActivateCreativesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchActivateCreativesRequest,BatchActivateCreativesResponse>

batchCreateCreatives(@Nullable NetworkName parent, List<CreateCreativeRequest> requests)

public final BatchCreateCreativesResponse batchCreateCreatives(@Nullable NetworkName parent, List<CreateCreativeRequest> requests)

Creates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateCreativeRequest> requests = new ArrayList<>();
   BatchCreateCreativesResponse response =
       creativeServiceClient.batchCreateCreatives(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

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

requests List<CreateCreativeRequest>

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

Returns
Type Description
BatchCreateCreativesResponse

batchCreateCreatives(BatchCreateCreativesRequest request)

public final BatchCreateCreativesResponse batchCreateCreatives(BatchCreateCreativesRequest request)

Creates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchCreateCreativesRequest request =
       BatchCreateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateCreativeRequest>())
           .build();
   BatchCreateCreativesResponse response = creativeServiceClient.batchCreateCreatives(request);
 }
 
Parameter
Name Description
request BatchCreateCreativesRequest

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

Returns
Type Description
BatchCreateCreativesResponse

batchCreateCreatives(String parent, List<CreateCreativeRequest> requests)

public final BatchCreateCreativesResponse batchCreateCreatives(String parent, List<CreateCreativeRequest> requests)

Creates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateCreativeRequest> requests = new ArrayList<>();
   BatchCreateCreativesResponse response =
       creativeServiceClient.batchCreateCreatives(parent, requests);
 }
 
Parameters
Name Description
parent String

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

requests List<CreateCreativeRequest>

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

Returns
Type Description
BatchCreateCreativesResponse

batchCreateCreativesCallable()

public final UnaryCallable<BatchCreateCreativesRequest,BatchCreateCreativesResponse> batchCreateCreativesCallable()

Creates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchCreateCreativesRequest request =
       BatchCreateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateCreativeRequest>())
           .build();
   ApiFuture<BatchCreateCreativesResponse> future =
       creativeServiceClient.batchCreateCreativesCallable().futureCall(request);
   // Do something.
   BatchCreateCreativesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateCreativesRequest,BatchCreateCreativesResponse>

batchDeactivateCreatives(@Nullable NetworkName parent, List<String> names)

public final BatchDeactivateCreativesResponse batchDeactivateCreatives(@Nullable NetworkName parent, List<String> names)

Deactivates a list of Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchDeactivateCreativesResponse response =
       creativeServiceClient.batchDeactivateCreatives(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Creatives to deactivate. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
BatchDeactivateCreativesResponse

batchDeactivateCreatives(BatchDeactivateCreativesRequest request)

public final BatchDeactivateCreativesResponse batchDeactivateCreatives(BatchDeactivateCreativesRequest request)

Deactivates a list of Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchDeactivateCreativesRequest request =
       BatchDeactivateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchDeactivateCreativesResponse response =
       creativeServiceClient.batchDeactivateCreatives(request);
 }
 
Parameter
Name Description
request BatchDeactivateCreativesRequest

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

Returns
Type Description
BatchDeactivateCreativesResponse

batchDeactivateCreatives(String parent, List<String> names)

public final BatchDeactivateCreativesResponse batchDeactivateCreatives(String parent, List<String> names)

Deactivates a list of Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchDeactivateCreativesResponse response =
       creativeServiceClient.batchDeactivateCreatives(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Creatives to deactivate. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
BatchDeactivateCreativesResponse

batchDeactivateCreativesCallable()

public final UnaryCallable<BatchDeactivateCreativesRequest,BatchDeactivateCreativesResponse> batchDeactivateCreativesCallable()

Deactivates a list of Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchDeactivateCreativesRequest request =
       BatchDeactivateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchDeactivateCreativesResponse> future =
       creativeServiceClient.batchDeactivateCreativesCallable().futureCall(request);
   // Do something.
   BatchDeactivateCreativesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchDeactivateCreativesRequest,BatchDeactivateCreativesResponse>

batchUpdateCreatives(@Nullable NetworkName parent, List<UpdateCreativeRequest> requests)

public final BatchUpdateCreativesResponse batchUpdateCreatives(@Nullable NetworkName parent, List<UpdateCreativeRequest> requests)

Batch updates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateCreativeRequest> requests = new ArrayList<>();
   BatchUpdateCreativesResponse response =
       creativeServiceClient.batchUpdateCreatives(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

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

requests List<UpdateCreativeRequest>

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

Returns
Type Description
BatchUpdateCreativesResponse

batchUpdateCreatives(BatchUpdateCreativesRequest request)

public final BatchUpdateCreativesResponse batchUpdateCreatives(BatchUpdateCreativesRequest request)

Batch updates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchUpdateCreativesRequest request =
       BatchUpdateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateCreativeRequest>())
           .build();
   BatchUpdateCreativesResponse response = creativeServiceClient.batchUpdateCreatives(request);
 }
 
Parameter
Name Description
request BatchUpdateCreativesRequest

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

Returns
Type Description
BatchUpdateCreativesResponse

batchUpdateCreatives(String parent, List<UpdateCreativeRequest> requests)

public final BatchUpdateCreativesResponse batchUpdateCreatives(String parent, List<UpdateCreativeRequest> requests)

Batch updates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateCreativeRequest> requests = new ArrayList<>();
   BatchUpdateCreativesResponse response =
       creativeServiceClient.batchUpdateCreatives(parent, requests);
 }
 
Parameters
Name Description
parent String

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

requests List<UpdateCreativeRequest>

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

Returns
Type Description
BatchUpdateCreativesResponse

batchUpdateCreativesCallable()

public final UnaryCallable<BatchUpdateCreativesRequest,BatchUpdateCreativesResponse> batchUpdateCreativesCallable()

Batch updates Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   BatchUpdateCreativesRequest request =
       BatchUpdateCreativesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateCreativeRequest>())
           .build();
   ApiFuture<BatchUpdateCreativesResponse> future =
       creativeServiceClient.batchUpdateCreativesCallable().futureCall(request);
   // Do something.
   BatchUpdateCreativesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateCreativesRequest,BatchUpdateCreativesResponse>

close()

public final void close()

createCreative(@Nullable NetworkName parent, Creative creative)

public final Creative createCreative(@Nullable NetworkName parent, Creative creative)

Creates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   Creative creative = Creative.newBuilder().build();
   Creative response = creativeServiceClient.createCreative(parent, creative);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

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

creative Creative

Required. The Creative to create.

Returns
Type Description
Creative

createCreative(CreateCreativeRequest request)

public final Creative createCreative(CreateCreativeRequest request)

Creates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   CreateCreativeRequest request =
       CreateCreativeRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setCreative(Creative.newBuilder().build())
           .build();
   Creative response = creativeServiceClient.createCreative(request);
 }
 
Parameter
Name Description
request CreateCreativeRequest

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

Returns
Type Description
Creative

createCreative(String parent, Creative creative)

public final Creative createCreative(String parent, Creative creative)

Creates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   Creative creative = Creative.newBuilder().build();
   Creative response = creativeServiceClient.createCreative(parent, creative);
 }
 
Parameters
Name Description
parent String

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

creative Creative

Required. The Creative to create.

Returns
Type Description
Creative

createCreativeCallable()

public final UnaryCallable<CreateCreativeRequest,Creative> createCreativeCallable()

Creates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   CreateCreativeRequest request =
       CreateCreativeRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setCreative(Creative.newBuilder().build())
           .build();
   ApiFuture<Creative> future =
       creativeServiceClient.createCreativeCallable().futureCall(request);
   // Do something.
   Creative response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateCreativeRequest,Creative>

getCreative(@Nullable CreativeName name)

public final Creative getCreative(@Nullable CreativeName name)

Retrieves a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   CreativeName name = CreativeName.of("[NETWORK_CODE]", "[CREATIVE]");
   Creative response = creativeServiceClient.getCreative(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.CreativeName

Required. The resource name of the Creative. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
Creative

getCreative(GetCreativeRequest request)

public final Creative getCreative(GetCreativeRequest request)

Retrieves a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   GetCreativeRequest request =
       GetCreativeRequest.newBuilder()
           .setName(CreativeName.of("[NETWORK_CODE]", "[CREATIVE]").toString())
           .build();
   Creative response = creativeServiceClient.getCreative(request);
 }
 
Parameter
Name Description
request GetCreativeRequest

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

Returns
Type Description
Creative

getCreative(String name)

public final Creative getCreative(String name)

Retrieves a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   String name = CreativeName.of("[NETWORK_CODE]", "[CREATIVE]").toString();
   Creative response = creativeServiceClient.getCreative(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the Creative. Format: networks/{network_code}/creatives/{creative_id}

Returns
Type Description
Creative

getCreativeCallable()

public final UnaryCallable<GetCreativeRequest,Creative> getCreativeCallable()

Retrieves a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   GetCreativeRequest request =
       GetCreativeRequest.newBuilder()
           .setName(CreativeName.of("[NETWORK_CODE]", "[CREATIVE]").toString())
           .build();
   ApiFuture<Creative> future = creativeServiceClient.getCreativeCallable().futureCall(request);
   // Do something.
   Creative response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetCreativeRequest,Creative>

getSettings()

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

getStub()

public CreativeServiceStub getStub()
Returns
Type Description
CreativeServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listCreatives(@Nullable NetworkName parent)

public final CreativeServiceClient.ListCreativesPagedResponse listCreatives(@Nullable NetworkName parent)

Lists Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (Creative element : creativeServiceClient.listCreatives(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 Creatives. Format: networks/{network_code}

Returns
Type Description
CreativeServiceClient.ListCreativesPagedResponse

listCreatives(ListCreativesRequest request)

public final CreativeServiceClient.ListCreativesPagedResponse listCreatives(ListCreativesRequest request)

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

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

Returns
Type Description
CreativeServiceClient.ListCreativesPagedResponse

listCreatives(String parent)

public final CreativeServiceClient.ListCreativesPagedResponse listCreatives(String parent)

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

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

Returns
Type Description
CreativeServiceClient.ListCreativesPagedResponse

listCreativesCallable()

public final UnaryCallable<ListCreativesRequest,ListCreativesResponse> listCreativesCallable()

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

listCreativesPagedCallable()

public final UnaryCallable<ListCreativesRequest,CreativeServiceClient.ListCreativesPagedResponse> listCreativesPagedCallable()

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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateCreative(Creative creative, FieldMask updateMask)

public final Creative updateCreative(Creative creative, FieldMask updateMask)

Updates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   Creative creative = Creative.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Creative response = creativeServiceClient.updateCreative(creative, updateMask);
 }
 
Parameters
Name Description
creative Creative

Required. The Creative to update.

The Creative's name is used to identify the Creative to update. Format: networks/{network_code}/creatives/{creative_id}

updateMask FieldMask

Optional. The list of fields to update.

Returns
Type Description
Creative

updateCreative(UpdateCreativeRequest request)

public final Creative updateCreative(UpdateCreativeRequest request)

Updates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   UpdateCreativeRequest request =
       UpdateCreativeRequest.newBuilder()
           .setCreative(Creative.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Creative response = creativeServiceClient.updateCreative(request);
 }
 
Parameter
Name Description
request UpdateCreativeRequest

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

Returns
Type Description
Creative

updateCreativeCallable()

public final UnaryCallable<UpdateCreativeRequest,Creative> updateCreativeCallable()

Updates a Creative 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 (CreativeServiceClient creativeServiceClient = CreativeServiceClient.create()) {
   UpdateCreativeRequest request =
       UpdateCreativeRequest.newBuilder()
           .setCreative(Creative.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Creative> future =
       creativeServiceClient.updateCreativeCallable().futureCall(request);
   // Do something.
   Creative response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateCreativeRequest,Creative>