Class McmEarningsServiceClient (0.52.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (McmEarnings element : mcmEarningsServiceClient.fetchMcmEarnings(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 

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

FetchMcmEarnings

API to retrieve a list of McmEarnings objects.

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

  • fetchMcmEarnings(FetchMcmEarningsRequest request)

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

  • fetchMcmEarnings(NetworkName parent)

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

  • fetchMcmEarningsPagedCallable()

  • fetchMcmEarningsCallable()

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 McmEarningsServiceSettings 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
 McmEarningsServiceSettings mcmEarningsServiceSettings =
     McmEarningsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 McmEarningsServiceClient mcmEarningsServiceClient =
     McmEarningsServiceClient.create(mcmEarningsServiceSettings);
 

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
 McmEarningsServiceSettings mcmEarningsServiceSettings =
     McmEarningsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 McmEarningsServiceClient mcmEarningsServiceClient =
     McmEarningsServiceClient.create(mcmEarningsServiceSettings);
 

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

Inheritance

java.lang.Object > McmEarningsServiceClient

Static Methods

create()

public static final McmEarningsServiceClient create()

Constructs an instance of McmEarningsServiceClient with default settings.

Returns
Type Description
McmEarningsServiceClient
Exceptions
Type Description
IOException

create(McmEarningsServiceSettings settings)

public static final McmEarningsServiceClient create(McmEarningsServiceSettings settings)

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

create(McmEarningsServiceStub stub)

public static final McmEarningsServiceClient create(McmEarningsServiceStub stub)

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

Parameter
Name Description
stub McmEarningsServiceStub
Returns
Type Description
McmEarningsServiceClient

Constructors

McmEarningsServiceClient(McmEarningsServiceSettings settings)

protected McmEarningsServiceClient(McmEarningsServiceSettings settings)

Constructs an instance of McmEarningsServiceClient, 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 McmEarningsServiceSettings

McmEarningsServiceClient(McmEarningsServiceStub stub)

protected McmEarningsServiceClient(McmEarningsServiceStub stub)
Parameter
Name Description
stub McmEarningsServiceStub

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

fetchMcmEarnings(FetchMcmEarningsRequest request)

public final McmEarningsServiceClient.FetchMcmEarningsPagedResponse fetchMcmEarnings(FetchMcmEarningsRequest request)

API to retrieve a list of McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   FetchMcmEarningsRequest request =
       FetchMcmEarningsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .setMonth(Date.newBuilder().build())
           .build();
   for (McmEarnings element : mcmEarningsServiceClient.fetchMcmEarnings(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request FetchMcmEarningsRequest

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

Returns
Type Description
McmEarningsServiceClient.FetchMcmEarningsPagedResponse

fetchMcmEarnings(NetworkName parent)

public final McmEarningsServiceClient.FetchMcmEarningsPagedResponse fetchMcmEarnings(NetworkName parent)

API to retrieve a list of McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (McmEarnings element : mcmEarningsServiceClient.fetchMcmEarnings(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent NetworkName

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

Returns
Type Description
McmEarningsServiceClient.FetchMcmEarningsPagedResponse

fetchMcmEarnings(String parent)

public final McmEarningsServiceClient.FetchMcmEarningsPagedResponse fetchMcmEarnings(String parent)

API to retrieve a list of McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (McmEarnings element : mcmEarningsServiceClient.fetchMcmEarnings(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

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

Returns
Type Description
McmEarningsServiceClient.FetchMcmEarningsPagedResponse

fetchMcmEarningsCallable()

public final UnaryCallable<FetchMcmEarningsRequest,FetchMcmEarningsResponse> fetchMcmEarningsCallable()

API to retrieve a list of McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   FetchMcmEarningsRequest request =
       FetchMcmEarningsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .setMonth(Date.newBuilder().build())
           .build();
   while (true) {
     FetchMcmEarningsResponse response =
         mcmEarningsServiceClient.fetchMcmEarningsCallable().call(request);
     for (McmEarnings element : response.getMcmEarningsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<FetchMcmEarningsRequest,FetchMcmEarningsResponse>

fetchMcmEarningsPagedCallable()

public final UnaryCallable<FetchMcmEarningsRequest,McmEarningsServiceClient.FetchMcmEarningsPagedResponse> fetchMcmEarningsPagedCallable()

API to retrieve a list of McmEarnings 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 (McmEarningsServiceClient mcmEarningsServiceClient = McmEarningsServiceClient.create()) {
   FetchMcmEarningsRequest request =
       FetchMcmEarningsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .setMonth(Date.newBuilder().build())
           .build();
   ApiFuture<McmEarnings> future =
       mcmEarningsServiceClient.fetchMcmEarningsPagedCallable().futureCall(request);
   // Do something.
   for (McmEarnings element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<FetchMcmEarningsRequest,FetchMcmEarningsPagedResponse>

getSettings()

public final McmEarningsServiceSettings getSettings()
Returns
Type Description
McmEarningsServiceSettings

getStub()

public McmEarningsServiceStub getStub()
Returns
Type Description
McmEarningsServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()