1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * A client to Retail API 19 * 20 * <p>The interfaces provided are listed below, along with usage samples. 21 * 22 * <p>======================= CatalogServiceClient ======================= 23 * 24 * <p>Service Description: Service for managing catalog configuration. 25 * 26 * <p>Sample for CatalogServiceClient: 27 * 28 * <pre>{@code 29 * // This snippet has been automatically generated and should be regarded as a code template only. 30 * // It will require modifications to work: 31 * // - It may require correct/in-range values for request initialization. 32 * // - It may require specifying regional endpoints when creating the service client as shown in 33 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 34 * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { 35 * Catalog catalog = Catalog.newBuilder().build(); 36 * FieldMask updateMask = FieldMask.newBuilder().build(); 37 * Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask); 38 * } 39 * }</pre> 40 * 41 * <p>======================= CompletionServiceClient ======================= 42 * 43 * <p>Service Description: Autocomplete service for retail. 44 * 45 * <p>This feature is only available for users who have Retail Search enabled. Enable Retail Search 46 * on Cloud Console before using this feature. 47 * 48 * <p>Sample for CompletionServiceClient: 49 * 50 * <pre>{@code 51 * // This snippet has been automatically generated and should be regarded as a code template only. 52 * // It will require modifications to work: 53 * // - It may require correct/in-range values for request initialization. 54 * // - It may require specifying regional endpoints when creating the service client as shown in 55 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 56 * try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) { 57 * CompleteQueryRequest request = 58 * CompleteQueryRequest.newBuilder() 59 * .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 60 * .setQuery("query107944136") 61 * .setVisitorId("visitorId1880545833") 62 * .addAllLanguageCodes(new ArrayList<String>()) 63 * .setDeviceType("deviceType781190832") 64 * .setDataset("dataset1443214456") 65 * .setMaxSuggestions(618824852) 66 * .setEntity("entity-1298275357") 67 * .build(); 68 * CompleteQueryResponse response = completionServiceClient.completeQuery(request); 69 * } 70 * }</pre> 71 * 72 * <p>======================= ControlServiceClient ======================= 73 * 74 * <p>Service Description: Service for modifying Control. 75 * 76 * <p>Sample for ControlServiceClient: 77 * 78 * <pre>{@code 79 * // This snippet has been automatically generated and should be regarded as a code template only. 80 * // It will require modifications to work: 81 * // - It may require correct/in-range values for request initialization. 82 * // - It may require specifying regional endpoints when creating the service client as shown in 83 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 84 * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { 85 * CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); 86 * Control control = Control.newBuilder().build(); 87 * String controlId = "controlId-395080872"; 88 * Control response = controlServiceClient.createControl(parent, control, controlId); 89 * } 90 * }</pre> 91 * 92 * <p>======================= ModelServiceClient ======================= 93 * 94 * <p>Service Description: Service for performing CRUD operations on models. Recommendation models 95 * contain all the metadata necessary to generate a set of models for the `Predict()` API. A model 96 * is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. 97 * Frequently Bought Together on Home Page). 98 * 99 * <p>This service allows you to do the following: 100 * 101 * <ul> 102 * <li>Initiate training of a model. 103 * <li>Pause training of an existing model. 104 * <li>List all the available models along with their metadata. 105 * <li>Control their tuning schedule. 106 * </ul> 107 * 108 * <p>Sample for ModelServiceClient: 109 * 110 * <pre>{@code 111 * // This snippet has been automatically generated and should be regarded as a code template only. 112 * // It will require modifications to work: 113 * // - It may require correct/in-range values for request initialization. 114 * // - It may require specifying regional endpoints when creating the service client as shown in 115 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 116 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 117 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[MODEL]"); 118 * Model response = modelServiceClient.getModel(name); 119 * } 120 * }</pre> 121 * 122 * <p>======================= PredictionServiceClient ======================= 123 * 124 * <p>Service Description: Service for making recommendation prediction. 125 * 126 * <p>Sample for PredictionServiceClient: 127 * 128 * <pre>{@code 129 * // This snippet has been automatically generated and should be regarded as a code template only. 130 * // It will require modifications to work: 131 * // - It may require correct/in-range values for request initialization. 132 * // - It may require specifying regional endpoints when creating the service client as shown in 133 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 134 * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { 135 * PredictRequest request = 136 * PredictRequest.newBuilder() 137 * .setPlacement("placement1792938725") 138 * .setUserEvent(UserEvent.newBuilder().build()) 139 * .setPageSize(883849137) 140 * .setPageToken("pageToken873572522") 141 * .setFilter("filter-1274492040") 142 * .setValidateOnly(true) 143 * .putAllParams(new HashMap<String, Value>()) 144 * .putAllLabels(new HashMap<String, String>()) 145 * .build(); 146 * PredictResponse response = predictionServiceClient.predict(request); 147 * } 148 * }</pre> 149 * 150 * <p>======================= ProductServiceClient ======================= 151 * 152 * <p>Service Description: Service for ingesting [Product][google.cloud.retail.v2.Product] 153 * information of the customer's website. 154 * 155 * <p>Sample for ProductServiceClient: 156 * 157 * <pre>{@code 158 * // This snippet has been automatically generated and should be regarded as a code template only. 159 * // It will require modifications to work: 160 * // - It may require correct/in-range values for request initialization. 161 * // - It may require specifying regional endpoints when creating the service client as shown in 162 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 163 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 164 * BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); 165 * Product product = Product.newBuilder().build(); 166 * String productId = "productId-1051830678"; 167 * Product response = productServiceClient.createProduct(parent, product, productId); 168 * } 169 * }</pre> 170 * 171 * <p>======================= SearchServiceClient ======================= 172 * 173 * <p>Service Description: Service for search. 174 * 175 * <p>This feature is only available for users who have Retail Search enabled. Enable Retail Search 176 * on Cloud Console before using this feature. 177 * 178 * <p>Sample for SearchServiceClient: 179 * 180 * <pre>{@code 181 * // This snippet has been automatically generated and should be regarded as a code template only. 182 * // It will require modifications to work: 183 * // - It may require correct/in-range values for request initialization. 184 * // - It may require specifying regional endpoints when creating the service client as shown in 185 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 186 * try (SearchServiceClient searchServiceClient = SearchServiceClient.create()) { 187 * SearchRequest request = 188 * SearchRequest.newBuilder() 189 * .setPlacement("placement1792938725") 190 * .setBranch( 191 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 192 * .setQuery("query107944136") 193 * .setVisitorId("visitorId1880545833") 194 * .setUserInfo(UserInfo.newBuilder().build()) 195 * .setPageSize(883849137) 196 * .setPageToken("pageToken873572522") 197 * .setOffset(-1019779949) 198 * .setFilter("filter-1274492040") 199 * .setCanonicalFilter("canonicalFilter-722283124") 200 * .setOrderBy("orderBy-1207110587") 201 * .addAllFacetSpecs(new ArrayList<SearchRequest.FacetSpec>()) 202 * .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) 203 * .setBoostSpec(SearchRequest.BoostSpec.newBuilder().build()) 204 * .setQueryExpansionSpec(SearchRequest.QueryExpansionSpec.newBuilder().build()) 205 * .addAllVariantRollupKeys(new ArrayList<String>()) 206 * .addAllPageCategories(new ArrayList<String>()) 207 * .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) 208 * .putAllLabels(new HashMap<String, String>()) 209 * .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build()) 210 * .setEntity("entity-1298275357") 211 * .build(); 212 * for (SearchResponse.SearchResult element : searchServiceClient.search(request).iterateAll()) { 213 * // doThingsWith(element); 214 * } 215 * } 216 * }</pre> 217 * 218 * <p>======================= ServingConfigServiceClient ======================= 219 * 220 * <p>Service Description: Service for modifying ServingConfig. 221 * 222 * <p>Sample for ServingConfigServiceClient: 223 * 224 * <pre>{@code 225 * // This snippet has been automatically generated and should be regarded as a code template only. 226 * // It will require modifications to work: 227 * // - It may require correct/in-range values for request initialization. 228 * // - It may require specifying regional endpoints when creating the service client as shown in 229 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 230 * try (ServingConfigServiceClient servingConfigServiceClient = 231 * ServingConfigServiceClient.create()) { 232 * CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); 233 * ServingConfig servingConfig = ServingConfig.newBuilder().build(); 234 * String servingConfigId = "servingConfigId-831052759"; 235 * ServingConfig response = 236 * servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); 237 * } 238 * }</pre> 239 * 240 * <p>======================= UserEventServiceClient ======================= 241 * 242 * <p>Service Description: Service for ingesting end user actions on the customer website. 243 * 244 * <p>Sample for UserEventServiceClient: 245 * 246 * <pre>{@code 247 * // This snippet has been automatically generated and should be regarded as a code template only. 248 * // It will require modifications to work: 249 * // - It may require correct/in-range values for request initialization. 250 * // - It may require specifying regional endpoints when creating the service client as shown in 251 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 252 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 253 * WriteUserEventRequest request = 254 * WriteUserEventRequest.newBuilder() 255 * .setParent("parent-995424086") 256 * .setUserEvent(UserEvent.newBuilder().build()) 257 * .setWriteAsync(true) 258 * .build(); 259 * UserEvent response = userEventServiceClient.writeUserEvent(request); 260 * } 261 * }</pre> 262 */ 263 @Generated("by gapic-generator-java") 264 package com.google.cloud.retail.v2; 265 266 import javax.annotation.Generated; 267