Class YieldPartnerServiceClient (0.62.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for retrieving yield partners.

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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   YieldPartnerName name = YieldPartnerName.of("[NETWORK_CODE]", "[YIELD_PARTNER]");
   YieldPartner response = yieldPartnerServiceClient.getYieldPartner(name);
 }
 

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

GetYieldPartner

Gets a YieldPartner object.

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

  • getYieldPartner(GetYieldPartnerRequest request)

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

  • getYieldPartner(YieldPartnerName name)

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

  • getYieldPartnerCallable()

ListYieldPartners

Gets a list of all yield partners.

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

  • listYieldPartners(ListYieldPartnersRequest request)

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

  • listYieldPartners(NetworkName parent)

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

  • listYieldPartnersPagedCallable()

  • listYieldPartnersCallable()

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 YieldPartnerServiceSettings 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
 YieldPartnerServiceSettings yieldPartnerServiceSettings =
     YieldPartnerServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 YieldPartnerServiceClient yieldPartnerServiceClient =
     YieldPartnerServiceClient.create(yieldPartnerServiceSettings);
 

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
 YieldPartnerServiceSettings yieldPartnerServiceSettings =
     YieldPartnerServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 YieldPartnerServiceClient yieldPartnerServiceClient =
     YieldPartnerServiceClient.create(yieldPartnerServiceSettings);
 

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

Inheritance

java.lang.Object > YieldPartnerServiceClient

Static Methods

create()

public static final YieldPartnerServiceClient create()

Constructs an instance of YieldPartnerServiceClient with default settings.

Returns
Type Description
YieldPartnerServiceClient
Exceptions
Type Description
IOException

create(YieldPartnerServiceSettings settings)

public static final YieldPartnerServiceClient create(YieldPartnerServiceSettings settings)

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

create(YieldPartnerServiceStub stub)

public static final YieldPartnerServiceClient create(YieldPartnerServiceStub stub)

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

Parameter
Name Description
stub YieldPartnerServiceStub
Returns
Type Description
YieldPartnerServiceClient

Constructors

YieldPartnerServiceClient(YieldPartnerServiceSettings settings)

protected YieldPartnerServiceClient(YieldPartnerServiceSettings settings)

Constructs an instance of YieldPartnerServiceClient, 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 YieldPartnerServiceSettings

YieldPartnerServiceClient(YieldPartnerServiceStub stub)

protected YieldPartnerServiceClient(YieldPartnerServiceStub stub)
Parameter
Name Description
stub YieldPartnerServiceStub

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 YieldPartnerServiceSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.YieldPartnerServiceSettings

getStub()

public YieldPartnerServiceStub getStub()
Returns
Type Description
YieldPartnerServiceStub

getYieldPartner(@Nullable YieldPartnerName name)

public final YieldPartner getYieldPartner(@Nullable YieldPartnerName name)

Gets a YieldPartner 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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   YieldPartnerName name = YieldPartnerName.of("[NETWORK_CODE]", "[YIELD_PARTNER]");
   YieldPartner response = yieldPartnerServiceClient.getYieldPartner(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.YieldPartnerName

Required. The resource name of the yield partner. Format: networks/{network_code}/yieldPartners/{yieldPartnerId}

Returns
Type Description
YieldPartner

getYieldPartner(GetYieldPartnerRequest request)

public final YieldPartner getYieldPartner(GetYieldPartnerRequest request)

Gets a YieldPartner 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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   GetYieldPartnerRequest request =
       GetYieldPartnerRequest.newBuilder()
           .setName(YieldPartnerName.of("[NETWORK_CODE]", "[YIELD_PARTNER]").toString())
           .build();
   YieldPartner response = yieldPartnerServiceClient.getYieldPartner(request);
 }
 
Parameter
Name Description
request GetYieldPartnerRequest

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

Returns
Type Description
YieldPartner

getYieldPartner(String name)

public final YieldPartner getYieldPartner(String name)

Gets a YieldPartner 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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   String name = YieldPartnerName.of("[NETWORK_CODE]", "[YIELD_PARTNER]").toString();
   YieldPartner response = yieldPartnerServiceClient.getYieldPartner(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the yield partner. Format: networks/{network_code}/yieldPartners/{yieldPartnerId}

Returns
Type Description
YieldPartner

getYieldPartnerCallable()

public final UnaryCallable<GetYieldPartnerRequest,YieldPartner> getYieldPartnerCallable()

Gets a YieldPartner 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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   GetYieldPartnerRequest request =
       GetYieldPartnerRequest.newBuilder()
           .setName(YieldPartnerName.of("[NETWORK_CODE]", "[YIELD_PARTNER]").toString())
           .build();
   ApiFuture<YieldPartner> future =
       yieldPartnerServiceClient.getYieldPartnerCallable().futureCall(request);
   // Do something.
   YieldPartner response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetYieldPartnerRequest,YieldPartner>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listYieldPartners(@Nullable NetworkName parent)

public final YieldPartnerServiceClient.ListYieldPartnersPagedResponse listYieldPartners(@Nullable NetworkName parent)

Gets a list of all yield partners.

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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (YieldPartner element :
       yieldPartnerServiceClient.listYieldPartners(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 yield partners. Format: networks/{network_code}

Returns
Type Description
YieldPartnerServiceClient.ListYieldPartnersPagedResponse

listYieldPartners(ListYieldPartnersRequest request)

public final YieldPartnerServiceClient.ListYieldPartnersPagedResponse listYieldPartners(ListYieldPartnersRequest request)

Gets a list of all yield partners.

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

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

Returns
Type Description
YieldPartnerServiceClient.ListYieldPartnersPagedResponse

listYieldPartners(String parent)

public final YieldPartnerServiceClient.ListYieldPartnersPagedResponse listYieldPartners(String parent)

Gets a list of all yield partners.

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 (YieldPartnerServiceClient yieldPartnerServiceClient = YieldPartnerServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (YieldPartner element :
       yieldPartnerServiceClient.listYieldPartners(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

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

Returns
Type Description
YieldPartnerServiceClient.ListYieldPartnersPagedResponse

listYieldPartnersCallable()

public final UnaryCallable<ListYieldPartnersRequest,ListYieldPartnersResponse> listYieldPartnersCallable()

Gets a list of all yield partners.

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

listYieldPartnersPagedCallable()

public final UnaryCallable<ListYieldPartnersRequest,YieldPartnerServiceClient.ListYieldPartnersPagedResponse> listYieldPartnersPagedCallable()

Gets a list of all yield partners.

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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()