- 2.57.0 (latest)
- 2.56.0
- 2.55.0
- 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
com.google.cloud.retail.v2
A client to Retail API
The interfaces provided are listed below, along with usage samples.
CatalogServiceClient
Service Description: Service for managing catalog configuration.
Sample for CatalogServiceClient:
try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
Catalog catalog = Catalog.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
}
CompletionServiceClient
Service Description: Auto-completion service for retail.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample for CompletionServiceClient:
try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
CompleteQueryRequest request =
CompleteQueryRequest.newBuilder()
.setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
.setQuery("query107944136")
.setVisitorId("visitorId1880545833")
.addAllLanguageCodes(new ArrayList<String>())
.setDeviceType("deviceType781190832")
.setDataset("dataset1443214456")
.setMaxSuggestions(618824852)
.build();
CompleteQueryResponse response = completionServiceClient.completeQuery(request);
}
PredictionServiceClient
Service Description: Service for making recommendation prediction.
Sample for PredictionServiceClient:
try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
PredictRequest request =
PredictRequest.newBuilder()
.setPlacement("placement1792938725")
.setUserEvent(UserEvent.newBuilder().build())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setValidateOnly(true)
.putAllParams(new HashMap<String, Value>())
.putAllLabels(new HashMap<String, String>())
.build();
PredictResponse response = predictionServiceClient.predict(request);
}
ProductServiceClient
Service Description: Service for ingesting Product information of the customer's website.
Sample for ProductServiceClient:
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);
}
SearchServiceClient
Service Description: Service for search.
This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.
Sample for SearchServiceClient:
try (SearchServiceClient searchServiceClient = SearchServiceClient.create()) {
SearchRequest request =
SearchRequest.newBuilder()
.setPlacement("placement1792938725")
.setBranch(
BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
.setQuery("query107944136")
.setVisitorId("visitorId1880545833")
.setUserInfo(UserInfo.newBuilder().build())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOffset(-1019779949)
.setFilter("filter-1274492040")
.setCanonicalFilter("canonicalFilter-722283124")
.setOrderBy("orderBy-1207110587")
.addAllFacetSpecs(new ArrayList<SearchRequest.FacetSpec>())
.setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build())
.setBoostSpec(SearchRequest.BoostSpec.newBuilder().build())
.setQueryExpansionSpec(SearchRequest.QueryExpansionSpec.newBuilder().build())
.addAllVariantRollupKeys(new ArrayList<String>())
.addAllPageCategories(new ArrayList<String>())
.setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
.build();
for (SearchResponse.SearchResult element : searchServiceClient.search(request).iterateAll()) {
// doThingsWith(element);
}
}
UserEventServiceClient
Service Description: Service for ingesting end user actions on the customer website.
Sample for UserEventServiceClient:
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
WriteUserEventRequest request =
WriteUserEventRequest.newBuilder()
.setParent("parent-995424086")
.setUserEvent(UserEvent.newBuilder().build())
.build();
UserEvent response = userEventServiceClient.writeUserEvent(request);
}