Class ShippingSettingsServiceClient (0.2.0)

GitHub RepositoryProduct Reference

Service Description: Service to get method call shipping setting information per Merchant API method.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   ShippingSettingsName name = ShippingSettingsName.of("[ACCOUNT]");
   ShippingSettings response = shippingSettingsServiceClient.getShippingSettings(name);
 }
 

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

GetShippingSettings

Retrieve shipping setting information.

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

  • getShippingSettings(GetShippingSettingsRequest request)

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

  • getShippingSettings(ShippingSettingsName name)

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

  • getShippingSettingsCallable()

InsertShippingSettings

Replace the shipping setting of a merchant with the request shipping setting. Executing this method requires admin access.

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

  • insertShippingSettings(InsertShippingSettingsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertShippingSettingsCallable()

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 ShippingSettingsServiceSettings 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
 ShippingSettingsServiceSettings shippingSettingsServiceSettings =
     ShippingSettingsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create(shippingSettingsServiceSettings);
 

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
 ShippingSettingsServiceSettings shippingSettingsServiceSettings =
     ShippingSettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create(shippingSettingsServiceSettings);
 

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
 ShippingSettingsServiceSettings shippingSettingsServiceSettings =
     ShippingSettingsServiceSettings.newHttpJsonBuilder().build();
 ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create(shippingSettingsServiceSettings);
 

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

Inheritance

java.lang.Object > ShippingSettingsServiceClient

Static Methods

create()

public static final ShippingSettingsServiceClient create()

Constructs an instance of ShippingSettingsServiceClient with default settings.

Returns
Type Description
ShippingSettingsServiceClient
Exceptions
Type Description
IOException

create(ShippingSettingsServiceSettings settings)

public static final ShippingSettingsServiceClient create(ShippingSettingsServiceSettings settings)

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

create(ShippingSettingsServiceStub stub)

public static final ShippingSettingsServiceClient create(ShippingSettingsServiceStub stub)

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

Parameter
Name Description
stub ShippingSettingsServiceStub
Returns
Type Description
ShippingSettingsServiceClient

Constructors

ShippingSettingsServiceClient(ShippingSettingsServiceSettings settings)

protected ShippingSettingsServiceClient(ShippingSettingsServiceSettings settings)

Constructs an instance of ShippingSettingsServiceClient, 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 ShippingSettingsServiceSettings

ShippingSettingsServiceClient(ShippingSettingsServiceStub stub)

protected ShippingSettingsServiceClient(ShippingSettingsServiceStub stub)
Parameter
Name Description
stub ShippingSettingsServiceStub

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

getShippingSettings(GetShippingSettingsRequest request)

public final ShippingSettings getShippingSettings(GetShippingSettingsRequest request)

Retrieve shipping setting information.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   GetShippingSettingsRequest request =
       GetShippingSettingsRequest.newBuilder()
           .setName(ShippingSettingsName.of("[ACCOUNT]").toString())
           .build();
   ShippingSettings response = shippingSettingsServiceClient.getShippingSettings(request);
 }
 
Parameter
Name Description
request GetShippingSettingsRequest

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

Returns
Type Description
ShippingSettings

getShippingSettings(ShippingSettingsName name)

public final ShippingSettings getShippingSettings(ShippingSettingsName name)

Retrieve shipping setting information.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   ShippingSettingsName name = ShippingSettingsName.of("[ACCOUNT]");
   ShippingSettings response = shippingSettingsServiceClient.getShippingSettings(name);
 }
 
Parameter
Name Description
name ShippingSettingsName

Required. The name of the shipping setting to retrieve. Format: accounts/{account}/shippingsetting

Returns
Type Description
ShippingSettings

getShippingSettings(String name)

public final ShippingSettings getShippingSettings(String name)

Retrieve shipping setting information.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   String name = ShippingSettingsName.of("[ACCOUNT]").toString();
   ShippingSettings response = shippingSettingsServiceClient.getShippingSettings(name);
 }
 
Parameter
Name Description
name String

Required. The name of the shipping setting to retrieve. Format: accounts/{account}/shippingsetting

Returns
Type Description
ShippingSettings

getShippingSettingsCallable()

public final UnaryCallable<GetShippingSettingsRequest,ShippingSettings> getShippingSettingsCallable()

Retrieve shipping setting information.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   GetShippingSettingsRequest request =
       GetShippingSettingsRequest.newBuilder()
           .setName(ShippingSettingsName.of("[ACCOUNT]").toString())
           .build();
   ApiFuture<ShippingSettings> future =
       shippingSettingsServiceClient.getShippingSettingsCallable().futureCall(request);
   // Do something.
   ShippingSettings response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetShippingSettingsRequest,ShippingSettings>

getStub()

public ShippingSettingsServiceStub getStub()
Returns
Type Description
ShippingSettingsServiceStub

insertShippingSettings(InsertShippingSettingsRequest request)

public final ShippingSettings insertShippingSettings(InsertShippingSettingsRequest request)

Replace the shipping setting of a merchant with the request shipping setting. Executing this method requires admin access.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   InsertShippingSettingsRequest request =
       InsertShippingSettingsRequest.newBuilder()
           .setParent("parent-995424086")
           .setShippingSetting(ShippingSettings.newBuilder().build())
           .build();
   ShippingSettings response = shippingSettingsServiceClient.insertShippingSettings(request);
 }
 
Parameter
Name Description
request InsertShippingSettingsRequest

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

Returns
Type Description
ShippingSettings

insertShippingSettingsCallable()

public final UnaryCallable<InsertShippingSettingsRequest,ShippingSettings> insertShippingSettingsCallable()

Replace the shipping setting of a merchant with the request shipping setting. Executing this method requires admin access.

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 (ShippingSettingsServiceClient shippingSettingsServiceClient =
     ShippingSettingsServiceClient.create()) {
   InsertShippingSettingsRequest request =
       InsertShippingSettingsRequest.newBuilder()
           .setParent("parent-995424086")
           .setShippingSetting(ShippingSettings.newBuilder().build())
           .build();
   ApiFuture<ShippingSettings> future =
       shippingSettingsServiceClient.insertShippingSettingsCallable().futureCall(request);
   // Do something.
   ShippingSettings response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertShippingSettingsRequest,ShippingSettings>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()