Class GbpAccountsServiceClient (0.23.0)

GitHub RepositoryProduct Reference

Service Description: The service facilitates the management of a merchant's Google Business Profile (GBP) account settings. This API defines the following resource model: - GbpAccount

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   LinkGbpAccountResponse response = gbpAccountsServiceClient.linkGbpAccount(parent);
 }
 

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

ListGbpAccounts

List the GBP accounts for a given merchant.

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

  • listGbpAccounts(ListGbpAccountsRequest request)

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

  • listGbpAccounts(AccountName parent)

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

  • listGbpAccountsPagedCallable()

  • listGbpAccountsCallable()

LinkGbpAccount

Link the specified merchant to a GBP account for all countries.

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

  • linkGbpAccount(LinkGbpAccountRequest request)

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

  • linkGbpAccount(AccountName parent)

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

  • linkGbpAccountCallable()

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 GbpAccountsServiceSettings 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
 GbpAccountsServiceSettings gbpAccountsServiceSettings =
     GbpAccountsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 GbpAccountsServiceClient gbpAccountsServiceClient =
     GbpAccountsServiceClient.create(gbpAccountsServiceSettings);
 

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
 GbpAccountsServiceSettings gbpAccountsServiceSettings =
     GbpAccountsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 GbpAccountsServiceClient gbpAccountsServiceClient =
     GbpAccountsServiceClient.create(gbpAccountsServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 GbpAccountsServiceSettings gbpAccountsServiceSettings =
     GbpAccountsServiceSettings.newHttpJsonBuilder().build();
 GbpAccountsServiceClient gbpAccountsServiceClient =
     GbpAccountsServiceClient.create(gbpAccountsServiceSettings);
 

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

Inheritance

java.lang.Object > GbpAccountsServiceClient

Static Methods

create()

public static final GbpAccountsServiceClient create()

Constructs an instance of GbpAccountsServiceClient with default settings.

Returns
Type Description
GbpAccountsServiceClient
Exceptions
Type Description
IOException

create(GbpAccountsServiceSettings settings)

public static final GbpAccountsServiceClient create(GbpAccountsServiceSettings settings)

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

create(GbpAccountsServiceStub stub)

public static final GbpAccountsServiceClient create(GbpAccountsServiceStub stub)

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

Parameter
Name Description
stub GbpAccountsServiceStub
Returns
Type Description
GbpAccountsServiceClient

Constructors

GbpAccountsServiceClient(GbpAccountsServiceSettings settings)

protected GbpAccountsServiceClient(GbpAccountsServiceSettings settings)

Constructs an instance of GbpAccountsServiceClient, 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 GbpAccountsServiceSettings

GbpAccountsServiceClient(GbpAccountsServiceStub stub)

protected GbpAccountsServiceClient(GbpAccountsServiceStub stub)
Parameter
Name Description
stub GbpAccountsServiceStub

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 GbpAccountsServiceSettings getSettings()
Returns
Type Description
GbpAccountsServiceSettings

getStub()

public GbpAccountsServiceStub getStub()
Returns
Type Description
GbpAccountsServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

linkGbpAccount(AccountName parent)

public final LinkGbpAccountResponse linkGbpAccount(AccountName parent)

Link the specified merchant to a GBP account for all countries.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   LinkGbpAccountResponse response = gbpAccountsServiceClient.linkGbpAccount(parent);
 }
 
Parameter
Name Description
parent AccountName

Required. The name of the parent resource to which the GBP account is linked. Format: accounts/{account}.

Returns
Type Description
LinkGbpAccountResponse

linkGbpAccount(LinkGbpAccountRequest request)

public final LinkGbpAccountResponse linkGbpAccount(LinkGbpAccountRequest request)

Link the specified merchant to a GBP account for all countries.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   LinkGbpAccountRequest request =
       LinkGbpAccountRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setGbpEmail("gbpEmail-824582745")
           .build();
   LinkGbpAccountResponse response = gbpAccountsServiceClient.linkGbpAccount(request);
 }
 
