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 package com.google.cloud.retail.v2; 18 19 import com.google.api.HttpBody; 20 import com.google.api.core.BetaApi; 21 import com.google.api.gax.core.BackgroundResource; 22 import com.google.api.gax.httpjson.longrunning.OperationsClient; 23 import com.google.api.gax.longrunning.OperationFuture; 24 import com.google.api.gax.rpc.OperationCallable; 25 import com.google.api.gax.rpc.UnaryCallable; 26 import com.google.cloud.retail.v2.stub.UserEventServiceStub; 27 import com.google.cloud.retail.v2.stub.UserEventServiceStubSettings; 28 import com.google.longrunning.Operation; 29 import java.io.IOException; 30 import java.util.concurrent.TimeUnit; 31 import javax.annotation.Generated; 32 33 // AUTO-GENERATED DOCUMENTATION AND CLASS. 34 /** 35 * Service Description: Service for ingesting end user actions on the customer website. 36 * 37 * <p>This class provides the ability to make remote calls to the backing service through method 38 * calls that map to API methods. Sample code to get started: 39 * 40 * <pre>{@code 41 * // This snippet has been automatically generated and should be regarded as a code template only. 42 * // It will require modifications to work: 43 * // - It may require correct/in-range values for request initialization. 44 * // - It may require specifying regional endpoints when creating the service client as shown in 45 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 46 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 47 * WriteUserEventRequest request = 48 * WriteUserEventRequest.newBuilder() 49 * .setParent("parent-995424086") 50 * .setUserEvent(UserEvent.newBuilder().build()) 51 * .setWriteAsync(true) 52 * .build(); 53 * UserEvent response = userEventServiceClient.writeUserEvent(request); 54 * } 55 * }</pre> 56 * 57 * <p>Note: close() needs to be called on the UserEventServiceClient object to clean up resources 58 * such as threads. In the example above, try-with-resources is used, which automatically calls 59 * close(). 60 * 61 * <p>The surface of this class includes several types of Java methods for each of the API's 62 * methods: 63 * 64 * <ol> 65 * <li>A "flattened" method. With this type of method, the fields of the request type have been 66 * converted into function parameters. It may be the case that not all fields are available as 67 * parameters, and not every API method will have a flattened method entry point. 68 * <li>A "request object" method. This type of method only takes one parameter, a request object, 69 * which must be constructed before the call. Not every API method will have a request object 70 * method. 71 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 72 * callable object, which can be used to initiate calls to the service. 73 * </ol> 74 * 75 * <p>See the individual methods for example code. 76 * 77 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 78 * these names, this class includes a format method for each type of name, and additionally a parse 79 * method to extract the individual identifiers contained within names that are returned. 80 * 81 * <p>This class can be customized by passing in a custom instance of UserEventServiceSettings to 82 * create(). For example: 83 * 84 * <p>To customize credentials: 85 * 86 * <pre>{@code 87 * // This snippet has been automatically generated and should be regarded as a code template only. 88 * // It will require modifications to work: 89 * // - It may require correct/in-range values for request initialization. 90 * // - It may require specifying regional endpoints when creating the service client as shown in 91 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 92 * UserEventServiceSettings userEventServiceSettings = 93 * UserEventServiceSettings.newBuilder() 94 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 95 * .build(); 96 * UserEventServiceClient userEventServiceClient = 97 * UserEventServiceClient.create(userEventServiceSettings); 98 * }</pre> 99 * 100 * <p>To customize the endpoint: 101 * 102 * <pre>{@code 103 * // This snippet has been automatically generated and should be regarded as a code template only. 104 * // It will require modifications to work: 105 * // - It may require correct/in-range values for request initialization. 106 * // - It may require specifying regional endpoints when creating the service client as shown in 107 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 108 * UserEventServiceSettings userEventServiceSettings = 109 * UserEventServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 110 * UserEventServiceClient userEventServiceClient = 111 * UserEventServiceClient.create(userEventServiceSettings); 112 * }</pre> 113 * 114 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 115 * the wire: 116 * 117 * <pre>{@code 118 * // This snippet has been automatically generated and should be regarded as a code template only. 119 * // It will require modifications to work: 120 * // - It may require correct/in-range values for request initialization. 121 * // - It may require specifying regional endpoints when creating the service client as shown in 122 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 123 * UserEventServiceSettings userEventServiceSettings = 124 * UserEventServiceSettings.newHttpJsonBuilder().build(); 125 * UserEventServiceClient userEventServiceClient = 126 * UserEventServiceClient.create(userEventServiceSettings); 127 * }</pre> 128 * 129 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 130 */ 131 @Generated("by gapic-generator-java") 132 public class UserEventServiceClient implements BackgroundResource { 133 private final UserEventServiceSettings settings; 134 private final UserEventServiceStub stub; 135 private final OperationsClient httpJsonOperationsClient; 136 private final com.google.longrunning.OperationsClient operationsClient; 137 138 /** Constructs an instance of UserEventServiceClient with default settings. */ create()139 public static final UserEventServiceClient create() throws IOException { 140 return create(UserEventServiceSettings.newBuilder().build()); 141 } 142 143 /** 144 * Constructs an instance of UserEventServiceClient, using the given settings. The channels are 145 * created based on the settings passed in, or defaults for any settings that are not set. 146 */ create(UserEventServiceSettings settings)147 public static final UserEventServiceClient create(UserEventServiceSettings settings) 148 throws IOException { 149 return new UserEventServiceClient(settings); 150 } 151 152 /** 153 * Constructs an instance of UserEventServiceClient, using the given stub for making calls. This 154 * is for advanced usage - prefer using create(UserEventServiceSettings). 155 */ create(UserEventServiceStub stub)156 public static final UserEventServiceClient create(UserEventServiceStub stub) { 157 return new UserEventServiceClient(stub); 158 } 159 160 /** 161 * Constructs an instance of UserEventServiceClient, using the given settings. This is protected 162 * so that it is easy to make a subclass, but otherwise, the static factory methods should be 163 * preferred. 164 */ UserEventServiceClient(UserEventServiceSettings settings)165 protected UserEventServiceClient(UserEventServiceSettings settings) throws IOException { 166 this.settings = settings; 167 this.stub = ((UserEventServiceStubSettings) settings.getStubSettings()).createStub(); 168 this.operationsClient = 169 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 170 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 171 } 172 UserEventServiceClient(UserEventServiceStub stub)173 protected UserEventServiceClient(UserEventServiceStub stub) { 174 this.settings = null; 175 this.stub = stub; 176 this.operationsClient = 177 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 178 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 179 } 180 getSettings()181 public final UserEventServiceSettings getSettings() { 182 return settings; 183 } 184 getStub()185 public UserEventServiceStub getStub() { 186 return stub; 187 } 188 189 /** 190 * Returns the OperationsClient that can be used to query the status of a long-running operation 191 * returned by another API method call. 192 */ getOperationsClient()193 public final com.google.longrunning.OperationsClient getOperationsClient() { 194 return operationsClient; 195 } 196 197 /** 198 * Returns the OperationsClient that can be used to query the status of a long-running operation 199 * returned by another API method call. 200 */ 201 @BetaApi getHttpJsonOperationsClient()202 public final OperationsClient getHttpJsonOperationsClient() { 203 return httpJsonOperationsClient; 204 } 205 206 // AUTO-GENERATED DOCUMENTATION AND METHOD. 207 /** 208 * Writes a single user event. 209 * 210 * <p>Sample code: 211 * 212 * <pre>{@code 213 * // This snippet has been automatically generated and should be regarded as a code template only. 214 * // It will require modifications to work: 215 * // - It may require correct/in-range values for request initialization. 216 * // - It may require specifying regional endpoints when creating the service client as shown in 217 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 218 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 219 * WriteUserEventRequest request = 220 * WriteUserEventRequest.newBuilder() 221 * .setParent("parent-995424086") 222 * .setUserEvent(UserEvent.newBuilder().build()) 223 * .setWriteAsync(true) 224 * .build(); 225 * UserEvent response = userEventServiceClient.writeUserEvent(request); 226 * } 227 * }</pre> 228 * 229 * @param request The request object containing all of the parameters for the API call. 230 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 231 */ writeUserEvent(WriteUserEventRequest request)232 public final UserEvent writeUserEvent(WriteUserEventRequest request) { 233 return writeUserEventCallable().call(request); 234 } 235 236 // AUTO-GENERATED DOCUMENTATION AND METHOD. 237 /** 238 * Writes a single user event. 239 * 240 * <p>Sample code: 241 * 242 * <pre>{@code 243 * // This snippet has been automatically generated and should be regarded as a code template only. 244 * // It will require modifications to work: 245 * // - It may require correct/in-range values for request initialization. 246 * // - It may require specifying regional endpoints when creating the service client as shown in 247 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 248 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 249 * WriteUserEventRequest request = 250 * WriteUserEventRequest.newBuilder() 251 * .setParent("parent-995424086") 252 * .setUserEvent(UserEvent.newBuilder().build()) 253 * .setWriteAsync(true) 254 * .build(); 255 * ApiFuture<UserEvent> future = 256 * userEventServiceClient.writeUserEventCallable().futureCall(request); 257 * // Do something. 258 * UserEvent response = future.get(); 259 * } 260 * }</pre> 261 */ writeUserEventCallable()262 public final UnaryCallable<WriteUserEventRequest, UserEvent> writeUserEventCallable() { 263 return stub.writeUserEventCallable(); 264 } 265 266 // AUTO-GENERATED DOCUMENTATION AND METHOD. 267 /** 268 * Writes a single user event from the browser. This uses a GET request to due to browser 269 * restriction of POST-ing to a 3rd party domain. 270 * 271 * <p>This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users 272 * should not call this method directly. 273 * 274 * <p>Sample code: 275 * 276 * <pre>{@code 277 * // This snippet has been automatically generated and should be regarded as a code template only. 278 * // It will require modifications to work: 279 * // - It may require correct/in-range values for request initialization. 280 * // - It may require specifying regional endpoints when creating the service client as shown in 281 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 282 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 283 * CollectUserEventRequest request = 284 * CollectUserEventRequest.newBuilder() 285 * .setParent("parent-995424086") 286 * .setUserEvent("userEvent315571599") 287 * .setUri("uri116076") 288 * .setEts(100772) 289 * .setRawJson("rawJson985449776") 290 * .build(); 291 * HttpBody response = userEventServiceClient.collectUserEvent(request); 292 * } 293 * }</pre> 294 * 295 * @param request The request object containing all of the parameters for the API call. 296 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 297 */ collectUserEvent(CollectUserEventRequest request)298 public final HttpBody collectUserEvent(CollectUserEventRequest request) { 299 return collectUserEventCallable().call(request); 300 } 301 302 // AUTO-GENERATED DOCUMENTATION AND METHOD. 303 /** 304 * Writes a single user event from the browser. This uses a GET request to due to browser 305 * restriction of POST-ing to a 3rd party domain. 306 * 307 * <p>This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users 308 * should not call this method directly. 309 * 310 * <p>Sample code: 311 * 312 * <pre>{@code 313 * // This snippet has been automatically generated and should be regarded as a code template only. 314 * // It will require modifications to work: 315 * // - It may require correct/in-range values for request initialization. 316 * // - It may require specifying regional endpoints when creating the service client as shown in 317 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 318 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 319 * CollectUserEventRequest request = 320 * CollectUserEventRequest.newBuilder() 321 * .setParent("parent-995424086") 322 * .setUserEvent("userEvent315571599") 323 * .setUri("uri116076") 324 * .setEts(100772) 325 * .setRawJson("rawJson985449776") 326 * .build(); 327 * ApiFuture<HttpBody> future = 328 * userEventServiceClient.collectUserEventCallable().futureCall(request); 329 * // Do something. 330 * HttpBody response = future.get(); 331 * } 332 * }</pre> 333 */ collectUserEventCallable()334 public final UnaryCallable<CollectUserEventRequest, HttpBody> collectUserEventCallable() { 335 return stub.collectUserEventCallable(); 336 } 337 338 // AUTO-GENERATED DOCUMENTATION AND METHOD. 339 /** 340 * Deletes permanently all user events specified by the filter provided. Depending on the number 341 * of events specified by the filter, this operation could take hours or days to complete. To test 342 * a filter, use the list command first. 343 * 344 * <p>Sample code: 345 * 346 * <pre>{@code 347 * // This snippet has been automatically generated and should be regarded as a code template only. 348 * // It will require modifications to work: 349 * // - It may require correct/in-range values for request initialization. 350 * // - It may require specifying regional endpoints when creating the service client as shown in 351 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 352 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 353 * PurgeUserEventsRequest request = 354 * PurgeUserEventsRequest.newBuilder() 355 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 356 * .setFilter("filter-1274492040") 357 * .setForce(true) 358 * .build(); 359 * PurgeUserEventsResponse response = userEventServiceClient.purgeUserEventsAsync(request).get(); 360 * } 361 * }</pre> 362 * 363 * @param request The request object containing all of the parameters for the API call. 364 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 365 */ purgeUserEventsAsync( PurgeUserEventsRequest request)366 public final OperationFuture<PurgeUserEventsResponse, PurgeMetadata> purgeUserEventsAsync( 367 PurgeUserEventsRequest request) { 368 return purgeUserEventsOperationCallable().futureCall(request); 369 } 370 371 // AUTO-GENERATED DOCUMENTATION AND METHOD. 372 /** 373 * Deletes permanently all user events specified by the filter provided. Depending on the number 374 * of events specified by the filter, this operation could take hours or days to complete. To test 375 * a filter, use the list command first. 376 * 377 * <p>Sample code: 378 * 379 * <pre>{@code 380 * // This snippet has been automatically generated and should be regarded as a code template only. 381 * // It will require modifications to work: 382 * // - It may require correct/in-range values for request initialization. 383 * // - It may require specifying regional endpoints when creating the service client as shown in 384 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 385 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 386 * PurgeUserEventsRequest request = 387 * PurgeUserEventsRequest.newBuilder() 388 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 389 * .setFilter("filter-1274492040") 390 * .setForce(true) 391 * .build(); 392 * OperationFuture<PurgeUserEventsResponse, PurgeMetadata> future = 393 * userEventServiceClient.purgeUserEventsOperationCallable().futureCall(request); 394 * // Do something. 395 * PurgeUserEventsResponse response = future.get(); 396 * } 397 * }</pre> 398 */ 399 public final OperationCallable<PurgeUserEventsRequest, PurgeUserEventsResponse, PurgeMetadata> purgeUserEventsOperationCallable()400 purgeUserEventsOperationCallable() { 401 return stub.purgeUserEventsOperationCallable(); 402 } 403 404 // AUTO-GENERATED DOCUMENTATION AND METHOD. 405 /** 406 * Deletes permanently all user events specified by the filter provided. Depending on the number 407 * of events specified by the filter, this operation could take hours or days to complete. To test 408 * a filter, use the list command first. 409 * 410 * <p>Sample code: 411 * 412 * <pre>{@code 413 * // This snippet has been automatically generated and should be regarded as a code template only. 414 * // It will require modifications to work: 415 * // - It may require correct/in-range values for request initialization. 416 * // - It may require specifying regional endpoints when creating the service client as shown in 417 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 418 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 419 * PurgeUserEventsRequest request = 420 * PurgeUserEventsRequest.newBuilder() 421 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 422 * .setFilter("filter-1274492040") 423 * .setForce(true) 424 * .build(); 425 * ApiFuture<Operation> future = 426 * userEventServiceClient.purgeUserEventsCallable().futureCall(request); 427 * // Do something. 428 * Operation response = future.get(); 429 * } 430 * }</pre> 431 */ purgeUserEventsCallable()432 public final UnaryCallable<PurgeUserEventsRequest, Operation> purgeUserEventsCallable() { 433 return stub.purgeUserEventsCallable(); 434 } 435 436 // AUTO-GENERATED DOCUMENTATION AND METHOD. 437 /** 438 * Bulk import of User events. Request processing might be synchronous. Events that already exist 439 * are skipped. Use this method for backfilling historical user events. 440 * 441 * <p>`Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of 442 * the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`. 443 * 444 * <p>Sample code: 445 * 446 * <pre>{@code 447 * // This snippet has been automatically generated and should be regarded as a code template only. 448 * // It will require modifications to work: 449 * // - It may require correct/in-range values for request initialization. 450 * // - It may require specifying regional endpoints when creating the service client as shown in 451 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 452 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 453 * ImportUserEventsRequest request = 454 * ImportUserEventsRequest.newBuilder() 455 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 456 * .setInputConfig(UserEventInputConfig.newBuilder().build()) 457 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 458 * .build(); 459 * ImportUserEventsResponse response = 460 * userEventServiceClient.importUserEventsAsync(request).get(); 461 * } 462 * }</pre> 463 * 464 * @param request The request object containing all of the parameters for the API call. 465 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 466 */ importUserEventsAsync( ImportUserEventsRequest request)467 public final OperationFuture<ImportUserEventsResponse, ImportMetadata> importUserEventsAsync( 468 ImportUserEventsRequest request) { 469 return importUserEventsOperationCallable().futureCall(request); 470 } 471 472 // AUTO-GENERATED DOCUMENTATION AND METHOD. 473 /** 474 * Bulk import of User events. Request processing might be synchronous. Events that already exist 475 * are skipped. Use this method for backfilling historical user events. 476 * 477 * <p>`Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of 478 * the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`. 479 * 480 * <p>Sample code: 481 * 482 * <pre>{@code 483 * // This snippet has been automatically generated and should be regarded as a code template only. 484 * // It will require modifications to work: 485 * // - It may require correct/in-range values for request initialization. 486 * // - It may require specifying regional endpoints when creating the service client as shown in 487 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 488 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 489 * ImportUserEventsRequest request = 490 * ImportUserEventsRequest.newBuilder() 491 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 492 * .setInputConfig(UserEventInputConfig.newBuilder().build()) 493 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 494 * .build(); 495 * OperationFuture<ImportUserEventsResponse, ImportMetadata> future = 496 * userEventServiceClient.importUserEventsOperationCallable().futureCall(request); 497 * // Do something. 498 * ImportUserEventsResponse response = future.get(); 499 * } 500 * }</pre> 501 */ 502 public final OperationCallable<ImportUserEventsRequest, ImportUserEventsResponse, ImportMetadata> importUserEventsOperationCallable()503 importUserEventsOperationCallable() { 504 return stub.importUserEventsOperationCallable(); 505 } 506 507 // AUTO-GENERATED DOCUMENTATION AND METHOD. 508 /** 509 * Bulk import of User events. Request processing might be synchronous. Events that already exist 510 * are skipped. Use this method for backfilling historical user events. 511 * 512 * <p>`Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of 513 * the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`. 514 * 515 * <p>Sample code: 516 * 517 * <pre>{@code 518 * // This snippet has been automatically generated and should be regarded as a code template only. 519 * // It will require modifications to work: 520 * // - It may require correct/in-range values for request initialization. 521 * // - It may require specifying regional endpoints when creating the service client as shown in 522 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 523 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 524 * ImportUserEventsRequest request = 525 * ImportUserEventsRequest.newBuilder() 526 * .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) 527 * .setInputConfig(UserEventInputConfig.newBuilder().build()) 528 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 529 * .build(); 530 * ApiFuture<Operation> future = 531 * userEventServiceClient.importUserEventsCallable().futureCall(request); 532 * // Do something. 533 * Operation response = future.get(); 534 * } 535 * }</pre> 536 */ importUserEventsCallable()537 public final UnaryCallable<ImportUserEventsRequest, Operation> importUserEventsCallable() { 538 return stub.importUserEventsCallable(); 539 } 540 541 // AUTO-GENERATED DOCUMENTATION AND METHOD. 542 /** 543 * Starts a user-event rejoin operation with latest product catalog. Events are not annotated with 544 * detailed product information for products that are missing from the catalog when the user event 545 * is ingested. These events are stored as unjoined events with limited usage on training and 546 * serving. You can use this method to start a join operation on specified events with the latest 547 * version of product catalog. You can also use this method to correct events joined with the 548 * wrong product catalog. A rejoin operation can take hours or days to complete. 549 * 550 * <p>Sample code: 551 * 552 * <pre>{@code 553 * // This snippet has been automatically generated and should be regarded as a code template only. 554 * // It will require modifications to work: 555 * // - It may require correct/in-range values for request initialization. 556 * // - It may require specifying regional endpoints when creating the service client as shown in 557 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 558 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 559 * RejoinUserEventsRequest request = 560 * RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build(); 561 * RejoinUserEventsResponse response = 562 * userEventServiceClient.rejoinUserEventsAsync(request).get(); 563 * } 564 * }</pre> 565 * 566 * @param request The request object containing all of the parameters for the API call. 567 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 568 */ 569 public final OperationFuture<RejoinUserEventsResponse, RejoinUserEventsMetadata> rejoinUserEventsAsync(RejoinUserEventsRequest request)570 rejoinUserEventsAsync(RejoinUserEventsRequest request) { 571 return rejoinUserEventsOperationCallable().futureCall(request); 572 } 573 574 // AUTO-GENERATED DOCUMENTATION AND METHOD. 575 /** 576 * Starts a user-event rejoin operation with latest product catalog. Events are not annotated with 577 * detailed product information for products that are missing from the catalog when the user event 578 * is ingested. These events are stored as unjoined events with limited usage on training and 579 * serving. You can use this method to start a join operation on specified events with the latest 580 * version of product catalog. You can also use this method to correct events joined with the 581 * wrong product catalog. A rejoin operation can take hours or days to complete. 582 * 583 * <p>Sample code: 584 * 585 * <pre>{@code 586 * // This snippet has been automatically generated and should be regarded as a code template only. 587 * // It will require modifications to work: 588 * // - It may require correct/in-range values for request initialization. 589 * // - It may require specifying regional endpoints when creating the service client as shown in 590 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 591 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 592 * RejoinUserEventsRequest request = 593 * RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build(); 594 * OperationFuture<RejoinUserEventsResponse, RejoinUserEventsMetadata> future = 595 * userEventServiceClient.rejoinUserEventsOperationCallable().futureCall(request); 596 * // Do something. 597 * RejoinUserEventsResponse response = future.get(); 598 * } 599 * }</pre> 600 */ 601 public final OperationCallable< 602 RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> rejoinUserEventsOperationCallable()603 rejoinUserEventsOperationCallable() { 604 return stub.rejoinUserEventsOperationCallable(); 605 } 606 607 // AUTO-GENERATED DOCUMENTATION AND METHOD. 608 /** 609 * Starts a user-event rejoin operation with latest product catalog. Events are not annotated with 610 * detailed product information for products that are missing from the catalog when the user event 611 * is ingested. These events are stored as unjoined events with limited usage on training and 612 * serving. You can use this method to start a join operation on specified events with the latest 613 * version of product catalog. You can also use this method to correct events joined with the 614 * wrong product catalog. A rejoin operation can take hours or days to complete. 615 * 616 * <p>Sample code: 617 * 618 * <pre>{@code 619 * // This snippet has been automatically generated and should be regarded as a code template only. 620 * // It will require modifications to work: 621 * // - It may require correct/in-range values for request initialization. 622 * // - It may require specifying regional endpoints when creating the service client as shown in 623 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 624 * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) { 625 * RejoinUserEventsRequest request = 626 * RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build(); 627 * ApiFuture<Operation> future = 628 * userEventServiceClient.rejoinUserEventsCallable().futureCall(request); 629 * // Do something. 630 * Operation response = future.get(); 631 * } 632 * }</pre> 633 */ rejoinUserEventsCallable()634 public final UnaryCallable<RejoinUserEventsRequest, Operation> rejoinUserEventsCallable() { 635 return stub.rejoinUserEventsCallable(); 636 } 637 638 @Override close()639 public final void close() { 640 stub.close(); 641 } 642 643 @Override shutdown()644 public void shutdown() { 645 stub.shutdown(); 646 } 647 648 @Override isShutdown()649 public boolean isShutdown() { 650 return stub.isShutdown(); 651 } 652 653 @Override isTerminated()654 public boolean isTerminated() { 655 return stub.isTerminated(); 656 } 657 658 @Override shutdownNow()659 public void shutdownNow() { 660 stub.shutdownNow(); 661 } 662 663 @Override awaitTermination(long duration, TimeUnit unit)664 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 665 return stub.awaitTermination(duration, unit); 666 } 667 } 668