Class AudienceSegmentCategoryServiceClient (0.62.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   AudienceSegmentCategoryName name =
       AudienceSegmentCategoryName.of("[NETWORK_CODE]", "[AUDIENCE_SEGMENT_CATEGORY]");
   AudienceSegmentCategory response =
       audienceSegmentCategoryServiceClient.getAudienceSegmentCategory(name);
 }
 

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

GetAudienceSegmentCategory

Retrieves a AudienceSegmentCategory object.

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

  • getAudienceSegmentCategory(GetAudienceSegmentCategoryRequest request)

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

  • getAudienceSegmentCategory(AudienceSegmentCategoryName name)

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

  • getAudienceSegmentCategoryCallable()

ListAudienceSegmentCategories

Lists AudienceSegmentCategory objects.

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

  • listAudienceSegmentCategories(ListAudienceSegmentCategoriesRequest request)

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

  • listAudienceSegmentCategories(NetworkName parent)

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

  • listAudienceSegmentCategoriesPagedCallable()

  • listAudienceSegmentCategoriesCallable()

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 AudienceSegmentCategoryServiceSettings 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
 AudienceSegmentCategoryServiceSettings audienceSegmentCategoryServiceSettings =
     AudienceSegmentCategoryServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create(audienceSegmentCategoryServiceSettings);
 

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
 AudienceSegmentCategoryServiceSettings audienceSegmentCategoryServiceSettings =
     AudienceSegmentCategoryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create(audienceSegmentCategoryServiceSettings);
 

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

Inheritance

java.lang.Object > AudienceSegmentCategoryServiceClient

Static Methods

create()

public static final AudienceSegmentCategoryServiceClient create()

Constructs an instance of AudienceSegmentCategoryServiceClient with default settings.

Returns
Type Description
AudienceSegmentCategoryServiceClient
Exceptions
Type Description
IOException

create(AudienceSegmentCategoryServiceSettings settings)

public static final AudienceSegmentCategoryServiceClient create(AudienceSegmentCategoryServiceSettings settings)

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

create(AudienceSegmentCategoryServiceStub stub)

public static final AudienceSegmentCategoryServiceClient create(AudienceSegmentCategoryServiceStub stub)

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

Parameter
Name Description
stub AudienceSegmentCategoryServiceStub
Returns
Type Description
AudienceSegmentCategoryServiceClient

Constructors

AudienceSegmentCategoryServiceClient(AudienceSegmentCategoryServiceSettings settings)

protected AudienceSegmentCategoryServiceClient(AudienceSegmentCategoryServiceSettings settings)

Constructs an instance of AudienceSegmentCategoryServiceClient, 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 AudienceSegmentCategoryServiceSettings

AudienceSegmentCategoryServiceClient(AudienceSegmentCategoryServiceStub stub)

protected AudienceSegmentCategoryServiceClient(AudienceSegmentCategoryServiceStub stub)
Parameter
Name Description
stub AudienceSegmentCategoryServiceStub

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

close()

public final void close()

getAudienceSegmentCategory(@Nullable AudienceSegmentCategoryName name)

public final AudienceSegmentCategory getAudienceSegmentCategory(@Nullable AudienceSegmentCategoryName name)

Retrieves a AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   AudienceSegmentCategoryName name =
       AudienceSegmentCategoryName.of("[NETWORK_CODE]", "[AUDIENCE_SEGMENT_CATEGORY]");
   AudienceSegmentCategory response =
       audienceSegmentCategoryServiceClient.getAudienceSegmentCategory(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AudienceSegmentCategoryName

Required. The resource name of the AudienceSegmentCategory. Format: networks/{network_code}/audienceSegmentCategories/{audience_segment_category_id}

Returns
Type Description
AudienceSegmentCategory

getAudienceSegmentCategory(GetAudienceSegmentCategoryRequest request)

public final AudienceSegmentCategory getAudienceSegmentCategory(GetAudienceSegmentCategoryRequest request)

Retrieves a AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   GetAudienceSegmentCategoryRequest request =
       GetAudienceSegmentCategoryRequest.newBuilder()
           .setName(
               AudienceSegmentCategoryName.of("[NETWORK_CODE]", "[AUDIENCE_SEGMENT_CATEGORY]")
                   .toString())
           .build();
   AudienceSegmentCategory response =
       audienceSegmentCategoryServiceClient.getAudienceSegmentCategory(request);
 }
 
Parameter
Name Description
request GetAudienceSegmentCategoryRequest

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

Returns
Type Description
AudienceSegmentCategory

getAudienceSegmentCategory(String name)

public final AudienceSegmentCategory getAudienceSegmentCategory(String name)

Retrieves a AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   String name =
       AudienceSegmentCategoryName.of("[NETWORK_CODE]", "[AUDIENCE_SEGMENT_CATEGORY]")
           .toString();
   AudienceSegmentCategory response =
       audienceSegmentCategoryServiceClient.getAudienceSegmentCategory(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the AudienceSegmentCategory. Format: networks/{network_code}/audienceSegmentCategories/{audience_segment_category_id}

Returns
Type Description
AudienceSegmentCategory

getAudienceSegmentCategoryCallable()

public final UnaryCallable<GetAudienceSegmentCategoryRequest,AudienceSegmentCategory> getAudienceSegmentCategoryCallable()

Retrieves a AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   GetAudienceSegmentCategoryRequest request =
       GetAudienceSegmentCategoryRequest.newBuilder()
           .setName(
               AudienceSegmentCategoryName.of("[NETWORK_CODE]", "[AUDIENCE_SEGMENT_CATEGORY]")
                   .toString())
           .build();
   ApiFuture<AudienceSegmentCategory> future =
       audienceSegmentCategoryServiceClient
           .getAudienceSegmentCategoryCallable()
           .futureCall(request);
   // Do something.
   AudienceSegmentCategory response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetAudienceSegmentCategoryRequest,AudienceSegmentCategory>

getSettings()

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

getStub()

public AudienceSegmentCategoryServiceStub getStub()
Returns
Type Description
AudienceSegmentCategoryServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listAudienceSegmentCategories(@Nullable NetworkName parent)

public final AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse listAudienceSegmentCategories(@Nullable NetworkName parent)

Lists AudienceSegmentCategory 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 (AudienceSegmentCategoryServiceClient audienceSegmentCategoryServiceClient =
     AudienceSegmentCategoryServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (AudienceSegmentCategory element :
       audienceSegmentCategoryServiceClient.listAudienceSegmentCategories(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 AudienceSegmentCategories. Format: networks/{network_code}

Returns
Type Description
AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse

listAudienceSegmentCategories(ListAudienceSegmentCategoriesRequest request)

public final AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse listAudienceSegmentCategories(ListAudienceSegmentCategoriesRequest request)

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

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

Returns
Type Description
AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse

listAudienceSegmentCategories(String parent)

public final AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse listAudienceSegmentCategories(String parent)

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

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

Returns
Type Description
AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse

listAudienceSegmentCategoriesCallable()

public final UnaryCallable<ListAudienceSegmentCategoriesRequest,ListAudienceSegmentCategoriesResponse> listAudienceSegmentCategoriesCallable()

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

listAudienceSegmentCategoriesPagedCallable()

public final UnaryCallable<ListAudienceSegmentCategoriesRequest,AudienceSegmentCategoryServiceClient.ListAudienceSegmentCategoriesPagedResponse> listAudienceSegmentCategoriesPagedCallable()

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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()