Parameter
Name Description
request LinkGbpAccountRequest

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

Returns
Type Description
LinkGbpAccountResponse

linkGbpAccount(String parent)

public final LinkGbpAccountResponse linkGbpAccount(String parent)

Link the specified merchant to a GBP account for all countries.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   LinkGbpAccountResponse response = gbpAccountsServiceClient.linkGbpAccount(parent);
 }
 
Parameter
Name Description
parent String

Required. The name of the parent resource to which the GBP account is linked. Format: accounts/{account}.

Returns
Type Description
LinkGbpAccountResponse

linkGbpAccountCallable()

public final UnaryCallable<LinkGbpAccountRequest,LinkGbpAccountResponse> linkGbpAccountCallable()

Link the specified merchant to a GBP account for all countries.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   LinkGbpAccountRequest request =
       LinkGbpAccountRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setGbpEmail("gbpEmail-824582745")
           .build();
   ApiFuture<LinkGbpAccountResponse> future =
       gbpAccountsServiceClient.linkGbpAccountCallable().futureCall(request);
   // Do something.
   LinkGbpAccountResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<LinkGbpAccountRequest,LinkGbpAccountResponse>

listGbpAccounts(AccountName parent)

public final GbpAccountsServiceClient.ListGbpAccountsPagedResponse listGbpAccounts(AccountName parent)

List the GBP accounts for a given merchant.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   for (GbpAccount element : gbpAccountsServiceClient.listGbpAccounts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AccountName

Required. The name of the parent resource under which the GBP accounts are listed. Format: accounts/{account}.

Returns
Type Description
GbpAccountsServiceClient.ListGbpAccountsPagedResponse

listGbpAccounts(ListGbpAccountsRequest request)

public final GbpAccountsServiceClient.ListGbpAccountsPagedResponse listGbpAccounts(ListGbpAccountsRequest request)

List the GBP accounts for a given merchant.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   ListGbpAccountsRequest request =
       ListGbpAccountsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (GbpAccount element : gbpAccountsServiceClient.listGbpAccounts(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListGbpAccountsRequest

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

Returns
Type Description
GbpAccountsServiceClient.ListGbpAccountsPagedResponse

listGbpAccounts(String parent)

public final GbpAccountsServiceClient.ListGbpAccountsPagedResponse listGbpAccounts(String parent)

List the GBP accounts for a given merchant.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   for (GbpAccount element : gbpAccountsServiceClient.listGbpAccounts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The name of the parent resource under which the GBP accounts are listed. Format: accounts/{account}.

Returns
Type Description
GbpAccountsServiceClient.ListGbpAccountsPagedResponse

listGbpAccountsCallable()

public final UnaryCallable<ListGbpAccountsRequest,ListGbpAccountsResponse> listGbpAccountsCallable()

List the GBP accounts for a given merchant.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   ListGbpAccountsRequest request =
       ListGbpAccountsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListGbpAccountsResponse response =
         gbpAccountsServiceClient.listGbpAccountsCallable().call(request);
     for (GbpAccount element : response.getGbpAccountsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListGbpAccountsRequest,ListGbpAccountsResponse>

listGbpAccountsPagedCallable()

public final UnaryCallable<ListGbpAccountsRequest,GbpAccountsServiceClient.ListGbpAccountsPagedResponse> listGbpAccountsPagedCallable()

List the GBP accounts for a given merchant.

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 (GbpAccountsServiceClient gbpAccountsServiceClient = GbpAccountsServiceClient.create()) {
   ListGbpAccountsRequest request =
       ListGbpAccountsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<GbpAccount> future =
       gbpAccountsServiceClient.listGbpAccountsPagedCallable().futureCall(request);
   // Do something.
   for (GbpAccount element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListGbpAccountsRequest,ListGbpAccountsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()