Class FulfillmentsClient (4.47.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
MethodDescriptionMethod 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
TypeDescription
FulfillmentsClient
Exceptions
TypeDescription
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
NameDescription
settingsFulfillmentsSettings
Returns
TypeDescription
FulfillmentsClient
Exceptions
TypeDescription
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
NameDescription
stubFulfillmentsStub
Returns
TypeDescription
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
NameDescription
settingsFulfillmentsSettings

FulfillmentsClient(FulfillmentsStub stub)

protected FulfillmentsClient(FulfillmentsStub stub)
Parameter
NameDescription
stubFulfillmentsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
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
NameDescription
nameFulfillmentName

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

Returns
TypeDescription
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
NameDescription
requestGetFulfillmentRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

public final FulfillmentsSettings getSettings()
Returns
TypeDescription
FulfillmentsSettings

getStub()

public FulfillmentsStub getStub()
Returns
TypeDescription
FulfillmentsStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
fulfillmentFulfillment

Required. The fulfillment to update.

updateMaskFieldMask

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

Returns
TypeDescription
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
NameDescription
requestUpdateFulfillmentRequest

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<UpdateFulfillmentRequest,Fulfillment>