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.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.cloud.retail.v2.stub.ProductServiceStub; 32 import com.google.cloud.retail.v2.stub.ProductServiceStubSettings; 33 import com.google.common.util.concurrent.MoreExecutors; 34 import com.google.longrunning.Operation; 35 import com.google.protobuf.Empty; 36 import com.google.protobuf.FieldMask; 37 import java.io.IOException; 38 import java.util.List; 39 import java.util.concurrent.TimeUnit; 40 import javax.annotation.Generated; 41 42 // AUTO-GENERATED DOCUMENTATION AND CLASS. 43 /** 44 * Service Description: Service for ingesting [Product][google.cloud.retail.v2.Product] information 45 * of the customer's website. 46 * 47 * <p>This class provides the ability to make remote calls to the backing service through method 48 * calls that map to API methods. Sample code to get started: 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 (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 57 * BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); 58 * Product product = Product.newBuilder().build(); 59 * String productId = "productId-1051830678"; 60 * Product response = productServiceClient.createProduct(parent, product, productId); 61 * } 62 * }</pre> 63 * 64 * <p>Note: close() needs to be called on the ProductServiceClient object to clean up resources such 65 * as threads. In the example above, try-with-resources is used, which automatically calls close(). 66 * 67 * <p>The surface of this class includes several types of Java methods for each of the API's 68 * methods: 69 * 70 * <ol> 71 * <li>A "flattened" method. With this type of method, the fields of the request type have been 72 * converted into function parameters. It may be the case that not all fields are available as 73 * parameters, and not every API method will have a flattened method entry point. 74 * <li>A "request object" method. This type of method only takes one parameter, a request object, 75 * which must be constructed before the call. Not every API method will have a request object 76 * method. 77 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 78 * callable object, which can be used to initiate calls to the service. 79 * </ol> 80 * 81 * <p>See the individual methods for example code. 82 * 83 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 84 * these names, this class includes a format method for each type of name, and additionally a parse 85 * method to extract the individual identifiers contained within names that are returned. 86 * 87 * <p>This class can be customized by passing in a custom instance of ProductServiceSettings to 88 * create(). For example: 89 * 90 * <p>To customize credentials: 91 * 92 * <pre>{@code 93 * // This snippet has been automatically generated and should be regarded as a code template only. 94 * // It will require modifications to work: 95 * // - It may require correct/in-range values for request initialization. 96 * // - It may require specifying regional endpoints when creating the service client as shown in 97 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 98 * ProductServiceSettings productServiceSettings = 99 * ProductServiceSettings.newBuilder() 100 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 101 * .build(); 102 * ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings); 103 * }</pre> 104 * 105 * <p>To customize the endpoint: 106 * 107 * <pre>{@code 108 * // This snippet has been automatically generated and should be regarded as a code template only. 109 * // It will require modifications to work: 110 * // - It may require correct/in-range values for request initialization. 111 * // - It may require specifying regional endpoints when creating the service client as shown in 112 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 113 * ProductServiceSettings productServiceSettings = 114 * ProductServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 115 * ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings); 116 * }</pre> 117 * 118 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 119 * the wire: 120 * 121 * <pre>{@code 122 * // This snippet has been automatically generated and should be regarded as a code template only. 123 * // It will require modifications to work: 124 * // - It may require correct/in-range values for request initialization. 125 * // - It may require specifying regional endpoints when creating the service client as shown in 126 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 127 * ProductServiceSettings productServiceSettings = 128 * ProductServiceSettings.newHttpJsonBuilder().build(); 129 * ProductServiceClient productServiceClient = ProductServiceClient.create(productServiceSettings); 130 * }</pre> 131 * 132 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 133 */ 134 @Generated("by gapic-generator-java") 135 public class ProductServiceClient implements BackgroundResource { 136 private final ProductServiceSettings settings; 137 private final ProductServiceStub stub; 138 private final OperationsClient httpJsonOperationsClient; 139 private final com.google.longrunning.OperationsClient operationsClient; 140 141 /** Constructs an instance of ProductServiceClient with default settings. */ create()142 public static final ProductServiceClient create() throws IOException { 143 return create(ProductServiceSettings.newBuilder().build()); 144 } 145 146 /** 147 * Constructs an instance of ProductServiceClient, using the given settings. The channels are 148 * created based on the settings passed in, or defaults for any settings that are not set. 149 */ create(ProductServiceSettings settings)150 public static final ProductServiceClient create(ProductServiceSettings settings) 151 throws IOException { 152 return new ProductServiceClient(settings); 153 } 154 155 /** 156 * Constructs an instance of ProductServiceClient, using the given stub for making calls. This is 157 * for advanced usage - prefer using create(ProductServiceSettings). 158 */ create(ProductServiceStub stub)159 public static final ProductServiceClient create(ProductServiceStub stub) { 160 return new ProductServiceClient(stub); 161 } 162 163 /** 164 * Constructs an instance of ProductServiceClient, using the given settings. This is protected so 165 * that it is easy to make a subclass, but otherwise, the static factory methods should be 166 * preferred. 167 */ ProductServiceClient(ProductServiceSettings settings)168 protected ProductServiceClient(ProductServiceSettings settings) throws IOException { 169 this.settings = settings; 170 this.stub = ((ProductServiceStubSettings) settings.getStubSettings()).createStub(); 171 this.operationsClient = 172 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 173 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 174 } 175 ProductServiceClient(ProductServiceStub stub)176 protected ProductServiceClient(ProductServiceStub stub) { 177 this.settings = null; 178 this.stub = stub; 179 this.operationsClient = 180 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 181 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 182 } 183 getSettings()184 public final ProductServiceSettings getSettings() { 185 return settings; 186 } 187 getStub()188 public ProductServiceStub getStub() { 189 return stub; 190 } 191 192 /** 193 * Returns the OperationsClient that can be used to query the status of a long-running operation 194 * returned by another API method call. 195 */ getOperationsClient()196 public final com.google.longrunning.OperationsClient getOperationsClient() { 197 return operationsClient; 198 } 199 200 /** 201 * Returns the OperationsClient that can be used to query the status of a long-running operation 202 * returned by another API method call. 203 */ 204 @BetaApi getHttpJsonOperationsClient()205 public final OperationsClient getHttpJsonOperationsClient() { 206 return httpJsonOperationsClient; 207 } 208 209 // AUTO-GENERATED DOCUMENTATION AND METHOD. 210 /** 211 * Creates a [Product][google.cloud.retail.v2.Product]. 212 * 213 * <p>Sample code: 214 * 215 * <pre>{@code 216 * // This snippet has been automatically generated and should be regarded as a code template only. 217 * // It will require modifications to work: 218 * // - It may require correct/in-range values for request initialization. 219 * // - It may require specifying regional endpoints when creating the service client as shown in 220 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 221 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 222 * BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); 223 * Product product = Product.newBuilder().build(); 224 * String productId = "productId-1051830678"; 225 * Product response = productServiceClient.createProduct(parent, product, productId); 226 * } 227 * }</pre> 228 * 229 * @param parent Required. The parent catalog resource name, such as 230 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. 231 * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. 232 * @param productId Required. The ID to use for the [Product][google.cloud.retail.v2.Product], 233 * which will become the final component of the 234 * [Product.name][google.cloud.retail.v2.Product.name]. 235 * <p>If the caller does not have permission to create the 236 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 237 * PERMISSION_DENIED error is returned. 238 * <p>This field must be unique among all [Product][google.cloud.retail.v2.Product]s with the 239 * same [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an 240 * ALREADY_EXISTS error is returned. 241 * <p>This field must be a UTF-8 encoded string with a length limit of 128 characters. 242 * Otherwise, an INVALID_ARGUMENT error is returned. 243 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 244 */ createProduct(BranchName parent, Product product, String productId)245 public final Product createProduct(BranchName parent, Product product, String productId) { 246 CreateProductRequest request = 247 CreateProductRequest.newBuilder() 248 .setParent(parent == null ? null : parent.toString()) 249 .setProduct(product) 250 .setProductId(productId) 251 .build(); 252 return createProduct(request); 253 } 254 255 // AUTO-GENERATED DOCUMENTATION AND METHOD. 256 /** 257 * Creates a [Product][google.cloud.retail.v2.Product]. 258 * 259 * <p>Sample code: 260 * 261 * <pre>{@code 262 * // This snippet has been automatically generated and should be regarded as a code template only. 263 * // It will require modifications to work: 264 * // - It may require correct/in-range values for request initialization. 265 * // - It may require specifying regional endpoints when creating the service client as shown in 266 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 267 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 268 * String parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString(); 269 * Product product = Product.newBuilder().build(); 270 * String productId = "productId-1051830678"; 271 * Product response = productServiceClient.createProduct(parent, product, productId); 272 * } 273 * }</pre> 274 * 275 * @param parent Required. The parent catalog resource name, such as 276 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. 277 * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. 278 * @param productId Required. The ID to use for the [Product][google.cloud.retail.v2.Product], 279 * which will become the final component of the 280 * [Product.name][google.cloud.retail.v2.Product.name]. 281 * <p>If the caller does not have permission to create the 282 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 283 * PERMISSION_DENIED error is returned. 284 * <p>This field must be unique among all [Product][google.cloud.retail.v2.Product]s with the 285 * same [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an 286 * ALREADY_EXISTS error is returned. 287 * <p>This field must be a UTF-8 encoded string with a length limit of 128 characters. 288 * Otherwise, an INVALID_ARGUMENT error is returned. 289 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 290 */ createProduct(String parent, Product product, String productId)291 public final Product createProduct(String parent, Product product, String productId) { 292 CreateProductRequest request = 293 CreateProductRequest.newBuilder() 294 .setParent(parent) 295 .setProduct(product) 296 .setProductId(productId) 297 .build(); 298 return createProduct(request); 299 } 300 301 // AUTO-GENERATED DOCUMENTATION AND METHOD. 302 /** 303 * Creates a [Product][google.cloud.retail.v2.Product]. 304 * 305 * <p>Sample code: 306 * 307 * <pre>{@code 308 * // This snippet has been automatically generated and should be regarded as a code template only. 309 * // It will require modifications to work: 310 * // - It may require correct/in-range values for request initialization. 311 * // - It may require specifying regional endpoints when creating the service client as shown in 312 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 313 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 314 * CreateProductRequest request = 315 * CreateProductRequest.newBuilder() 316 * .setParent( 317 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 318 * .setProduct(Product.newBuilder().build()) 319 * .setProductId("productId-1051830678") 320 * .build(); 321 * Product response = productServiceClient.createProduct(request); 322 * } 323 * }</pre> 324 * 325 * @param request The request object containing all of the parameters for the API call. 326 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 327 */ createProduct(CreateProductRequest request)328 public final Product createProduct(CreateProductRequest request) { 329 return createProductCallable().call(request); 330 } 331 332 // AUTO-GENERATED DOCUMENTATION AND METHOD. 333 /** 334 * Creates a [Product][google.cloud.retail.v2.Product]. 335 * 336 * <p>Sample code: 337 * 338 * <pre>{@code 339 * // This snippet has been automatically generated and should be regarded as a code template only. 340 * // It will require modifications to work: 341 * // - It may require correct/in-range values for request initialization. 342 * // - It may require specifying regional endpoints when creating the service client as shown in 343 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 344 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 345 * CreateProductRequest request = 346 * CreateProductRequest.newBuilder() 347 * .setParent( 348 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 349 * .setProduct(Product.newBuilder().build()) 350 * .setProductId("productId-1051830678") 351 * .build(); 352 * ApiFuture<Product> future = productServiceClient.createProductCallable().futureCall(request); 353 * // Do something. 354 * Product response = future.get(); 355 * } 356 * }</pre> 357 */ createProductCallable()358 public final UnaryCallable<CreateProductRequest, Product> createProductCallable() { 359 return stub.createProductCallable(); 360 } 361 362 // AUTO-GENERATED DOCUMENTATION AND METHOD. 363 /** 364 * Gets a [Product][google.cloud.retail.v2.Product]. 365 * 366 * <p>Sample code: 367 * 368 * <pre>{@code 369 * // This snippet has been automatically generated and should be regarded as a code template only. 370 * // It will require modifications to work: 371 * // - It may require correct/in-range values for request initialization. 372 * // - It may require specifying regional endpoints when creating the service client as shown in 373 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 374 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 375 * ProductName name = 376 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 377 * Product response = productServiceClient.getProduct(name); 378 * } 379 * }</pre> 380 * 381 * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as 382 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 383 * <p>If the caller does not have permission to access the 384 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 385 * PERMISSION_DENIED error is returned. 386 * <p>If the requested [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND 387 * error is returned. 388 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 389 */ getProduct(ProductName name)390 public final Product getProduct(ProductName name) { 391 GetProductRequest request = 392 GetProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 393 return getProduct(request); 394 } 395 396 // AUTO-GENERATED DOCUMENTATION AND METHOD. 397 /** 398 * Gets a [Product][google.cloud.retail.v2.Product]. 399 * 400 * <p>Sample code: 401 * 402 * <pre>{@code 403 * // This snippet has been automatically generated and should be regarded as a code template only. 404 * // It will require modifications to work: 405 * // - It may require correct/in-range values for request initialization. 406 * // - It may require specifying regional endpoints when creating the service client as shown in 407 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 408 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 409 * String name = 410 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 411 * .toString(); 412 * Product response = productServiceClient.getProduct(name); 413 * } 414 * }</pre> 415 * 416 * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as 417 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 418 * <p>If the caller does not have permission to access the 419 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 420 * PERMISSION_DENIED error is returned. 421 * <p>If the requested [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND 422 * error is returned. 423 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 424 */ getProduct(String name)425 public final Product getProduct(String name) { 426 GetProductRequest request = GetProductRequest.newBuilder().setName(name).build(); 427 return getProduct(request); 428 } 429 430 // AUTO-GENERATED DOCUMENTATION AND METHOD. 431 /** 432 * Gets a [Product][google.cloud.retail.v2.Product]. 433 * 434 * <p>Sample code: 435 * 436 * <pre>{@code 437 * // This snippet has been automatically generated and should be regarded as a code template only. 438 * // It will require modifications to work: 439 * // - It may require correct/in-range values for request initialization. 440 * // - It may require specifying regional endpoints when creating the service client as shown in 441 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 442 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 443 * GetProductRequest request = 444 * GetProductRequest.newBuilder() 445 * .setName( 446 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 447 * .toString()) 448 * .build(); 449 * Product response = productServiceClient.getProduct(request); 450 * } 451 * }</pre> 452 * 453 * @param request The request object containing all of the parameters for the API call. 454 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 455 */ getProduct(GetProductRequest request)456 public final Product getProduct(GetProductRequest request) { 457 return getProductCallable().call(request); 458 } 459 460 // AUTO-GENERATED DOCUMENTATION AND METHOD. 461 /** 462 * Gets a [Product][google.cloud.retail.v2.Product]. 463 * 464 * <p>Sample code: 465 * 466 * <pre>{@code 467 * // This snippet has been automatically generated and should be regarded as a code template only. 468 * // It will require modifications to work: 469 * // - It may require correct/in-range values for request initialization. 470 * // - It may require specifying regional endpoints when creating the service client as shown in 471 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 472 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 473 * GetProductRequest request = 474 * GetProductRequest.newBuilder() 475 * .setName( 476 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 477 * .toString()) 478 * .build(); 479 * ApiFuture<Product> future = productServiceClient.getProductCallable().futureCall(request); 480 * // Do something. 481 * Product response = future.get(); 482 * } 483 * }</pre> 484 */ getProductCallable()485 public final UnaryCallable<GetProductRequest, Product> getProductCallable() { 486 return stub.getProductCallable(); 487 } 488 489 // AUTO-GENERATED DOCUMENTATION AND METHOD. 490 /** 491 * Gets a list of [Product][google.cloud.retail.v2.Product]s. 492 * 493 * <p>Sample code: 494 * 495 * <pre>{@code 496 * // This snippet has been automatically generated and should be regarded as a code template only. 497 * // It will require modifications to work: 498 * // - It may require correct/in-range values for request initialization. 499 * // - It may require specifying regional endpoints when creating the service client as shown in 500 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 501 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 502 * BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); 503 * for (Product element : productServiceClient.listProducts(parent).iterateAll()) { 504 * // doThingsWith(element); 505 * } 506 * } 507 * }</pre> 508 * 509 * @param parent Required. The parent branch resource name, such as 510 * `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use `default_branch` 511 * as the branch ID, to list products under the default branch. 512 * <p>If the caller does not have permission to list 513 * [Product][google.cloud.retail.v2.Product]s under this branch, regardless of whether or not 514 * this branch exists, a PERMISSION_DENIED error is returned. 515 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 516 */ listProducts(BranchName parent)517 public final ListProductsPagedResponse listProducts(BranchName parent) { 518 ListProductsRequest request = 519 ListProductsRequest.newBuilder() 520 .setParent(parent == null ? null : parent.toString()) 521 .build(); 522 return listProducts(request); 523 } 524 525 // AUTO-GENERATED DOCUMENTATION AND METHOD. 526 /** 527 * Gets a list of [Product][google.cloud.retail.v2.Product]s. 528 * 529 * <p>Sample code: 530 * 531 * <pre>{@code 532 * // This snippet has been automatically generated and should be regarded as a code template only. 533 * // It will require modifications to work: 534 * // - It may require correct/in-range values for request initialization. 535 * // - It may require specifying regional endpoints when creating the service client as shown in 536 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 537 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 538 * String parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString(); 539 * for (Product element : productServiceClient.listProducts(parent).iterateAll()) { 540 * // doThingsWith(element); 541 * } 542 * } 543 * }</pre> 544 * 545 * @param parent Required. The parent branch resource name, such as 546 * `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use `default_branch` 547 * as the branch ID, to list products under the default branch. 548 * <p>If the caller does not have permission to list 549 * [Product][google.cloud.retail.v2.Product]s under this branch, regardless of whether or not 550 * this branch exists, a PERMISSION_DENIED error is returned. 551 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 552 */ listProducts(String parent)553 public final ListProductsPagedResponse listProducts(String parent) { 554 ListProductsRequest request = ListProductsRequest.newBuilder().setParent(parent).build(); 555 return listProducts(request); 556 } 557 558 // AUTO-GENERATED DOCUMENTATION AND METHOD. 559 /** 560 * Gets a list of [Product][google.cloud.retail.v2.Product]s. 561 * 562 * <p>Sample code: 563 * 564 * <pre>{@code 565 * // This snippet has been automatically generated and should be regarded as a code template only. 566 * // It will require modifications to work: 567 * // - It may require correct/in-range values for request initialization. 568 * // - It may require specifying regional endpoints when creating the service client as shown in 569 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 570 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 571 * ListProductsRequest request = 572 * ListProductsRequest.newBuilder() 573 * .setParent( 574 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 575 * .setPageSize(883849137) 576 * .setPageToken("pageToken873572522") 577 * .setFilter("filter-1274492040") 578 * .setReadMask(FieldMask.newBuilder().build()) 579 * .build(); 580 * for (Product element : productServiceClient.listProducts(request).iterateAll()) { 581 * // doThingsWith(element); 582 * } 583 * } 584 * }</pre> 585 * 586 * @param request The request object containing all of the parameters for the API call. 587 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 588 */ listProducts(ListProductsRequest request)589 public final ListProductsPagedResponse listProducts(ListProductsRequest request) { 590 return listProductsPagedCallable().call(request); 591 } 592 593 // AUTO-GENERATED DOCUMENTATION AND METHOD. 594 /** 595 * Gets a list of [Product][google.cloud.retail.v2.Product]s. 596 * 597 * <p>Sample code: 598 * 599 * <pre>{@code 600 * // This snippet has been automatically generated and should be regarded as a code template only. 601 * // It will require modifications to work: 602 * // - It may require correct/in-range values for request initialization. 603 * // - It may require specifying regional endpoints when creating the service client as shown in 604 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 605 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 606 * ListProductsRequest request = 607 * ListProductsRequest.newBuilder() 608 * .setParent( 609 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 610 * .setPageSize(883849137) 611 * .setPageToken("pageToken873572522") 612 * .setFilter("filter-1274492040") 613 * .setReadMask(FieldMask.newBuilder().build()) 614 * .build(); 615 * ApiFuture<Product> future = 616 * productServiceClient.listProductsPagedCallable().futureCall(request); 617 * // Do something. 618 * for (Product element : future.get().iterateAll()) { 619 * // doThingsWith(element); 620 * } 621 * } 622 * }</pre> 623 */ 624 public final UnaryCallable<ListProductsRequest, ListProductsPagedResponse> listProductsPagedCallable()625 listProductsPagedCallable() { 626 return stub.listProductsPagedCallable(); 627 } 628 629 // AUTO-GENERATED DOCUMENTATION AND METHOD. 630 /** 631 * Gets a list of [Product][google.cloud.retail.v2.Product]s. 632 * 633 * <p>Sample code: 634 * 635 * <pre>{@code 636 * // This snippet has been automatically generated and should be regarded as a code template only. 637 * // It will require modifications to work: 638 * // - It may require correct/in-range values for request initialization. 639 * // - It may require specifying regional endpoints when creating the service client as shown in 640 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 641 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 642 * ListProductsRequest request = 643 * ListProductsRequest.newBuilder() 644 * .setParent( 645 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 646 * .setPageSize(883849137) 647 * .setPageToken("pageToken873572522") 648 * .setFilter("filter-1274492040") 649 * .setReadMask(FieldMask.newBuilder().build()) 650 * .build(); 651 * while (true) { 652 * ListProductsResponse response = productServiceClient.listProductsCallable().call(request); 653 * for (Product element : response.getProductsList()) { 654 * // doThingsWith(element); 655 * } 656 * String nextPageToken = response.getNextPageToken(); 657 * if (!Strings.isNullOrEmpty(nextPageToken)) { 658 * request = request.toBuilder().setPageToken(nextPageToken).build(); 659 * } else { 660 * break; 661 * } 662 * } 663 * } 664 * }</pre> 665 */ listProductsCallable()666 public final UnaryCallable<ListProductsRequest, ListProductsResponse> listProductsCallable() { 667 return stub.listProductsCallable(); 668 } 669 670 // AUTO-GENERATED DOCUMENTATION AND METHOD. 671 /** 672 * Updates a [Product][google.cloud.retail.v2.Product]. 673 * 674 * <p>Sample code: 675 * 676 * <pre>{@code 677 * // This snippet has been automatically generated and should be regarded as a code template only. 678 * // It will require modifications to work: 679 * // - It may require correct/in-range values for request initialization. 680 * // - It may require specifying regional endpoints when creating the service client as shown in 681 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 682 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 683 * Product product = Product.newBuilder().build(); 684 * FieldMask updateMask = FieldMask.newBuilder().build(); 685 * Product response = productServiceClient.updateProduct(product, updateMask); 686 * } 687 * }</pre> 688 * 689 * @param product Required. The product to update/create. 690 * <p>If the caller does not have permission to update the 691 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 692 * PERMISSION_DENIED error is returned. 693 * <p>If the [Product][google.cloud.retail.v2.Product] to update does not exist and 694 * [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing] is not set, a 695 * NOT_FOUND error is returned. 696 * @param updateMask Indicates which fields in the provided 697 * [Product][google.cloud.retail.v2.Product] to update. The immutable and output only fields 698 * are NOT supported. If not set, all supported fields (the fields that are neither immutable 699 * nor output only) are updated. 700 * <p>If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. 701 * <p>The attribute key can be updated by setting the mask path as "attributes.${key_name}". 702 * If a key name is present in the mask but not in the patching product from the request, this 703 * key will be deleted after the update. 704 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 705 */ updateProduct(Product product, FieldMask updateMask)706 public final Product updateProduct(Product product, FieldMask updateMask) { 707 UpdateProductRequest request = 708 UpdateProductRequest.newBuilder().setProduct(product).setUpdateMask(updateMask).build(); 709 return updateProduct(request); 710 } 711 712 // AUTO-GENERATED DOCUMENTATION AND METHOD. 713 /** 714 * Updates a [Product][google.cloud.retail.v2.Product]. 715 * 716 * <p>Sample code: 717 * 718 * <pre>{@code 719 * // This snippet has been automatically generated and should be regarded as a code template only. 720 * // It will require modifications to work: 721 * // - It may require correct/in-range values for request initialization. 722 * // - It may require specifying regional endpoints when creating the service client as shown in 723 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 724 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 725 * UpdateProductRequest request = 726 * UpdateProductRequest.newBuilder() 727 * .setProduct(Product.newBuilder().build()) 728 * .setUpdateMask(FieldMask.newBuilder().build()) 729 * .setAllowMissing(true) 730 * .build(); 731 * Product response = productServiceClient.updateProduct(request); 732 * } 733 * }</pre> 734 * 735 * @param request The request object containing all of the parameters for the API call. 736 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 737 */ updateProduct(UpdateProductRequest request)738 public final Product updateProduct(UpdateProductRequest request) { 739 return updateProductCallable().call(request); 740 } 741 742 // AUTO-GENERATED DOCUMENTATION AND METHOD. 743 /** 744 * Updates a [Product][google.cloud.retail.v2.Product]. 745 * 746 * <p>Sample code: 747 * 748 * <pre>{@code 749 * // This snippet has been automatically generated and should be regarded as a code template only. 750 * // It will require modifications to work: 751 * // - It may require correct/in-range values for request initialization. 752 * // - It may require specifying regional endpoints when creating the service client as shown in 753 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 754 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 755 * UpdateProductRequest request = 756 * UpdateProductRequest.newBuilder() 757 * .setProduct(Product.newBuilder().build()) 758 * .setUpdateMask(FieldMask.newBuilder().build()) 759 * .setAllowMissing(true) 760 * .build(); 761 * ApiFuture<Product> future = productServiceClient.updateProductCallable().futureCall(request); 762 * // Do something. 763 * Product response = future.get(); 764 * } 765 * }</pre> 766 */ updateProductCallable()767 public final UnaryCallable<UpdateProductRequest, Product> updateProductCallable() { 768 return stub.updateProductCallable(); 769 } 770 771 // AUTO-GENERATED DOCUMENTATION AND METHOD. 772 /** 773 * Deletes a [Product][google.cloud.retail.v2.Product]. 774 * 775 * <p>Sample code: 776 * 777 * <pre>{@code 778 * // This snippet has been automatically generated and should be regarded as a code template only. 779 * // It will require modifications to work: 780 * // - It may require correct/in-range values for request initialization. 781 * // - It may require specifying regional endpoints when creating the service client as shown in 782 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 783 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 784 * ProductName name = 785 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 786 * productServiceClient.deleteProduct(name); 787 * } 788 * }</pre> 789 * 790 * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as 791 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 792 * <p>If the caller does not have permission to delete the 793 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 794 * PERMISSION_DENIED error is returned. 795 * <p>If the [Product][google.cloud.retail.v2.Product] to delete does not exist, a NOT_FOUND 796 * error is returned. 797 * <p>The [Product][google.cloud.retail.v2.Product] to delete can neither be a 798 * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] 799 * [Product][google.cloud.retail.v2.Product] member nor a 800 * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] 801 * [Product][google.cloud.retail.v2.Product] with more than one 802 * [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an INVALID_ARGUMENT 803 * error is returned. 804 * <p>All inventory information for the named [Product][google.cloud.retail.v2.Product] will 805 * be deleted. 806 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 807 */ deleteProduct(ProductName name)808 public final void deleteProduct(ProductName name) { 809 DeleteProductRequest request = 810 DeleteProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 811 deleteProduct(request); 812 } 813 814 // AUTO-GENERATED DOCUMENTATION AND METHOD. 815 /** 816 * Deletes a [Product][google.cloud.retail.v2.Product]. 817 * 818 * <p>Sample code: 819 * 820 * <pre>{@code 821 * // This snippet has been automatically generated and should be regarded as a code template only. 822 * // It will require modifications to work: 823 * // - It may require correct/in-range values for request initialization. 824 * // - It may require specifying regional endpoints when creating the service client as shown in 825 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 826 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 827 * String name = 828 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 829 * .toString(); 830 * productServiceClient.deleteProduct(name); 831 * } 832 * }</pre> 833 * 834 * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as 835 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 836 * <p>If the caller does not have permission to delete the 837 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 838 * PERMISSION_DENIED error is returned. 839 * <p>If the [Product][google.cloud.retail.v2.Product] to delete does not exist, a NOT_FOUND 840 * error is returned. 841 * <p>The [Product][google.cloud.retail.v2.Product] to delete can neither be a 842 * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] 843 * [Product][google.cloud.retail.v2.Product] member nor a 844 * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] 845 * [Product][google.cloud.retail.v2.Product] with more than one 846 * [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an INVALID_ARGUMENT 847 * error is returned. 848 * <p>All inventory information for the named [Product][google.cloud.retail.v2.Product] will 849 * be deleted. 850 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 851 */ deleteProduct(String name)852 public final void deleteProduct(String name) { 853 DeleteProductRequest request = DeleteProductRequest.newBuilder().setName(name).build(); 854 deleteProduct(request); 855 } 856 857 // AUTO-GENERATED DOCUMENTATION AND METHOD. 858 /** 859 * Deletes a [Product][google.cloud.retail.v2.Product]. 860 * 861 * <p>Sample code: 862 * 863 * <pre>{@code 864 * // This snippet has been automatically generated and should be regarded as a code template only. 865 * // It will require modifications to work: 866 * // - It may require correct/in-range values for request initialization. 867 * // - It may require specifying regional endpoints when creating the service client as shown in 868 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 869 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 870 * DeleteProductRequest request = 871 * DeleteProductRequest.newBuilder() 872 * .setName( 873 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 874 * .toString()) 875 * .build(); 876 * productServiceClient.deleteProduct(request); 877 * } 878 * }</pre> 879 * 880 * @param request The request object containing all of the parameters for the API call. 881 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 882 */ deleteProduct(DeleteProductRequest request)883 public final void deleteProduct(DeleteProductRequest request) { 884 deleteProductCallable().call(request); 885 } 886 887 // AUTO-GENERATED DOCUMENTATION AND METHOD. 888 /** 889 * Deletes a [Product][google.cloud.retail.v2.Product]. 890 * 891 * <p>Sample code: 892 * 893 * <pre>{@code 894 * // This snippet has been automatically generated and should be regarded as a code template only. 895 * // It will require modifications to work: 896 * // - It may require correct/in-range values for request initialization. 897 * // - It may require specifying regional endpoints when creating the service client as shown in 898 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 899 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 900 * DeleteProductRequest request = 901 * DeleteProductRequest.newBuilder() 902 * .setName( 903 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 904 * .toString()) 905 * .build(); 906 * ApiFuture<Empty> future = productServiceClient.deleteProductCallable().futureCall(request); 907 * // Do something. 908 * future.get(); 909 * } 910 * }</pre> 911 */ deleteProductCallable()912 public final UnaryCallable<DeleteProductRequest, Empty> deleteProductCallable() { 913 return stub.deleteProductCallable(); 914 } 915 916 // AUTO-GENERATED DOCUMENTATION AND METHOD. 917 /** 918 * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. 919 * 920 * <p>Request processing may be synchronous. Non-existing items are created. 921 * 922 * <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to 923 * be successfully updated. 924 * 925 * <p>Sample code: 926 * 927 * <pre>{@code 928 * // This snippet has been automatically generated and should be regarded as a code template only. 929 * // It will require modifications to work: 930 * // - It may require correct/in-range values for request initialization. 931 * // - It may require specifying regional endpoints when creating the service client as shown in 932 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 933 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 934 * ImportProductsRequest request = 935 * ImportProductsRequest.newBuilder() 936 * .setParent( 937 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 938 * .setRequestId("requestId693933066") 939 * .setInputConfig(ProductInputConfig.newBuilder().build()) 940 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 941 * .setUpdateMask(FieldMask.newBuilder().build()) 942 * .setNotificationPubsubTopic("notificationPubsubTopic-1361224991") 943 * .build(); 944 * ImportProductsResponse response = productServiceClient.importProductsAsync(request).get(); 945 * } 946 * }</pre> 947 * 948 * @param request The request object containing all of the parameters for the API call. 949 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 950 */ importProductsAsync( ImportProductsRequest request)951 public final OperationFuture<ImportProductsResponse, ImportMetadata> importProductsAsync( 952 ImportProductsRequest request) { 953 return importProductsOperationCallable().futureCall(request); 954 } 955 956 // AUTO-GENERATED DOCUMENTATION AND METHOD. 957 /** 958 * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. 959 * 960 * <p>Request processing may be synchronous. Non-existing items are created. 961 * 962 * <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to 963 * be successfully updated. 964 * 965 * <p>Sample code: 966 * 967 * <pre>{@code 968 * // This snippet has been automatically generated and should be regarded as a code template only. 969 * // It will require modifications to work: 970 * // - It may require correct/in-range values for request initialization. 971 * // - It may require specifying regional endpoints when creating the service client as shown in 972 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 973 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 974 * ImportProductsRequest request = 975 * ImportProductsRequest.newBuilder() 976 * .setParent( 977 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 978 * .setRequestId("requestId693933066") 979 * .setInputConfig(ProductInputConfig.newBuilder().build()) 980 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 981 * .setUpdateMask(FieldMask.newBuilder().build()) 982 * .setNotificationPubsubTopic("notificationPubsubTopic-1361224991") 983 * .build(); 984 * OperationFuture<ImportProductsResponse, ImportMetadata> future = 985 * productServiceClient.importProductsOperationCallable().futureCall(request); 986 * // Do something. 987 * ImportProductsResponse response = future.get(); 988 * } 989 * }</pre> 990 */ 991 public final OperationCallable<ImportProductsRequest, ImportProductsResponse, ImportMetadata> importProductsOperationCallable()992 importProductsOperationCallable() { 993 return stub.importProductsOperationCallable(); 994 } 995 996 // AUTO-GENERATED DOCUMENTATION AND METHOD. 997 /** 998 * Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. 999 * 1000 * <p>Request processing may be synchronous. Non-existing items are created. 1001 * 1002 * <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to 1003 * be successfully updated. 1004 * 1005 * <p>Sample code: 1006 * 1007 * <pre>{@code 1008 * // This snippet has been automatically generated and should be regarded as a code template only. 1009 * // It will require modifications to work: 1010 * // - It may require correct/in-range values for request initialization. 1011 * // - It may require specifying regional endpoints when creating the service client as shown in 1012 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1013 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1014 * ImportProductsRequest request = 1015 * ImportProductsRequest.newBuilder() 1016 * .setParent( 1017 * BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) 1018 * .setRequestId("requestId693933066") 1019 * .setInputConfig(ProductInputConfig.newBuilder().build()) 1020 * .setErrorsConfig(ImportErrorsConfig.newBuilder().build()) 1021 * .setUpdateMask(FieldMask.newBuilder().build()) 1022 * .setNotificationPubsubTopic("notificationPubsubTopic-1361224991") 1023 * .build(); 1024 * ApiFuture<Operation> future = 1025 * productServiceClient.importProductsCallable().futureCall(request); 1026 * // Do something. 1027 * Operation response = future.get(); 1028 * } 1029 * }</pre> 1030 */ importProductsCallable()1031 public final UnaryCallable<ImportProductsRequest, Operation> importProductsCallable() { 1032 return stub.importProductsCallable(); 1033 } 1034 1035 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1036 /** 1037 * Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting 1038 * the last update timestamps of each inventory field. 1039 * 1040 * <p>This process is asynchronous and does not require the 1041 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1042 * the request is valid, the update is enqueued and processed downstream. As a consequence, when a 1043 * response is returned, updates are not immediately manifested in the 1044 * [Product][google.cloud.retail.v2.Product] queried by 1045 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1046 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1047 * 1048 * <p>When inventory is updated with 1049 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 1050 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the 1051 * specified inventory field value(s) overwrite any existing value(s) while ignoring the last 1052 * update time for this field. Furthermore, the last update times for the specified inventory 1053 * fields are overwritten by the times of the 1054 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or 1055 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. 1056 * 1057 * <p>If no inventory fields are set in 1058 * [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any 1059 * pre-existing inventory information for this product is used. 1060 * 1061 * <p>If no inventory fields are set in 1062 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any 1063 * existing inventory information is preserved. 1064 * 1065 * <p>Pre-existing inventory information can only be updated with 1066 * [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], 1067 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], 1068 * and 1069 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1070 * 1071 * <p>The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the 1072 * [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. 1073 * 1074 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1075 * with the stale updates are not marked as [done][google.longrunning.Operation.done] until they 1076 * are obsolete. 1077 * 1078 * <p>Sample code: 1079 * 1080 * <pre>{@code 1081 * // This snippet has been automatically generated and should be regarded as a code template only. 1082 * // It will require modifications to work: 1083 * // - It may require correct/in-range values for request initialization. 1084 * // - It may require specifying regional endpoints when creating the service client as shown in 1085 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1086 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1087 * Product inventory = Product.newBuilder().build(); 1088 * FieldMask setMask = FieldMask.newBuilder().build(); 1089 * SetInventoryResponse response = 1090 * productServiceClient.setInventoryAsync(inventory, setMask).get(); 1091 * } 1092 * }</pre> 1093 * 1094 * @param inventory Required. The inventory information to update. The allowable fields to update 1095 * are: 1096 * <ul> 1097 * <li>[Product.price_info][google.cloud.retail.v2.Product.price_info] 1098 * <li>[Product.availability][google.cloud.retail.v2.Product.availability] 1099 * <li>[Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] 1100 * <li>[Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] The 1101 * updated inventory fields must be specified in 1102 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]. 1103 * </ul> 1104 * <p>If [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name] is empty or 1105 * invalid, an INVALID_ARGUMENT error is returned. 1106 * <p>If the caller does not have permission to update the 1107 * [Product][google.cloud.retail.v2.Product] named in 1108 * [Product.name][google.cloud.retail.v2.Product.name], regardless of whether or not it 1109 * exists, a PERMISSION_DENIED error is returned. 1110 * <p>If the [Product][google.cloud.retail.v2.Product] to update does not have existing 1111 * inventory information, the provided inventory information will be inserted. 1112 * <p>If the [Product][google.cloud.retail.v2.Product] to update has existing inventory 1113 * information, the provided inventory information will be merged while respecting the last 1114 * update time for each inventory field, using the provided or default value for 1115 * [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time]. 1116 * <p>The caller can replace place IDs for a subset of fulfillment types in the following 1117 * ways: 1118 * <ul> 1119 * <li>Adds "fulfillment_info" in 1120 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] 1121 * <li>Specifies only the desired fulfillment types and corresponding place IDs to update in 1122 * [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] 1123 * </ul> 1124 * <p>The caller can clear all place IDs from a subset of fulfillment types in the following 1125 * ways: 1126 * <ul> 1127 * <li>Adds "fulfillment_info" in 1128 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] 1129 * <li>Specifies only the desired fulfillment types to clear in 1130 * [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] 1131 * <li>Checks that only the desired fulfillment info types have empty 1132 * [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] 1133 * </ul> 1134 * <p>The last update time is recorded for the following inventory fields: 1135 * <ul> 1136 * <li>[Product.price_info][google.cloud.retail.v2.Product.price_info] 1137 * <li>[Product.availability][google.cloud.retail.v2.Product.availability] 1138 * <li>[Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] 1139 * <li>[Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] 1140 * </ul> 1141 * <p>If a full overwrite of inventory information while ignoring timestamps is needed, 1142 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] should 1143 * be invoked instead. 1144 * @param setMask Indicates which inventory fields in the provided 1145 * [Product][google.cloud.retail.v2.Product] to update. 1146 * <p>At least one field must be provided. 1147 * <p>If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned 1148 * and the entire update will be ignored. 1149 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1150 */ setInventoryAsync( Product inventory, FieldMask setMask)1151 public final OperationFuture<SetInventoryResponse, SetInventoryMetadata> setInventoryAsync( 1152 Product inventory, FieldMask setMask) { 1153 SetInventoryRequest request = 1154 SetInventoryRequest.newBuilder().setInventory(inventory).setSetMask(setMask).build(); 1155 return setInventoryAsync(request); 1156 } 1157 1158 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1159 /** 1160 * Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting 1161 * the last update timestamps of each inventory field. 1162 * 1163 * <p>This process is asynchronous and does not require the 1164 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1165 * the request is valid, the update is enqueued and processed downstream. As a consequence, when a 1166 * response is returned, updates are not immediately manifested in the 1167 * [Product][google.cloud.retail.v2.Product] queried by 1168 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1169 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1170 * 1171 * <p>When inventory is updated with 1172 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 1173 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the 1174 * specified inventory field value(s) overwrite any existing value(s) while ignoring the last 1175 * update time for this field. Furthermore, the last update times for the specified inventory 1176 * fields are overwritten by the times of the 1177 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or 1178 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. 1179 * 1180 * <p>If no inventory fields are set in 1181 * [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any 1182 * pre-existing inventory information for this product is used. 1183 * 1184 * <p>If no inventory fields are set in 1185 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any 1186 * existing inventory information is preserved. 1187 * 1188 * <p>Pre-existing inventory information can only be updated with 1189 * [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], 1190 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], 1191 * and 1192 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1193 * 1194 * <p>The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the 1195 * [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. 1196 * 1197 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1198 * with the stale updates are not marked as [done][google.longrunning.Operation.done] until they 1199 * are obsolete. 1200 * 1201 * <p>Sample code: 1202 * 1203 * <pre>{@code 1204 * // This snippet has been automatically generated and should be regarded as a code template only. 1205 * // It will require modifications to work: 1206 * // - It may require correct/in-range values for request initialization. 1207 * // - It may require specifying regional endpoints when creating the service client as shown in 1208 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1209 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1210 * SetInventoryRequest request = 1211 * SetInventoryRequest.newBuilder() 1212 * .setInventory(Product.newBuilder().build()) 1213 * .setSetMask(FieldMask.newBuilder().build()) 1214 * .setSetTime(Timestamp.newBuilder().build()) 1215 * .setAllowMissing(true) 1216 * .build(); 1217 * SetInventoryResponse response = productServiceClient.setInventoryAsync(request).get(); 1218 * } 1219 * }</pre> 1220 * 1221 * @param request The request object containing all of the parameters for the API call. 1222 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1223 */ setInventoryAsync( SetInventoryRequest request)1224 public final OperationFuture<SetInventoryResponse, SetInventoryMetadata> setInventoryAsync( 1225 SetInventoryRequest request) { 1226 return setInventoryOperationCallable().futureCall(request); 1227 } 1228 1229 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1230 /** 1231 * Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting 1232 * the last update timestamps of each inventory field. 1233 * 1234 * <p>This process is asynchronous and does not require the 1235 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1236 * the request is valid, the update is enqueued and processed downstream. As a consequence, when a 1237 * response is returned, updates are not immediately manifested in the 1238 * [Product][google.cloud.retail.v2.Product] queried by 1239 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1240 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1241 * 1242 * <p>When inventory is updated with 1243 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 1244 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the 1245 * specified inventory field value(s) overwrite any existing value(s) while ignoring the last 1246 * update time for this field. Furthermore, the last update times for the specified inventory 1247 * fields are overwritten by the times of the 1248 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or 1249 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. 1250 * 1251 * <p>If no inventory fields are set in 1252 * [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any 1253 * pre-existing inventory information for this product is used. 1254 * 1255 * <p>If no inventory fields are set in 1256 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any 1257 * existing inventory information is preserved. 1258 * 1259 * <p>Pre-existing inventory information can only be updated with 1260 * [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], 1261 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], 1262 * and 1263 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1264 * 1265 * <p>The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the 1266 * [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. 1267 * 1268 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1269 * with the stale updates are not marked as [done][google.longrunning.Operation.done] until they 1270 * are obsolete. 1271 * 1272 * <p>Sample code: 1273 * 1274 * <pre>{@code 1275 * // This snippet has been automatically generated and should be regarded as a code template only. 1276 * // It will require modifications to work: 1277 * // - It may require correct/in-range values for request initialization. 1278 * // - It may require specifying regional endpoints when creating the service client as shown in 1279 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1280 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1281 * SetInventoryRequest request = 1282 * SetInventoryRequest.newBuilder() 1283 * .setInventory(Product.newBuilder().build()) 1284 * .setSetMask(FieldMask.newBuilder().build()) 1285 * .setSetTime(Timestamp.newBuilder().build()) 1286 * .setAllowMissing(true) 1287 * .build(); 1288 * OperationFuture<SetInventoryResponse, SetInventoryMetadata> future = 1289 * productServiceClient.setInventoryOperationCallable().futureCall(request); 1290 * // Do something. 1291 * SetInventoryResponse response = future.get(); 1292 * } 1293 * }</pre> 1294 */ 1295 public final OperationCallable<SetInventoryRequest, SetInventoryResponse, SetInventoryMetadata> setInventoryOperationCallable()1296 setInventoryOperationCallable() { 1297 return stub.setInventoryOperationCallable(); 1298 } 1299 1300 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1301 /** 1302 * Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting 1303 * the last update timestamps of each inventory field. 1304 * 1305 * <p>This process is asynchronous and does not require the 1306 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1307 * the request is valid, the update is enqueued and processed downstream. As a consequence, when a 1308 * response is returned, updates are not immediately manifested in the 1309 * [Product][google.cloud.retail.v2.Product] queried by 1310 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1311 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1312 * 1313 * <p>When inventory is updated with 1314 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 1315 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the 1316 * specified inventory field value(s) overwrite any existing value(s) while ignoring the last 1317 * update time for this field. Furthermore, the last update times for the specified inventory 1318 * fields are overwritten by the times of the 1319 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or 1320 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. 1321 * 1322 * <p>If no inventory fields are set in 1323 * [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any 1324 * pre-existing inventory information for this product is used. 1325 * 1326 * <p>If no inventory fields are set in 1327 * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any 1328 * existing inventory information is preserved. 1329 * 1330 * <p>Pre-existing inventory information can only be updated with 1331 * [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], 1332 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], 1333 * and 1334 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1335 * 1336 * <p>The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the 1337 * [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. 1338 * 1339 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1340 * with the stale updates are not marked as [done][google.longrunning.Operation.done] until they 1341 * are obsolete. 1342 * 1343 * <p>Sample code: 1344 * 1345 * <pre>{@code 1346 * // This snippet has been automatically generated and should be regarded as a code template only. 1347 * // It will require modifications to work: 1348 * // - It may require correct/in-range values for request initialization. 1349 * // - It may require specifying regional endpoints when creating the service client as shown in 1350 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1351 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1352 * SetInventoryRequest request = 1353 * SetInventoryRequest.newBuilder() 1354 * .setInventory(Product.newBuilder().build()) 1355 * .setSetMask(FieldMask.newBuilder().build()) 1356 * .setSetTime(Timestamp.newBuilder().build()) 1357 * .setAllowMissing(true) 1358 * .build(); 1359 * ApiFuture<Operation> future = productServiceClient.setInventoryCallable().futureCall(request); 1360 * // Do something. 1361 * Operation response = future.get(); 1362 * } 1363 * }</pre> 1364 */ setInventoryCallable()1365 public final UnaryCallable<SetInventoryRequest, Operation> setInventoryCallable() { 1366 return stub.setInventoryCallable(); 1367 } 1368 1369 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1370 /** 1371 * It is recommended to use the 1372 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1373 * method instead of 1374 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. 1375 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1376 * achieves the same results but provides more fine-grained control over ingesting local inventory 1377 * data. 1378 * 1379 * <p>Incrementally adds place IDs to 1380 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1381 * 1382 * <p>This process is asynchronous and does not require the 1383 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1384 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1385 * when a response is returned, the added place IDs are not immediately manifested in the 1386 * [Product][google.cloud.retail.v2.Product] queried by 1387 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1388 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1389 * 1390 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1391 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1392 * afterwards. 1393 * 1394 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1395 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1396 * being obsolete. 1397 * 1398 * <p>Sample code: 1399 * 1400 * <pre>{@code 1401 * // This snippet has been automatically generated and should be regarded as a code template only. 1402 * // It will require modifications to work: 1403 * // - It may require correct/in-range values for request initialization. 1404 * // - It may require specifying regional endpoints when creating the service client as shown in 1405 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1406 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1407 * ProductName product = 1408 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 1409 * AddFulfillmentPlacesResponse response = 1410 * productServiceClient.addFulfillmentPlacesAsync(product).get(); 1411 * } 1412 * }</pre> 1413 * 1414 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 1415 * as 1416 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 1417 * <p>If the caller does not have permission to access the 1418 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 1419 * PERMISSION_DENIED error is returned. 1420 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1421 */ 1422 public final OperationFuture<AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(ProductName product)1423 addFulfillmentPlacesAsync(ProductName product) { 1424 AddFulfillmentPlacesRequest request = 1425 AddFulfillmentPlacesRequest.newBuilder() 1426 .setProduct(product == null ? null : product.toString()) 1427 .build(); 1428 return addFulfillmentPlacesAsync(request); 1429 } 1430 1431 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1432 /** 1433 * It is recommended to use the 1434 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1435 * method instead of 1436 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. 1437 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1438 * achieves the same results but provides more fine-grained control over ingesting local inventory 1439 * data. 1440 * 1441 * <p>Incrementally adds place IDs to 1442 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1443 * 1444 * <p>This process is asynchronous and does not require the 1445 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1446 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1447 * when a response is returned, the added place IDs are not immediately manifested in the 1448 * [Product][google.cloud.retail.v2.Product] queried by 1449 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1450 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1451 * 1452 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1453 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1454 * afterwards. 1455 * 1456 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1457 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1458 * being obsolete. 1459 * 1460 * <p>Sample code: 1461 * 1462 * <pre>{@code 1463 * // This snippet has been automatically generated and should be regarded as a code template only. 1464 * // It will require modifications to work: 1465 * // - It may require correct/in-range values for request initialization. 1466 * // - It may require specifying regional endpoints when creating the service client as shown in 1467 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1468 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1469 * String product = 1470 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1471 * .toString(); 1472 * AddFulfillmentPlacesResponse response = 1473 * productServiceClient.addFulfillmentPlacesAsync(product).get(); 1474 * } 1475 * }</pre> 1476 * 1477 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 1478 * as 1479 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 1480 * <p>If the caller does not have permission to access the 1481 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 1482 * PERMISSION_DENIED error is returned. 1483 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1484 */ 1485 public final OperationFuture<AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(String product)1486 addFulfillmentPlacesAsync(String product) { 1487 AddFulfillmentPlacesRequest request = 1488 AddFulfillmentPlacesRequest.newBuilder().setProduct(product).build(); 1489 return addFulfillmentPlacesAsync(request); 1490 } 1491 1492 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1493 /** 1494 * It is recommended to use the 1495 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1496 * method instead of 1497 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. 1498 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1499 * achieves the same results but provides more fine-grained control over ingesting local inventory 1500 * data. 1501 * 1502 * <p>Incrementally adds place IDs to 1503 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1504 * 1505 * <p>This process is asynchronous and does not require the 1506 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1507 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1508 * when a response is returned, the added place IDs are not immediately manifested in the 1509 * [Product][google.cloud.retail.v2.Product] queried by 1510 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1511 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1512 * 1513 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1514 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1515 * afterwards. 1516 * 1517 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1518 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1519 * being obsolete. 1520 * 1521 * <p>Sample code: 1522 * 1523 * <pre>{@code 1524 * // This snippet has been automatically generated and should be regarded as a code template only. 1525 * // It will require modifications to work: 1526 * // - It may require correct/in-range values for request initialization. 1527 * // - It may require specifying regional endpoints when creating the service client as shown in 1528 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1529 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1530 * AddFulfillmentPlacesRequest request = 1531 * AddFulfillmentPlacesRequest.newBuilder() 1532 * .setProduct( 1533 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1534 * .toString()) 1535 * .setType("type3575610") 1536 * .addAllPlaceIds(new ArrayList<String>()) 1537 * .setAddTime(Timestamp.newBuilder().build()) 1538 * .setAllowMissing(true) 1539 * .build(); 1540 * AddFulfillmentPlacesResponse response = 1541 * productServiceClient.addFulfillmentPlacesAsync(request).get(); 1542 * } 1543 * }</pre> 1544 * 1545 * @param request The request object containing all of the parameters for the API call. 1546 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1547 */ 1548 public final OperationFuture<AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> addFulfillmentPlacesAsync(AddFulfillmentPlacesRequest request)1549 addFulfillmentPlacesAsync(AddFulfillmentPlacesRequest request) { 1550 return addFulfillmentPlacesOperationCallable().futureCall(request); 1551 } 1552 1553 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1554 /** 1555 * It is recommended to use the 1556 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1557 * method instead of 1558 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. 1559 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1560 * achieves the same results but provides more fine-grained control over ingesting local inventory 1561 * data. 1562 * 1563 * <p>Incrementally adds place IDs to 1564 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1565 * 1566 * <p>This process is asynchronous and does not require the 1567 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1568 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1569 * when a response is returned, the added place IDs are not immediately manifested in the 1570 * [Product][google.cloud.retail.v2.Product] queried by 1571 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1572 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1573 * 1574 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1575 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1576 * afterwards. 1577 * 1578 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1579 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1580 * being obsolete. 1581 * 1582 * <p>Sample code: 1583 * 1584 * <pre>{@code 1585 * // This snippet has been automatically generated and should be regarded as a code template only. 1586 * // It will require modifications to work: 1587 * // - It may require correct/in-range values for request initialization. 1588 * // - It may require specifying regional endpoints when creating the service client as shown in 1589 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1590 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1591 * AddFulfillmentPlacesRequest request = 1592 * AddFulfillmentPlacesRequest.newBuilder() 1593 * .setProduct( 1594 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1595 * .toString()) 1596 * .setType("type3575610") 1597 * .addAllPlaceIds(new ArrayList<String>()) 1598 * .setAddTime(Timestamp.newBuilder().build()) 1599 * .setAllowMissing(true) 1600 * .build(); 1601 * OperationFuture<AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> future = 1602 * productServiceClient.addFulfillmentPlacesOperationCallable().futureCall(request); 1603 * // Do something. 1604 * AddFulfillmentPlacesResponse response = future.get(); 1605 * } 1606 * }</pre> 1607 */ 1608 public final OperationCallable< 1609 AddFulfillmentPlacesRequest, AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata> addFulfillmentPlacesOperationCallable()1610 addFulfillmentPlacesOperationCallable() { 1611 return stub.addFulfillmentPlacesOperationCallable(); 1612 } 1613 1614 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1615 /** 1616 * It is recommended to use the 1617 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1618 * method instead of 1619 * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. 1620 * [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] 1621 * achieves the same results but provides more fine-grained control over ingesting local inventory 1622 * data. 1623 * 1624 * <p>Incrementally adds place IDs to 1625 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1626 * 1627 * <p>This process is asynchronous and does not require the 1628 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1629 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1630 * when a response is returned, the added place IDs are not immediately manifested in the 1631 * [Product][google.cloud.retail.v2.Product] queried by 1632 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1633 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1634 * 1635 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1636 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1637 * afterwards. 1638 * 1639 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1640 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1641 * being obsolete. 1642 * 1643 * <p>Sample code: 1644 * 1645 * <pre>{@code 1646 * // This snippet has been automatically generated and should be regarded as a code template only. 1647 * // It will require modifications to work: 1648 * // - It may require correct/in-range values for request initialization. 1649 * // - It may require specifying regional endpoints when creating the service client as shown in 1650 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1651 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1652 * AddFulfillmentPlacesRequest request = 1653 * AddFulfillmentPlacesRequest.newBuilder() 1654 * .setProduct( 1655 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1656 * .toString()) 1657 * .setType("type3575610") 1658 * .addAllPlaceIds(new ArrayList<String>()) 1659 * .setAddTime(Timestamp.newBuilder().build()) 1660 * .setAllowMissing(true) 1661 * .build(); 1662 * ApiFuture<Operation> future = 1663 * productServiceClient.addFulfillmentPlacesCallable().futureCall(request); 1664 * // Do something. 1665 * Operation response = future.get(); 1666 * } 1667 * }</pre> 1668 */ 1669 public final UnaryCallable<AddFulfillmentPlacesRequest, Operation> addFulfillmentPlacesCallable()1670 addFulfillmentPlacesCallable() { 1671 return stub.addFulfillmentPlacesCallable(); 1672 } 1673 1674 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1675 /** 1676 * It is recommended to use the 1677 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1678 * method instead of 1679 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1680 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1681 * achieves the same results but provides more fine-grained control over ingesting local inventory 1682 * data. 1683 * 1684 * <p>Incrementally removes place IDs from a 1685 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1686 * 1687 * <p>This process is asynchronous and does not require the 1688 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1689 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1690 * when a response is returned, the removed place IDs are not immediately manifested in the 1691 * [Product][google.cloud.retail.v2.Product] queried by 1692 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1693 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1694 * 1695 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1696 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1697 * afterwards. 1698 * 1699 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1700 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1701 * being obsolete. 1702 * 1703 * <p>Sample code: 1704 * 1705 * <pre>{@code 1706 * // This snippet has been automatically generated and should be regarded as a code template only. 1707 * // It will require modifications to work: 1708 * // - It may require correct/in-range values for request initialization. 1709 * // - It may require specifying regional endpoints when creating the service client as shown in 1710 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1711 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1712 * ProductName product = 1713 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 1714 * RemoveFulfillmentPlacesResponse response = 1715 * productServiceClient.removeFulfillmentPlacesAsync(product).get(); 1716 * } 1717 * }</pre> 1718 * 1719 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 1720 * as 1721 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 1722 * <p>If the caller does not have permission to access the 1723 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 1724 * PERMISSION_DENIED error is returned. 1725 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1726 */ 1727 public final OperationFuture<RemoveFulfillmentPlacesResponse, RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(ProductName product)1728 removeFulfillmentPlacesAsync(ProductName product) { 1729 RemoveFulfillmentPlacesRequest request = 1730 RemoveFulfillmentPlacesRequest.newBuilder() 1731 .setProduct(product == null ? null : product.toString()) 1732 .build(); 1733 return removeFulfillmentPlacesAsync(request); 1734 } 1735 1736 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1737 /** 1738 * It is recommended to use the 1739 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1740 * method instead of 1741 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1742 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1743 * achieves the same results but provides more fine-grained control over ingesting local inventory 1744 * data. 1745 * 1746 * <p>Incrementally removes place IDs from a 1747 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1748 * 1749 * <p>This process is asynchronous and does not require the 1750 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1751 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1752 * when a response is returned, the removed place IDs are not immediately manifested in the 1753 * [Product][google.cloud.retail.v2.Product] queried by 1754 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1755 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1756 * 1757 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1758 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1759 * afterwards. 1760 * 1761 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1762 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1763 * being obsolete. 1764 * 1765 * <p>Sample code: 1766 * 1767 * <pre>{@code 1768 * // This snippet has been automatically generated and should be regarded as a code template only. 1769 * // It will require modifications to work: 1770 * // - It may require correct/in-range values for request initialization. 1771 * // - It may require specifying regional endpoints when creating the service client as shown in 1772 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1773 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1774 * String product = 1775 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1776 * .toString(); 1777 * RemoveFulfillmentPlacesResponse response = 1778 * productServiceClient.removeFulfillmentPlacesAsync(product).get(); 1779 * } 1780 * }</pre> 1781 * 1782 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 1783 * as 1784 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 1785 * <p>If the caller does not have permission to access the 1786 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 1787 * PERMISSION_DENIED error is returned. 1788 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1789 */ 1790 public final OperationFuture<RemoveFulfillmentPlacesResponse, RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(String product)1791 removeFulfillmentPlacesAsync(String product) { 1792 RemoveFulfillmentPlacesRequest request = 1793 RemoveFulfillmentPlacesRequest.newBuilder().setProduct(product).build(); 1794 return removeFulfillmentPlacesAsync(request); 1795 } 1796 1797 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1798 /** 1799 * It is recommended to use the 1800 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1801 * method instead of 1802 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1803 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1804 * achieves the same results but provides more fine-grained control over ingesting local inventory 1805 * data. 1806 * 1807 * <p>Incrementally removes place IDs from a 1808 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1809 * 1810 * <p>This process is asynchronous and does not require the 1811 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1812 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1813 * when a response is returned, the removed place IDs are not immediately manifested in the 1814 * [Product][google.cloud.retail.v2.Product] queried by 1815 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1816 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1817 * 1818 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1819 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1820 * afterwards. 1821 * 1822 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1823 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1824 * being obsolete. 1825 * 1826 * <p>Sample code: 1827 * 1828 * <pre>{@code 1829 * // This snippet has been automatically generated and should be regarded as a code template only. 1830 * // It will require modifications to work: 1831 * // - It may require correct/in-range values for request initialization. 1832 * // - It may require specifying regional endpoints when creating the service client as shown in 1833 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1834 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1835 * RemoveFulfillmentPlacesRequest request = 1836 * RemoveFulfillmentPlacesRequest.newBuilder() 1837 * .setProduct( 1838 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1839 * .toString()) 1840 * .setType("type3575610") 1841 * .addAllPlaceIds(new ArrayList<String>()) 1842 * .setRemoveTime(Timestamp.newBuilder().build()) 1843 * .setAllowMissing(true) 1844 * .build(); 1845 * RemoveFulfillmentPlacesResponse response = 1846 * productServiceClient.removeFulfillmentPlacesAsync(request).get(); 1847 * } 1848 * }</pre> 1849 * 1850 * @param request The request object containing all of the parameters for the API call. 1851 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1852 */ 1853 public final OperationFuture<RemoveFulfillmentPlacesResponse, RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesAsync(RemoveFulfillmentPlacesRequest request)1854 removeFulfillmentPlacesAsync(RemoveFulfillmentPlacesRequest request) { 1855 return removeFulfillmentPlacesOperationCallable().futureCall(request); 1856 } 1857 1858 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1859 /** 1860 * It is recommended to use the 1861 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1862 * method instead of 1863 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1864 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1865 * achieves the same results but provides more fine-grained control over ingesting local inventory 1866 * data. 1867 * 1868 * <p>Incrementally removes place IDs from a 1869 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1870 * 1871 * <p>This process is asynchronous and does not require the 1872 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1873 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1874 * when a response is returned, the removed place IDs are not immediately manifested in the 1875 * [Product][google.cloud.retail.v2.Product] queried by 1876 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1877 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1878 * 1879 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1880 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1881 * afterwards. 1882 * 1883 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1884 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1885 * being obsolete. 1886 * 1887 * <p>Sample code: 1888 * 1889 * <pre>{@code 1890 * // This snippet has been automatically generated and should be regarded as a code template only. 1891 * // It will require modifications to work: 1892 * // - It may require correct/in-range values for request initialization. 1893 * // - It may require specifying regional endpoints when creating the service client as shown in 1894 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1895 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1896 * RemoveFulfillmentPlacesRequest request = 1897 * RemoveFulfillmentPlacesRequest.newBuilder() 1898 * .setProduct( 1899 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1900 * .toString()) 1901 * .setType("type3575610") 1902 * .addAllPlaceIds(new ArrayList<String>()) 1903 * .setRemoveTime(Timestamp.newBuilder().build()) 1904 * .setAllowMissing(true) 1905 * .build(); 1906 * OperationFuture<RemoveFulfillmentPlacesResponse, RemoveFulfillmentPlacesMetadata> future = 1907 * productServiceClient.removeFulfillmentPlacesOperationCallable().futureCall(request); 1908 * // Do something. 1909 * RemoveFulfillmentPlacesResponse response = future.get(); 1910 * } 1911 * }</pre> 1912 */ 1913 public final OperationCallable< 1914 RemoveFulfillmentPlacesRequest, 1915 RemoveFulfillmentPlacesResponse, 1916 RemoveFulfillmentPlacesMetadata> removeFulfillmentPlacesOperationCallable()1917 removeFulfillmentPlacesOperationCallable() { 1918 return stub.removeFulfillmentPlacesOperationCallable(); 1919 } 1920 1921 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1922 /** 1923 * It is recommended to use the 1924 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1925 * method instead of 1926 * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. 1927 * [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] 1928 * achieves the same results but provides more fine-grained control over ingesting local inventory 1929 * data. 1930 * 1931 * <p>Incrementally removes place IDs from a 1932 * [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. 1933 * 1934 * <p>This process is asynchronous and does not require the 1935 * [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If 1936 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1937 * when a response is returned, the removed place IDs are not immediately manifested in the 1938 * [Product][google.cloud.retail.v2.Product] queried by 1939 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1940 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1941 * 1942 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 1943 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 1944 * afterwards. 1945 * 1946 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 1947 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 1948 * being obsolete. 1949 * 1950 * <p>Sample code: 1951 * 1952 * <pre>{@code 1953 * // This snippet has been automatically generated and should be regarded as a code template only. 1954 * // It will require modifications to work: 1955 * // - It may require correct/in-range values for request initialization. 1956 * // - It may require specifying regional endpoints when creating the service client as shown in 1957 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1958 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 1959 * RemoveFulfillmentPlacesRequest request = 1960 * RemoveFulfillmentPlacesRequest.newBuilder() 1961 * .setProduct( 1962 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 1963 * .toString()) 1964 * .setType("type3575610") 1965 * .addAllPlaceIds(new ArrayList<String>()) 1966 * .setRemoveTime(Timestamp.newBuilder().build()) 1967 * .setAllowMissing(true) 1968 * .build(); 1969 * ApiFuture<Operation> future = 1970 * productServiceClient.removeFulfillmentPlacesCallable().futureCall(request); 1971 * // Do something. 1972 * Operation response = future.get(); 1973 * } 1974 * }</pre> 1975 */ 1976 public final UnaryCallable<RemoveFulfillmentPlacesRequest, Operation> removeFulfillmentPlacesCallable()1977 removeFulfillmentPlacesCallable() { 1978 return stub.removeFulfillmentPlacesCallable(); 1979 } 1980 1981 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1982 /** 1983 * Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list 1984 * of places, while respecting the last update timestamps of each inventory field. 1985 * 1986 * <p>This process is asynchronous and does not require the 1987 * [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If 1988 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 1989 * when a response is returned, updates are not immediately manifested in the 1990 * [Product][google.cloud.retail.v2.Product] queried by 1991 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 1992 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 1993 * 1994 * <p>Local inventory information can only be modified using this method. 1995 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 1996 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 1997 * effect on local inventories. 1998 * 1999 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2000 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2001 * afterwards. 2002 * 2003 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2004 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2005 * being obsolete. 2006 * 2007 * <p>Sample code: 2008 * 2009 * <pre>{@code 2010 * // This snippet has been automatically generated and should be regarded as a code template only. 2011 * // It will require modifications to work: 2012 * // - It may require correct/in-range values for request initialization. 2013 * // - It may require specifying regional endpoints when creating the service client as shown in 2014 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2015 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2016 * ProductName product = 2017 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 2018 * AddLocalInventoriesResponse response = 2019 * productServiceClient.addLocalInventoriesAsync(product).get(); 2020 * } 2021 * }</pre> 2022 * 2023 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 2024 * as 2025 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 2026 * <p>If the caller does not have permission to access the 2027 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 2028 * PERMISSION_DENIED error is returned. 2029 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2030 */ 2031 public final OperationFuture<AddLocalInventoriesResponse, AddLocalInventoriesMetadata> addLocalInventoriesAsync(ProductName product)2032 addLocalInventoriesAsync(ProductName product) { 2033 AddLocalInventoriesRequest request = 2034 AddLocalInventoriesRequest.newBuilder() 2035 .setProduct(product == null ? null : product.toString()) 2036 .build(); 2037 return addLocalInventoriesAsync(request); 2038 } 2039 2040 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2041 /** 2042 * Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list 2043 * of places, while respecting the last update timestamps of each inventory field. 2044 * 2045 * <p>This process is asynchronous and does not require the 2046 * [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If 2047 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 2048 * when a response is returned, updates are not immediately manifested in the 2049 * [Product][google.cloud.retail.v2.Product] queried by 2050 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2051 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2052 * 2053 * <p>Local inventory information can only be modified using this method. 2054 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2055 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2056 * effect on local inventories. 2057 * 2058 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2059 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2060 * afterwards. 2061 * 2062 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2063 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2064 * being obsolete. 2065 * 2066 * <p>Sample code: 2067 * 2068 * <pre>{@code 2069 * // This snippet has been automatically generated and should be regarded as a code template only. 2070 * // It will require modifications to work: 2071 * // - It may require correct/in-range values for request initialization. 2072 * // - It may require specifying regional endpoints when creating the service client as shown in 2073 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2074 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2075 * String product = 2076 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2077 * .toString(); 2078 * AddLocalInventoriesResponse response = 2079 * productServiceClient.addLocalInventoriesAsync(product).get(); 2080 * } 2081 * }</pre> 2082 * 2083 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 2084 * as 2085 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 2086 * <p>If the caller does not have permission to access the 2087 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 2088 * PERMISSION_DENIED error is returned. 2089 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2090 */ 2091 public final OperationFuture<AddLocalInventoriesResponse, AddLocalInventoriesMetadata> addLocalInventoriesAsync(String product)2092 addLocalInventoriesAsync(String product) { 2093 AddLocalInventoriesRequest request = 2094 AddLocalInventoriesRequest.newBuilder().setProduct(product).build(); 2095 return addLocalInventoriesAsync(request); 2096 } 2097 2098 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2099 /** 2100 * Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list 2101 * of places, while respecting the last update timestamps of each inventory field. 2102 * 2103 * <p>This process is asynchronous and does not require the 2104 * [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If 2105 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 2106 * when a response is returned, updates are not immediately manifested in the 2107 * [Product][google.cloud.retail.v2.Product] queried by 2108 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2109 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2110 * 2111 * <p>Local inventory information can only be modified using this method. 2112 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2113 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2114 * effect on local inventories. 2115 * 2116 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2117 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2118 * afterwards. 2119 * 2120 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2121 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2122 * being obsolete. 2123 * 2124 * <p>Sample code: 2125 * 2126 * <pre>{@code 2127 * // This snippet has been automatically generated and should be regarded as a code template only. 2128 * // It will require modifications to work: 2129 * // - It may require correct/in-range values for request initialization. 2130 * // - It may require specifying regional endpoints when creating the service client as shown in 2131 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2132 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2133 * AddLocalInventoriesRequest request = 2134 * AddLocalInventoriesRequest.newBuilder() 2135 * .setProduct( 2136 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2137 * .toString()) 2138 * .addAllLocalInventories(new ArrayList<LocalInventory>()) 2139 * .setAddMask(FieldMask.newBuilder().build()) 2140 * .setAddTime(Timestamp.newBuilder().build()) 2141 * .setAllowMissing(true) 2142 * .build(); 2143 * AddLocalInventoriesResponse response = 2144 * productServiceClient.addLocalInventoriesAsync(request).get(); 2145 * } 2146 * }</pre> 2147 * 2148 * @param request The request object containing all of the parameters for the API call. 2149 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2150 */ 2151 public final OperationFuture<AddLocalInventoriesResponse, AddLocalInventoriesMetadata> addLocalInventoriesAsync(AddLocalInventoriesRequest request)2152 addLocalInventoriesAsync(AddLocalInventoriesRequest request) { 2153 return addLocalInventoriesOperationCallable().futureCall(request); 2154 } 2155 2156 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2157 /** 2158 * Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list 2159 * of places, while respecting the last update timestamps of each inventory field. 2160 * 2161 * <p>This process is asynchronous and does not require the 2162 * [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If 2163 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 2164 * when a response is returned, updates are not immediately manifested in the 2165 * [Product][google.cloud.retail.v2.Product] queried by 2166 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2167 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2168 * 2169 * <p>Local inventory information can only be modified using this method. 2170 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2171 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2172 * effect on local inventories. 2173 * 2174 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2175 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2176 * afterwards. 2177 * 2178 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2179 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2180 * being obsolete. 2181 * 2182 * <p>Sample code: 2183 * 2184 * <pre>{@code 2185 * // This snippet has been automatically generated and should be regarded as a code template only. 2186 * // It will require modifications to work: 2187 * // - It may require correct/in-range values for request initialization. 2188 * // - It may require specifying regional endpoints when creating the service client as shown in 2189 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2190 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2191 * AddLocalInventoriesRequest request = 2192 * AddLocalInventoriesRequest.newBuilder() 2193 * .setProduct( 2194 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2195 * .toString()) 2196 * .addAllLocalInventories(new ArrayList<LocalInventory>()) 2197 * .setAddMask(FieldMask.newBuilder().build()) 2198 * .setAddTime(Timestamp.newBuilder().build()) 2199 * .setAllowMissing(true) 2200 * .build(); 2201 * OperationFuture<AddLocalInventoriesResponse, AddLocalInventoriesMetadata> future = 2202 * productServiceClient.addLocalInventoriesOperationCallable().futureCall(request); 2203 * // Do something. 2204 * AddLocalInventoriesResponse response = future.get(); 2205 * } 2206 * }</pre> 2207 */ 2208 public final OperationCallable< 2209 AddLocalInventoriesRequest, AddLocalInventoriesResponse, AddLocalInventoriesMetadata> addLocalInventoriesOperationCallable()2210 addLocalInventoriesOperationCallable() { 2211 return stub.addLocalInventoriesOperationCallable(); 2212 } 2213 2214 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2215 /** 2216 * Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list 2217 * of places, while respecting the last update timestamps of each inventory field. 2218 * 2219 * <p>This process is asynchronous and does not require the 2220 * [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If 2221 * the request is valid, the update will be enqueued and processed downstream. As a consequence, 2222 * when a response is returned, updates are not immediately manifested in the 2223 * [Product][google.cloud.retail.v2.Product] queried by 2224 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2225 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2226 * 2227 * <p>Local inventory information can only be modified using this method. 2228 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2229 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2230 * effect on local inventories. 2231 * 2232 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2233 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2234 * afterwards. 2235 * 2236 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2237 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2238 * being obsolete. 2239 * 2240 * <p>Sample code: 2241 * 2242 * <pre>{@code 2243 * // This snippet has been automatically generated and should be regarded as a code template only. 2244 * // It will require modifications to work: 2245 * // - It may require correct/in-range values for request initialization. 2246 * // - It may require specifying regional endpoints when creating the service client as shown in 2247 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2248 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2249 * AddLocalInventoriesRequest request = 2250 * AddLocalInventoriesRequest.newBuilder() 2251 * .setProduct( 2252 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2253 * .toString()) 2254 * .addAllLocalInventories(new ArrayList<LocalInventory>()) 2255 * .setAddMask(FieldMask.newBuilder().build()) 2256 * .setAddTime(Timestamp.newBuilder().build()) 2257 * .setAllowMissing(true) 2258 * .build(); 2259 * ApiFuture<Operation> future = 2260 * productServiceClient.addLocalInventoriesCallable().futureCall(request); 2261 * // Do something. 2262 * Operation response = future.get(); 2263 * } 2264 * }</pre> 2265 */ addLocalInventoriesCallable()2266 public final UnaryCallable<AddLocalInventoriesRequest, Operation> addLocalInventoriesCallable() { 2267 return stub.addLocalInventoriesCallable(); 2268 } 2269 2270 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2271 /** 2272 * Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of 2273 * places at a removal timestamp. 2274 * 2275 * <p>This process is asynchronous. If the request is valid, the removal will be enqueued and 2276 * processed downstream. As a consequence, when a response is returned, removals are not 2277 * immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by 2278 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2279 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2280 * 2281 * <p>Local inventory information can only be removed using this method. 2282 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2283 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2284 * effect on local inventories. 2285 * 2286 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2287 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2288 * afterwards. 2289 * 2290 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2291 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2292 * being obsolete. 2293 * 2294 * <p>Sample code: 2295 * 2296 * <pre>{@code 2297 * // This snippet has been automatically generated and should be regarded as a code template only. 2298 * // It will require modifications to work: 2299 * // - It may require correct/in-range values for request initialization. 2300 * // - It may require specifying regional endpoints when creating the service client as shown in 2301 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2302 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2303 * ProductName product = 2304 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); 2305 * RemoveLocalInventoriesResponse response = 2306 * productServiceClient.removeLocalInventoriesAsync(product).get(); 2307 * } 2308 * }</pre> 2309 * 2310 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 2311 * as 2312 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 2313 * <p>If the caller does not have permission to access the 2314 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 2315 * PERMISSION_DENIED error is returned. 2316 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2317 */ 2318 public final OperationFuture<RemoveLocalInventoriesResponse, RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(ProductName product)2319 removeLocalInventoriesAsync(ProductName product) { 2320 RemoveLocalInventoriesRequest request = 2321 RemoveLocalInventoriesRequest.newBuilder() 2322 .setProduct(product == null ? null : product.toString()) 2323 .build(); 2324 return removeLocalInventoriesAsync(request); 2325 } 2326 2327 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2328 /** 2329 * Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of 2330 * places at a removal timestamp. 2331 * 2332 * <p>This process is asynchronous. If the request is valid, the removal will be enqueued and 2333 * processed downstream. As a consequence, when a response is returned, removals are not 2334 * immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by 2335 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2336 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2337 * 2338 * <p>Local inventory information can only be removed using this method. 2339 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2340 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2341 * effect on local inventories. 2342 * 2343 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2344 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2345 * afterwards. 2346 * 2347 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2348 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2349 * being obsolete. 2350 * 2351 * <p>Sample code: 2352 * 2353 * <pre>{@code 2354 * // This snippet has been automatically generated and should be regarded as a code template only. 2355 * // It will require modifications to work: 2356 * // - It may require correct/in-range values for request initialization. 2357 * // - It may require specifying regional endpoints when creating the service client as shown in 2358 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2359 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2360 * String product = 2361 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2362 * .toString(); 2363 * RemoveLocalInventoriesResponse response = 2364 * productServiceClient.removeLocalInventoriesAsync(product).get(); 2365 * } 2366 * }</pre> 2367 * 2368 * @param product Required. Full resource name of [Product][google.cloud.retail.v2.Product], such 2369 * as 2370 * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. 2371 * <p>If the caller does not have permission to access the 2372 * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a 2373 * PERMISSION_DENIED error is returned. 2374 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2375 */ 2376 public final OperationFuture<RemoveLocalInventoriesResponse, RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(String product)2377 removeLocalInventoriesAsync(String product) { 2378 RemoveLocalInventoriesRequest request = 2379 RemoveLocalInventoriesRequest.newBuilder().setProduct(product).build(); 2380 return removeLocalInventoriesAsync(request); 2381 } 2382 2383 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2384 /** 2385 * Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of 2386 * places at a removal timestamp. 2387 * 2388 * <p>This process is asynchronous. If the request is valid, the removal will be enqueued and 2389 * processed downstream. As a consequence, when a response is returned, removals are not 2390 * immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by 2391 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2392 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2393 * 2394 * <p>Local inventory information can only be removed using this method. 2395 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2396 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2397 * effect on local inventories. 2398 * 2399 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2400 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2401 * afterwards. 2402 * 2403 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2404 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2405 * being obsolete. 2406 * 2407 * <p>Sample code: 2408 * 2409 * <pre>{@code 2410 * // This snippet has been automatically generated and should be regarded as a code template only. 2411 * // It will require modifications to work: 2412 * // - It may require correct/in-range values for request initialization. 2413 * // - It may require specifying regional endpoints when creating the service client as shown in 2414 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2415 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2416 * RemoveLocalInventoriesRequest request = 2417 * RemoveLocalInventoriesRequest.newBuilder() 2418 * .setProduct( 2419 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2420 * .toString()) 2421 * .addAllPlaceIds(new ArrayList<String>()) 2422 * .setRemoveTime(Timestamp.newBuilder().build()) 2423 * .setAllowMissing(true) 2424 * .build(); 2425 * RemoveLocalInventoriesResponse response = 2426 * productServiceClient.removeLocalInventoriesAsync(request).get(); 2427 * } 2428 * }</pre> 2429 * 2430 * @param request The request object containing all of the parameters for the API call. 2431 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2432 */ 2433 public final OperationFuture<RemoveLocalInventoriesResponse, RemoveLocalInventoriesMetadata> removeLocalInventoriesAsync(RemoveLocalInventoriesRequest request)2434 removeLocalInventoriesAsync(RemoveLocalInventoriesRequest request) { 2435 return removeLocalInventoriesOperationCallable().futureCall(request); 2436 } 2437 2438 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2439 /** 2440 * Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of 2441 * places at a removal timestamp. 2442 * 2443 * <p>This process is asynchronous. If the request is valid, the removal will be enqueued and 2444 * processed downstream. As a consequence, when a response is returned, removals are not 2445 * immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by 2446 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2447 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2448 * 2449 * <p>Local inventory information can only be removed using this method. 2450 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2451 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2452 * effect on local inventories. 2453 * 2454 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2455 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2456 * afterwards. 2457 * 2458 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2459 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2460 * being obsolete. 2461 * 2462 * <p>Sample code: 2463 * 2464 * <pre>{@code 2465 * // This snippet has been automatically generated and should be regarded as a code template only. 2466 * // It will require modifications to work: 2467 * // - It may require correct/in-range values for request initialization. 2468 * // - It may require specifying regional endpoints when creating the service client as shown in 2469 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2470 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2471 * RemoveLocalInventoriesRequest request = 2472 * RemoveLocalInventoriesRequest.newBuilder() 2473 * .setProduct( 2474 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2475 * .toString()) 2476 * .addAllPlaceIds(new ArrayList<String>()) 2477 * .setRemoveTime(Timestamp.newBuilder().build()) 2478 * .setAllowMissing(true) 2479 * .build(); 2480 * OperationFuture<RemoveLocalInventoriesResponse, RemoveLocalInventoriesMetadata> future = 2481 * productServiceClient.removeLocalInventoriesOperationCallable().futureCall(request); 2482 * // Do something. 2483 * RemoveLocalInventoriesResponse response = future.get(); 2484 * } 2485 * }</pre> 2486 */ 2487 public final OperationCallable< 2488 RemoveLocalInventoriesRequest, 2489 RemoveLocalInventoriesResponse, 2490 RemoveLocalInventoriesMetadata> removeLocalInventoriesOperationCallable()2491 removeLocalInventoriesOperationCallable() { 2492 return stub.removeLocalInventoriesOperationCallable(); 2493 } 2494 2495 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2496 /** 2497 * Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of 2498 * places at a removal timestamp. 2499 * 2500 * <p>This process is asynchronous. If the request is valid, the removal will be enqueued and 2501 * processed downstream. As a consequence, when a response is returned, removals are not 2502 * immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by 2503 * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or 2504 * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. 2505 * 2506 * <p>Local inventory information can only be removed using this method. 2507 * [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and 2508 * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no 2509 * effect on local inventories. 2510 * 2511 * <p>The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and 2512 * [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND 2513 * afterwards. 2514 * 2515 * <p>If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated 2516 * with the stale updates will not be marked as [done][google.longrunning.Operation.done] until 2517 * being obsolete. 2518 * 2519 * <p>Sample code: 2520 * 2521 * <pre>{@code 2522 * // This snippet has been automatically generated and should be regarded as a code template only. 2523 * // It will require modifications to work: 2524 * // - It may require correct/in-range values for request initialization. 2525 * // - It may require specifying regional endpoints when creating the service client as shown in 2526 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2527 * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) { 2528 * RemoveLocalInventoriesRequest request = 2529 * RemoveLocalInventoriesRequest.newBuilder() 2530 * .setProduct( 2531 * ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]") 2532 * .toString()) 2533 * .addAllPlaceIds(new ArrayList<String>()) 2534 * .setRemoveTime(Timestamp.newBuilder().build()) 2535 * .setAllowMissing(true) 2536 * .build(); 2537 * ApiFuture<Operation> future = 2538 * productServiceClient.removeLocalInventoriesCallable().futureCall(request); 2539 * // Do something. 2540 * Operation response = future.get(); 2541 * } 2542 * }</pre> 2543 */ 2544 public final UnaryCallable<RemoveLocalInventoriesRequest, Operation> removeLocalInventoriesCallable()2545 removeLocalInventoriesCallable() { 2546 return stub.removeLocalInventoriesCallable(); 2547 } 2548 2549 @Override close()2550 public final void close() { 2551 stub.close(); 2552 } 2553 2554 @Override shutdown()2555 public void shutdown() { 2556 stub.shutdown(); 2557 } 2558 2559 @Override isShutdown()2560 public boolean isShutdown() { 2561 return stub.isShutdown(); 2562 } 2563 2564 @Override isTerminated()2565 public boolean isTerminated() { 2566 return stub.isTerminated(); 2567 } 2568 2569 @Override shutdownNow()2570 public void shutdownNow() { 2571 stub.shutdownNow(); 2572 } 2573 2574 @Override awaitTermination(long duration, TimeUnit unit)2575 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 2576 return stub.awaitTermination(duration, unit); 2577 } 2578 2579 public static class ListProductsPagedResponse 2580 extends AbstractPagedListResponse< 2581 ListProductsRequest, 2582 ListProductsResponse, 2583 Product, 2584 ListProductsPage, 2585 ListProductsFixedSizeCollection> { 2586 createAsync( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ApiFuture<ListProductsResponse> futureResponse)2587 public static ApiFuture<ListProductsPagedResponse> createAsync( 2588 PageContext<ListProductsRequest, ListProductsResponse, Product> context, 2589 ApiFuture<ListProductsResponse> futureResponse) { 2590 ApiFuture<ListProductsPage> futurePage = 2591 ListProductsPage.createEmptyPage().createPageAsync(context, futureResponse); 2592 return ApiFutures.transform( 2593 futurePage, 2594 input -> new ListProductsPagedResponse(input), 2595 MoreExecutors.directExecutor()); 2596 } 2597 ListProductsPagedResponse(ListProductsPage page)2598 private ListProductsPagedResponse(ListProductsPage page) { 2599 super(page, ListProductsFixedSizeCollection.createEmptyCollection()); 2600 } 2601 } 2602 2603 public static class ListProductsPage 2604 extends AbstractPage<ListProductsRequest, ListProductsResponse, Product, ListProductsPage> { 2605 ListProductsPage( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ListProductsResponse response)2606 private ListProductsPage( 2607 PageContext<ListProductsRequest, ListProductsResponse, Product> context, 2608 ListProductsResponse response) { 2609 super(context, response); 2610 } 2611 createEmptyPage()2612 private static ListProductsPage createEmptyPage() { 2613 return new ListProductsPage(null, null); 2614 } 2615 2616 @Override createPage( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ListProductsResponse response)2617 protected ListProductsPage createPage( 2618 PageContext<ListProductsRequest, ListProductsResponse, Product> context, 2619 ListProductsResponse response) { 2620 return new ListProductsPage(context, response); 2621 } 2622 2623 @Override createPageAsync( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ApiFuture<ListProductsResponse> futureResponse)2624 public ApiFuture<ListProductsPage> createPageAsync( 2625 PageContext<ListProductsRequest, ListProductsResponse, Product> context, 2626 ApiFuture<ListProductsResponse> futureResponse) { 2627 return super.createPageAsync(context, futureResponse); 2628 } 2629 } 2630 2631 public static class ListProductsFixedSizeCollection 2632 extends AbstractFixedSizeCollection< 2633 ListProductsRequest, 2634 ListProductsResponse, 2635 Product, 2636 ListProductsPage, 2637 ListProductsFixedSizeCollection> { 2638 ListProductsFixedSizeCollection(List<ListProductsPage> pages, int collectionSize)2639 private ListProductsFixedSizeCollection(List<ListProductsPage> pages, int collectionSize) { 2640 super(pages, collectionSize); 2641 } 2642 createEmptyCollection()2643 private static ListProductsFixedSizeCollection createEmptyCollection() { 2644 return new ListProductsFixedSizeCollection(null, 0); 2645 } 2646 2647 @Override createCollection( List<ListProductsPage> pages, int collectionSize)2648 protected ListProductsFixedSizeCollection createCollection( 2649 List<ListProductsPage> pages, int collectionSize) { 2650 return new ListProductsFixedSizeCollection(pages, collectionSize); 2651 } 2652 } 2653 } 2654