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