• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.vision.v1;
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.vision.v1.stub.ProductSearchStub;
32 import com.google.cloud.vision.v1.stub.ProductSearchStubSettings;
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: Manages Products and ProductSets of reference images for use in product
45  * search. It uses the following resource model:
46  *
47  * <p>- The API has a collection of [ProductSet][google.cloud.vision.v1.ProductSet] resources, named
48  * `projects/&#42;/locations/&#42;/productSets/&#42;`, which acts as a way to put different products
49  * into groups to limit identification.
50  *
51  * <p>In parallel,
52  *
53  * <p>- The API has a collection of [Product][google.cloud.vision.v1.Product] resources, named
54  * `projects/&#42;/locations/&#42;/products/&#42;`
55  *
56  * <p>- Each [Product][google.cloud.vision.v1.Product] has a collection of
57  * [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named
58  * `projects/&#42;/locations/&#42;/products/&#42;/referenceImages/&#42;`
59  *
60  * <p>This class provides the ability to make remote calls to the backing service through method
61  * calls that map to API methods. Sample code to get started:
62  *
63  * <pre>{@code
64  * // This snippet has been automatically generated and should be regarded as a code template only.
65  * // It will require modifications to work:
66  * // - It may require correct/in-range values for request initialization.
67  * // - It may require specifying regional endpoints when creating the service client as shown in
68  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
69  * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
70  *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
71  *   ProductSet productSet = ProductSet.newBuilder().build();
72  *   String productSetId = "productSetId1003042158";
73  *   ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
74  * }
75  * }</pre>
76  *
77  * <p>Note: close() needs to be called on the ProductSearchClient object to clean up resources such
78  * as threads. In the example above, try-with-resources is used, which automatically calls close().
79  *
80  * <p>The surface of this class includes several types of Java methods for each of the API's
81  * methods:
82  *
83  * <ol>
84  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
85  *       converted into function parameters. It may be the case that not all fields are available as
86  *       parameters, and not every API method will have a flattened method entry point.
87  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
88  *       which must be constructed before the call. Not every API method will have a request object
89  *       method.
90  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
91  *       callable object, which can be used to initiate calls to the service.
92  * </ol>
93  *
94  * <p>See the individual methods for example code.
95  *
96  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
97  * these names, this class includes a format method for each type of name, and additionally a parse
98  * method to extract the individual identifiers contained within names that are returned.
99  *
100  * <p>This class can be customized by passing in a custom instance of ProductSearchSettings to
101  * create(). For example:
102  *
103  * <p>To customize credentials:
104  *
105  * <pre>{@code
106  * // This snippet has been automatically generated and should be regarded as a code template only.
107  * // It will require modifications to work:
108  * // - It may require correct/in-range values for request initialization.
109  * // - It may require specifying regional endpoints when creating the service client as shown in
110  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
111  * ProductSearchSettings productSearchSettings =
112  *     ProductSearchSettings.newBuilder()
113  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
114  *         .build();
115  * ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
116  * }</pre>
117  *
118  * <p>To customize the endpoint:
119  *
120  * <pre>{@code
121  * // This snippet has been automatically generated and should be regarded as a code template only.
122  * // It will require modifications to work:
123  * // - It may require correct/in-range values for request initialization.
124  * // - It may require specifying regional endpoints when creating the service client as shown in
125  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
126  * ProductSearchSettings productSearchSettings =
127  *     ProductSearchSettings.newBuilder().setEndpoint(myEndpoint).build();
128  * ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
129  * }</pre>
130  *
131  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
132  * the wire:
133  *
134  * <pre>{@code
135  * // This snippet has been automatically generated and should be regarded as a code template only.
136  * // It will require modifications to work:
137  * // - It may require correct/in-range values for request initialization.
138  * // - It may require specifying regional endpoints when creating the service client as shown in
139  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
140  * ProductSearchSettings productSearchSettings =
141  *     ProductSearchSettings.newHttpJsonBuilder().build();
142  * ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
143  * }</pre>
144  *
145  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
146  */
147 @Generated("by gapic-generator-java")
148 public class ProductSearchClient implements BackgroundResource {
149   private final ProductSearchSettings settings;
150   private final ProductSearchStub stub;
151   private final OperationsClient httpJsonOperationsClient;
152   private final com.google.longrunning.OperationsClient operationsClient;
153 
154   /** Constructs an instance of ProductSearchClient with default settings. */
create()155   public static final ProductSearchClient create() throws IOException {
156     return create(ProductSearchSettings.newBuilder().build());
157   }
158 
159   /**
160    * Constructs an instance of ProductSearchClient, using the given settings. The channels are
161    * created based on the settings passed in, or defaults for any settings that are not set.
162    */
create(ProductSearchSettings settings)163   public static final ProductSearchClient create(ProductSearchSettings settings)
164       throws IOException {
165     return new ProductSearchClient(settings);
166   }
167 
168   /**
169    * Constructs an instance of ProductSearchClient, using the given stub for making calls. This is
170    * for advanced usage - prefer using create(ProductSearchSettings).
171    */
create(ProductSearchStub stub)172   public static final ProductSearchClient create(ProductSearchStub stub) {
173     return new ProductSearchClient(stub);
174   }
175 
176   /**
177    * Constructs an instance of ProductSearchClient, using the given settings. This is protected so
178    * that it is easy to make a subclass, but otherwise, the static factory methods should be
179    * preferred.
180    */
ProductSearchClient(ProductSearchSettings settings)181   protected ProductSearchClient(ProductSearchSettings settings) throws IOException {
182     this.settings = settings;
183     this.stub = ((ProductSearchStubSettings) settings.getStubSettings()).createStub();
184     this.operationsClient =
185         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
186     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
187   }
188 
ProductSearchClient(ProductSearchStub stub)189   protected ProductSearchClient(ProductSearchStub stub) {
190     this.settings = null;
191     this.stub = stub;
192     this.operationsClient =
193         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
194     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
195   }
196 
getSettings()197   public final ProductSearchSettings getSettings() {
198     return settings;
199   }
200 
getStub()201   public ProductSearchStub getStub() {
202     return stub;
203   }
204 
205   /**
206    * Returns the OperationsClient that can be used to query the status of a long-running operation
207    * returned by another API method call.
208    */
getOperationsClient()209   public final com.google.longrunning.OperationsClient getOperationsClient() {
210     return operationsClient;
211   }
212 
213   /**
214    * Returns the OperationsClient that can be used to query the status of a long-running operation
215    * returned by another API method call.
216    */
217   @BetaApi
getHttpJsonOperationsClient()218   public final OperationsClient getHttpJsonOperationsClient() {
219     return httpJsonOperationsClient;
220   }
221 
222   // AUTO-GENERATED DOCUMENTATION AND METHOD.
223   /**
224    * Creates and returns a new ProductSet resource.
225    *
226    * <p>Possible errors:
227    *
228    * <ul>
229    *   <li>Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
230    * </ul>
231    *
232    * <p>Sample code:
233    *
234    * <pre>{@code
235    * // This snippet has been automatically generated and should be regarded as a code template only.
236    * // It will require modifications to work:
237    * // - It may require correct/in-range values for request initialization.
238    * // - It may require specifying regional endpoints when creating the service client as shown in
239    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
240    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
241    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
242    *   ProductSet productSet = ProductSet.newBuilder().build();
243    *   String productSetId = "productSetId1003042158";
244    *   ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
245    * }
246    * }</pre>
247    *
248    * @param parent Required. The project in which the ProductSet should be created.
249    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
250    * @param productSet Required. The ProductSet to create.
251    * @param productSetId A user-supplied resource id for this ProductSet. If set, the server will
252    *     attempt to use this value as the resource id. If it is already in use, an error is returned
253    *     with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the
254    *     character `/`.
255    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
256    */
createProductSet( LocationName parent, ProductSet productSet, String productSetId)257   public final ProductSet createProductSet(
258       LocationName parent, ProductSet productSet, String productSetId) {
259     CreateProductSetRequest request =
260         CreateProductSetRequest.newBuilder()
261             .setParent(parent == null ? null : parent.toString())
262             .setProductSet(productSet)
263             .setProductSetId(productSetId)
264             .build();
265     return createProductSet(request);
266   }
267 
268   // AUTO-GENERATED DOCUMENTATION AND METHOD.
269   /**
270    * Creates and returns a new ProductSet resource.
271    *
272    * <p>Possible errors:
273    *
274    * <ul>
275    *   <li>Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
276    * </ul>
277    *
278    * <p>Sample code:
279    *
280    * <pre>{@code
281    * // This snippet has been automatically generated and should be regarded as a code template only.
282    * // It will require modifications to work:
283    * // - It may require correct/in-range values for request initialization.
284    * // - It may require specifying regional endpoints when creating the service client as shown in
285    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
286    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
287    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
288    *   ProductSet productSet = ProductSet.newBuilder().build();
289    *   String productSetId = "productSetId1003042158";
290    *   ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
291    * }
292    * }</pre>
293    *
294    * @param parent Required. The project in which the ProductSet should be created.
295    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
296    * @param productSet Required. The ProductSet to create.
297    * @param productSetId A user-supplied resource id for this ProductSet. If set, the server will
298    *     attempt to use this value as the resource id. If it is already in use, an error is returned
299    *     with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the
300    *     character `/`.
301    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
302    */
createProductSet( String parent, ProductSet productSet, String productSetId)303   public final ProductSet createProductSet(
304       String parent, ProductSet productSet, String productSetId) {
305     CreateProductSetRequest request =
306         CreateProductSetRequest.newBuilder()
307             .setParent(parent)
308             .setProductSet(productSet)
309             .setProductSetId(productSetId)
310             .build();
311     return createProductSet(request);
312   }
313 
314   // AUTO-GENERATED DOCUMENTATION AND METHOD.
315   /**
316    * Creates and returns a new ProductSet resource.
317    *
318    * <p>Possible errors:
319    *
320    * <ul>
321    *   <li>Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
322    * </ul>
323    *
324    * <p>Sample code:
325    *
326    * <pre>{@code
327    * // This snippet has been automatically generated and should be regarded as a code template only.
328    * // It will require modifications to work:
329    * // - It may require correct/in-range values for request initialization.
330    * // - It may require specifying regional endpoints when creating the service client as shown in
331    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
332    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
333    *   CreateProductSetRequest request =
334    *       CreateProductSetRequest.newBuilder()
335    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
336    *           .setProductSet(ProductSet.newBuilder().build())
337    *           .setProductSetId("productSetId1003042158")
338    *           .build();
339    *   ProductSet response = productSearchClient.createProductSet(request);
340    * }
341    * }</pre>
342    *
343    * @param request The request object containing all of the parameters for the API call.
344    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
345    */
createProductSet(CreateProductSetRequest request)346   public final ProductSet createProductSet(CreateProductSetRequest request) {
347     return createProductSetCallable().call(request);
348   }
349 
350   // AUTO-GENERATED DOCUMENTATION AND METHOD.
351   /**
352    * Creates and returns a new ProductSet resource.
353    *
354    * <p>Possible errors:
355    *
356    * <ul>
357    *   <li>Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
358    * </ul>
359    *
360    * <p>Sample code:
361    *
362    * <pre>{@code
363    * // This snippet has been automatically generated and should be regarded as a code template only.
364    * // It will require modifications to work:
365    * // - It may require correct/in-range values for request initialization.
366    * // - It may require specifying regional endpoints when creating the service client as shown in
367    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
368    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
369    *   CreateProductSetRequest request =
370    *       CreateProductSetRequest.newBuilder()
371    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
372    *           .setProductSet(ProductSet.newBuilder().build())
373    *           .setProductSetId("productSetId1003042158")
374    *           .build();
375    *   ApiFuture<ProductSet> future =
376    *       productSearchClient.createProductSetCallable().futureCall(request);
377    *   // Do something.
378    *   ProductSet response = future.get();
379    * }
380    * }</pre>
381    */
createProductSetCallable()382   public final UnaryCallable<CreateProductSetRequest, ProductSet> createProductSetCallable() {
383     return stub.createProductSetCallable();
384   }
385 
386   // AUTO-GENERATED DOCUMENTATION AND METHOD.
387   /**
388    * Lists ProductSets in an unspecified order.
389    *
390    * <p>Possible errors:
391    *
392    * <ul>
393    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
394    * </ul>
395    *
396    * <p>Sample code:
397    *
398    * <pre>{@code
399    * // This snippet has been automatically generated and should be regarded as a code template only.
400    * // It will require modifications to work:
401    * // - It may require correct/in-range values for request initialization.
402    * // - It may require specifying regional endpoints when creating the service client as shown in
403    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
404    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
405    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
406    *   for (ProductSet element : productSearchClient.listProductSets(parent).iterateAll()) {
407    *     // doThingsWith(element);
408    *   }
409    * }
410    * }</pre>
411    *
412    * @param parent Required. The project from which ProductSets should be listed.
413    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
414    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
415    */
listProductSets(LocationName parent)416   public final ListProductSetsPagedResponse listProductSets(LocationName parent) {
417     ListProductSetsRequest request =
418         ListProductSetsRequest.newBuilder()
419             .setParent(parent == null ? null : parent.toString())
420             .build();
421     return listProductSets(request);
422   }
423 
424   // AUTO-GENERATED DOCUMENTATION AND METHOD.
425   /**
426    * Lists ProductSets in an unspecified order.
427    *
428    * <p>Possible errors:
429    *
430    * <ul>
431    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
432    * </ul>
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 (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
443    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
444    *   for (ProductSet element : productSearchClient.listProductSets(parent).iterateAll()) {
445    *     // doThingsWith(element);
446    *   }
447    * }
448    * }</pre>
449    *
450    * @param parent Required. The project from which ProductSets should be listed.
451    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
452    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
453    */
listProductSets(String parent)454   public final ListProductSetsPagedResponse listProductSets(String parent) {
455     ListProductSetsRequest request = ListProductSetsRequest.newBuilder().setParent(parent).build();
456     return listProductSets(request);
457   }
458 
459   // AUTO-GENERATED DOCUMENTATION AND METHOD.
460   /**
461    * Lists ProductSets in an unspecified order.
462    *
463    * <p>Possible errors:
464    *
465    * <ul>
466    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
467    * </ul>
468    *
469    * <p>Sample code:
470    *
471    * <pre>{@code
472    * // This snippet has been automatically generated and should be regarded as a code template only.
473    * // It will require modifications to work:
474    * // - It may require correct/in-range values for request initialization.
475    * // - It may require specifying regional endpoints when creating the service client as shown in
476    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
477    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
478    *   ListProductSetsRequest request =
479    *       ListProductSetsRequest.newBuilder()
480    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
481    *           .setPageSize(883849137)
482    *           .setPageToken("pageToken873572522")
483    *           .build();
484    *   for (ProductSet element : productSearchClient.listProductSets(request).iterateAll()) {
485    *     // doThingsWith(element);
486    *   }
487    * }
488    * }</pre>
489    *
490    * @param request The request object containing all of the parameters for the API call.
491    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
492    */
listProductSets(ListProductSetsRequest request)493   public final ListProductSetsPagedResponse listProductSets(ListProductSetsRequest request) {
494     return listProductSetsPagedCallable().call(request);
495   }
496 
497   // AUTO-GENERATED DOCUMENTATION AND METHOD.
498   /**
499    * Lists ProductSets in an unspecified order.
500    *
501    * <p>Possible errors:
502    *
503    * <ul>
504    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
505    * </ul>
506    *
507    * <p>Sample code:
508    *
509    * <pre>{@code
510    * // This snippet has been automatically generated and should be regarded as a code template only.
511    * // It will require modifications to work:
512    * // - It may require correct/in-range values for request initialization.
513    * // - It may require specifying regional endpoints when creating the service client as shown in
514    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
515    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
516    *   ListProductSetsRequest request =
517    *       ListProductSetsRequest.newBuilder()
518    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
519    *           .setPageSize(883849137)
520    *           .setPageToken("pageToken873572522")
521    *           .build();
522    *   ApiFuture<ProductSet> future =
523    *       productSearchClient.listProductSetsPagedCallable().futureCall(request);
524    *   // Do something.
525    *   for (ProductSet element : future.get().iterateAll()) {
526    *     // doThingsWith(element);
527    *   }
528    * }
529    * }</pre>
530    */
531   public final UnaryCallable<ListProductSetsRequest, ListProductSetsPagedResponse>
listProductSetsPagedCallable()532       listProductSetsPagedCallable() {
533     return stub.listProductSetsPagedCallable();
534   }
535 
536   // AUTO-GENERATED DOCUMENTATION AND METHOD.
537   /**
538    * Lists ProductSets in an unspecified order.
539    *
540    * <p>Possible errors:
541    *
542    * <ul>
543    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
544    * </ul>
545    *
546    * <p>Sample code:
547    *
548    * <pre>{@code
549    * // This snippet has been automatically generated and should be regarded as a code template only.
550    * // It will require modifications to work:
551    * // - It may require correct/in-range values for request initialization.
552    * // - It may require specifying regional endpoints when creating the service client as shown in
553    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
554    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
555    *   ListProductSetsRequest request =
556    *       ListProductSetsRequest.newBuilder()
557    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
558    *           .setPageSize(883849137)
559    *           .setPageToken("pageToken873572522")
560    *           .build();
561    *   while (true) {
562    *     ListProductSetsResponse response =
563    *         productSearchClient.listProductSetsCallable().call(request);
564    *     for (ProductSet element : response.getProductSetsList()) {
565    *       // doThingsWith(element);
566    *     }
567    *     String nextPageToken = response.getNextPageToken();
568    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
569    *       request = request.toBuilder().setPageToken(nextPageToken).build();
570    *     } else {
571    *       break;
572    *     }
573    *   }
574    * }
575    * }</pre>
576    */
577   public final UnaryCallable<ListProductSetsRequest, ListProductSetsResponse>
listProductSetsCallable()578       listProductSetsCallable() {
579     return stub.listProductSetsCallable();
580   }
581 
582   // AUTO-GENERATED DOCUMENTATION AND METHOD.
583   /**
584    * Gets information associated with a ProductSet.
585    *
586    * <p>Possible errors:
587    *
588    * <ul>
589    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
590    * </ul>
591    *
592    * <p>Sample code:
593    *
594    * <pre>{@code
595    * // This snippet has been automatically generated and should be regarded as a code template only.
596    * // It will require modifications to work:
597    * // - It may require correct/in-range values for request initialization.
598    * // - It may require specifying regional endpoints when creating the service client as shown in
599    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
600    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
601    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
602    *   ProductSet response = productSearchClient.getProductSet(name);
603    * }
604    * }</pre>
605    *
606    * @param name Required. Resource name of the ProductSet to get.
607    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
608    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
609    */
getProductSet(ProductSetName name)610   public final ProductSet getProductSet(ProductSetName name) {
611     GetProductSetRequest request =
612         GetProductSetRequest.newBuilder().setName(name == null ? null : name.toString()).build();
613     return getProductSet(request);
614   }
615 
616   // AUTO-GENERATED DOCUMENTATION AND METHOD.
617   /**
618    * Gets information associated with a ProductSet.
619    *
620    * <p>Possible errors:
621    *
622    * <ul>
623    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
624    * </ul>
625    *
626    * <p>Sample code:
627    *
628    * <pre>{@code
629    * // This snippet has been automatically generated and should be regarded as a code template only.
630    * // It will require modifications to work:
631    * // - It may require correct/in-range values for request initialization.
632    * // - It may require specifying regional endpoints when creating the service client as shown in
633    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
634    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
635    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
636    *   ProductSet response = productSearchClient.getProductSet(name);
637    * }
638    * }</pre>
639    *
640    * @param name Required. Resource name of the ProductSet to get.
641    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
642    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
643    */
getProductSet(String name)644   public final ProductSet getProductSet(String name) {
645     GetProductSetRequest request = GetProductSetRequest.newBuilder().setName(name).build();
646     return getProductSet(request);
647   }
648 
649   // AUTO-GENERATED DOCUMENTATION AND METHOD.
650   /**
651    * Gets information associated with a ProductSet.
652    *
653    * <p>Possible errors:
654    *
655    * <ul>
656    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
657    * </ul>
658    *
659    * <p>Sample code:
660    *
661    * <pre>{@code
662    * // This snippet has been automatically generated and should be regarded as a code template only.
663    * // It will require modifications to work:
664    * // - It may require correct/in-range values for request initialization.
665    * // - It may require specifying regional endpoints when creating the service client as shown in
666    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
667    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
668    *   GetProductSetRequest request =
669    *       GetProductSetRequest.newBuilder()
670    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
671    *           .build();
672    *   ProductSet response = productSearchClient.getProductSet(request);
673    * }
674    * }</pre>
675    *
676    * @param request The request object containing all of the parameters for the API call.
677    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
678    */
getProductSet(GetProductSetRequest request)679   public final ProductSet getProductSet(GetProductSetRequest request) {
680     return getProductSetCallable().call(request);
681   }
682 
683   // AUTO-GENERATED DOCUMENTATION AND METHOD.
684   /**
685    * Gets information associated with a ProductSet.
686    *
687    * <p>Possible errors:
688    *
689    * <ul>
690    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
691    * </ul>
692    *
693    * <p>Sample code:
694    *
695    * <pre>{@code
696    * // This snippet has been automatically generated and should be regarded as a code template only.
697    * // It will require modifications to work:
698    * // - It may require correct/in-range values for request initialization.
699    * // - It may require specifying regional endpoints when creating the service client as shown in
700    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
701    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
702    *   GetProductSetRequest request =
703    *       GetProductSetRequest.newBuilder()
704    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
705    *           .build();
706    *   ApiFuture<ProductSet> future =
707    *       productSearchClient.getProductSetCallable().futureCall(request);
708    *   // Do something.
709    *   ProductSet response = future.get();
710    * }
711    * }</pre>
712    */
getProductSetCallable()713   public final UnaryCallable<GetProductSetRequest, ProductSet> getProductSetCallable() {
714     return stub.getProductSetCallable();
715   }
716 
717   // AUTO-GENERATED DOCUMENTATION AND METHOD.
718   /**
719    * Makes changes to a ProductSet resource. Only display_name can be updated currently.
720    *
721    * <p>Possible errors:
722    *
723    * <ul>
724    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
725    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the
726    *       request or longer than 4096 characters.
727    * </ul>
728    *
729    * <p>Sample code:
730    *
731    * <pre>{@code
732    * // This snippet has been automatically generated and should be regarded as a code template only.
733    * // It will require modifications to work:
734    * // - It may require correct/in-range values for request initialization.
735    * // - It may require specifying regional endpoints when creating the service client as shown in
736    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
737    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
738    *   ProductSet productSet = ProductSet.newBuilder().build();
739    *   FieldMask updateMask = FieldMask.newBuilder().build();
740    *   ProductSet response = productSearchClient.updateProductSet(productSet, updateMask);
741    * }
742    * }</pre>
743    *
744    * @param productSet Required. The ProductSet resource which replaces the one on the server.
745    * @param updateMask The [FieldMask][google.protobuf.FieldMask] that specifies which fields to
746    *     update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask
747    *     path is `display_name`.
748    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
749    */
updateProductSet(ProductSet productSet, FieldMask updateMask)750   public final ProductSet updateProductSet(ProductSet productSet, FieldMask updateMask) {
751     UpdateProductSetRequest request =
752         UpdateProductSetRequest.newBuilder()
753             .setProductSet(productSet)
754             .setUpdateMask(updateMask)
755             .build();
756     return updateProductSet(request);
757   }
758 
759   // AUTO-GENERATED DOCUMENTATION AND METHOD.
760   /**
761    * Makes changes to a ProductSet resource. Only display_name can be updated currently.
762    *
763    * <p>Possible errors:
764    *
765    * <ul>
766    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
767    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the
768    *       request or longer than 4096 characters.
769    * </ul>
770    *
771    * <p>Sample code:
772    *
773    * <pre>{@code
774    * // This snippet has been automatically generated and should be regarded as a code template only.
775    * // It will require modifications to work:
776    * // - It may require correct/in-range values for request initialization.
777    * // - It may require specifying regional endpoints when creating the service client as shown in
778    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
779    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
780    *   UpdateProductSetRequest request =
781    *       UpdateProductSetRequest.newBuilder()
782    *           .setProductSet(ProductSet.newBuilder().build())
783    *           .setUpdateMask(FieldMask.newBuilder().build())
784    *           .build();
785    *   ProductSet response = productSearchClient.updateProductSet(request);
786    * }
787    * }</pre>
788    *
789    * @param request The request object containing all of the parameters for the API call.
790    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
791    */
updateProductSet(UpdateProductSetRequest request)792   public final ProductSet updateProductSet(UpdateProductSetRequest request) {
793     return updateProductSetCallable().call(request);
794   }
795 
796   // AUTO-GENERATED DOCUMENTATION AND METHOD.
797   /**
798    * Makes changes to a ProductSet resource. Only display_name can be updated currently.
799    *
800    * <p>Possible errors:
801    *
802    * <ul>
803    *   <li>Returns NOT_FOUND if the ProductSet does not exist.
804    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the
805    *       request or longer than 4096 characters.
806    * </ul>
807    *
808    * <p>Sample code:
809    *
810    * <pre>{@code
811    * // This snippet has been automatically generated and should be regarded as a code template only.
812    * // It will require modifications to work:
813    * // - It may require correct/in-range values for request initialization.
814    * // - It may require specifying regional endpoints when creating the service client as shown in
815    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
816    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
817    *   UpdateProductSetRequest request =
818    *       UpdateProductSetRequest.newBuilder()
819    *           .setProductSet(ProductSet.newBuilder().build())
820    *           .setUpdateMask(FieldMask.newBuilder().build())
821    *           .build();
822    *   ApiFuture<ProductSet> future =
823    *       productSearchClient.updateProductSetCallable().futureCall(request);
824    *   // Do something.
825    *   ProductSet response = future.get();
826    * }
827    * }</pre>
828    */
updateProductSetCallable()829   public final UnaryCallable<UpdateProductSetRequest, ProductSet> updateProductSetCallable() {
830     return stub.updateProductSetCallable();
831   }
832 
833   // AUTO-GENERATED DOCUMENTATION AND METHOD.
834   /**
835    * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
836    * deleted.
837    *
838    * <p>The actual image files are not deleted from Google Cloud Storage.
839    *
840    * <p>Sample code:
841    *
842    * <pre>{@code
843    * // This snippet has been automatically generated and should be regarded as a code template only.
844    * // It will require modifications to work:
845    * // - It may require correct/in-range values for request initialization.
846    * // - It may require specifying regional endpoints when creating the service client as shown in
847    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
848    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
849    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
850    *   productSearchClient.deleteProductSet(name);
851    * }
852    * }</pre>
853    *
854    * @param name Required. Resource name of the ProductSet to delete.
855    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
856    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
857    */
deleteProductSet(ProductSetName name)858   public final void deleteProductSet(ProductSetName name) {
859     DeleteProductSetRequest request =
860         DeleteProductSetRequest.newBuilder().setName(name == null ? null : name.toString()).build();
861     deleteProductSet(request);
862   }
863 
864   // AUTO-GENERATED DOCUMENTATION AND METHOD.
865   /**
866    * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
867    * deleted.
868    *
869    * <p>The actual image files are not deleted from Google Cloud Storage.
870    *
871    * <p>Sample code:
872    *
873    * <pre>{@code
874    * // This snippet has been automatically generated and should be regarded as a code template only.
875    * // It will require modifications to work:
876    * // - It may require correct/in-range values for request initialization.
877    * // - It may require specifying regional endpoints when creating the service client as shown in
878    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
879    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
880    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
881    *   productSearchClient.deleteProductSet(name);
882    * }
883    * }</pre>
884    *
885    * @param name Required. Resource name of the ProductSet to delete.
886    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
887    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
888    */
deleteProductSet(String name)889   public final void deleteProductSet(String name) {
890     DeleteProductSetRequest request = DeleteProductSetRequest.newBuilder().setName(name).build();
891     deleteProductSet(request);
892   }
893 
894   // AUTO-GENERATED DOCUMENTATION AND METHOD.
895   /**
896    * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
897    * deleted.
898    *
899    * <p>The actual image files are not deleted from Google Cloud Storage.
900    *
901    * <p>Sample code:
902    *
903    * <pre>{@code
904    * // This snippet has been automatically generated and should be regarded as a code template only.
905    * // It will require modifications to work:
906    * // - It may require correct/in-range values for request initialization.
907    * // - It may require specifying regional endpoints when creating the service client as shown in
908    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
909    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
910    *   DeleteProductSetRequest request =
911    *       DeleteProductSetRequest.newBuilder()
912    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
913    *           .build();
914    *   productSearchClient.deleteProductSet(request);
915    * }
916    * }</pre>
917    *
918    * @param request The request object containing all of the parameters for the API call.
919    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
920    */
deleteProductSet(DeleteProductSetRequest request)921   public final void deleteProductSet(DeleteProductSetRequest request) {
922     deleteProductSetCallable().call(request);
923   }
924 
925   // AUTO-GENERATED DOCUMENTATION AND METHOD.
926   /**
927    * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
928    * deleted.
929    *
930    * <p>The actual image files are not deleted from Google Cloud Storage.
931    *
932    * <p>Sample code:
933    *
934    * <pre>{@code
935    * // This snippet has been automatically generated and should be regarded as a code template only.
936    * // It will require modifications to work:
937    * // - It may require correct/in-range values for request initialization.
938    * // - It may require specifying regional endpoints when creating the service client as shown in
939    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
940    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
941    *   DeleteProductSetRequest request =
942    *       DeleteProductSetRequest.newBuilder()
943    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
944    *           .build();
945    *   ApiFuture<Empty> future = productSearchClient.deleteProductSetCallable().futureCall(request);
946    *   // Do something.
947    *   future.get();
948    * }
949    * }</pre>
950    */
deleteProductSetCallable()951   public final UnaryCallable<DeleteProductSetRequest, Empty> deleteProductSetCallable() {
952     return stub.deleteProductSetCallable();
953   }
954 
955   // AUTO-GENERATED DOCUMENTATION AND METHOD.
956   /**
957    * Creates and returns a new product resource.
958    *
959    * <p>Possible errors:
960    *
961    * <ul>
962    *   <li>Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
963    *   <li>Returns INVALID_ARGUMENT if description is longer than 4096 characters.
964    *   <li>Returns INVALID_ARGUMENT if product_category is missing or invalid.
965    * </ul>
966    *
967    * <p>Sample code:
968    *
969    * <pre>{@code
970    * // This snippet has been automatically generated and should be regarded as a code template only.
971    * // It will require modifications to work:
972    * // - It may require correct/in-range values for request initialization.
973    * // - It may require specifying regional endpoints when creating the service client as shown in
974    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
975    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
976    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
977    *   Product product = Product.newBuilder().build();
978    *   String productId = "productId-1051830678";
979    *   Product response = productSearchClient.createProduct(parent, product, productId);
980    * }
981    * }</pre>
982    *
983    * @param parent Required. The project in which the Product should be created.
984    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
985    * @param product Required. The product to create.
986    * @param productId A user-supplied resource id for this Product. If set, the server will attempt
987    *     to use this value as the resource id. If it is already in use, an error is returned with
988    *     code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
989    *     `/`.
990    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
991    */
createProduct(LocationName parent, Product product, String productId)992   public final Product createProduct(LocationName parent, Product product, String productId) {
993     CreateProductRequest request =
994         CreateProductRequest.newBuilder()
995             .setParent(parent == null ? null : parent.toString())
996             .setProduct(product)
997             .setProductId(productId)
998             .build();
999     return createProduct(request);
1000   }
1001 
1002   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1003   /**
1004    * Creates and returns a new product resource.
1005    *
1006    * <p>Possible errors:
1007    *
1008    * <ul>
1009    *   <li>Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
1010    *   <li>Returns INVALID_ARGUMENT if description is longer than 4096 characters.
1011    *   <li>Returns INVALID_ARGUMENT if product_category is missing or invalid.
1012    * </ul>
1013    *
1014    * <p>Sample code:
1015    *
1016    * <pre>{@code
1017    * // This snippet has been automatically generated and should be regarded as a code template only.
1018    * // It will require modifications to work:
1019    * // - It may require correct/in-range values for request initialization.
1020    * // - It may require specifying regional endpoints when creating the service client as shown in
1021    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1022    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1023    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
1024    *   Product product = Product.newBuilder().build();
1025    *   String productId = "productId-1051830678";
1026    *   Product response = productSearchClient.createProduct(parent, product, productId);
1027    * }
1028    * }</pre>
1029    *
1030    * @param parent Required. The project in which the Product should be created.
1031    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
1032    * @param product Required. The product to create.
1033    * @param productId A user-supplied resource id for this Product. If set, the server will attempt
1034    *     to use this value as the resource id. If it is already in use, an error is returned with
1035    *     code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
1036    *     `/`.
1037    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1038    */
createProduct(String parent, Product product, String productId)1039   public final Product createProduct(String parent, Product product, String productId) {
1040     CreateProductRequest request =
1041         CreateProductRequest.newBuilder()
1042             .setParent(parent)
1043             .setProduct(product)
1044             .setProductId(productId)
1045             .build();
1046     return createProduct(request);
1047   }
1048 
1049   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1050   /**
1051    * Creates and returns a new product resource.
1052    *
1053    * <p>Possible errors:
1054    *
1055    * <ul>
1056    *   <li>Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
1057    *   <li>Returns INVALID_ARGUMENT if description is longer than 4096 characters.
1058    *   <li>Returns INVALID_ARGUMENT if product_category is missing or invalid.
1059    * </ul>
1060    *
1061    * <p>Sample code:
1062    *
1063    * <pre>{@code
1064    * // This snippet has been automatically generated and should be regarded as a code template only.
1065    * // It will require modifications to work:
1066    * // - It may require correct/in-range values for request initialization.
1067    * // - It may require specifying regional endpoints when creating the service client as shown in
1068    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1069    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1070    *   CreateProductRequest request =
1071    *       CreateProductRequest.newBuilder()
1072    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1073    *           .setProduct(Product.newBuilder().build())
1074    *           .setProductId("productId-1051830678")
1075    *           .build();
1076    *   Product response = productSearchClient.createProduct(request);
1077    * }
1078    * }</pre>
1079    *
1080    * @param request The request object containing all of the parameters for the API call.
1081    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1082    */
createProduct(CreateProductRequest request)1083   public final Product createProduct(CreateProductRequest request) {
1084     return createProductCallable().call(request);
1085   }
1086 
1087   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1088   /**
1089    * Creates and returns a new product resource.
1090    *
1091    * <p>Possible errors:
1092    *
1093    * <ul>
1094    *   <li>Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
1095    *   <li>Returns INVALID_ARGUMENT if description is longer than 4096 characters.
1096    *   <li>Returns INVALID_ARGUMENT if product_category is missing or invalid.
1097    * </ul>
1098    *
1099    * <p>Sample code:
1100    *
1101    * <pre>{@code
1102    * // This snippet has been automatically generated and should be regarded as a code template only.
1103    * // It will require modifications to work:
1104    * // - It may require correct/in-range values for request initialization.
1105    * // - It may require specifying regional endpoints when creating the service client as shown in
1106    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1107    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1108    *   CreateProductRequest request =
1109    *       CreateProductRequest.newBuilder()
1110    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1111    *           .setProduct(Product.newBuilder().build())
1112    *           .setProductId("productId-1051830678")
1113    *           .build();
1114    *   ApiFuture<Product> future = productSearchClient.createProductCallable().futureCall(request);
1115    *   // Do something.
1116    *   Product response = future.get();
1117    * }
1118    * }</pre>
1119    */
createProductCallable()1120   public final UnaryCallable<CreateProductRequest, Product> createProductCallable() {
1121     return stub.createProductCallable();
1122   }
1123 
1124   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1125   /**
1126    * Lists products in an unspecified order.
1127    *
1128    * <p>Possible errors:
1129    *
1130    * <ul>
1131    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1132    * </ul>
1133    *
1134    * <p>Sample code:
1135    *
1136    * <pre>{@code
1137    * // This snippet has been automatically generated and should be regarded as a code template only.
1138    * // It will require modifications to work:
1139    * // - It may require correct/in-range values for request initialization.
1140    * // - It may require specifying regional endpoints when creating the service client as shown in
1141    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1142    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1143    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
1144    *   for (Product element : productSearchClient.listProducts(parent).iterateAll()) {
1145    *     // doThingsWith(element);
1146    *   }
1147    * }
1148    * }</pre>
1149    *
1150    * @param parent Required. The project OR ProductSet from which Products should be listed.
1151    *     <p>Format: `projects/PROJECT_ID/locations/LOC_ID`
1152    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1153    */
listProducts(LocationName parent)1154   public final ListProductsPagedResponse listProducts(LocationName parent) {
1155     ListProductsRequest request =
1156         ListProductsRequest.newBuilder()
1157             .setParent(parent == null ? null : parent.toString())
1158             .build();
1159     return listProducts(request);
1160   }
1161 
1162   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1163   /**
1164    * Lists products in an unspecified order.
1165    *
1166    * <p>Possible errors:
1167    *
1168    * <ul>
1169    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1170    * </ul>
1171    *
1172    * <p>Sample code:
1173    *
1174    * <pre>{@code
1175    * // This snippet has been automatically generated and should be regarded as a code template only.
1176    * // It will require modifications to work:
1177    * // - It may require correct/in-range values for request initialization.
1178    * // - It may require specifying regional endpoints when creating the service client as shown in
1179    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1180    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1181    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
1182    *   for (Product element : productSearchClient.listProducts(parent).iterateAll()) {
1183    *     // doThingsWith(element);
1184    *   }
1185    * }
1186    * }</pre>
1187    *
1188    * @param parent Required. The project OR ProductSet from which Products should be listed.
1189    *     <p>Format: `projects/PROJECT_ID/locations/LOC_ID`
1190    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1191    */
listProducts(String parent)1192   public final ListProductsPagedResponse listProducts(String parent) {
1193     ListProductsRequest request = ListProductsRequest.newBuilder().setParent(parent).build();
1194     return listProducts(request);
1195   }
1196 
1197   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1198   /**
1199    * Lists products in an unspecified order.
1200    *
1201    * <p>Possible errors:
1202    *
1203    * <ul>
1204    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1205    * </ul>
1206    *
1207    * <p>Sample code:
1208    *
1209    * <pre>{@code
1210    * // This snippet has been automatically generated and should be regarded as a code template only.
1211    * // It will require modifications to work:
1212    * // - It may require correct/in-range values for request initialization.
1213    * // - It may require specifying regional endpoints when creating the service client as shown in
1214    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1215    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1216    *   ListProductsRequest request =
1217    *       ListProductsRequest.newBuilder()
1218    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1219    *           .setPageSize(883849137)
1220    *           .setPageToken("pageToken873572522")
1221    *           .build();
1222    *   for (Product element : productSearchClient.listProducts(request).iterateAll()) {
1223    *     // doThingsWith(element);
1224    *   }
1225    * }
1226    * }</pre>
1227    *
1228    * @param request The request object containing all of the parameters for the API call.
1229    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1230    */
listProducts(ListProductsRequest request)1231   public final ListProductsPagedResponse listProducts(ListProductsRequest request) {
1232     return listProductsPagedCallable().call(request);
1233   }
1234 
1235   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1236   /**
1237    * Lists products in an unspecified order.
1238    *
1239    * <p>Possible errors:
1240    *
1241    * <ul>
1242    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1243    * </ul>
1244    *
1245    * <p>Sample code:
1246    *
1247    * <pre>{@code
1248    * // This snippet has been automatically generated and should be regarded as a code template only.
1249    * // It will require modifications to work:
1250    * // - It may require correct/in-range values for request initialization.
1251    * // - It may require specifying regional endpoints when creating the service client as shown in
1252    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1253    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1254    *   ListProductsRequest request =
1255    *       ListProductsRequest.newBuilder()
1256    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1257    *           .setPageSize(883849137)
1258    *           .setPageToken("pageToken873572522")
1259    *           .build();
1260    *   ApiFuture<Product> future =
1261    *       productSearchClient.listProductsPagedCallable().futureCall(request);
1262    *   // Do something.
1263    *   for (Product element : future.get().iterateAll()) {
1264    *     // doThingsWith(element);
1265    *   }
1266    * }
1267    * }</pre>
1268    */
1269   public final UnaryCallable<ListProductsRequest, ListProductsPagedResponse>
listProductsPagedCallable()1270       listProductsPagedCallable() {
1271     return stub.listProductsPagedCallable();
1272   }
1273 
1274   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1275   /**
1276    * Lists products in an unspecified order.
1277    *
1278    * <p>Possible errors:
1279    *
1280    * <ul>
1281    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1282    * </ul>
1283    *
1284    * <p>Sample code:
1285    *
1286    * <pre>{@code
1287    * // This snippet has been automatically generated and should be regarded as a code template only.
1288    * // It will require modifications to work:
1289    * // - It may require correct/in-range values for request initialization.
1290    * // - It may require specifying regional endpoints when creating the service client as shown in
1291    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1292    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1293    *   ListProductsRequest request =
1294    *       ListProductsRequest.newBuilder()
1295    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1296    *           .setPageSize(883849137)
1297    *           .setPageToken("pageToken873572522")
1298    *           .build();
1299    *   while (true) {
1300    *     ListProductsResponse response = productSearchClient.listProductsCallable().call(request);
1301    *     for (Product element : response.getProductsList()) {
1302    *       // doThingsWith(element);
1303    *     }
1304    *     String nextPageToken = response.getNextPageToken();
1305    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1306    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1307    *     } else {
1308    *       break;
1309    *     }
1310    *   }
1311    * }
1312    * }</pre>
1313    */
listProductsCallable()1314   public final UnaryCallable<ListProductsRequest, ListProductsResponse> listProductsCallable() {
1315     return stub.listProductsCallable();
1316   }
1317 
1318   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1319   /**
1320    * Gets information associated with a Product.
1321    *
1322    * <p>Possible errors:
1323    *
1324    * <ul>
1325    *   <li>Returns NOT_FOUND if the Product does not exist.
1326    * </ul>
1327    *
1328    * <p>Sample code:
1329    *
1330    * <pre>{@code
1331    * // This snippet has been automatically generated and should be regarded as a code template only.
1332    * // It will require modifications to work:
1333    * // - It may require correct/in-range values for request initialization.
1334    * // - It may require specifying regional endpoints when creating the service client as shown in
1335    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1336    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1337    *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
1338    *   Product response = productSearchClient.getProduct(name);
1339    * }
1340    * }</pre>
1341    *
1342    * @param name Required. Resource name of the Product to get.
1343    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1344    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1345    */
getProduct(ProductName name)1346   public final Product getProduct(ProductName name) {
1347     GetProductRequest request =
1348         GetProductRequest.newBuilder().setName(name == null ? null : name.toString()).build();
1349     return getProduct(request);
1350   }
1351 
1352   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1353   /**
1354    * Gets information associated with a Product.
1355    *
1356    * <p>Possible errors:
1357    *
1358    * <ul>
1359    *   <li>Returns NOT_FOUND if the Product does not exist.
1360    * </ul>
1361    *
1362    * <p>Sample code:
1363    *
1364    * <pre>{@code
1365    * // This snippet has been automatically generated and should be regarded as a code template only.
1366    * // It will require modifications to work:
1367    * // - It may require correct/in-range values for request initialization.
1368    * // - It may require specifying regional endpoints when creating the service client as shown in
1369    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1370    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1371    *   String name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
1372    *   Product response = productSearchClient.getProduct(name);
1373    * }
1374    * }</pre>
1375    *
1376    * @param name Required. Resource name of the Product to get.
1377    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1378    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1379    */
getProduct(String name)1380   public final Product getProduct(String name) {
1381     GetProductRequest request = GetProductRequest.newBuilder().setName(name).build();
1382     return getProduct(request);
1383   }
1384 
1385   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1386   /**
1387    * Gets information associated with a Product.
1388    *
1389    * <p>Possible errors:
1390    *
1391    * <ul>
1392    *   <li>Returns NOT_FOUND if the Product does not exist.
1393    * </ul>
1394    *
1395    * <p>Sample code:
1396    *
1397    * <pre>{@code
1398    * // This snippet has been automatically generated and should be regarded as a code template only.
1399    * // It will require modifications to work:
1400    * // - It may require correct/in-range values for request initialization.
1401    * // - It may require specifying regional endpoints when creating the service client as shown in
1402    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1403    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1404    *   GetProductRequest request =
1405    *       GetProductRequest.newBuilder()
1406    *           .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1407    *           .build();
1408    *   Product response = productSearchClient.getProduct(request);
1409    * }
1410    * }</pre>
1411    *
1412    * @param request The request object containing all of the parameters for the API call.
1413    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1414    */
getProduct(GetProductRequest request)1415   public final Product getProduct(GetProductRequest request) {
1416     return getProductCallable().call(request);
1417   }
1418 
1419   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1420   /**
1421    * Gets information associated with a Product.
1422    *
1423    * <p>Possible errors:
1424    *
1425    * <ul>
1426    *   <li>Returns NOT_FOUND if the Product does not exist.
1427    * </ul>
1428    *
1429    * <p>Sample code:
1430    *
1431    * <pre>{@code
1432    * // This snippet has been automatically generated and should be regarded as a code template only.
1433    * // It will require modifications to work:
1434    * // - It may require correct/in-range values for request initialization.
1435    * // - It may require specifying regional endpoints when creating the service client as shown in
1436    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1437    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1438    *   GetProductRequest request =
1439    *       GetProductRequest.newBuilder()
1440    *           .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1441    *           .build();
1442    *   ApiFuture<Product> future = productSearchClient.getProductCallable().futureCall(request);
1443    *   // Do something.
1444    *   Product response = future.get();
1445    * }
1446    * }</pre>
1447    */
getProductCallable()1448   public final UnaryCallable<GetProductRequest, Product> getProductCallable() {
1449     return stub.getProductCallable();
1450   }
1451 
1452   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1453   /**
1454    * Makes changes to a Product resource. Only the `display_name`, `description`, and `labels`
1455    * fields can be updated right now.
1456    *
1457    * <p>If labels are updated, the change will not be reflected in queries until the next index
1458    * time.
1459    *
1460    * <p>Possible errors:
1461    *
1462    * <ul>
1463    *   <li>Returns NOT_FOUND if the Product does not exist.
1464    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from
1465    *       the request or longer than 4096 characters.
1466    *   <li>Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096
1467    *       characters.
1468    *   <li>Returns INVALID_ARGUMENT if product_category is present in update_mask.
1469    * </ul>
1470    *
1471    * <p>Sample code:
1472    *
1473    * <pre>{@code
1474    * // This snippet has been automatically generated and should be regarded as a code template only.
1475    * // It will require modifications to work:
1476    * // - It may require correct/in-range values for request initialization.
1477    * // - It may require specifying regional endpoints when creating the service client as shown in
1478    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1479    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1480    *   Product product = Product.newBuilder().build();
1481    *   FieldMask updateMask = FieldMask.newBuilder().build();
1482    *   Product response = productSearchClient.updateProduct(product, updateMask);
1483    * }
1484    * }</pre>
1485    *
1486    * @param product Required. The Product resource which replaces the one on the server.
1487    *     product.name is immutable.
1488    * @param updateMask The [FieldMask][google.protobuf.FieldMask] that specifies which fields to
1489    *     update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask
1490    *     paths include `product_labels`, `display_name`, and `description`.
1491    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1492    */
updateProduct(Product product, FieldMask updateMask)1493   public final Product updateProduct(Product product, FieldMask updateMask) {
1494     UpdateProductRequest request =
1495         UpdateProductRequest.newBuilder().setProduct(product).setUpdateMask(updateMask).build();
1496     return updateProduct(request);
1497   }
1498 
1499   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1500   /**
1501    * Makes changes to a Product resource. Only the `display_name`, `description`, and `labels`
1502    * fields can be updated right now.
1503    *
1504    * <p>If labels are updated, the change will not be reflected in queries until the next index
1505    * time.
1506    *
1507    * <p>Possible errors:
1508    *
1509    * <ul>
1510    *   <li>Returns NOT_FOUND if the Product does not exist.
1511    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from
1512    *       the request or longer than 4096 characters.
1513    *   <li>Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096
1514    *       characters.
1515    *   <li>Returns INVALID_ARGUMENT if product_category is present in update_mask.
1516    * </ul>
1517    *
1518    * <p>Sample code:
1519    *
1520    * <pre>{@code
1521    * // This snippet has been automatically generated and should be regarded as a code template only.
1522    * // It will require modifications to work:
1523    * // - It may require correct/in-range values for request initialization.
1524    * // - It may require specifying regional endpoints when creating the service client as shown in
1525    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1526    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1527    *   UpdateProductRequest request =
1528    *       UpdateProductRequest.newBuilder()
1529    *           .setProduct(Product.newBuilder().build())
1530    *           .setUpdateMask(FieldMask.newBuilder().build())
1531    *           .build();
1532    *   Product response = productSearchClient.updateProduct(request);
1533    * }
1534    * }</pre>
1535    *
1536    * @param request The request object containing all of the parameters for the API call.
1537    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1538    */
updateProduct(UpdateProductRequest request)1539   public final Product updateProduct(UpdateProductRequest request) {
1540     return updateProductCallable().call(request);
1541   }
1542 
1543   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1544   /**
1545    * Makes changes to a Product resource. Only the `display_name`, `description`, and `labels`
1546    * fields can be updated right now.
1547    *
1548    * <p>If labels are updated, the change will not be reflected in queries until the next index
1549    * time.
1550    *
1551    * <p>Possible errors:
1552    *
1553    * <ul>
1554    *   <li>Returns NOT_FOUND if the Product does not exist.
1555    *   <li>Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from
1556    *       the request or longer than 4096 characters.
1557    *   <li>Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096
1558    *       characters.
1559    *   <li>Returns INVALID_ARGUMENT if product_category is present in update_mask.
1560    * </ul>
1561    *
1562    * <p>Sample code:
1563    *
1564    * <pre>{@code
1565    * // This snippet has been automatically generated and should be regarded as a code template only.
1566    * // It will require modifications to work:
1567    * // - It may require correct/in-range values for request initialization.
1568    * // - It may require specifying regional endpoints when creating the service client as shown in
1569    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1570    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1571    *   UpdateProductRequest request =
1572    *       UpdateProductRequest.newBuilder()
1573    *           .setProduct(Product.newBuilder().build())
1574    *           .setUpdateMask(FieldMask.newBuilder().build())
1575    *           .build();
1576    *   ApiFuture<Product> future = productSearchClient.updateProductCallable().futureCall(request);
1577    *   // Do something.
1578    *   Product response = future.get();
1579    * }
1580    * }</pre>
1581    */
updateProductCallable()1582   public final UnaryCallable<UpdateProductRequest, Product> updateProductCallable() {
1583     return stub.updateProductCallable();
1584   }
1585 
1586   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1587   /**
1588    * Permanently deletes a product and its reference images.
1589    *
1590    * <p>Metadata of the product and all its images will be deleted right away, but search queries
1591    * against ProductSets containing the product may still work until all related caches are
1592    * refreshed.
1593    *
1594    * <p>Sample code:
1595    *
1596    * <pre>{@code
1597    * // This snippet has been automatically generated and should be regarded as a code template only.
1598    * // It will require modifications to work:
1599    * // - It may require correct/in-range values for request initialization.
1600    * // - It may require specifying regional endpoints when creating the service client as shown in
1601    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1602    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1603    *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
1604    *   productSearchClient.deleteProduct(name);
1605    * }
1606    * }</pre>
1607    *
1608    * @param name Required. Resource name of product to delete.
1609    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1610    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1611    */
deleteProduct(ProductName name)1612   public final void deleteProduct(ProductName name) {
1613     DeleteProductRequest request =
1614         DeleteProductRequest.newBuilder().setName(name == null ? null : name.toString()).build();
1615     deleteProduct(request);
1616   }
1617 
1618   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1619   /**
1620    * Permanently deletes a product and its reference images.
1621    *
1622    * <p>Metadata of the product and all its images will be deleted right away, but search queries
1623    * against ProductSets containing the product may still work until all related caches are
1624    * refreshed.
1625    *
1626    * <p>Sample code:
1627    *
1628    * <pre>{@code
1629    * // This snippet has been automatically generated and should be regarded as a code template only.
1630    * // It will require modifications to work:
1631    * // - It may require correct/in-range values for request initialization.
1632    * // - It may require specifying regional endpoints when creating the service client as shown in
1633    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1634    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1635    *   String name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
1636    *   productSearchClient.deleteProduct(name);
1637    * }
1638    * }</pre>
1639    *
1640    * @param name Required. Resource name of product to delete.
1641    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1642    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1643    */
deleteProduct(String name)1644   public final void deleteProduct(String name) {
1645     DeleteProductRequest request = DeleteProductRequest.newBuilder().setName(name).build();
1646     deleteProduct(request);
1647   }
1648 
1649   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1650   /**
1651    * Permanently deletes a product and its reference images.
1652    *
1653    * <p>Metadata of the product and all its images will be deleted right away, but search queries
1654    * against ProductSets containing the product may still work until all related caches are
1655    * refreshed.
1656    *
1657    * <p>Sample code:
1658    *
1659    * <pre>{@code
1660    * // This snippet has been automatically generated and should be regarded as a code template only.
1661    * // It will require modifications to work:
1662    * // - It may require correct/in-range values for request initialization.
1663    * // - It may require specifying regional endpoints when creating the service client as shown in
1664    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1665    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1666    *   DeleteProductRequest request =
1667    *       DeleteProductRequest.newBuilder()
1668    *           .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1669    *           .build();
1670    *   productSearchClient.deleteProduct(request);
1671    * }
1672    * }</pre>
1673    *
1674    * @param request The request object containing all of the parameters for the API call.
1675    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1676    */
deleteProduct(DeleteProductRequest request)1677   public final void deleteProduct(DeleteProductRequest request) {
1678     deleteProductCallable().call(request);
1679   }
1680 
1681   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1682   /**
1683    * Permanently deletes a product and its reference images.
1684    *
1685    * <p>Metadata of the product and all its images will be deleted right away, but search queries
1686    * against ProductSets containing the product may still work until all related caches are
1687    * refreshed.
1688    *
1689    * <p>Sample code:
1690    *
1691    * <pre>{@code
1692    * // This snippet has been automatically generated and should be regarded as a code template only.
1693    * // It will require modifications to work:
1694    * // - It may require correct/in-range values for request initialization.
1695    * // - It may require specifying regional endpoints when creating the service client as shown in
1696    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1697    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1698    *   DeleteProductRequest request =
1699    *       DeleteProductRequest.newBuilder()
1700    *           .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1701    *           .build();
1702    *   ApiFuture<Empty> future = productSearchClient.deleteProductCallable().futureCall(request);
1703    *   // Do something.
1704    *   future.get();
1705    * }
1706    * }</pre>
1707    */
deleteProductCallable()1708   public final UnaryCallable<DeleteProductRequest, Empty> deleteProductCallable() {
1709     return stub.deleteProductCallable();
1710   }
1711 
1712   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1713   /**
1714    * Creates and returns a new ReferenceImage resource.
1715    *
1716    * <p>The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will
1717    * try to detect regions of interest in the image that are compatible with the product_category on
1718    * the parent product. If it is specified, detection is ALWAYS skipped. The system converts
1719    * polygons into non-rotated rectangles.
1720    *
1721    * <p>Note that the pipeline will resize the image if the image resolution is too large to process
1722    * (above 50MP).
1723    *
1724    * <p>Possible errors:
1725    *
1726    * <ul>
1727    *   <li>Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
1728    *   <li>Returns INVALID_ARGUMENT if the product does not exist.
1729    *   <li>Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with
1730    *       the parent product's product_category is detected.
1731    *   <li>Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
1732    * </ul>
1733    *
1734    * <p>Sample code:
1735    *
1736    * <pre>{@code
1737    * // This snippet has been automatically generated and should be regarded as a code template only.
1738    * // It will require modifications to work:
1739    * // - It may require correct/in-range values for request initialization.
1740    * // - It may require specifying regional endpoints when creating the service client as shown in
1741    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1742    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1743    *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
1744    *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
1745    *   String referenceImageId = "referenceImageId1224107531";
1746    *   ReferenceImage response =
1747    *       productSearchClient.createReferenceImage(parent, referenceImage, referenceImageId);
1748    * }
1749    * }</pre>
1750    *
1751    * @param parent Required. Resource name of the product in which to create the reference image.
1752    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1753    * @param referenceImage Required. The reference image to create. If an image ID is specified, it
1754    *     is ignored.
1755    * @param referenceImageId A user-supplied resource id for the ReferenceImage to be added. If set,
1756    *     the server will attempt to use this value as the resource id. If it is already in use, an
1757    *     error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot
1758    *     contain the character `/`.
1759    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1760    */
createReferenceImage( ProductName parent, ReferenceImage referenceImage, String referenceImageId)1761   public final ReferenceImage createReferenceImage(
1762       ProductName parent, ReferenceImage referenceImage, String referenceImageId) {
1763     CreateReferenceImageRequest request =
1764         CreateReferenceImageRequest.newBuilder()
1765             .setParent(parent == null ? null : parent.toString())
1766             .setReferenceImage(referenceImage)
1767             .setReferenceImageId(referenceImageId)
1768             .build();
1769     return createReferenceImage(request);
1770   }
1771 
1772   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1773   /**
1774    * Creates and returns a new ReferenceImage resource.
1775    *
1776    * <p>The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will
1777    * try to detect regions of interest in the image that are compatible with the product_category on
1778    * the parent product. If it is specified, detection is ALWAYS skipped. The system converts
1779    * polygons into non-rotated rectangles.
1780    *
1781    * <p>Note that the pipeline will resize the image if the image resolution is too large to process
1782    * (above 50MP).
1783    *
1784    * <p>Possible errors:
1785    *
1786    * <ul>
1787    *   <li>Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
1788    *   <li>Returns INVALID_ARGUMENT if the product does not exist.
1789    *   <li>Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with
1790    *       the parent product's product_category is detected.
1791    *   <li>Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
1792    * </ul>
1793    *
1794    * <p>Sample code:
1795    *
1796    * <pre>{@code
1797    * // This snippet has been automatically generated and should be regarded as a code template only.
1798    * // It will require modifications to work:
1799    * // - It may require correct/in-range values for request initialization.
1800    * // - It may require specifying regional endpoints when creating the service client as shown in
1801    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1802    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1803    *   String parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
1804    *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
1805    *   String referenceImageId = "referenceImageId1224107531";
1806    *   ReferenceImage response =
1807    *       productSearchClient.createReferenceImage(parent, referenceImage, referenceImageId);
1808    * }
1809    * }</pre>
1810    *
1811    * @param parent Required. Resource name of the product in which to create the reference image.
1812    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1813    * @param referenceImage Required. The reference image to create. If an image ID is specified, it
1814    *     is ignored.
1815    * @param referenceImageId A user-supplied resource id for the ReferenceImage to be added. If set,
1816    *     the server will attempt to use this value as the resource id. If it is already in use, an
1817    *     error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot
1818    *     contain the character `/`.
1819    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1820    */
createReferenceImage( String parent, ReferenceImage referenceImage, String referenceImageId)1821   public final ReferenceImage createReferenceImage(
1822       String parent, ReferenceImage referenceImage, String referenceImageId) {
1823     CreateReferenceImageRequest request =
1824         CreateReferenceImageRequest.newBuilder()
1825             .setParent(parent)
1826             .setReferenceImage(referenceImage)
1827             .setReferenceImageId(referenceImageId)
1828             .build();
1829     return createReferenceImage(request);
1830   }
1831 
1832   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1833   /**
1834    * Creates and returns a new ReferenceImage resource.
1835    *
1836    * <p>The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will
1837    * try to detect regions of interest in the image that are compatible with the product_category on
1838    * the parent product. If it is specified, detection is ALWAYS skipped. The system converts
1839    * polygons into non-rotated rectangles.
1840    *
1841    * <p>Note that the pipeline will resize the image if the image resolution is too large to process
1842    * (above 50MP).
1843    *
1844    * <p>Possible errors:
1845    *
1846    * <ul>
1847    *   <li>Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
1848    *   <li>Returns INVALID_ARGUMENT if the product does not exist.
1849    *   <li>Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with
1850    *       the parent product's product_category is detected.
1851    *   <li>Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
1852    * </ul>
1853    *
1854    * <p>Sample code:
1855    *
1856    * <pre>{@code
1857    * // This snippet has been automatically generated and should be regarded as a code template only.
1858    * // It will require modifications to work:
1859    * // - It may require correct/in-range values for request initialization.
1860    * // - It may require specifying regional endpoints when creating the service client as shown in
1861    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1862    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1863    *   CreateReferenceImageRequest request =
1864    *       CreateReferenceImageRequest.newBuilder()
1865    *           .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1866    *           .setReferenceImage(ReferenceImage.newBuilder().build())
1867    *           .setReferenceImageId("referenceImageId1224107531")
1868    *           .build();
1869    *   ReferenceImage response = productSearchClient.createReferenceImage(request);
1870    * }
1871    * }</pre>
1872    *
1873    * @param request The request object containing all of the parameters for the API call.
1874    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1875    */
createReferenceImage(CreateReferenceImageRequest request)1876   public final ReferenceImage createReferenceImage(CreateReferenceImageRequest request) {
1877     return createReferenceImageCallable().call(request);
1878   }
1879 
1880   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1881   /**
1882    * Creates and returns a new ReferenceImage resource.
1883    *
1884    * <p>The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will
1885    * try to detect regions of interest in the image that are compatible with the product_category on
1886    * the parent product. If it is specified, detection is ALWAYS skipped. The system converts
1887    * polygons into non-rotated rectangles.
1888    *
1889    * <p>Note that the pipeline will resize the image if the image resolution is too large to process
1890    * (above 50MP).
1891    *
1892    * <p>Possible errors:
1893    *
1894    * <ul>
1895    *   <li>Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
1896    *   <li>Returns INVALID_ARGUMENT if the product does not exist.
1897    *   <li>Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with
1898    *       the parent product's product_category is detected.
1899    *   <li>Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
1900    * </ul>
1901    *
1902    * <p>Sample code:
1903    *
1904    * <pre>{@code
1905    * // This snippet has been automatically generated and should be regarded as a code template only.
1906    * // It will require modifications to work:
1907    * // - It may require correct/in-range values for request initialization.
1908    * // - It may require specifying regional endpoints when creating the service client as shown in
1909    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1910    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1911    *   CreateReferenceImageRequest request =
1912    *       CreateReferenceImageRequest.newBuilder()
1913    *           .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
1914    *           .setReferenceImage(ReferenceImage.newBuilder().build())
1915    *           .setReferenceImageId("referenceImageId1224107531")
1916    *           .build();
1917    *   ApiFuture<ReferenceImage> future =
1918    *       productSearchClient.createReferenceImageCallable().futureCall(request);
1919    *   // Do something.
1920    *   ReferenceImage response = future.get();
1921    * }
1922    * }</pre>
1923    */
1924   public final UnaryCallable<CreateReferenceImageRequest, ReferenceImage>
createReferenceImageCallable()1925       createReferenceImageCallable() {
1926     return stub.createReferenceImageCallable();
1927   }
1928 
1929   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1930   /**
1931    * Permanently deletes a reference image.
1932    *
1933    * <p>The image metadata will be deleted right away, but search queries against ProductSets
1934    * containing the image may still work until all related caches are refreshed.
1935    *
1936    * <p>The actual image files are not deleted from Google Cloud Storage.
1937    *
1938    * <p>Sample code:
1939    *
1940    * <pre>{@code
1941    * // This snippet has been automatically generated and should be regarded as a code template only.
1942    * // It will require modifications to work:
1943    * // - It may require correct/in-range values for request initialization.
1944    * // - It may require specifying regional endpoints when creating the service client as shown in
1945    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1946    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1947    *   ReferenceImageName name =
1948    *       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
1949    *   productSearchClient.deleteReferenceImage(name);
1950    * }
1951    * }</pre>
1952    *
1953    * @param name Required. The resource name of the reference image to delete.
1954    *     <p>Format is:
1955    *     `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
1956    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1957    */
deleteReferenceImage(ReferenceImageName name)1958   public final void deleteReferenceImage(ReferenceImageName name) {
1959     DeleteReferenceImageRequest request =
1960         DeleteReferenceImageRequest.newBuilder()
1961             .setName(name == null ? null : name.toString())
1962             .build();
1963     deleteReferenceImage(request);
1964   }
1965 
1966   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1967   /**
1968    * Permanently deletes a reference image.
1969    *
1970    * <p>The image metadata will be deleted right away, but search queries against ProductSets
1971    * containing the image may still work until all related caches are refreshed.
1972    *
1973    * <p>The actual image files are not deleted from Google Cloud Storage.
1974    *
1975    * <p>Sample code:
1976    *
1977    * <pre>{@code
1978    * // This snippet has been automatically generated and should be regarded as a code template only.
1979    * // It will require modifications to work:
1980    * // - It may require correct/in-range values for request initialization.
1981    * // - It may require specifying regional endpoints when creating the service client as shown in
1982    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1983    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
1984    *   String name =
1985    *       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
1986    *           .toString();
1987    *   productSearchClient.deleteReferenceImage(name);
1988    * }
1989    * }</pre>
1990    *
1991    * @param name Required. The resource name of the reference image to delete.
1992    *     <p>Format is:
1993    *     `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
1994    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1995    */
deleteReferenceImage(String name)1996   public final void deleteReferenceImage(String name) {
1997     DeleteReferenceImageRequest request =
1998         DeleteReferenceImageRequest.newBuilder().setName(name).build();
1999     deleteReferenceImage(request);
2000   }
2001 
2002   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2003   /**
2004    * Permanently deletes a reference image.
2005    *
2006    * <p>The image metadata will be deleted right away, but search queries against ProductSets
2007    * containing the image may still work until all related caches are refreshed.
2008    *
2009    * <p>The actual image files are not deleted from Google Cloud Storage.
2010    *
2011    * <p>Sample code:
2012    *
2013    * <pre>{@code
2014    * // This snippet has been automatically generated and should be regarded as a code template only.
2015    * // It will require modifications to work:
2016    * // - It may require correct/in-range values for request initialization.
2017    * // - It may require specifying regional endpoints when creating the service client as shown in
2018    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2019    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2020    *   DeleteReferenceImageRequest request =
2021    *       DeleteReferenceImageRequest.newBuilder()
2022    *           .setName(
2023    *               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
2024    *                   .toString())
2025    *           .build();
2026    *   productSearchClient.deleteReferenceImage(request);
2027    * }
2028    * }</pre>
2029    *
2030    * @param request The request object containing all of the parameters for the API call.
2031    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2032    */
deleteReferenceImage(DeleteReferenceImageRequest request)2033   public final void deleteReferenceImage(DeleteReferenceImageRequest request) {
2034     deleteReferenceImageCallable().call(request);
2035   }
2036 
2037   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2038   /**
2039    * Permanently deletes a reference image.
2040    *
2041    * <p>The image metadata will be deleted right away, but search queries against ProductSets
2042    * containing the image may still work until all related caches are refreshed.
2043    *
2044    * <p>The actual image files are not deleted from Google Cloud Storage.
2045    *
2046    * <p>Sample code:
2047    *
2048    * <pre>{@code
2049    * // This snippet has been automatically generated and should be regarded as a code template only.
2050    * // It will require modifications to work:
2051    * // - It may require correct/in-range values for request initialization.
2052    * // - It may require specifying regional endpoints when creating the service client as shown in
2053    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2054    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2055    *   DeleteReferenceImageRequest request =
2056    *       DeleteReferenceImageRequest.newBuilder()
2057    *           .setName(
2058    *               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
2059    *                   .toString())
2060    *           .build();
2061    *   ApiFuture<Empty> future =
2062    *       productSearchClient.deleteReferenceImageCallable().futureCall(request);
2063    *   // Do something.
2064    *   future.get();
2065    * }
2066    * }</pre>
2067    */
deleteReferenceImageCallable()2068   public final UnaryCallable<DeleteReferenceImageRequest, Empty> deleteReferenceImageCallable() {
2069     return stub.deleteReferenceImageCallable();
2070   }
2071 
2072   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2073   /**
2074    * Lists reference images.
2075    *
2076    * <p>Possible errors:
2077    *
2078    * <ul>
2079    *   <li>Returns NOT_FOUND if the parent product does not exist.
2080    *   <li>Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
2081    * </ul>
2082    *
2083    * <p>Sample code:
2084    *
2085    * <pre>{@code
2086    * // This snippet has been automatically generated and should be regarded as a code template only.
2087    * // It will require modifications to work:
2088    * // - It may require correct/in-range values for request initialization.
2089    * // - It may require specifying regional endpoints when creating the service client as shown in
2090    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2091    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2092    *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
2093    *   for (ReferenceImage element : productSearchClient.listReferenceImages(parent).iterateAll()) {
2094    *     // doThingsWith(element);
2095    *   }
2096    * }
2097    * }</pre>
2098    *
2099    * @param parent Required. Resource name of the product containing the reference images.
2100    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
2101    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2102    */
listReferenceImages(ProductName parent)2103   public final ListReferenceImagesPagedResponse listReferenceImages(ProductName parent) {
2104     ListReferenceImagesRequest request =
2105         ListReferenceImagesRequest.newBuilder()
2106             .setParent(parent == null ? null : parent.toString())
2107             .build();
2108     return listReferenceImages(request);
2109   }
2110 
2111   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2112   /**
2113    * Lists reference images.
2114    *
2115    * <p>Possible errors:
2116    *
2117    * <ul>
2118    *   <li>Returns NOT_FOUND if the parent product does not exist.
2119    *   <li>Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
2120    * </ul>
2121    *
2122    * <p>Sample code:
2123    *
2124    * <pre>{@code
2125    * // This snippet has been automatically generated and should be regarded as a code template only.
2126    * // It will require modifications to work:
2127    * // - It may require correct/in-range values for request initialization.
2128    * // - It may require specifying regional endpoints when creating the service client as shown in
2129    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2130    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2131    *   String parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
2132    *   for (ReferenceImage element : productSearchClient.listReferenceImages(parent).iterateAll()) {
2133    *     // doThingsWith(element);
2134    *   }
2135    * }
2136    * }</pre>
2137    *
2138    * @param parent Required. Resource name of the product containing the reference images.
2139    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
2140    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2141    */
listReferenceImages(String parent)2142   public final ListReferenceImagesPagedResponse listReferenceImages(String parent) {
2143     ListReferenceImagesRequest request =
2144         ListReferenceImagesRequest.newBuilder().setParent(parent).build();
2145     return listReferenceImages(request);
2146   }
2147 
2148   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2149   /**
2150    * Lists reference images.
2151    *
2152    * <p>Possible errors:
2153    *
2154    * <ul>
2155    *   <li>Returns NOT_FOUND if the parent product does not exist.
2156    *   <li>Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
2157    * </ul>
2158    *
2159    * <p>Sample code:
2160    *
2161    * <pre>{@code
2162    * // This snippet has been automatically generated and should be regarded as a code template only.
2163    * // It will require modifications to work:
2164    * // - It may require correct/in-range values for request initialization.
2165    * // - It may require specifying regional endpoints when creating the service client as shown in
2166    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2167    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2168    *   ListReferenceImagesRequest request =
2169    *       ListReferenceImagesRequest.newBuilder()
2170    *           .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2171    *           .setPageSize(883849137)
2172    *           .setPageToken("pageToken873572522")
2173    *           .build();
2174    *   for (ReferenceImage element : productSearchClient.listReferenceImages(request).iterateAll()) {
2175    *     // doThingsWith(element);
2176    *   }
2177    * }
2178    * }</pre>
2179    *
2180    * @param request The request object containing all of the parameters for the API call.
2181    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2182    */
listReferenceImages( ListReferenceImagesRequest request)2183   public final ListReferenceImagesPagedResponse listReferenceImages(
2184       ListReferenceImagesRequest request) {
2185     return listReferenceImagesPagedCallable().call(request);
2186   }
2187 
2188   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2189   /**
2190    * Lists reference images.
2191    *
2192    * <p>Possible errors:
2193    *
2194    * <ul>
2195    *   <li>Returns NOT_FOUND if the parent product does not exist.
2196    *   <li>Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
2197    * </ul>
2198    *
2199    * <p>Sample code:
2200    *
2201    * <pre>{@code
2202    * // This snippet has been automatically generated and should be regarded as a code template only.
2203    * // It will require modifications to work:
2204    * // - It may require correct/in-range values for request initialization.
2205    * // - It may require specifying regional endpoints when creating the service client as shown in
2206    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2207    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2208    *   ListReferenceImagesRequest request =
2209    *       ListReferenceImagesRequest.newBuilder()
2210    *           .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2211    *           .setPageSize(883849137)
2212    *           .setPageToken("pageToken873572522")
2213    *           .build();
2214    *   ApiFuture<ReferenceImage> future =
2215    *       productSearchClient.listReferenceImagesPagedCallable().futureCall(request);
2216    *   // Do something.
2217    *   for (ReferenceImage element : future.get().iterateAll()) {
2218    *     // doThingsWith(element);
2219    *   }
2220    * }
2221    * }</pre>
2222    */
2223   public final UnaryCallable<ListReferenceImagesRequest, ListReferenceImagesPagedResponse>
listReferenceImagesPagedCallable()2224       listReferenceImagesPagedCallable() {
2225     return stub.listReferenceImagesPagedCallable();
2226   }
2227 
2228   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2229   /**
2230    * Lists reference images.
2231    *
2232    * <p>Possible errors:
2233    *
2234    * <ul>
2235    *   <li>Returns NOT_FOUND if the parent product does not exist.
2236    *   <li>Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
2237    * </ul>
2238    *
2239    * <p>Sample code:
2240    *
2241    * <pre>{@code
2242    * // This snippet has been automatically generated and should be regarded as a code template only.
2243    * // It will require modifications to work:
2244    * // - It may require correct/in-range values for request initialization.
2245    * // - It may require specifying regional endpoints when creating the service client as shown in
2246    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2247    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2248    *   ListReferenceImagesRequest request =
2249    *       ListReferenceImagesRequest.newBuilder()
2250    *           .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2251    *           .setPageSize(883849137)
2252    *           .setPageToken("pageToken873572522")
2253    *           .build();
2254    *   while (true) {
2255    *     ListReferenceImagesResponse response =
2256    *         productSearchClient.listReferenceImagesCallable().call(request);
2257    *     for (ReferenceImage element : response.getReferenceImagesList()) {
2258    *       // doThingsWith(element);
2259    *     }
2260    *     String nextPageToken = response.getNextPageToken();
2261    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
2262    *       request = request.toBuilder().setPageToken(nextPageToken).build();
2263    *     } else {
2264    *       break;
2265    *     }
2266    *   }
2267    * }
2268    * }</pre>
2269    */
2270   public final UnaryCallable<ListReferenceImagesRequest, ListReferenceImagesResponse>
listReferenceImagesCallable()2271       listReferenceImagesCallable() {
2272     return stub.listReferenceImagesCallable();
2273   }
2274 
2275   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2276   /**
2277    * Gets information associated with a ReferenceImage.
2278    *
2279    * <p>Possible errors:
2280    *
2281    * <ul>
2282    *   <li>Returns NOT_FOUND if the specified image does not exist.
2283    * </ul>
2284    *
2285    * <p>Sample code:
2286    *
2287    * <pre>{@code
2288    * // This snippet has been automatically generated and should be regarded as a code template only.
2289    * // It will require modifications to work:
2290    * // - It may require correct/in-range values for request initialization.
2291    * // - It may require specifying regional endpoints when creating the service client as shown in
2292    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2293    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2294    *   ReferenceImageName name =
2295    *       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
2296    *   ReferenceImage response = productSearchClient.getReferenceImage(name);
2297    * }
2298    * }</pre>
2299    *
2300    * @param name Required. The resource name of the ReferenceImage to get.
2301    *     <p>Format is:
2302    *     `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
2303    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2304    */
getReferenceImage(ReferenceImageName name)2305   public final ReferenceImage getReferenceImage(ReferenceImageName name) {
2306     GetReferenceImageRequest request =
2307         GetReferenceImageRequest.newBuilder()
2308             .setName(name == null ? null : name.toString())
2309             .build();
2310     return getReferenceImage(request);
2311   }
2312 
2313   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2314   /**
2315    * Gets information associated with a ReferenceImage.
2316    *
2317    * <p>Possible errors:
2318    *
2319    * <ul>
2320    *   <li>Returns NOT_FOUND if the specified image does not exist.
2321    * </ul>
2322    *
2323    * <p>Sample code:
2324    *
2325    * <pre>{@code
2326    * // This snippet has been automatically generated and should be regarded as a code template only.
2327    * // It will require modifications to work:
2328    * // - It may require correct/in-range values for request initialization.
2329    * // - It may require specifying regional endpoints when creating the service client as shown in
2330    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2331    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2332    *   String name =
2333    *       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
2334    *           .toString();
2335    *   ReferenceImage response = productSearchClient.getReferenceImage(name);
2336    * }
2337    * }</pre>
2338    *
2339    * @param name Required. The resource name of the ReferenceImage to get.
2340    *     <p>Format is:
2341    *     `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
2342    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2343    */
getReferenceImage(String name)2344   public final ReferenceImage getReferenceImage(String name) {
2345     GetReferenceImageRequest request = GetReferenceImageRequest.newBuilder().setName(name).build();
2346     return getReferenceImage(request);
2347   }
2348 
2349   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2350   /**
2351    * Gets information associated with a ReferenceImage.
2352    *
2353    * <p>Possible errors:
2354    *
2355    * <ul>
2356    *   <li>Returns NOT_FOUND if the specified image does not exist.
2357    * </ul>
2358    *
2359    * <p>Sample code:
2360    *
2361    * <pre>{@code
2362    * // This snippet has been automatically generated and should be regarded as a code template only.
2363    * // It will require modifications to work:
2364    * // - It may require correct/in-range values for request initialization.
2365    * // - It may require specifying regional endpoints when creating the service client as shown in
2366    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2367    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2368    *   GetReferenceImageRequest request =
2369    *       GetReferenceImageRequest.newBuilder()
2370    *           .setName(
2371    *               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
2372    *                   .toString())
2373    *           .build();
2374    *   ReferenceImage response = productSearchClient.getReferenceImage(request);
2375    * }
2376    * }</pre>
2377    *
2378    * @param request The request object containing all of the parameters for the API call.
2379    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2380    */
getReferenceImage(GetReferenceImageRequest request)2381   public final ReferenceImage getReferenceImage(GetReferenceImageRequest request) {
2382     return getReferenceImageCallable().call(request);
2383   }
2384 
2385   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2386   /**
2387    * Gets information associated with a ReferenceImage.
2388    *
2389    * <p>Possible errors:
2390    *
2391    * <ul>
2392    *   <li>Returns NOT_FOUND if the specified image does not exist.
2393    * </ul>
2394    *
2395    * <p>Sample code:
2396    *
2397    * <pre>{@code
2398    * // This snippet has been automatically generated and should be regarded as a code template only.
2399    * // It will require modifications to work:
2400    * // - It may require correct/in-range values for request initialization.
2401    * // - It may require specifying regional endpoints when creating the service client as shown in
2402    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2403    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2404    *   GetReferenceImageRequest request =
2405    *       GetReferenceImageRequest.newBuilder()
2406    *           .setName(
2407    *               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
2408    *                   .toString())
2409    *           .build();
2410    *   ApiFuture<ReferenceImage> future =
2411    *       productSearchClient.getReferenceImageCallable().futureCall(request);
2412    *   // Do something.
2413    *   ReferenceImage response = future.get();
2414    * }
2415    * }</pre>
2416    */
getReferenceImageCallable()2417   public final UnaryCallable<GetReferenceImageRequest, ReferenceImage> getReferenceImageCallable() {
2418     return stub.getReferenceImageCallable();
2419   }
2420 
2421   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2422   /**
2423    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2424    * made.
2425    *
2426    * <p>One Product can be added to at most 100 ProductSets.
2427    *
2428    * <p>Possible errors:
2429    *
2430    * <ul>
2431    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2432    * </ul>
2433    *
2434    * <p>Sample code:
2435    *
2436    * <pre>{@code
2437    * // This snippet has been automatically generated and should be regarded as a code template only.
2438    * // It will require modifications to work:
2439    * // - It may require correct/in-range values for request initialization.
2440    * // - It may require specifying regional endpoints when creating the service client as shown in
2441    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2442    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2443    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
2444    *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
2445    *   productSearchClient.addProductToProductSet(name, product);
2446    * }
2447    * }</pre>
2448    *
2449    * @param name Required. The resource name for the ProductSet to modify.
2450    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2451    * @param product Required. The resource name for the Product to be added to this ProductSet.
2452    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2453    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2454    */
addProductToProductSet(ProductSetName name, ProductName product)2455   public final void addProductToProductSet(ProductSetName name, ProductName product) {
2456     AddProductToProductSetRequest request =
2457         AddProductToProductSetRequest.newBuilder()
2458             .setName(name == null ? null : name.toString())
2459             .setProduct(product == null ? null : product.toString())
2460             .build();
2461     addProductToProductSet(request);
2462   }
2463 
2464   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2465   /**
2466    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2467    * made.
2468    *
2469    * <p>One Product can be added to at most 100 ProductSets.
2470    *
2471    * <p>Possible errors:
2472    *
2473    * <ul>
2474    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2475    * </ul>
2476    *
2477    * <p>Sample code:
2478    *
2479    * <pre>{@code
2480    * // This snippet has been automatically generated and should be regarded as a code template only.
2481    * // It will require modifications to work:
2482    * // - It may require correct/in-range values for request initialization.
2483    * // - It may require specifying regional endpoints when creating the service client as shown in
2484    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2485    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2486    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
2487    *   String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
2488    *   productSearchClient.addProductToProductSet(name, product);
2489    * }
2490    * }</pre>
2491    *
2492    * @param name Required. The resource name for the ProductSet to modify.
2493    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2494    * @param product Required. The resource name for the Product to be added to this ProductSet.
2495    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2496    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2497    */
addProductToProductSet(ProductSetName name, String product)2498   public final void addProductToProductSet(ProductSetName name, String product) {
2499     AddProductToProductSetRequest request =
2500         AddProductToProductSetRequest.newBuilder()
2501             .setName(name == null ? null : name.toString())
2502             .setProduct(product)
2503             .build();
2504     addProductToProductSet(request);
2505   }
2506 
2507   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2508   /**
2509    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2510    * made.
2511    *
2512    * <p>One Product can be added to at most 100 ProductSets.
2513    *
2514    * <p>Possible errors:
2515    *
2516    * <ul>
2517    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2518    * </ul>
2519    *
2520    * <p>Sample code:
2521    *
2522    * <pre>{@code
2523    * // This snippet has been automatically generated and should be regarded as a code template only.
2524    * // It will require modifications to work:
2525    * // - It may require correct/in-range values for request initialization.
2526    * // - It may require specifying regional endpoints when creating the service client as shown in
2527    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2528    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2529    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
2530    *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
2531    *   productSearchClient.addProductToProductSet(name, product);
2532    * }
2533    * }</pre>
2534    *
2535    * @param name Required. The resource name for the ProductSet to modify.
2536    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2537    * @param product Required. The resource name for the Product to be added to this ProductSet.
2538    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2539    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2540    */
addProductToProductSet(String name, ProductName product)2541   public final void addProductToProductSet(String name, ProductName product) {
2542     AddProductToProductSetRequest request =
2543         AddProductToProductSetRequest.newBuilder()
2544             .setName(name)
2545             .setProduct(product == null ? null : product.toString())
2546             .build();
2547     addProductToProductSet(request);
2548   }
2549 
2550   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2551   /**
2552    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2553    * made.
2554    *
2555    * <p>One Product can be added to at most 100 ProductSets.
2556    *
2557    * <p>Possible errors:
2558    *
2559    * <ul>
2560    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2561    * </ul>
2562    *
2563    * <p>Sample code:
2564    *
2565    * <pre>{@code
2566    * // This snippet has been automatically generated and should be regarded as a code template only.
2567    * // It will require modifications to work:
2568    * // - It may require correct/in-range values for request initialization.
2569    * // - It may require specifying regional endpoints when creating the service client as shown in
2570    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2571    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2572    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
2573    *   String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
2574    *   productSearchClient.addProductToProductSet(name, product);
2575    * }
2576    * }</pre>
2577    *
2578    * @param name Required. The resource name for the ProductSet to modify.
2579    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2580    * @param product Required. The resource name for the Product to be added to this ProductSet.
2581    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2582    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2583    */
addProductToProductSet(String name, String product)2584   public final void addProductToProductSet(String name, String product) {
2585     AddProductToProductSetRequest request =
2586         AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build();
2587     addProductToProductSet(request);
2588   }
2589 
2590   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2591   /**
2592    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2593    * made.
2594    *
2595    * <p>One Product can be added to at most 100 ProductSets.
2596    *
2597    * <p>Possible errors:
2598    *
2599    * <ul>
2600    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2601    * </ul>
2602    *
2603    * <p>Sample code:
2604    *
2605    * <pre>{@code
2606    * // This snippet has been automatically generated and should be regarded as a code template only.
2607    * // It will require modifications to work:
2608    * // - It may require correct/in-range values for request initialization.
2609    * // - It may require specifying regional endpoints when creating the service client as shown in
2610    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2611    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2612    *   AddProductToProductSetRequest request =
2613    *       AddProductToProductSetRequest.newBuilder()
2614    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2615    *           .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2616    *           .build();
2617    *   productSearchClient.addProductToProductSet(request);
2618    * }
2619    * }</pre>
2620    *
2621    * @param request The request object containing all of the parameters for the API call.
2622    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2623    */
addProductToProductSet(AddProductToProductSetRequest request)2624   public final void addProductToProductSet(AddProductToProductSetRequest request) {
2625     addProductToProductSetCallable().call(request);
2626   }
2627 
2628   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2629   /**
2630    * Adds a Product to the specified ProductSet. If the Product is already present, no change is
2631    * made.
2632    *
2633    * <p>One Product can be added to at most 100 ProductSets.
2634    *
2635    * <p>Possible errors:
2636    *
2637    * <ul>
2638    *   <li>Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
2639    * </ul>
2640    *
2641    * <p>Sample code:
2642    *
2643    * <pre>{@code
2644    * // This snippet has been automatically generated and should be regarded as a code template only.
2645    * // It will require modifications to work:
2646    * // - It may require correct/in-range values for request initialization.
2647    * // - It may require specifying regional endpoints when creating the service client as shown in
2648    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2649    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2650    *   AddProductToProductSetRequest request =
2651    *       AddProductToProductSetRequest.newBuilder()
2652    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2653    *           .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2654    *           .build();
2655    *   ApiFuture<Empty> future =
2656    *       productSearchClient.addProductToProductSetCallable().futureCall(request);
2657    *   // Do something.
2658    *   future.get();
2659    * }
2660    * }</pre>
2661    */
2662   public final UnaryCallable<AddProductToProductSetRequest, Empty>
addProductToProductSetCallable()2663       addProductToProductSetCallable() {
2664     return stub.addProductToProductSetCallable();
2665   }
2666 
2667   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2668   /**
2669    * Removes a Product from the specified ProductSet.
2670    *
2671    * <p>Sample code:
2672    *
2673    * <pre>{@code
2674    * // This snippet has been automatically generated and should be regarded as a code template only.
2675    * // It will require modifications to work:
2676    * // - It may require correct/in-range values for request initialization.
2677    * // - It may require specifying regional endpoints when creating the service client as shown in
2678    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2679    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2680    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
2681    *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
2682    *   productSearchClient.removeProductFromProductSet(name, product);
2683    * }
2684    * }</pre>
2685    *
2686    * @param name Required. The resource name for the ProductSet to modify.
2687    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2688    * @param product Required. The resource name for the Product to be removed from this ProductSet.
2689    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2690    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2691    */
removeProductFromProductSet(ProductSetName name, ProductName product)2692   public final void removeProductFromProductSet(ProductSetName name, ProductName product) {
2693     RemoveProductFromProductSetRequest request =
2694         RemoveProductFromProductSetRequest.newBuilder()
2695             .setName(name == null ? null : name.toString())
2696             .setProduct(product == null ? null : product.toString())
2697             .build();
2698     removeProductFromProductSet(request);
2699   }
2700 
2701   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2702   /**
2703    * Removes a Product from the specified ProductSet.
2704    *
2705    * <p>Sample code:
2706    *
2707    * <pre>{@code
2708    * // This snippet has been automatically generated and should be regarded as a code template only.
2709    * // It will require modifications to work:
2710    * // - It may require correct/in-range values for request initialization.
2711    * // - It may require specifying regional endpoints when creating the service client as shown in
2712    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2713    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2714    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
2715    *   String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
2716    *   productSearchClient.removeProductFromProductSet(name, product);
2717    * }
2718    * }</pre>
2719    *
2720    * @param name Required. The resource name for the ProductSet to modify.
2721    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2722    * @param product Required. The resource name for the Product to be removed from this ProductSet.
2723    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2724    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2725    */
removeProductFromProductSet(ProductSetName name, String product)2726   public final void removeProductFromProductSet(ProductSetName name, String product) {
2727     RemoveProductFromProductSetRequest request =
2728         RemoveProductFromProductSetRequest.newBuilder()
2729             .setName(name == null ? null : name.toString())
2730             .setProduct(product)
2731             .build();
2732     removeProductFromProductSet(request);
2733   }
2734 
2735   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2736   /**
2737    * Removes a Product from the specified ProductSet.
2738    *
2739    * <p>Sample code:
2740    *
2741    * <pre>{@code
2742    * // This snippet has been automatically generated and should be regarded as a code template only.
2743    * // It will require modifications to work:
2744    * // - It may require correct/in-range values for request initialization.
2745    * // - It may require specifying regional endpoints when creating the service client as shown in
2746    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2747    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2748    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
2749    *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
2750    *   productSearchClient.removeProductFromProductSet(name, product);
2751    * }
2752    * }</pre>
2753    *
2754    * @param name Required. The resource name for the ProductSet to modify.
2755    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2756    * @param product Required. The resource name for the Product to be removed from this ProductSet.
2757    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2758    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2759    */
removeProductFromProductSet(String name, ProductName product)2760   public final void removeProductFromProductSet(String name, ProductName product) {
2761     RemoveProductFromProductSetRequest request =
2762         RemoveProductFromProductSetRequest.newBuilder()
2763             .setName(name)
2764             .setProduct(product == null ? null : product.toString())
2765             .build();
2766     removeProductFromProductSet(request);
2767   }
2768 
2769   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2770   /**
2771    * Removes a Product from the specified ProductSet.
2772    *
2773    * <p>Sample code:
2774    *
2775    * <pre>{@code
2776    * // This snippet has been automatically generated and should be regarded as a code template only.
2777    * // It will require modifications to work:
2778    * // - It may require correct/in-range values for request initialization.
2779    * // - It may require specifying regional endpoints when creating the service client as shown in
2780    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2781    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2782    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
2783    *   String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
2784    *   productSearchClient.removeProductFromProductSet(name, product);
2785    * }
2786    * }</pre>
2787    *
2788    * @param name Required. The resource name for the ProductSet to modify.
2789    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2790    * @param product Required. The resource name for the Product to be removed from this ProductSet.
2791    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
2792    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2793    */
removeProductFromProductSet(String name, String product)2794   public final void removeProductFromProductSet(String name, String product) {
2795     RemoveProductFromProductSetRequest request =
2796         RemoveProductFromProductSetRequest.newBuilder().setName(name).setProduct(product).build();
2797     removeProductFromProductSet(request);
2798   }
2799 
2800   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2801   /**
2802    * Removes a Product from the specified ProductSet.
2803    *
2804    * <p>Sample code:
2805    *
2806    * <pre>{@code
2807    * // This snippet has been automatically generated and should be regarded as a code template only.
2808    * // It will require modifications to work:
2809    * // - It may require correct/in-range values for request initialization.
2810    * // - It may require specifying regional endpoints when creating the service client as shown in
2811    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2812    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2813    *   RemoveProductFromProductSetRequest request =
2814    *       RemoveProductFromProductSetRequest.newBuilder()
2815    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2816    *           .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2817    *           .build();
2818    *   productSearchClient.removeProductFromProductSet(request);
2819    * }
2820    * }</pre>
2821    *
2822    * @param request The request object containing all of the parameters for the API call.
2823    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2824    */
removeProductFromProductSet(RemoveProductFromProductSetRequest request)2825   public final void removeProductFromProductSet(RemoveProductFromProductSetRequest request) {
2826     removeProductFromProductSetCallable().call(request);
2827   }
2828 
2829   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2830   /**
2831    * Removes a Product from the specified ProductSet.
2832    *
2833    * <p>Sample code:
2834    *
2835    * <pre>{@code
2836    * // This snippet has been automatically generated and should be regarded as a code template only.
2837    * // It will require modifications to work:
2838    * // - It may require correct/in-range values for request initialization.
2839    * // - It may require specifying regional endpoints when creating the service client as shown in
2840    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2841    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2842    *   RemoveProductFromProductSetRequest request =
2843    *       RemoveProductFromProductSetRequest.newBuilder()
2844    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2845    *           .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
2846    *           .build();
2847    *   ApiFuture<Empty> future =
2848    *       productSearchClient.removeProductFromProductSetCallable().futureCall(request);
2849    *   // Do something.
2850    *   future.get();
2851    * }
2852    * }</pre>
2853    */
2854   public final UnaryCallable<RemoveProductFromProductSetRequest, Empty>
removeProductFromProductSetCallable()2855       removeProductFromProductSetCallable() {
2856     return stub.removeProductFromProductSetCallable();
2857   }
2858 
2859   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2860   /**
2861    * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist,
2862    * the products field of the response will be empty.
2863    *
2864    * <p>Possible errors:
2865    *
2866    * <ul>
2867    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
2868    * </ul>
2869    *
2870    * <p>Sample code:
2871    *
2872    * <pre>{@code
2873    * // This snippet has been automatically generated and should be regarded as a code template only.
2874    * // It will require modifications to work:
2875    * // - It may require correct/in-range values for request initialization.
2876    * // - It may require specifying regional endpoints when creating the service client as shown in
2877    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2878    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2879    *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
2880    *   for (Product element : productSearchClient.listProductsInProductSet(name).iterateAll()) {
2881    *     // doThingsWith(element);
2882    *   }
2883    * }
2884    * }</pre>
2885    *
2886    * @param name Required. The ProductSet resource for which to retrieve Products.
2887    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2888    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2889    */
listProductsInProductSet(ProductSetName name)2890   public final ListProductsInProductSetPagedResponse listProductsInProductSet(ProductSetName name) {
2891     ListProductsInProductSetRequest request =
2892         ListProductsInProductSetRequest.newBuilder()
2893             .setName(name == null ? null : name.toString())
2894             .build();
2895     return listProductsInProductSet(request);
2896   }
2897 
2898   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2899   /**
2900    * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist,
2901    * the products field of the response will be empty.
2902    *
2903    * <p>Possible errors:
2904    *
2905    * <ul>
2906    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
2907    * </ul>
2908    *
2909    * <p>Sample code:
2910    *
2911    * <pre>{@code
2912    * // This snippet has been automatically generated and should be regarded as a code template only.
2913    * // It will require modifications to work:
2914    * // - It may require correct/in-range values for request initialization.
2915    * // - It may require specifying regional endpoints when creating the service client as shown in
2916    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2917    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2918    *   String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
2919    *   for (Product element : productSearchClient.listProductsInProductSet(name).iterateAll()) {
2920    *     // doThingsWith(element);
2921    *   }
2922    * }
2923    * }</pre>
2924    *
2925    * @param name Required. The ProductSet resource for which to retrieve Products.
2926    *     <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
2927    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2928    */
listProductsInProductSet(String name)2929   public final ListProductsInProductSetPagedResponse listProductsInProductSet(String name) {
2930     ListProductsInProductSetRequest request =
2931         ListProductsInProductSetRequest.newBuilder().setName(name).build();
2932     return listProductsInProductSet(request);
2933   }
2934 
2935   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2936   /**
2937    * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist,
2938    * the products field of the response will be empty.
2939    *
2940    * <p>Possible errors:
2941    *
2942    * <ul>
2943    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
2944    * </ul>
2945    *
2946    * <p>Sample code:
2947    *
2948    * <pre>{@code
2949    * // This snippet has been automatically generated and should be regarded as a code template only.
2950    * // It will require modifications to work:
2951    * // - It may require correct/in-range values for request initialization.
2952    * // - It may require specifying regional endpoints when creating the service client as shown in
2953    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2954    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2955    *   ListProductsInProductSetRequest request =
2956    *       ListProductsInProductSetRequest.newBuilder()
2957    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2958    *           .setPageSize(883849137)
2959    *           .setPageToken("pageToken873572522")
2960    *           .build();
2961    *   for (Product element : productSearchClient.listProductsInProductSet(request).iterateAll()) {
2962    *     // doThingsWith(element);
2963    *   }
2964    * }
2965    * }</pre>
2966    *
2967    * @param request The request object containing all of the parameters for the API call.
2968    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2969    */
listProductsInProductSet( ListProductsInProductSetRequest request)2970   public final ListProductsInProductSetPagedResponse listProductsInProductSet(
2971       ListProductsInProductSetRequest request) {
2972     return listProductsInProductSetPagedCallable().call(request);
2973   }
2974 
2975   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2976   /**
2977    * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist,
2978    * the products field of the response will be empty.
2979    *
2980    * <p>Possible errors:
2981    *
2982    * <ul>
2983    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
2984    * </ul>
2985    *
2986    * <p>Sample code:
2987    *
2988    * <pre>{@code
2989    * // This snippet has been automatically generated and should be regarded as a code template only.
2990    * // It will require modifications to work:
2991    * // - It may require correct/in-range values for request initialization.
2992    * // - It may require specifying regional endpoints when creating the service client as shown in
2993    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2994    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
2995    *   ListProductsInProductSetRequest request =
2996    *       ListProductsInProductSetRequest.newBuilder()
2997    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
2998    *           .setPageSize(883849137)
2999    *           .setPageToken("pageToken873572522")
3000    *           .build();
3001    *   ApiFuture<Product> future =
3002    *       productSearchClient.listProductsInProductSetPagedCallable().futureCall(request);
3003    *   // Do something.
3004    *   for (Product element : future.get().iterateAll()) {
3005    *     // doThingsWith(element);
3006    *   }
3007    * }
3008    * }</pre>
3009    */
3010   public final UnaryCallable<ListProductsInProductSetRequest, ListProductsInProductSetPagedResponse>
listProductsInProductSetPagedCallable()3011       listProductsInProductSetPagedCallable() {
3012     return stub.listProductsInProductSetPagedCallable();
3013   }
3014 
3015   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3016   /**
3017    * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist,
3018    * the products field of the response will be empty.
3019    *
3020    * <p>Possible errors:
3021    *
3022    * <ul>
3023    *   <li>Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
3024    * </ul>
3025    *
3026    * <p>Sample code:
3027    *
3028    * <pre>{@code
3029    * // This snippet has been automatically generated and should be regarded as a code template only.
3030    * // It will require modifications to work:
3031    * // - It may require correct/in-range values for request initialization.
3032    * // - It may require specifying regional endpoints when creating the service client as shown in
3033    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3034    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3035    *   ListProductsInProductSetRequest request =
3036    *       ListProductsInProductSetRequest.newBuilder()
3037    *           .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
3038    *           .setPageSize(883849137)
3039    *           .setPageToken("pageToken873572522")
3040    *           .build();
3041    *   while (true) {
3042    *     ListProductsInProductSetResponse response =
3043    *         productSearchClient.listProductsInProductSetCallable().call(request);
3044    *     for (Product element : response.getProductsList()) {
3045    *       // doThingsWith(element);
3046    *     }
3047    *     String nextPageToken = response.getNextPageToken();
3048    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
3049    *       request = request.toBuilder().setPageToken(nextPageToken).build();
3050    *     } else {
3051    *       break;
3052    *     }
3053    *   }
3054    * }
3055    * }</pre>
3056    */
3057   public final UnaryCallable<ListProductsInProductSetRequest, ListProductsInProductSetResponse>
listProductsInProductSetCallable()3058       listProductsInProductSetCallable() {
3059     return stub.listProductsInProductSetCallable();
3060   }
3061 
3062   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3063   /**
3064    * Asynchronous API that imports a list of reference images to specified product sets based on a
3065    * list of image information.
3066    *
3067    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3068    * track of the progress and results of the request. `Operation.metadata` contains
3069    * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`.
3070    * (results)
3071    *
3072    * <p>The input source of this method is a csv file on Google Cloud Storage. For the format of the
3073    * csv file please see
3074    * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
3075    *
3076    * <p>Sample code:
3077    *
3078    * <pre>{@code
3079    * // This snippet has been automatically generated and should be regarded as a code template only.
3080    * // It will require modifications to work:
3081    * // - It may require correct/in-range values for request initialization.
3082    * // - It may require specifying regional endpoints when creating the service client as shown in
3083    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3084    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3085    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
3086    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
3087    *   ImportProductSetsResponse response =
3088    *       productSearchClient.importProductSetsAsync(parent, inputConfig).get();
3089    * }
3090    * }</pre>
3091    *
3092    * @param parent Required. The project in which the ProductSets should be imported.
3093    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
3094    * @param inputConfig Required. The input content for the list of requests.
3095    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3096    */
3097   public final OperationFuture<ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsAsync(LocationName parent, ImportProductSetsInputConfig inputConfig)3098       importProductSetsAsync(LocationName parent, ImportProductSetsInputConfig inputConfig) {
3099     ImportProductSetsRequest request =
3100         ImportProductSetsRequest.newBuilder()
3101             .setParent(parent == null ? null : parent.toString())
3102             .setInputConfig(inputConfig)
3103             .build();
3104     return importProductSetsAsync(request);
3105   }
3106 
3107   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3108   /**
3109    * Asynchronous API that imports a list of reference images to specified product sets based on a
3110    * list of image information.
3111    *
3112    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3113    * track of the progress and results of the request. `Operation.metadata` contains
3114    * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`.
3115    * (results)
3116    *
3117    * <p>The input source of this method is a csv file on Google Cloud Storage. For the format of the
3118    * csv file please see
3119    * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
3120    *
3121    * <p>Sample code:
3122    *
3123    * <pre>{@code
3124    * // This snippet has been automatically generated and should be regarded as a code template only.
3125    * // It will require modifications to work:
3126    * // - It may require correct/in-range values for request initialization.
3127    * // - It may require specifying regional endpoints when creating the service client as shown in
3128    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3129    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3130    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
3131    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
3132    *   ImportProductSetsResponse response =
3133    *       productSearchClient.importProductSetsAsync(parent, inputConfig).get();
3134    * }
3135    * }</pre>
3136    *
3137    * @param parent Required. The project in which the ProductSets should be imported.
3138    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
3139    * @param inputConfig Required. The input content for the list of requests.
3140    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3141    */
3142   public final OperationFuture<ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsAsync(String parent, ImportProductSetsInputConfig inputConfig)3143       importProductSetsAsync(String parent, ImportProductSetsInputConfig inputConfig) {
3144     ImportProductSetsRequest request =
3145         ImportProductSetsRequest.newBuilder().setParent(parent).setInputConfig(inputConfig).build();
3146     return importProductSetsAsync(request);
3147   }
3148 
3149   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3150   /**
3151    * Asynchronous API that imports a list of reference images to specified product sets based on a
3152    * list of image information.
3153    *
3154    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3155    * track of the progress and results of the request. `Operation.metadata` contains
3156    * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`.
3157    * (results)
3158    *
3159    * <p>The input source of this method is a csv file on Google Cloud Storage. For the format of the
3160    * csv file please see
3161    * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
3162    *
3163    * <p>Sample code:
3164    *
3165    * <pre>{@code
3166    * // This snippet has been automatically generated and should be regarded as a code template only.
3167    * // It will require modifications to work:
3168    * // - It may require correct/in-range values for request initialization.
3169    * // - It may require specifying regional endpoints when creating the service client as shown in
3170    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3171    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3172    *   ImportProductSetsRequest request =
3173    *       ImportProductSetsRequest.newBuilder()
3174    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3175    *           .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
3176    *           .build();
3177    *   ImportProductSetsResponse response =
3178    *       productSearchClient.importProductSetsAsync(request).get();
3179    * }
3180    * }</pre>
3181    *
3182    * @param request The request object containing all of the parameters for the API call.
3183    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3184    */
3185   public final OperationFuture<ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsAsync(ImportProductSetsRequest request)3186       importProductSetsAsync(ImportProductSetsRequest request) {
3187     return importProductSetsOperationCallable().futureCall(request);
3188   }
3189 
3190   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3191   /**
3192    * Asynchronous API that imports a list of reference images to specified product sets based on a
3193    * list of image information.
3194    *
3195    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3196    * track of the progress and results of the request. `Operation.metadata` contains
3197    * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`.
3198    * (results)
3199    *
3200    * <p>The input source of this method is a csv file on Google Cloud Storage. For the format of the
3201    * csv file please see
3202    * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
3203    *
3204    * <p>Sample code:
3205    *
3206    * <pre>{@code
3207    * // This snippet has been automatically generated and should be regarded as a code template only.
3208    * // It will require modifications to work:
3209    * // - It may require correct/in-range values for request initialization.
3210    * // - It may require specifying regional endpoints when creating the service client as shown in
3211    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3212    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3213    *   ImportProductSetsRequest request =
3214    *       ImportProductSetsRequest.newBuilder()
3215    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3216    *           .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
3217    *           .build();
3218    *   OperationFuture<ImportProductSetsResponse, BatchOperationMetadata> future =
3219    *       productSearchClient.importProductSetsOperationCallable().futureCall(request);
3220    *   // Do something.
3221    *   ImportProductSetsResponse response = future.get();
3222    * }
3223    * }</pre>
3224    */
3225   public final OperationCallable<
3226           ImportProductSetsRequest, ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsOperationCallable()3227       importProductSetsOperationCallable() {
3228     return stub.importProductSetsOperationCallable();
3229   }
3230 
3231   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3232   /**
3233    * Asynchronous API that imports a list of reference images to specified product sets based on a
3234    * list of image information.
3235    *
3236    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3237    * track of the progress and results of the request. `Operation.metadata` contains
3238    * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`.
3239    * (results)
3240    *
3241    * <p>The input source of this method is a csv file on Google Cloud Storage. For the format of the
3242    * csv file please see
3243    * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
3244    *
3245    * <p>Sample code:
3246    *
3247    * <pre>{@code
3248    * // This snippet has been automatically generated and should be regarded as a code template only.
3249    * // It will require modifications to work:
3250    * // - It may require correct/in-range values for request initialization.
3251    * // - It may require specifying regional endpoints when creating the service client as shown in
3252    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3253    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3254    *   ImportProductSetsRequest request =
3255    *       ImportProductSetsRequest.newBuilder()
3256    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3257    *           .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
3258    *           .build();
3259    *   ApiFuture<Operation> future =
3260    *       productSearchClient.importProductSetsCallable().futureCall(request);
3261    *   // Do something.
3262    *   Operation response = future.get();
3263    * }
3264    * }</pre>
3265    */
importProductSetsCallable()3266   public final UnaryCallable<ImportProductSetsRequest, Operation> importProductSetsCallable() {
3267     return stub.importProductSetsCallable();
3268   }
3269 
3270   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3271   /**
3272    * Asynchronous API to delete all Products in a ProductSet or all Products that are in no
3273    * ProductSet.
3274    *
3275    * <p>If a Product is a member of the specified ProductSet in addition to other ProductSets, the
3276    * Product will still be deleted.
3277    *
3278    * <p>It is recommended to not delete the specified ProductSet until after this operation has
3279    * completed. It is also recommended to not add any of the Products involved in the batch delete
3280    * to a new ProductSet while this operation is running because those Products may still end up
3281    * deleted.
3282    *
3283    * <p>It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep
3284    * the csv files used in ImportProductSets (if that was how you originally built the Product Set)
3285    * before starting PurgeProducts, in case you need to re-import the data after deletion.
3286    *
3287    * <p>If the plan is to purge all of the Products from a ProductSet and then re-use the empty
3288    * ProductSet to re-import new Products into the empty ProductSet, you must wait until the
3289    * PurgeProducts operation has finished for that ProductSet.
3290    *
3291    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3292    * track of the progress and results of the request. `Operation.metadata` contains
3293    * `BatchOperationMetadata`. (progress)
3294    *
3295    * <p>Sample code:
3296    *
3297    * <pre>{@code
3298    * // This snippet has been automatically generated and should be regarded as a code template only.
3299    * // It will require modifications to work:
3300    * // - It may require correct/in-range values for request initialization.
3301    * // - It may require specifying regional endpoints when creating the service client as shown in
3302    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3303    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3304    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
3305    *   productSearchClient.purgeProductsAsync(parent).get();
3306    * }
3307    * }</pre>
3308    *
3309    * @param parent Required. The project and location in which the Products should be deleted.
3310    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
3311    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3312    */
purgeProductsAsync( LocationName parent)3313   public final OperationFuture<Empty, BatchOperationMetadata> purgeProductsAsync(
3314       LocationName parent) {
3315     PurgeProductsRequest request =
3316         PurgeProductsRequest.newBuilder()
3317             .setParent(parent == null ? null : parent.toString())
3318             .build();
3319     return purgeProductsAsync(request);
3320   }
3321 
3322   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3323   /**
3324    * Asynchronous API to delete all Products in a ProductSet or all Products that are in no
3325    * ProductSet.
3326    *
3327    * <p>If a Product is a member of the specified ProductSet in addition to other ProductSets, the
3328    * Product will still be deleted.
3329    *
3330    * <p>It is recommended to not delete the specified ProductSet until after this operation has
3331    * completed. It is also recommended to not add any of the Products involved in the batch delete
3332    * to a new ProductSet while this operation is running because those Products may still end up
3333    * deleted.
3334    *
3335    * <p>It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep
3336    * the csv files used in ImportProductSets (if that was how you originally built the Product Set)
3337    * before starting PurgeProducts, in case you need to re-import the data after deletion.
3338    *
3339    * <p>If the plan is to purge all of the Products from a ProductSet and then re-use the empty
3340    * ProductSet to re-import new Products into the empty ProductSet, you must wait until the
3341    * PurgeProducts operation has finished for that ProductSet.
3342    *
3343    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3344    * track of the progress and results of the request. `Operation.metadata` contains
3345    * `BatchOperationMetadata`. (progress)
3346    *
3347    * <p>Sample code:
3348    *
3349    * <pre>{@code
3350    * // This snippet has been automatically generated and should be regarded as a code template only.
3351    * // It will require modifications to work:
3352    * // - It may require correct/in-range values for request initialization.
3353    * // - It may require specifying regional endpoints when creating the service client as shown in
3354    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3355    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3356    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
3357    *   productSearchClient.purgeProductsAsync(parent).get();
3358    * }
3359    * }</pre>
3360    *
3361    * @param parent Required. The project and location in which the Products should be deleted.
3362    *     <p>Format is `projects/PROJECT_ID/locations/LOC_ID`.
3363    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3364    */
purgeProductsAsync(String parent)3365   public final OperationFuture<Empty, BatchOperationMetadata> purgeProductsAsync(String parent) {
3366     PurgeProductsRequest request = PurgeProductsRequest.newBuilder().setParent(parent).build();
3367     return purgeProductsAsync(request);
3368   }
3369 
3370   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3371   /**
3372    * Asynchronous API to delete all Products in a ProductSet or all Products that are in no
3373    * ProductSet.
3374    *
3375    * <p>If a Product is a member of the specified ProductSet in addition to other ProductSets, the
3376    * Product will still be deleted.
3377    *
3378    * <p>It is recommended to not delete the specified ProductSet until after this operation has
3379    * completed. It is also recommended to not add any of the Products involved in the batch delete
3380    * to a new ProductSet while this operation is running because those Products may still end up
3381    * deleted.
3382    *
3383    * <p>It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep
3384    * the csv files used in ImportProductSets (if that was how you originally built the Product Set)
3385    * before starting PurgeProducts, in case you need to re-import the data after deletion.
3386    *
3387    * <p>If the plan is to purge all of the Products from a ProductSet and then re-use the empty
3388    * ProductSet to re-import new Products into the empty ProductSet, you must wait until the
3389    * PurgeProducts operation has finished for that ProductSet.
3390    *
3391    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3392    * track of the progress and results of the request. `Operation.metadata` contains
3393    * `BatchOperationMetadata`. (progress)
3394    *
3395    * <p>Sample code:
3396    *
3397    * <pre>{@code
3398    * // This snippet has been automatically generated and should be regarded as a code template only.
3399    * // It will require modifications to work:
3400    * // - It may require correct/in-range values for request initialization.
3401    * // - It may require specifying regional endpoints when creating the service client as shown in
3402    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3403    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3404    *   PurgeProductsRequest request =
3405    *       PurgeProductsRequest.newBuilder()
3406    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3407    *           .setForce(true)
3408    *           .build();
3409    *   productSearchClient.purgeProductsAsync(request).get();
3410    * }
3411    * }</pre>
3412    *
3413    * @param request The request object containing all of the parameters for the API call.
3414    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
3415    */
purgeProductsAsync( PurgeProductsRequest request)3416   public final OperationFuture<Empty, BatchOperationMetadata> purgeProductsAsync(
3417       PurgeProductsRequest request) {
3418     return purgeProductsOperationCallable().futureCall(request);
3419   }
3420 
3421   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3422   /**
3423    * Asynchronous API to delete all Products in a ProductSet or all Products that are in no
3424    * ProductSet.
3425    *
3426    * <p>If a Product is a member of the specified ProductSet in addition to other ProductSets, the
3427    * Product will still be deleted.
3428    *
3429    * <p>It is recommended to not delete the specified ProductSet until after this operation has
3430    * completed. It is also recommended to not add any of the Products involved in the batch delete
3431    * to a new ProductSet while this operation is running because those Products may still end up
3432    * deleted.
3433    *
3434    * <p>It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep
3435    * the csv files used in ImportProductSets (if that was how you originally built the Product Set)
3436    * before starting PurgeProducts, in case you need to re-import the data after deletion.
3437    *
3438    * <p>If the plan is to purge all of the Products from a ProductSet and then re-use the empty
3439    * ProductSet to re-import new Products into the empty ProductSet, you must wait until the
3440    * PurgeProducts operation has finished for that ProductSet.
3441    *
3442    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3443    * track of the progress and results of the request. `Operation.metadata` contains
3444    * `BatchOperationMetadata`. (progress)
3445    *
3446    * <p>Sample code:
3447    *
3448    * <pre>{@code
3449    * // This snippet has been automatically generated and should be regarded as a code template only.
3450    * // It will require modifications to work:
3451    * // - It may require correct/in-range values for request initialization.
3452    * // - It may require specifying regional endpoints when creating the service client as shown in
3453    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3454    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3455    *   PurgeProductsRequest request =
3456    *       PurgeProductsRequest.newBuilder()
3457    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3458    *           .setForce(true)
3459    *           .build();
3460    *   OperationFuture<Empty, BatchOperationMetadata> future =
3461    *       productSearchClient.purgeProductsOperationCallable().futureCall(request);
3462    *   // Do something.
3463    *   future.get();
3464    * }
3465    * }</pre>
3466    */
3467   public final OperationCallable<PurgeProductsRequest, Empty, BatchOperationMetadata>
purgeProductsOperationCallable()3468       purgeProductsOperationCallable() {
3469     return stub.purgeProductsOperationCallable();
3470   }
3471 
3472   // AUTO-GENERATED DOCUMENTATION AND METHOD.
3473   /**
3474    * Asynchronous API to delete all Products in a ProductSet or all Products that are in no
3475    * ProductSet.
3476    *
3477    * <p>If a Product is a member of the specified ProductSet in addition to other ProductSets, the
3478    * Product will still be deleted.
3479    *
3480    * <p>It is recommended to not delete the specified ProductSet until after this operation has
3481    * completed. It is also recommended to not add any of the Products involved in the batch delete
3482    * to a new ProductSet while this operation is running because those Products may still end up
3483    * deleted.
3484    *
3485    * <p>It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep
3486    * the csv files used in ImportProductSets (if that was how you originally built the Product Set)
3487    * before starting PurgeProducts, in case you need to re-import the data after deletion.
3488    *
3489    * <p>If the plan is to purge all of the Products from a ProductSet and then re-use the empty
3490    * ProductSet to re-import new Products into the empty ProductSet, you must wait until the
3491    * PurgeProducts operation has finished for that ProductSet.
3492    *
3493    * <p>The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep
3494    * track of the progress and results of the request. `Operation.metadata` contains
3495    * `BatchOperationMetadata`. (progress)
3496    *
3497    * <p>Sample code:
3498    *
3499    * <pre>{@code
3500    * // This snippet has been automatically generated and should be regarded as a code template only.
3501    * // It will require modifications to work:
3502    * // - It may require correct/in-range values for request initialization.
3503    * // - It may require specifying regional endpoints when creating the service client as shown in
3504    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3505    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
3506    *   PurgeProductsRequest request =
3507    *       PurgeProductsRequest.newBuilder()
3508    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
3509    *           .setForce(true)
3510    *           .build();
3511    *   ApiFuture<Operation> future = productSearchClient.purgeProductsCallable().futureCall(request);
3512    *   // Do something.
3513    *   future.get();
3514    * }
3515    * }</pre>
3516    */
purgeProductsCallable()3517   public final UnaryCallable<PurgeProductsRequest, Operation> purgeProductsCallable() {
3518     return stub.purgeProductsCallable();
3519   }
3520 
3521   @Override
close()3522   public final void close() {
3523     stub.close();
3524   }
3525 
3526   @Override
shutdown()3527   public void shutdown() {
3528     stub.shutdown();
3529   }
3530 
3531   @Override
isShutdown()3532   public boolean isShutdown() {
3533     return stub.isShutdown();
3534   }
3535 
3536   @Override
isTerminated()3537   public boolean isTerminated() {
3538     return stub.isTerminated();
3539   }
3540 
3541   @Override
shutdownNow()3542   public void shutdownNow() {
3543     stub.shutdownNow();
3544   }
3545 
3546   @Override
awaitTermination(long duration, TimeUnit unit)3547   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
3548     return stub.awaitTermination(duration, unit);
3549   }
3550 
3551   public static class ListProductSetsPagedResponse
3552       extends AbstractPagedListResponse<
3553           ListProductSetsRequest,
3554           ListProductSetsResponse,
3555           ProductSet,
3556           ListProductSetsPage,
3557           ListProductSetsFixedSizeCollection> {
3558 
createAsync( PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context, ApiFuture<ListProductSetsResponse> futureResponse)3559     public static ApiFuture<ListProductSetsPagedResponse> createAsync(
3560         PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context,
3561         ApiFuture<ListProductSetsResponse> futureResponse) {
3562       ApiFuture<ListProductSetsPage> futurePage =
3563           ListProductSetsPage.createEmptyPage().createPageAsync(context, futureResponse);
3564       return ApiFutures.transform(
3565           futurePage,
3566           input -> new ListProductSetsPagedResponse(input),
3567           MoreExecutors.directExecutor());
3568     }
3569 
ListProductSetsPagedResponse(ListProductSetsPage page)3570     private ListProductSetsPagedResponse(ListProductSetsPage page) {
3571       super(page, ListProductSetsFixedSizeCollection.createEmptyCollection());
3572     }
3573   }
3574 
3575   public static class ListProductSetsPage
3576       extends AbstractPage<
3577           ListProductSetsRequest, ListProductSetsResponse, ProductSet, ListProductSetsPage> {
3578 
ListProductSetsPage( PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context, ListProductSetsResponse response)3579     private ListProductSetsPage(
3580         PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context,
3581         ListProductSetsResponse response) {
3582       super(context, response);
3583     }
3584 
createEmptyPage()3585     private static ListProductSetsPage createEmptyPage() {
3586       return new ListProductSetsPage(null, null);
3587     }
3588 
3589     @Override
createPage( PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context, ListProductSetsResponse response)3590     protected ListProductSetsPage createPage(
3591         PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context,
3592         ListProductSetsResponse response) {
3593       return new ListProductSetsPage(context, response);
3594     }
3595 
3596     @Override
createPageAsync( PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context, ApiFuture<ListProductSetsResponse> futureResponse)3597     public ApiFuture<ListProductSetsPage> createPageAsync(
3598         PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> context,
3599         ApiFuture<ListProductSetsResponse> futureResponse) {
3600       return super.createPageAsync(context, futureResponse);
3601     }
3602   }
3603 
3604   public static class ListProductSetsFixedSizeCollection
3605       extends AbstractFixedSizeCollection<
3606           ListProductSetsRequest,
3607           ListProductSetsResponse,
3608           ProductSet,
3609           ListProductSetsPage,
3610           ListProductSetsFixedSizeCollection> {
3611 
ListProductSetsFixedSizeCollection( List<ListProductSetsPage> pages, int collectionSize)3612     private ListProductSetsFixedSizeCollection(
3613         List<ListProductSetsPage> pages, int collectionSize) {
3614       super(pages, collectionSize);
3615     }
3616 
createEmptyCollection()3617     private static ListProductSetsFixedSizeCollection createEmptyCollection() {
3618       return new ListProductSetsFixedSizeCollection(null, 0);
3619     }
3620 
3621     @Override
createCollection( List<ListProductSetsPage> pages, int collectionSize)3622     protected ListProductSetsFixedSizeCollection createCollection(
3623         List<ListProductSetsPage> pages, int collectionSize) {
3624       return new ListProductSetsFixedSizeCollection(pages, collectionSize);
3625     }
3626   }
3627 
3628   public static class ListProductsPagedResponse
3629       extends AbstractPagedListResponse<
3630           ListProductsRequest,
3631           ListProductsResponse,
3632           Product,
3633           ListProductsPage,
3634           ListProductsFixedSizeCollection> {
3635 
createAsync( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ApiFuture<ListProductsResponse> futureResponse)3636     public static ApiFuture<ListProductsPagedResponse> createAsync(
3637         PageContext<ListProductsRequest, ListProductsResponse, Product> context,
3638         ApiFuture<ListProductsResponse> futureResponse) {
3639       ApiFuture<ListProductsPage> futurePage =
3640           ListProductsPage.createEmptyPage().createPageAsync(context, futureResponse);
3641       return ApiFutures.transform(
3642           futurePage,
3643           input -> new ListProductsPagedResponse(input),
3644           MoreExecutors.directExecutor());
3645     }
3646 
ListProductsPagedResponse(ListProductsPage page)3647     private ListProductsPagedResponse(ListProductsPage page) {
3648       super(page, ListProductsFixedSizeCollection.createEmptyCollection());
3649     }
3650   }
3651 
3652   public static class ListProductsPage
3653       extends AbstractPage<ListProductsRequest, ListProductsResponse, Product, ListProductsPage> {
3654 
ListProductsPage( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ListProductsResponse response)3655     private ListProductsPage(
3656         PageContext<ListProductsRequest, ListProductsResponse, Product> context,
3657         ListProductsResponse response) {
3658       super(context, response);
3659     }
3660 
createEmptyPage()3661     private static ListProductsPage createEmptyPage() {
3662       return new ListProductsPage(null, null);
3663     }
3664 
3665     @Override
createPage( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ListProductsResponse response)3666     protected ListProductsPage createPage(
3667         PageContext<ListProductsRequest, ListProductsResponse, Product> context,
3668         ListProductsResponse response) {
3669       return new ListProductsPage(context, response);
3670     }
3671 
3672     @Override
createPageAsync( PageContext<ListProductsRequest, ListProductsResponse, Product> context, ApiFuture<ListProductsResponse> futureResponse)3673     public ApiFuture<ListProductsPage> createPageAsync(
3674         PageContext<ListProductsRequest, ListProductsResponse, Product> context,
3675         ApiFuture<ListProductsResponse> futureResponse) {
3676       return super.createPageAsync(context, futureResponse);
3677     }
3678   }
3679 
3680   public static class ListProductsFixedSizeCollection
3681       extends AbstractFixedSizeCollection<
3682           ListProductsRequest,
3683           ListProductsResponse,
3684           Product,
3685           ListProductsPage,
3686           ListProductsFixedSizeCollection> {
3687 
ListProductsFixedSizeCollection(List<ListProductsPage> pages, int collectionSize)3688     private ListProductsFixedSizeCollection(List<ListProductsPage> pages, int collectionSize) {
3689       super(pages, collectionSize);
3690     }
3691 
createEmptyCollection()3692     private static ListProductsFixedSizeCollection createEmptyCollection() {
3693       return new ListProductsFixedSizeCollection(null, 0);
3694     }
3695 
3696     @Override
createCollection( List<ListProductsPage> pages, int collectionSize)3697     protected ListProductsFixedSizeCollection createCollection(
3698         List<ListProductsPage> pages, int collectionSize) {
3699       return new ListProductsFixedSizeCollection(pages, collectionSize);
3700     }
3701   }
3702 
3703   public static class ListReferenceImagesPagedResponse
3704       extends AbstractPagedListResponse<
3705           ListReferenceImagesRequest,
3706           ListReferenceImagesResponse,
3707           ReferenceImage,
3708           ListReferenceImagesPage,
3709           ListReferenceImagesFixedSizeCollection> {
3710 
createAsync( PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage> context, ApiFuture<ListReferenceImagesResponse> futureResponse)3711     public static ApiFuture<ListReferenceImagesPagedResponse> createAsync(
3712         PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
3713             context,
3714         ApiFuture<ListReferenceImagesResponse> futureResponse) {
3715       ApiFuture<ListReferenceImagesPage> futurePage =
3716           ListReferenceImagesPage.createEmptyPage().createPageAsync(context, futureResponse);
3717       return ApiFutures.transform(
3718           futurePage,
3719           input -> new ListReferenceImagesPagedResponse(input),
3720           MoreExecutors.directExecutor());
3721     }
3722 
ListReferenceImagesPagedResponse(ListReferenceImagesPage page)3723     private ListReferenceImagesPagedResponse(ListReferenceImagesPage page) {
3724       super(page, ListReferenceImagesFixedSizeCollection.createEmptyCollection());
3725     }
3726   }
3727 
3728   public static class ListReferenceImagesPage
3729       extends AbstractPage<
3730           ListReferenceImagesRequest,
3731           ListReferenceImagesResponse,
3732           ReferenceImage,
3733           ListReferenceImagesPage> {
3734 
ListReferenceImagesPage( PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage> context, ListReferenceImagesResponse response)3735     private ListReferenceImagesPage(
3736         PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
3737             context,
3738         ListReferenceImagesResponse response) {
3739       super(context, response);
3740     }
3741 
createEmptyPage()3742     private static ListReferenceImagesPage createEmptyPage() {
3743       return new ListReferenceImagesPage(null, null);
3744     }
3745 
3746     @Override
createPage( PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage> context, ListReferenceImagesResponse response)3747     protected ListReferenceImagesPage createPage(
3748         PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
3749             context,
3750         ListReferenceImagesResponse response) {
3751       return new ListReferenceImagesPage(context, response);
3752     }
3753 
3754     @Override
createPageAsync( PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage> context, ApiFuture<ListReferenceImagesResponse> futureResponse)3755     public ApiFuture<ListReferenceImagesPage> createPageAsync(
3756         PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
3757             context,
3758         ApiFuture<ListReferenceImagesResponse> futureResponse) {
3759       return super.createPageAsync(context, futureResponse);
3760     }
3761   }
3762 
3763   public static class ListReferenceImagesFixedSizeCollection
3764       extends AbstractFixedSizeCollection<
3765           ListReferenceImagesRequest,
3766           ListReferenceImagesResponse,
3767           ReferenceImage,
3768           ListReferenceImagesPage,
3769           ListReferenceImagesFixedSizeCollection> {
3770 
ListReferenceImagesFixedSizeCollection( List<ListReferenceImagesPage> pages, int collectionSize)3771     private ListReferenceImagesFixedSizeCollection(
3772         List<ListReferenceImagesPage> pages, int collectionSize) {
3773       super(pages, collectionSize);
3774     }
3775 
createEmptyCollection()3776     private static ListReferenceImagesFixedSizeCollection createEmptyCollection() {
3777       return new ListReferenceImagesFixedSizeCollection(null, 0);
3778     }
3779 
3780     @Override
createCollection( List<ListReferenceImagesPage> pages, int collectionSize)3781     protected ListReferenceImagesFixedSizeCollection createCollection(
3782         List<ListReferenceImagesPage> pages, int collectionSize) {
3783       return new ListReferenceImagesFixedSizeCollection(pages, collectionSize);
3784     }
3785   }
3786 
3787   public static class ListProductsInProductSetPagedResponse
3788       extends AbstractPagedListResponse<
3789           ListProductsInProductSetRequest,
3790           ListProductsInProductSetResponse,
3791           Product,
3792           ListProductsInProductSetPage,
3793           ListProductsInProductSetFixedSizeCollection> {
3794 
createAsync( PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product> context, ApiFuture<ListProductsInProductSetResponse> futureResponse)3795     public static ApiFuture<ListProductsInProductSetPagedResponse> createAsync(
3796         PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
3797             context,
3798         ApiFuture<ListProductsInProductSetResponse> futureResponse) {
3799       ApiFuture<ListProductsInProductSetPage> futurePage =
3800           ListProductsInProductSetPage.createEmptyPage().createPageAsync(context, futureResponse);
3801       return ApiFutures.transform(
3802           futurePage,
3803           input -> new ListProductsInProductSetPagedResponse(input),
3804           MoreExecutors.directExecutor());
3805     }
3806 
ListProductsInProductSetPagedResponse(ListProductsInProductSetPage page)3807     private ListProductsInProductSetPagedResponse(ListProductsInProductSetPage page) {
3808       super(page, ListProductsInProductSetFixedSizeCollection.createEmptyCollection());
3809     }
3810   }
3811 
3812   public static class ListProductsInProductSetPage
3813       extends AbstractPage<
3814           ListProductsInProductSetRequest,
3815           ListProductsInProductSetResponse,
3816           Product,
3817           ListProductsInProductSetPage> {
3818 
ListProductsInProductSetPage( PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product> context, ListProductsInProductSetResponse response)3819     private ListProductsInProductSetPage(
3820         PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
3821             context,
3822         ListProductsInProductSetResponse response) {
3823       super(context, response);
3824     }
3825 
createEmptyPage()3826     private static ListProductsInProductSetPage createEmptyPage() {
3827       return new ListProductsInProductSetPage(null, null);
3828     }
3829 
3830     @Override
createPage( PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product> context, ListProductsInProductSetResponse response)3831     protected ListProductsInProductSetPage createPage(
3832         PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
3833             context,
3834         ListProductsInProductSetResponse response) {
3835       return new ListProductsInProductSetPage(context, response);
3836     }
3837 
3838     @Override
createPageAsync( PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product> context, ApiFuture<ListProductsInProductSetResponse> futureResponse)3839     public ApiFuture<ListProductsInProductSetPage> createPageAsync(
3840         PageContext<ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
3841             context,
3842         ApiFuture<ListProductsInProductSetResponse> futureResponse) {
3843       return super.createPageAsync(context, futureResponse);
3844     }
3845   }
3846 
3847   public static class ListProductsInProductSetFixedSizeCollection
3848       extends AbstractFixedSizeCollection<
3849           ListProductsInProductSetRequest,
3850           ListProductsInProductSetResponse,
3851           Product,
3852           ListProductsInProductSetPage,
3853           ListProductsInProductSetFixedSizeCollection> {
3854 
ListProductsInProductSetFixedSizeCollection( List<ListProductsInProductSetPage> pages, int collectionSize)3855     private ListProductsInProductSetFixedSizeCollection(
3856         List<ListProductsInProductSetPage> pages, int collectionSize) {
3857       super(pages, collectionSize);
3858     }
3859 
createEmptyCollection()3860     private static ListProductsInProductSetFixedSizeCollection createEmptyCollection() {
3861       return new ListProductsInProductSetFixedSizeCollection(null, 0);
3862     }
3863 
3864     @Override
createCollection( List<ListProductsInProductSetPage> pages, int collectionSize)3865     protected ListProductsInProductSetFixedSizeCollection createCollection(
3866         List<ListProductsInProductSetPage> pages, int collectionSize) {
3867       return new ListProductsInProductSetFixedSizeCollection(pages, collectionSize);
3868     }
3869   }
3870 }
3871