- 2.55.0 (latest)
- 2.54.0
- 2.53.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.1
- 2.4.0
- 2.3.0
- 2.2.3
- 2.1.0
- 2.0.19
public class ProductServiceClient implements BackgroundResource
Service Description: Service for ingesting Product information of the customer's website.
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 for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
Product product = Product.newBuilder().build();
String productId = "productId-1051830678";
Product response = productServiceClient.createProduct(parent, product, productId);
}
Note: close() needs to be called on the ProductServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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 ProductServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
ProductServiceSettings productServiceSettings =
ProductServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
ProductServiceSettings productServiceSettings =
ProductServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
ProductServiceSettings productServiceSettings =
ProductServiceSettings.newBuilder()
.setTransportChannelProvider(
ProductServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final ProductServiceClient create()
Constructs an instance of ProductServiceClient with default settings.
Type | Description |
ProductServiceClient |
Type | Description |
IOException |
create(ProductServiceSettings settings)
public static final ProductServiceClient create(ProductServiceSettings settings)
Constructs an instance of ProductServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | ProductServiceSettings |
Type | Description |
ProductServiceClient |
Type | Description |
IOException |
create(ProductServiceStub stub)
public static final ProductServiceClient create(ProductServiceStub stub)
Constructs an instance of ProductServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ProductServiceSettings).
Name | Description |
stub | ProductServiceStub |
Type | Description |
ProductServiceClient |
Constructors
ProductServiceClient(ProductServiceSettings settings)
protected ProductServiceClient(ProductServiceSettings settings)
Constructs an instance of ProductServiceClient, 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.
Name | Description |
settings | ProductServiceSettings |
ProductServiceClient(ProductServiceStub stub)
protected ProductServiceClient(ProductServiceStub stub)
Name | Description |
stub | ProductServiceStub |
Methods
addFulfillmentPlacesAsync(AddFulfillmentPlacesRequest request)
public final OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(AddFulfillmentPlacesRequest request)
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddFulfillmentPlacesRequest request =
AddFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
AddFulfillmentPlacesResponse response =
productServiceClient.addFulfillmentPlacesAsync(request).get();
}
Name | Description |
request | AddFulfillmentPlacesRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> |
addFulfillmentPlacesAsync(ProductName product)
public final OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(ProductName product)
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
AddFulfillmentPlacesResponse response =
productServiceClient.addFulfillmentPlacesAsync(product).get();
}
Name | Description |
product | ProductName Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> |
addFulfillmentPlacesAsync(String product)
public final OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(String product)
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
AddFulfillmentPlacesResponse response =
productServiceClient.addFulfillmentPlacesAsync(product).get();
}
Name | Description |
product | String Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> |
addFulfillmentPlacesCallable()
public final UnaryCallable<AddFulfillmentPlacesRequest,Operation> addFulfillmentPlacesCallable()
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddFulfillmentPlacesRequest request =
AddFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future =
productServiceClient.addFulfillmentPlacesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AddFulfillmentPlacesRequest,Operation> |
addFulfillmentPlacesOperationCallable()
public final OperationCallable<AddFulfillmentPlacesRequest,AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> addFulfillmentPlacesOperationCallable()
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddFulfillmentPlacesRequest request =
AddFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> future =
productServiceClient.addFulfillmentPlacesOperationCallable().futureCall(request);
// Do something.
AddFulfillmentPlacesResponse response = future.get();
}
Type | Description |
OperationCallable<AddFulfillmentPlacesRequest,AddFulfillmentPlacesResponse,AddFulfillmentPlacesMetadata> |
addLocalInventoriesAsync(AddLocalInventoriesRequest request)
public final OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> addLocalInventoriesAsync(AddLocalInventoriesRequest request)
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddLocalInventoriesRequest request =
AddLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllLocalInventories(new ArrayList<LocalInventory>())
.setAddMask(FieldMask.newBuilder().build())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
AddLocalInventoriesResponse response =
productServiceClient.addLocalInventoriesAsync(request).get();
}
Name | Description |
request | AddLocalInventoriesRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> |
addLocalInventoriesAsync(ProductName product)
public final OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> addLocalInventoriesAsync(ProductName product)
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
AddLocalInventoriesResponse response =
productServiceClient.addLocalInventoriesAsync(product).get();
}
Name | Description |
product | ProductName Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> |
addLocalInventoriesAsync(String product)
public final OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> addLocalInventoriesAsync(String product)
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
AddLocalInventoriesResponse response =
productServiceClient.addLocalInventoriesAsync(product).get();
}
Name | Description |
product | String Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<AddLocalInventoriesResponse,AddLocalInventoriesMetadata> |
addLocalInventoriesCallable()
public final UnaryCallable<AddLocalInventoriesRequest,Operation> addLocalInventoriesCallable()
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddLocalInventoriesRequest request =
AddLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllLocalInventories(new ArrayList<LocalInventory>())
.setAddMask(FieldMask.newBuilder().build())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future =
productServiceClient.addLocalInventoriesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AddLocalInventoriesRequest,Operation> |
addLocalInventoriesOperationCallable()
public final OperationCallable<AddLocalInventoriesRequest,AddLocalInventoriesResponse,AddLocalInventoriesMetadata> addLocalInventoriesOperationCallable()
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
AddLocalInventoriesRequest request =
AddLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllLocalInventories(new ArrayList<LocalInventory>())
.setAddMask(FieldMask.newBuilder().build())
.setAddTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<AddLocalInventoriesResponse, AddLocalInventoriesMetadata> future =
productServiceClient.addLocalInventoriesOperationCallable().futureCall(request);
// Do something.
AddLocalInventoriesResponse response = future.get();
}
Type | Description |
OperationCallable<AddLocalInventoriesRequest,AddLocalInventoriesResponse,AddLocalInventoriesMetadata> |
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createProduct(BranchName parent, Product product, String productId)
public final Product createProduct(BranchName parent, Product product, String productId)
Creates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
Product product = Product.newBuilder().build();
String productId = "productId-1051830678";
Product response = productServiceClient.createProduct(parent, product, productId);
}
Name | Description |
parent | BranchName Required. The parent catalog resource name, such as
|
product | Product Required. The Product to create. |
productId | String Required. The ID to use for the Product, which will become the final component of the Product.name. If the caller does not have permission to create the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. This field must be unique among all Products with the same parent. Otherwise, an ALREADY_EXISTS error is returned. This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. |
Type | Description |
Product |
createProduct(CreateProductRequest request)
public final Product createProduct(CreateProductRequest request)
Creates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
CreateProductRequest request =
CreateProductRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setProduct(Product.newBuilder().build())
.setProductId("productId-1051830678")
.build();
Product response = productServiceClient.createProduct(request);
}
Name | Description |
request | CreateProductRequest The request object containing all of the parameters for the API call. |
Type | Description |
Product |
createProduct(String parent, Product product, String productId)
public final Product createProduct(String parent, Product product, String productId)
Creates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString();
Product product = Product.newBuilder().build();
String productId = "productId-1051830678";
Product response = productServiceClient.createProduct(parent, product, productId);
}
Name | Description |
parent | String Required. The parent catalog resource name, such as
|
product | Product Required. The Product to create. |
productId | String Required. The ID to use for the Product, which will become the final component of the Product.name. If the caller does not have permission to create the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. This field must be unique among all Products with the same parent. Otherwise, an ALREADY_EXISTS error is returned. This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. |
Type | Description |
Product |
createProductCallable()
public final UnaryCallable<CreateProductRequest,Product> createProductCallable()
Creates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
CreateProductRequest request =
CreateProductRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setProduct(Product.newBuilder().build())
.setProductId("productId-1051830678")
.build();
ApiFuture<Product> future = productServiceClient.createProductCallable().futureCall(request);
// Do something.
Product response = future.get();
}
Type | Description |
UnaryCallable<CreateProductRequest,Product> |
deleteProduct(DeleteProductRequest request)
public final void deleteProduct(DeleteProductRequest request)
Deletes a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
DeleteProductRequest request =
DeleteProductRequest.newBuilder()
.setName(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.build();
productServiceClient.deleteProduct(request);
}
Name | Description |
request | DeleteProductRequest The request object containing all of the parameters for the API call. |
deleteProduct(ProductName name)
public final void deleteProduct(ProductName name)
Deletes a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName name =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
productServiceClient.deleteProduct(name);
}
Name | Description |
name | ProductName Required. Full resource name of Product, such as
If the caller does not have permission to delete the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the Product to delete does not exist, a NOT_FOUND error is returned. The Product to delete can neither be a Product.Type.COLLECTION Product member nor a Product.Type.PRIMARY Product with more than one variants. Otherwise, an INVALID_ARGUMENT error is returned. All inventory information for the named Product will be deleted. |
deleteProduct(String name)
public final void deleteProduct(String name)
Deletes a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String name =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
productServiceClient.deleteProduct(name);
}
Name | Description |
name | String Required. Full resource name of Product, such as
If the caller does not have permission to delete the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the Product to delete does not exist, a NOT_FOUND error is returned. The Product to delete can neither be a Product.Type.COLLECTION Product member nor a Product.Type.PRIMARY Product with more than one variants. Otherwise, an INVALID_ARGUMENT error is returned. All inventory information for the named Product will be deleted. |
deleteProductCallable()
public final UnaryCallable<DeleteProductRequest,Empty> deleteProductCallable()
Deletes a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
DeleteProductRequest request =
DeleteProductRequest.newBuilder()
.setName(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.build();
ApiFuture<Empty> future = productServiceClient.deleteProductCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteProductRequest,Empty> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getProduct(GetProductRequest request)
public final Product getProduct(GetProductRequest request)
Gets a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
GetProductRequest request =
GetProductRequest.newBuilder()
.setName(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.build();
Product response = productServiceClient.getProduct(request);
}
Name | Description |
request | GetProductRequest The request object containing all of the parameters for the API call. |
Type | Description |
Product |
getProduct(ProductName name)
public final Product getProduct(ProductName name)
Gets a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName name =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
Product response = productServiceClient.getProduct(name);
}
Name | Description |
name | ProductName Required. Full resource name of Product, such as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the requested Product does not exist, a NOT_FOUND error is returned. |
Type | Description |
Product |
getProduct(String name)
public final Product getProduct(String name)
Gets a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String name =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
Product response = productServiceClient.getProduct(name);
}
Name | Description |
name | String Required. Full resource name of Product, such as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the requested Product does not exist, a NOT_FOUND error is returned. |
Type | Description |
Product |
getProductCallable()
public final UnaryCallable<GetProductRequest,Product> getProductCallable()
Gets a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
GetProductRequest request =
GetProductRequest.newBuilder()
.setName(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.build();
ApiFuture<Product> future = productServiceClient.getProductCallable().futureCall(request);
// Do something.
Product response = future.get();
}
Type | Description |
UnaryCallable<GetProductRequest,Product> |
getSettings()
public final ProductServiceSettings getSettings()
Type | Description |
ProductServiceSettings |
getStub()
public ProductServiceStub getStub()
Type | Description |
ProductServiceStub |
importProductsAsync(ImportProductsRequest request)
public final OperationFuture<ImportProductsResponse,ImportMetadata> importProductsAsync(ImportProductsRequest request)
Bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the Products to be successfully updated.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ImportProductsRequest request =
ImportProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setRequestId("requestId693933066")
.setInputConfig(ProductInputConfig.newBuilder().build())
.setErrorsConfig(ImportErrorsConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setNotificationPubsubTopic("notificationPubsubTopic-1361224991")
.build();
ImportProductsResponse response = productServiceClient.importProductsAsync(request).get();
}
Name | Description |
request | ImportProductsRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<ImportProductsResponse,ImportMetadata> |
importProductsCallable()
public final UnaryCallable<ImportProductsRequest,Operation> importProductsCallable()
Bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the Products to be successfully updated.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ImportProductsRequest request =
ImportProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setRequestId("requestId693933066")
.setInputConfig(ProductInputConfig.newBuilder().build())
.setErrorsConfig(ImportErrorsConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setNotificationPubsubTopic("notificationPubsubTopic-1361224991")
.build();
ApiFuture<Operation> future =
productServiceClient.importProductsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<ImportProductsRequest,Operation> |
importProductsOperationCallable()
public final OperationCallable<ImportProductsRequest,ImportProductsResponse,ImportMetadata> importProductsOperationCallable()
Bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the Products to be successfully updated.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ImportProductsRequest request =
ImportProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setRequestId("requestId693933066")
.setInputConfig(ProductInputConfig.newBuilder().build())
.setErrorsConfig(ImportErrorsConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setNotificationPubsubTopic("notificationPubsubTopic-1361224991")
.build();
OperationFuture<ImportProductsResponse, ImportMetadata> future =
productServiceClient.importProductsOperationCallable().futureCall(request);
// Do something.
ImportProductsResponse response = future.get();
}
Type | Description |
OperationCallable<ImportProductsRequest,ImportProductsResponse,ImportMetadata> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listProducts(BranchName parent)
public final ProductServiceClient.ListProductsPagedResponse listProducts(BranchName parent)
Gets a list of Products.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
for (Product element : productServiceClient.listProducts(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | BranchName Required. The parent branch resource name, such as
If the caller does not have permission to list Products under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned. |
Type | Description |
ProductServiceClient.ListProductsPagedResponse |
listProducts(ListProductsRequest request)
public final ProductServiceClient.ListProductsPagedResponse listProducts(ListProductsRequest request)
Gets a list of Products.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ListProductsRequest request =
ListProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
for (Product element : productServiceClient.listProducts(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListProductsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ProductServiceClient.ListProductsPagedResponse |
listProducts(String parent)
public final ProductServiceClient.ListProductsPagedResponse listProducts(String parent)
Gets a list of Products.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString();
for (Product element : productServiceClient.listProducts(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The parent branch resource name, such as
If the caller does not have permission to list Products under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned. |
Type | Description |
ProductServiceClient.ListProductsPagedResponse |
listProductsCallable()
public final UnaryCallable<ListProductsRequest,ListProductsResponse> listProductsCallable()
Gets a list of Products.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ListProductsRequest request =
ListProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
while (true) {
ListProductsResponse response = productServiceClient.listProductsCallable().call(request);
for (Product element : response.getProductsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListProductsRequest,ListProductsResponse> |
listProductsPagedCallable()
public final UnaryCallable<ListProductsRequest,ProductServiceClient.ListProductsPagedResponse> listProductsPagedCallable()
Gets a list of Products.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ListProductsRequest request =
ListProductsRequest.newBuilder()
.setParent(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Product> future =
productServiceClient.listProductsPagedCallable().futureCall(request);
// Do something.
for (Product element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListProductsRequest,ListProductsPagedResponse> |
removeFulfillmentPlacesAsync(ProductName product)
public final OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(ProductName product)
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
RemoveFulfillmentPlacesResponse response =
productServiceClient.removeFulfillmentPlacesAsync(product).get();
}
Name | Description |
product | ProductName Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> |
removeFulfillmentPlacesAsync(RemoveFulfillmentPlacesRequest request)
public final OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(RemoveFulfillmentPlacesRequest request)
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveFulfillmentPlacesRequest request =
RemoveFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
RemoveFulfillmentPlacesResponse response =
productServiceClient.removeFulfillmentPlacesAsync(request).get();
}
Name | Description |
request | RemoveFulfillmentPlacesRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> |
removeFulfillmentPlacesAsync(String product)
public final OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(String product)
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
RemoveFulfillmentPlacesResponse response =
productServiceClient.removeFulfillmentPlacesAsync(product).get();
}
Name | Description |
product | String Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> |
removeFulfillmentPlacesCallable()
public final UnaryCallable<RemoveFulfillmentPlacesRequest,Operation> removeFulfillmentPlacesCallable()
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveFulfillmentPlacesRequest request =
RemoveFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future =
productServiceClient.removeFulfillmentPlacesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<RemoveFulfillmentPlacesRequest,Operation> |
removeFulfillmentPlacesOperationCallable()
public final OperationCallable<RemoveFulfillmentPlacesRequest,RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesOperationCallable()
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveFulfillmentPlacesRequest request =
RemoveFulfillmentPlacesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.setType("type3575610")
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<RemoveFulfillmentPlacesResponse, RemoveFulfillmentPlacesMetadata> future =
productServiceClient.removeFulfillmentPlacesOperationCallable().futureCall(request);
// Do something.
RemoveFulfillmentPlacesResponse response = future.get();
}
Type | Description |
OperationCallable<RemoveFulfillmentPlacesRequest,RemoveFulfillmentPlacesResponse,RemoveFulfillmentPlacesMetadata> |
removeLocalInventoriesAsync(ProductName product)
public final OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(ProductName product)
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ProductName product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
RemoveLocalInventoriesResponse response =
productServiceClient.removeLocalInventoriesAsync(product).get();
}
Name | Description |
product | ProductName Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> |
removeLocalInventoriesAsync(RemoveLocalInventoriesRequest request)
public final OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(RemoveLocalInventoriesRequest request)
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveLocalInventoriesRequest request =
RemoveLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
RemoveLocalInventoriesResponse response =
productServiceClient.removeLocalInventoriesAsync(request).get();
}
Name | Description |
request | RemoveLocalInventoriesRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> |
removeLocalInventoriesAsync(String product)
public final OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(String product)
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
String product =
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString();
RemoveLocalInventoriesResponse response =
productServiceClient.removeLocalInventoriesAsync(product).get();
}
Name | Description |
product | String Required. Full resource name of Product, such
as
If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. |
Type | Description |
OperationFuture<RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> |
removeLocalInventoriesCallable()
public final UnaryCallable<RemoveLocalInventoriesRequest,Operation> removeLocalInventoriesCallable()
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveLocalInventoriesRequest request =
RemoveLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future =
productServiceClient.removeLocalInventoriesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<RemoveLocalInventoriesRequest,Operation> |
removeLocalInventoriesOperationCallable()
public final OperationCallable<RemoveLocalInventoriesRequest,RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> removeLocalInventoriesOperationCallable()
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
RemoveLocalInventoriesRequest request =
RemoveLocalInventoriesRequest.newBuilder()
.setProduct(
ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
.toString())
.addAllPlaceIds(new ArrayList<String>())
.setRemoveTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<RemoveLocalInventoriesResponse, RemoveLocalInventoriesMetadata> future =
productServiceClient.removeLocalInventoriesOperationCallable().futureCall(request);
// Do something.
RemoveLocalInventoriesResponse response = future.get();
}
Type | Description |
OperationCallable<RemoveLocalInventoriesRequest,RemoveLocalInventoriesResponse,RemoveLocalInventoriesMetadata> |
setInventoryAsync(Product inventory, FieldMask setMask)
public final OperationFuture<SetInventoryResponse,SetInventoryMetadata> setInventoryAsync(Product inventory, FieldMask setMask)
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information will be preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
Product inventory = Product.newBuilder().build();
FieldMask setMask = FieldMask.newBuilder().build();
SetInventoryResponse response =
productServiceClient.setInventoryAsync(inventory, setMask).get();
}
Name | Description |
inventory | Product Required. The inventory information to update. The allowable fields to update are:
If SetInventoryRequest.inventory.name is empty or invalid, an INVALID_ARGUMENT error is returned. If the caller does not have permission to update the Product named in Product.name, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the Product to update does not have existing inventory information, the provided inventory information will be inserted. If the Product to update has existing inventory information, the provided inventory information will be merged while respecting the last update time for each inventory field, using the provided or default value for SetInventoryRequest.set_time. The caller can replace place IDs for a subset of fulfillment types in the following ways:
The caller can clear all place IDs from a subset of fulfillment types in the following ways:
The last update time is recorded for the following inventory fields:
If a full overwrite of inventory information while ignoring timestamps is needed, ProductService.UpdateProduct should be invoked instead. |
setMask | FieldMask Indicates which inventory fields in the provided Product to update. At least one field must be provided. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned and the entire update will be ignored. |
Type | Description |
OperationFuture<SetInventoryResponse,SetInventoryMetadata> |
setInventoryAsync(SetInventoryRequest request)
public final OperationFuture<SetInventoryResponse,SetInventoryMetadata> setInventoryAsync(SetInventoryRequest request)
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information will be preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
SetInventoryRequest request =
SetInventoryRequest.newBuilder()
.setInventory(Product.newBuilder().build())
.setSetMask(FieldMask.newBuilder().build())
.setSetTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
SetInventoryResponse response = productServiceClient.setInventoryAsync(request).get();
}
Name | Description |
request | SetInventoryRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<SetInventoryResponse,SetInventoryMetadata> |
setInventoryCallable()
public final UnaryCallable<SetInventoryRequest,Operation> setInventoryCallable()
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information will be preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
SetInventoryRequest request =
SetInventoryRequest.newBuilder()
.setInventory(Product.newBuilder().build())
.setSetMask(FieldMask.newBuilder().build())
.setSetTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future = productServiceClient.setInventoryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetInventoryRequest,Operation> |
setInventoryOperationCallable()
public final OperationCallable<SetInventoryRequest,SetInventoryResponse,SetInventoryMetadata> setInventoryOperationCallable()
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information will be preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
SetInventoryRequest request =
SetInventoryRequest.newBuilder()
.setInventory(Product.newBuilder().build())
.setSetMask(FieldMask.newBuilder().build())
.setSetTime(Timestamp.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<SetInventoryResponse, SetInventoryMetadata> future =
productServiceClient.setInventoryOperationCallable().futureCall(request);
// Do something.
SetInventoryResponse response = future.get();
}
Type | Description |
OperationCallable<SetInventoryRequest,SetInventoryResponse,SetInventoryMetadata> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateProduct(Product product, FieldMask updateMask)
public final Product updateProduct(Product product, FieldMask updateMask)
Updates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
Product product = Product.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Product response = productServiceClient.updateProduct(product, updateMask);
}
Name | Description |
product | Product Required. The product to update/create. If the caller does not have permission to update the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the Product to update does not exist and allow_missing is not set, a NOT_FOUND error is returned. |
updateMask | FieldMask Indicates which fields in the provided Product to update. The immutable and output only fields are NOT supported. If not set, all supported fields (the fields that are neither immutable nor output only) are updated. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. The attribute key can be updated by setting the mask path as "attributes.${key_name}". If a key name is present in the mask but not in the patching product from the request, this key will be deleted after the update. |
Type | Description |
Product |
updateProduct(UpdateProductRequest request)
public final Product updateProduct(UpdateProductRequest request)
Updates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
UpdateProductRequest request =
UpdateProductRequest.newBuilder()
.setProduct(Product.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setAllowMissing(true)
.build();
Product response = productServiceClient.updateProduct(request);
}
Name | Description |
request | UpdateProductRequest The request object containing all of the parameters for the API call. |
Type | Description |
Product |
updateProductCallable()
public final UnaryCallable<UpdateProductRequest,Product> updateProductCallable()
Updates a Product.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
UpdateProductRequest request =
UpdateProductRequest.newBuilder()
.setProduct(Product.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Product> future = productServiceClient.updateProductCallable().futureCall(request);
// Do something.
Product response = future.get();
}
Type | Description |
UnaryCallable<UpdateProductRequest,Product> |