Class FulfillmentsClient (4.49.0)

GitHub RepositoryProduct Reference

Service Description: Service for managing Fulfillments.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   FulfillmentName name = FulfillmentName.ofProjectName("[PROJECT]");
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 

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

GetFulfillment

Retrieves the fulfillment.

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

  • getFulfillment(GetFulfillmentRequest request)

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

  • getFulfillment(FulfillmentName name)

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

  • getFulfillmentCallable()

UpdateFulfillment

Updates the fulfillment.

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

  • updateFulfillment(UpdateFulfillmentRequest request)

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

  • updateFulfillment(Fulfillment fulfillment, FieldMask updateMask)

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

  • updateFulfillmentCallable()

ListLocations

Lists information about the supported locations for this service.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

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 FulfillmentsSettings 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
 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

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
 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

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
 FulfillmentsSettings fulfillmentsSettings = FulfillmentsSettings.newHttpJsonBuilder().build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

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

Inheritance

java.lang.Object > FulfillmentsClient

Static Methods

create()

public static final FulfillmentsClient create()

Constructs an instance of FulfillmentsClient with default settings.

Returns
Type Description
FulfillmentsClient
Exceptions
Type Description
IOException

create(FulfillmentsSettings settings)

public static final FulfillmentsClient create(FulfillmentsSettings settings)

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

create(FulfillmentsStub stub)

public static final FulfillmentsClient create(FulfillmentsStub stub)

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

Parameter
Name Description
stub FulfillmentsStub
Returns
Type Description
FulfillmentsClient

Constructors

FulfillmentsClient(FulfillmentsSettings settings)

protected FulfillmentsClient(FulfillmentsSettings settings)

Constructs an instance of FulfillmentsClient, 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 FulfillmentsSettings

FulfillmentsClient(FulfillmentsStub stub)

protected FulfillmentsClient(FulfillmentsStub stub)
Parameter
Name Description
stub FulfillmentsStub

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

getFulfillment(FulfillmentName name)

public final Fulfillment getFulfillment(FulfillmentName name)

Retrieves the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   FulfillmentName name = FulfillmentName.ofProjectName("[PROJECT]");
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 
Parameter
Name Description
name FulfillmentName

Required. The name of the fulfillment. Format: projects/<Project ID>/agent/fulfillment.

Returns
Type Description
Fulfillment

getFulfillment(GetFulfillmentRequest request)

public final Fulfillment getFulfillment(GetFulfillmentRequest request)

Retrieves the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetFulfillmentRequest request =
       GetFulfillmentRequest.newBuilder()
           .setName(FulfillmentName.ofProjectName("[PROJECT]").toString())
           .build();
   Fulfillment response = fulfillmentsClient.getFulfillment(request);
 }
 
Parameter
Name Description
request GetFulfillmentRequest

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

Returns
Type Description
Fulfillment

getFulfillment(String name)

public final Fulfillment getFulfillment(String name)

Retrieves the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   String name = FulfillmentName.ofProjectName("[PROJECT]").toString();
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 
Parameter
Name Description
name String

Required. The name of the fulfillment. Format: projects/<Project ID>/agent/fulfillment.

Returns
Type Description
Fulfillment

getFulfillmentCallable()

public final UnaryCallable<GetFulfillmentRequest,Fulfillment> getFulfillmentCallable()

Retrieves the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetFulfillmentRequest request =
       GetFulfillmentRequest.newBuilder()
           .setName(FulfillmentName.ofProjectName("[PROJECT]").toString())
           .build();
   ApiFuture<Fulfillment> future =
       fulfillmentsClient.getFulfillmentCallable().futureCall(request);
   // Do something.
   Fulfillment response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetFulfillmentRequest,Fulfillment>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = fulfillmentsClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

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

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = fulfillmentsClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

public final FulfillmentsSettings getSettings()
Returns
Type Description
FulfillmentsSettings

getStub()

public FulfillmentsStub getStub()
Returns
Type Description
FulfillmentsStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLocations(ListLocationsRequest request)

public final FulfillmentsClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : fulfillmentsClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

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

Returns
Type Description
FulfillmentsClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = fulfillmentsClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,FulfillmentsClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       fulfillmentsClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateFulfillment(Fulfillment fulfillment, FieldMask updateMask)

public final Fulfillment updateFulfillment(Fulfillment fulfillment, FieldMask updateMask)

Updates the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   Fulfillment fulfillment = Fulfillment.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Fulfillment response = fulfillmentsClient.updateFulfillment(fulfillment, updateMask);
 }
 
Parameters
Name Description
fulfillment Fulfillment

Required. The fulfillment to update.

updateMask FieldMask

Required. The mask to control which fields get updated. If the mask is not present, all fields will be updated.

Returns
Type Description
Fulfillment

updateFulfillment(UpdateFulfillmentRequest request)

public final Fulfillment updateFulfillment(UpdateFulfillmentRequest request)

Updates the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   UpdateFulfillmentRequest request =
       UpdateFulfillmentRequest.newBuilder()
           .setFulfillment(Fulfillment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Fulfillment response = fulfillmentsClient.updateFulfillment(request);
 }
 
Parameter
Name Description
request UpdateFulfillmentRequest

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

Returns
Type Description
Fulfillment

updateFulfillmentCallable()

public final UnaryCallable<UpdateFulfillmentRequest,Fulfillment> updateFulfillmentCallable()

Updates the fulfillment.

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 (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   UpdateFulfillmentRequest request =
       UpdateFulfillmentRequest.newBuilder()
           .setFulfillment(Fulfillment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Fulfillment> future =
       fulfillmentsClient.updateFulfillmentCallable().futureCall(request);
   // Do something.
   Fulfillment response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateFulfillmentRequest,Fulfillment>