Class ThirdPartyCompanyServiceClient (0.54.0)

GitHub RepositoryProduct Reference

Service Description: Service to retrieve and list recognized third-party companies in Google Ad Manager.

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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   ThirdPartyCompanyName name =
       ThirdPartyCompanyName.of("[NETWORK_CODE]", "[THIRD_PARTY_COMPANY]");
   ThirdPartyCompany response = thirdPartyCompanyServiceClient.getThirdPartyCompany(name);
 }
 

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

GetThirdPartyCompany

Retrieves a ThirdPartyCompany object.

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

  • getThirdPartyCompany(GetThirdPartyCompanyRequest request)

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

  • getThirdPartyCompany(ThirdPartyCompanyName name)

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

  • getThirdPartyCompanyCallable()

ListThirdPartyCompanies

Lists ThirdPartyCompany objects.

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

  • listThirdPartyCompanies(ListThirdPartyCompaniesRequest request)

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

  • listThirdPartyCompanies(NetworkName parent)

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

  • listThirdPartyCompaniesPagedCallable()

  • listThirdPartyCompaniesCallable()

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 ThirdPartyCompanyServiceSettings 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
 ThirdPartyCompanyServiceSettings thirdPartyCompanyServiceSettings =
     ThirdPartyCompanyServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create(thirdPartyCompanyServiceSettings);
 

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
 ThirdPartyCompanyServiceSettings thirdPartyCompanyServiceSettings =
     ThirdPartyCompanyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create(thirdPartyCompanyServiceSettings);
 

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

Inheritance

java.lang.Object > ThirdPartyCompanyServiceClient

Static Methods

create()

public static final ThirdPartyCompanyServiceClient create()

Constructs an instance of ThirdPartyCompanyServiceClient with default settings.

Returns
Type Description
ThirdPartyCompanyServiceClient
Exceptions
Type Description
IOException

create(ThirdPartyCompanyServiceSettings settings)

public static final ThirdPartyCompanyServiceClient create(ThirdPartyCompanyServiceSettings settings)

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

create(ThirdPartyCompanyServiceStub stub)

public static final ThirdPartyCompanyServiceClient create(ThirdPartyCompanyServiceStub stub)

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

Parameter
Name Description
stub ThirdPartyCompanyServiceStub
Returns
Type Description
ThirdPartyCompanyServiceClient

Constructors

ThirdPartyCompanyServiceClient(ThirdPartyCompanyServiceSettings settings)

protected ThirdPartyCompanyServiceClient(ThirdPartyCompanyServiceSettings settings)

Constructs an instance of ThirdPartyCompanyServiceClient, 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 ThirdPartyCompanyServiceSettings

ThirdPartyCompanyServiceClient(ThirdPartyCompanyServiceStub stub)

protected ThirdPartyCompanyServiceClient(ThirdPartyCompanyServiceStub stub)
Parameter
Name Description
stub ThirdPartyCompanyServiceStub

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()

getSettings()

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

getStub()

public ThirdPartyCompanyServiceStub getStub()
Returns
Type Description
ThirdPartyCompanyServiceStub

getThirdPartyCompany(@Nullable ThirdPartyCompanyName name)

public final ThirdPartyCompany getThirdPartyCompany(@Nullable ThirdPartyCompanyName name)

Retrieves a ThirdPartyCompany 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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   ThirdPartyCompanyName name =
       ThirdPartyCompanyName.of("[NETWORK_CODE]", "[THIRD_PARTY_COMPANY]");
   ThirdPartyCompany response = thirdPartyCompanyServiceClient.getThirdPartyCompany(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.ThirdPartyCompanyName

Required. The resource name of the ThirdPartyCompany. Format: networks/{network_code}/thirdPartyCompanies/{third_party_company_id}

Returns
Type Description
ThirdPartyCompany

getThirdPartyCompany(GetThirdPartyCompanyRequest request)

public final ThirdPartyCompany getThirdPartyCompany(GetThirdPartyCompanyRequest request)

Retrieves a ThirdPartyCompany 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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   GetThirdPartyCompanyRequest request =
       GetThirdPartyCompanyRequest.newBuilder()
           .setName(
               ThirdPartyCompanyName.of("[NETWORK_CODE]", "[THIRD_PARTY_COMPANY]").toString())
           .build();
   ThirdPartyCompany response = thirdPartyCompanyServiceClient.getThirdPartyCompany(request);
 }
 
Parameter
Name Description
request GetThirdPartyCompanyRequest

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

Returns
Type Description
ThirdPartyCompany

getThirdPartyCompany(String name)

public final ThirdPartyCompany getThirdPartyCompany(String name)

Retrieves a ThirdPartyCompany 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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   String name = ThirdPartyCompanyName.of("[NETWORK_CODE]", "[THIRD_PARTY_COMPANY]").toString();
   ThirdPartyCompany response = thirdPartyCompanyServiceClient.getThirdPartyCompany(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the ThirdPartyCompany. Format: networks/{network_code}/thirdPartyCompanies/{third_party_company_id}

Returns
Type Description
ThirdPartyCompany

getThirdPartyCompanyCallable()

public final UnaryCallable<GetThirdPartyCompanyRequest,ThirdPartyCompany> getThirdPartyCompanyCallable()

Retrieves a ThirdPartyCompany 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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   GetThirdPartyCompanyRequest request =
       GetThirdPartyCompanyRequest.newBuilder()
           .setName(
               ThirdPartyCompanyName.of("[NETWORK_CODE]", "[THIRD_PARTY_COMPANY]").toString())
           .build();
   ApiFuture<ThirdPartyCompany> future =
       thirdPartyCompanyServiceClient.getThirdPartyCompanyCallable().futureCall(request);
   // Do something.
   ThirdPartyCompany response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetThirdPartyCompanyRequest,ThirdPartyCompany>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listThirdPartyCompanies(@Nullable NetworkName parent)

public final ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse listThirdPartyCompanies(@Nullable NetworkName parent)

Lists ThirdPartyCompany 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 (ThirdPartyCompanyServiceClient thirdPartyCompanyServiceClient =
     ThirdPartyCompanyServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (ThirdPartyCompany element :
       thirdPartyCompanyServiceClient.listThirdPartyCompanies(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 ThirdPartyCompanies. Format: networks/{network_code}

Returns
Type Description
ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse

listThirdPartyCompanies(ListThirdPartyCompaniesRequest request)

public final ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse listThirdPartyCompanies(ListThirdPartyCompaniesRequest request)

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

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

Returns
Type Description
ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse

listThirdPartyCompanies(String parent)

public final ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse listThirdPartyCompanies(String parent)

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

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

Returns
Type Description
ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse

listThirdPartyCompaniesCallable()

public final UnaryCallable<ListThirdPartyCompaniesRequest,ListThirdPartyCompaniesResponse> listThirdPartyCompaniesCallable()

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

listThirdPartyCompaniesPagedCallable()

public final UnaryCallable<ListThirdPartyCompaniesRequest,ThirdPartyCompanyServiceClient.ListThirdPartyCompaniesPagedResponse> listThirdPartyCompaniesPagedCallable()

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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()