• 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.retail.v2;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.gax.core.BackgroundResource;
22 import com.google.api.gax.paging.AbstractFixedSizeCollection;
23 import com.google.api.gax.paging.AbstractPage;
24 import com.google.api.gax.paging.AbstractPagedListResponse;
25 import com.google.api.gax.rpc.PageContext;
26 import com.google.api.gax.rpc.UnaryCallable;
27 import com.google.cloud.retail.v2.stub.CatalogServiceStub;
28 import com.google.cloud.retail.v2.stub.CatalogServiceStubSettings;
29 import com.google.common.util.concurrent.MoreExecutors;
30 import com.google.protobuf.Empty;
31 import com.google.protobuf.FieldMask;
32 import java.io.IOException;
33 import java.util.List;
34 import java.util.concurrent.TimeUnit;
35 import javax.annotation.Generated;
36 
37 // AUTO-GENERATED DOCUMENTATION AND CLASS.
38 /**
39  * Service Description: Service for managing catalog configuration.
40  *
41  * <p>This class provides the ability to make remote calls to the backing service through method
42  * calls that map to API methods. Sample code to get started:
43  *
44  * <pre>{@code
45  * // This snippet has been automatically generated and should be regarded as a code template only.
46  * // It will require modifications to work:
47  * // - It may require correct/in-range values for request initialization.
48  * // - It may require specifying regional endpoints when creating the service client as shown in
49  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
50  * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
51  *   Catalog catalog = Catalog.newBuilder().build();
52  *   FieldMask updateMask = FieldMask.newBuilder().build();
53  *   Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
54  * }
55  * }</pre>
56  *
57  * <p>Note: close() needs to be called on the CatalogServiceClient object to clean up resources such
58  * as threads. In the example above, try-with-resources is used, which automatically calls close().
59  *
60  * <p>The surface of this class includes several types of Java methods for each of the API's
61  * methods:
62  *
63  * <ol>
64  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
65  *       converted into function parameters. It may be the case that not all fields are available as
66  *       parameters, and not every API method will have a flattened method entry point.
67  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
68  *       which must be constructed before the call. Not every API method will have a request object
69  *       method.
70  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
71  *       callable object, which can be used to initiate calls to the service.
72  * </ol>
73  *
74  * <p>See the individual methods for example code.
75  *
76  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
77  * these names, this class includes a format method for each type of name, and additionally a parse
78  * method to extract the individual identifiers contained within names that are returned.
79  *
80  * <p>This class can be customized by passing in a custom instance of CatalogServiceSettings to
81  * create(). For example:
82  *
83  * <p>To customize credentials:
84  *
85  * <pre>{@code
86  * // This snippet has been automatically generated and should be regarded as a code template only.
87  * // It will require modifications to work:
88  * // - It may require correct/in-range values for request initialization.
89  * // - It may require specifying regional endpoints when creating the service client as shown in
90  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
91  * CatalogServiceSettings catalogServiceSettings =
92  *     CatalogServiceSettings.newBuilder()
93  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
94  *         .build();
95  * CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
96  * }</pre>
97  *
98  * <p>To customize the endpoint:
99  *
100  * <pre>{@code
101  * // This snippet has been automatically generated and should be regarded as a code template only.
102  * // It will require modifications to work:
103  * // - It may require correct/in-range values for request initialization.
104  * // - It may require specifying regional endpoints when creating the service client as shown in
105  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
106  * CatalogServiceSettings catalogServiceSettings =
107  *     CatalogServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
108  * CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
109  * }</pre>
110  *
111  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
112  * the wire:
113  *
114  * <pre>{@code
115  * // This snippet has been automatically generated and should be regarded as a code template only.
116  * // It will require modifications to work:
117  * // - It may require correct/in-range values for request initialization.
118  * // - It may require specifying regional endpoints when creating the service client as shown in
119  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
120  * CatalogServiceSettings catalogServiceSettings =
121  *     CatalogServiceSettings.newHttpJsonBuilder().build();
122  * CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
123  * }</pre>
124  *
125  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
126  */
127 @Generated("by gapic-generator-java")
128 public class CatalogServiceClient implements BackgroundResource {
129   private final CatalogServiceSettings settings;
130   private final CatalogServiceStub stub;
131 
132   /** Constructs an instance of CatalogServiceClient with default settings. */
create()133   public static final CatalogServiceClient create() throws IOException {
134     return create(CatalogServiceSettings.newBuilder().build());
135   }
136 
137   /**
138    * Constructs an instance of CatalogServiceClient, using the given settings. The channels are
139    * created based on the settings passed in, or defaults for any settings that are not set.
140    */
create(CatalogServiceSettings settings)141   public static final CatalogServiceClient create(CatalogServiceSettings settings)
142       throws IOException {
143     return new CatalogServiceClient(settings);
144   }
145 
146   /**
147    * Constructs an instance of CatalogServiceClient, using the given stub for making calls. This is
148    * for advanced usage - prefer using create(CatalogServiceSettings).
149    */
create(CatalogServiceStub stub)150   public static final CatalogServiceClient create(CatalogServiceStub stub) {
151     return new CatalogServiceClient(stub);
152   }
153 
154   /**
155    * Constructs an instance of CatalogServiceClient, using the given settings. This is protected so
156    * that it is easy to make a subclass, but otherwise, the static factory methods should be
157    * preferred.
158    */
CatalogServiceClient(CatalogServiceSettings settings)159   protected CatalogServiceClient(CatalogServiceSettings settings) throws IOException {
160     this.settings = settings;
161     this.stub = ((CatalogServiceStubSettings) settings.getStubSettings()).createStub();
162   }
163 
CatalogServiceClient(CatalogServiceStub stub)164   protected CatalogServiceClient(CatalogServiceStub stub) {
165     this.settings = null;
166     this.stub = stub;
167   }
168 
getSettings()169   public final CatalogServiceSettings getSettings() {
170     return settings;
171   }
172 
getStub()173   public CatalogServiceStub getStub() {
174     return stub;
175   }
176 
177   // AUTO-GENERATED DOCUMENTATION AND METHOD.
178   /**
179    * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
180    *
181    * <p>Sample code:
182    *
183    * <pre>{@code
184    * // This snippet has been automatically generated and should be regarded as a code template only.
185    * // It will require modifications to work:
186    * // - It may require correct/in-range values for request initialization.
187    * // - It may require specifying regional endpoints when creating the service client as shown in
188    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
189    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
190    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
191    *   for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
192    *     // doThingsWith(element);
193    *   }
194    * }
195    * }</pre>
196    *
197    * @param parent Required. The account resource name with an associated location.
198    *     <p>If the caller does not have permission to list
199    *     [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or
200    *     not this location exists, a PERMISSION_DENIED error is returned.
201    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
202    */
listCatalogs(LocationName parent)203   public final ListCatalogsPagedResponse listCatalogs(LocationName parent) {
204     ListCatalogsRequest request =
205         ListCatalogsRequest.newBuilder()
206             .setParent(parent == null ? null : parent.toString())
207             .build();
208     return listCatalogs(request);
209   }
210 
211   // AUTO-GENERATED DOCUMENTATION AND METHOD.
212   /**
213    * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
214    *
215    * <p>Sample code:
216    *
217    * <pre>{@code
218    * // This snippet has been automatically generated and should be regarded as a code template only.
219    * // It will require modifications to work:
220    * // - It may require correct/in-range values for request initialization.
221    * // - It may require specifying regional endpoints when creating the service client as shown in
222    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
223    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
224    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
225    *   for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
226    *     // doThingsWith(element);
227    *   }
228    * }
229    * }</pre>
230    *
231    * @param parent Required. The account resource name with an associated location.
232    *     <p>If the caller does not have permission to list
233    *     [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or
234    *     not this location exists, a PERMISSION_DENIED error is returned.
235    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
236    */
listCatalogs(String parent)237   public final ListCatalogsPagedResponse listCatalogs(String parent) {
238     ListCatalogsRequest request = ListCatalogsRequest.newBuilder().setParent(parent).build();
239     return listCatalogs(request);
240   }
241 
242   // AUTO-GENERATED DOCUMENTATION AND METHOD.
243   /**
244    * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
245    *
246    * <p>Sample code:
247    *
248    * <pre>{@code
249    * // This snippet has been automatically generated and should be regarded as a code template only.
250    * // It will require modifications to work:
251    * // - It may require correct/in-range values for request initialization.
252    * // - It may require specifying regional endpoints when creating the service client as shown in
253    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
254    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
255    *   ListCatalogsRequest request =
256    *       ListCatalogsRequest.newBuilder()
257    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
258    *           .setPageSize(883849137)
259    *           .setPageToken("pageToken873572522")
260    *           .build();
261    *   for (Catalog element : catalogServiceClient.listCatalogs(request).iterateAll()) {
262    *     // doThingsWith(element);
263    *   }
264    * }
265    * }</pre>
266    *
267    * @param request The request object containing all of the parameters for the API call.
268    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
269    */
listCatalogs(ListCatalogsRequest request)270   public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request) {
271     return listCatalogsPagedCallable().call(request);
272   }
273 
274   // AUTO-GENERATED DOCUMENTATION AND METHOD.
275   /**
276    * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
277    *
278    * <p>Sample code:
279    *
280    * <pre>{@code
281    * // This snippet has been automatically generated and should be regarded as a code template only.
282    * // It will require modifications to work:
283    * // - It may require correct/in-range values for request initialization.
284    * // - It may require specifying regional endpoints when creating the service client as shown in
285    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
286    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
287    *   ListCatalogsRequest request =
288    *       ListCatalogsRequest.newBuilder()
289    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
290    *           .setPageSize(883849137)
291    *           .setPageToken("pageToken873572522")
292    *           .build();
293    *   ApiFuture<Catalog> future =
294    *       catalogServiceClient.listCatalogsPagedCallable().futureCall(request);
295    *   // Do something.
296    *   for (Catalog element : future.get().iterateAll()) {
297    *     // doThingsWith(element);
298    *   }
299    * }
300    * }</pre>
301    */
302   public final UnaryCallable<ListCatalogsRequest, ListCatalogsPagedResponse>
listCatalogsPagedCallable()303       listCatalogsPagedCallable() {
304     return stub.listCatalogsPagedCallable();
305   }
306 
307   // AUTO-GENERATED DOCUMENTATION AND METHOD.
308   /**
309    * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
310    *
311    * <p>Sample code:
312    *
313    * <pre>{@code
314    * // This snippet has been automatically generated and should be regarded as a code template only.
315    * // It will require modifications to work:
316    * // - It may require correct/in-range values for request initialization.
317    * // - It may require specifying regional endpoints when creating the service client as shown in
318    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
319    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
320    *   ListCatalogsRequest request =
321    *       ListCatalogsRequest.newBuilder()
322    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
323    *           .setPageSize(883849137)
324    *           .setPageToken("pageToken873572522")
325    *           .build();
326    *   while (true) {
327    *     ListCatalogsResponse response = catalogServiceClient.listCatalogsCallable().call(request);
328    *     for (Catalog element : response.getCatalogsList()) {
329    *       // doThingsWith(element);
330    *     }
331    *     String nextPageToken = response.getNextPageToken();
332    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
333    *       request = request.toBuilder().setPageToken(nextPageToken).build();
334    *     } else {
335    *       break;
336    *     }
337    *   }
338    * }
339    * }</pre>
340    */
listCatalogsCallable()341   public final UnaryCallable<ListCatalogsRequest, ListCatalogsResponse> listCatalogsCallable() {
342     return stub.listCatalogsCallable();
343   }
344 
345   // AUTO-GENERATED DOCUMENTATION AND METHOD.
346   /**
347    * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
348    *
349    * <p>Sample code:
350    *
351    * <pre>{@code
352    * // This snippet has been automatically generated and should be regarded as a code template only.
353    * // It will require modifications to work:
354    * // - It may require correct/in-range values for request initialization.
355    * // - It may require specifying regional endpoints when creating the service client as shown in
356    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
357    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
358    *   Catalog catalog = Catalog.newBuilder().build();
359    *   FieldMask updateMask = FieldMask.newBuilder().build();
360    *   Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
361    * }
362    * }</pre>
363    *
364    * @param catalog Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
365    *     <p>If the caller does not have permission to update the
366    *     [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a
367    *     PERMISSION_DENIED error is returned.
368    *     <p>If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, a NOT_FOUND
369    *     error is returned.
370    * @param updateMask Indicates which fields in the provided
371    *     [Catalog][google.cloud.retail.v2.Catalog] to update.
372    *     <p>If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
373    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
374    */
updateCatalog(Catalog catalog, FieldMask updateMask)375   public final Catalog updateCatalog(Catalog catalog, FieldMask updateMask) {
376     UpdateCatalogRequest request =
377         UpdateCatalogRequest.newBuilder().setCatalog(catalog).setUpdateMask(updateMask).build();
378     return updateCatalog(request);
379   }
380 
381   // AUTO-GENERATED DOCUMENTATION AND METHOD.
382   /**
383    * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
384    *
385    * <p>Sample code:
386    *
387    * <pre>{@code
388    * // This snippet has been automatically generated and should be regarded as a code template only.
389    * // It will require modifications to work:
390    * // - It may require correct/in-range values for request initialization.
391    * // - It may require specifying regional endpoints when creating the service client as shown in
392    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
393    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
394    *   UpdateCatalogRequest request =
395    *       UpdateCatalogRequest.newBuilder()
396    *           .setCatalog(Catalog.newBuilder().build())
397    *           .setUpdateMask(FieldMask.newBuilder().build())
398    *           .build();
399    *   Catalog response = catalogServiceClient.updateCatalog(request);
400    * }
401    * }</pre>
402    *
403    * @param request The request object containing all of the parameters for the API call.
404    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
405    */
updateCatalog(UpdateCatalogRequest request)406   public final Catalog updateCatalog(UpdateCatalogRequest request) {
407     return updateCatalogCallable().call(request);
408   }
409 
410   // AUTO-GENERATED DOCUMENTATION AND METHOD.
411   /**
412    * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
413    *
414    * <p>Sample code:
415    *
416    * <pre>{@code
417    * // This snippet has been automatically generated and should be regarded as a code template only.
418    * // It will require modifications to work:
419    * // - It may require correct/in-range values for request initialization.
420    * // - It may require specifying regional endpoints when creating the service client as shown in
421    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
422    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
423    *   UpdateCatalogRequest request =
424    *       UpdateCatalogRequest.newBuilder()
425    *           .setCatalog(Catalog.newBuilder().build())
426    *           .setUpdateMask(FieldMask.newBuilder().build())
427    *           .build();
428    *   ApiFuture<Catalog> future = catalogServiceClient.updateCatalogCallable().futureCall(request);
429    *   // Do something.
430    *   Catalog response = future.get();
431    * }
432    * }</pre>
433    */
updateCatalogCallable()434   public final UnaryCallable<UpdateCatalogRequest, Catalog> updateCatalogCallable() {
435     return stub.updateCatalogCallable();
436   }
437 
438   // AUTO-GENERATED DOCUMENTATION AND METHOD.
439   /**
440    * Set a specified branch id as default branch. API methods such as
441    * [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
442    * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
443    * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat
444    * requests using "default_branch" to the actual branch id set as default.
445    *
446    * <p>For example, if `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1` is set as
447    * default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
448    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` is equivalent to
449    * setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
450    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1`.
451    *
452    * <p>Using multiple branches can be useful when developers would like to have a staging branch to
453    * test and verify for future usage. When it becomes ready, developers switch on the staging
454    * branch using this API while keeping using
455    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` as
456    * [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to
457    * this staging branch.
458    *
459    * <p>CAUTION: If you have live predict/search traffic, switching the default branch could
460    * potentially cause outages if the ID space of the new branch is very different from the old one.
461    *
462    * <p>More specifically:
463    *
464    * <ul>
465    *   <li>PredictionService will only return product IDs from branch {newBranch}.
466    *   <li>SearchService will only return product IDs from branch {newBranch} (if branch is not
467    *       explicitly set).
468    *   <li>UserEventService will only join events with products from branch {newBranch}.
469    * </ul>
470    *
471    * <p>Sample code:
472    *
473    * <pre>{@code
474    * // This snippet has been automatically generated and should be regarded as a code template only.
475    * // It will require modifications to work:
476    * // - It may require correct/in-range values for request initialization.
477    * // - It may require specifying regional endpoints when creating the service client as shown in
478    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
479    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
480    *   CatalogName catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
481    *   catalogServiceClient.setDefaultBranch(catalog);
482    * }
483    * }</pre>
484    *
485    * @param catalog Full resource name of the catalog, such as
486    *     `projects/&#42;/locations/global/catalogs/default_catalog`.
487    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
488    */
setDefaultBranch(CatalogName catalog)489   public final void setDefaultBranch(CatalogName catalog) {
490     SetDefaultBranchRequest request =
491         SetDefaultBranchRequest.newBuilder()
492             .setCatalog(catalog == null ? null : catalog.toString())
493             .build();
494     setDefaultBranch(request);
495   }
496 
497   // AUTO-GENERATED DOCUMENTATION AND METHOD.
498   /**
499    * Set a specified branch id as default branch. API methods such as
500    * [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
501    * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
502    * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat
503    * requests using "default_branch" to the actual branch id set as default.
504    *
505    * <p>For example, if `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1` is set as
506    * default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
507    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` is equivalent to
508    * setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
509    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1`.
510    *
511    * <p>Using multiple branches can be useful when developers would like to have a staging branch to
512    * test and verify for future usage. When it becomes ready, developers switch on the staging
513    * branch using this API while keeping using
514    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` as
515    * [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to
516    * this staging branch.
517    *
518    * <p>CAUTION: If you have live predict/search traffic, switching the default branch could
519    * potentially cause outages if the ID space of the new branch is very different from the old one.
520    *
521    * <p>More specifically:
522    *
523    * <ul>
524    *   <li>PredictionService will only return product IDs from branch {newBranch}.
525    *   <li>SearchService will only return product IDs from branch {newBranch} (if branch is not
526    *       explicitly set).
527    *   <li>UserEventService will only join events with products from branch {newBranch}.
528    * </ul>
529    *
530    * <p>Sample code:
531    *
532    * <pre>{@code
533    * // This snippet has been automatically generated and should be regarded as a code template only.
534    * // It will require modifications to work:
535    * // - It may require correct/in-range values for request initialization.
536    * // - It may require specifying regional endpoints when creating the service client as shown in
537    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
538    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
539    *   String catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
540    *   catalogServiceClient.setDefaultBranch(catalog);
541    * }
542    * }</pre>
543    *
544    * @param catalog Full resource name of the catalog, such as
545    *     `projects/&#42;/locations/global/catalogs/default_catalog`.
546    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
547    */
setDefaultBranch(String catalog)548   public final void setDefaultBranch(String catalog) {
549     SetDefaultBranchRequest request =
550         SetDefaultBranchRequest.newBuilder().setCatalog(catalog).build();
551     setDefaultBranch(request);
552   }
553 
554   // AUTO-GENERATED DOCUMENTATION AND METHOD.
555   /**
556    * Set a specified branch id as default branch. API methods such as
557    * [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
558    * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
559    * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat
560    * requests using "default_branch" to the actual branch id set as default.
561    *
562    * <p>For example, if `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1` is set as
563    * default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
564    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` is equivalent to
565    * setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
566    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1`.
567    *
568    * <p>Using multiple branches can be useful when developers would like to have a staging branch to
569    * test and verify for future usage. When it becomes ready, developers switch on the staging
570    * branch using this API while keeping using
571    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` as
572    * [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to
573    * this staging branch.
574    *
575    * <p>CAUTION: If you have live predict/search traffic, switching the default branch could
576    * potentially cause outages if the ID space of the new branch is very different from the old one.
577    *
578    * <p>More specifically:
579    *
580    * <ul>
581    *   <li>PredictionService will only return product IDs from branch {newBranch}.
582    *   <li>SearchService will only return product IDs from branch {newBranch} (if branch is not
583    *       explicitly set).
584    *   <li>UserEventService will only join events with products from branch {newBranch}.
585    * </ul>
586    *
587    * <p>Sample code:
588    *
589    * <pre>{@code
590    * // This snippet has been automatically generated and should be regarded as a code template only.
591    * // It will require modifications to work:
592    * // - It may require correct/in-range values for request initialization.
593    * // - It may require specifying regional endpoints when creating the service client as shown in
594    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
595    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
596    *   SetDefaultBranchRequest request =
597    *       SetDefaultBranchRequest.newBuilder()
598    *           .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
599    *           .setBranchId(
600    *               BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
601    *           .setNote("note3387378")
602    *           .setForce(true)
603    *           .build();
604    *   catalogServiceClient.setDefaultBranch(request);
605    * }
606    * }</pre>
607    *
608    * @param request The request object containing all of the parameters for the API call.
609    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
610    */
setDefaultBranch(SetDefaultBranchRequest request)611   public final void setDefaultBranch(SetDefaultBranchRequest request) {
612     setDefaultBranchCallable().call(request);
613   }
614 
615   // AUTO-GENERATED DOCUMENTATION AND METHOD.
616   /**
617    * Set a specified branch id as default branch. API methods such as
618    * [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
619    * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
620    * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat
621    * requests using "default_branch" to the actual branch id set as default.
622    *
623    * <p>For example, if `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1` is set as
624    * default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
625    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` is equivalent to
626    * setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
627    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/1`.
628    *
629    * <p>Using multiple branches can be useful when developers would like to have a staging branch to
630    * test and verify for future usage. When it becomes ready, developers switch on the staging
631    * branch using this API while keeping using
632    * `projects/&#42;/locations/&#42;/catalogs/&#42;/branches/default_branch` as
633    * [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to
634    * this staging branch.
635    *
636    * <p>CAUTION: If you have live predict/search traffic, switching the default branch could
637    * potentially cause outages if the ID space of the new branch is very different from the old one.
638    *
639    * <p>More specifically:
640    *
641    * <ul>
642    *   <li>PredictionService will only return product IDs from branch {newBranch}.
643    *   <li>SearchService will only return product IDs from branch {newBranch} (if branch is not
644    *       explicitly set).
645    *   <li>UserEventService will only join events with products from branch {newBranch}.
646    * </ul>
647    *
648    * <p>Sample code:
649    *
650    * <pre>{@code
651    * // This snippet has been automatically generated and should be regarded as a code template only.
652    * // It will require modifications to work:
653    * // - It may require correct/in-range values for request initialization.
654    * // - It may require specifying regional endpoints when creating the service client as shown in
655    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
656    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
657    *   SetDefaultBranchRequest request =
658    *       SetDefaultBranchRequest.newBuilder()
659    *           .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
660    *           .setBranchId(
661    *               BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
662    *           .setNote("note3387378")
663    *           .setForce(true)
664    *           .build();
665    *   ApiFuture<Empty> future = catalogServiceClient.setDefaultBranchCallable().futureCall(request);
666    *   // Do something.
667    *   future.get();
668    * }
669    * }</pre>
670    */
setDefaultBranchCallable()671   public final UnaryCallable<SetDefaultBranchRequest, Empty> setDefaultBranchCallable() {
672     return stub.setDefaultBranchCallable();
673   }
674 
675   // AUTO-GENERATED DOCUMENTATION AND METHOD.
676   /**
677    * Get which branch is currently default branch set by
678    * [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
679    * method under a specified parent catalog.
680    *
681    * <p>Sample code:
682    *
683    * <pre>{@code
684    * // This snippet has been automatically generated and should be regarded as a code template only.
685    * // It will require modifications to work:
686    * // - It may require correct/in-range values for request initialization.
687    * // - It may require specifying regional endpoints when creating the service client as shown in
688    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
689    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
690    *   CatalogName catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
691    *   GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(catalog);
692    * }
693    * }</pre>
694    *
695    * @param catalog The parent catalog resource name, such as
696    *     `projects/&#42;/locations/global/catalogs/default_catalog`.
697    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
698    */
getDefaultBranch(CatalogName catalog)699   public final GetDefaultBranchResponse getDefaultBranch(CatalogName catalog) {
700     GetDefaultBranchRequest request =
701         GetDefaultBranchRequest.newBuilder()
702             .setCatalog(catalog == null ? null : catalog.toString())
703             .build();
704     return getDefaultBranch(request);
705   }
706 
707   // AUTO-GENERATED DOCUMENTATION AND METHOD.
708   /**
709    * Get which branch is currently default branch set by
710    * [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
711    * method under a specified parent catalog.
712    *
713    * <p>Sample code:
714    *
715    * <pre>{@code
716    * // This snippet has been automatically generated and should be regarded as a code template only.
717    * // It will require modifications to work:
718    * // - It may require correct/in-range values for request initialization.
719    * // - It may require specifying regional endpoints when creating the service client as shown in
720    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
721    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
722    *   String catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
723    *   GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(catalog);
724    * }
725    * }</pre>
726    *
727    * @param catalog The parent catalog resource name, such as
728    *     `projects/&#42;/locations/global/catalogs/default_catalog`.
729    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
730    */
getDefaultBranch(String catalog)731   public final GetDefaultBranchResponse getDefaultBranch(String catalog) {
732     GetDefaultBranchRequest request =
733         GetDefaultBranchRequest.newBuilder().setCatalog(catalog).build();
734     return getDefaultBranch(request);
735   }
736 
737   // AUTO-GENERATED DOCUMENTATION AND METHOD.
738   /**
739    * Get which branch is currently default branch set by
740    * [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
741    * method under a specified parent catalog.
742    *
743    * <p>Sample code:
744    *
745    * <pre>{@code
746    * // This snippet has been automatically generated and should be regarded as a code template only.
747    * // It will require modifications to work:
748    * // - It may require correct/in-range values for request initialization.
749    * // - It may require specifying regional endpoints when creating the service client as shown in
750    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
751    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
752    *   GetDefaultBranchRequest request =
753    *       GetDefaultBranchRequest.newBuilder()
754    *           .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
755    *           .build();
756    *   GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(request);
757    * }
758    * }</pre>
759    *
760    * @param request The request object containing all of the parameters for the API call.
761    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
762    */
getDefaultBranch(GetDefaultBranchRequest request)763   public final GetDefaultBranchResponse getDefaultBranch(GetDefaultBranchRequest request) {
764     return getDefaultBranchCallable().call(request);
765   }
766 
767   // AUTO-GENERATED DOCUMENTATION AND METHOD.
768   /**
769    * Get which branch is currently default branch set by
770    * [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
771    * method under a specified parent catalog.
772    *
773    * <p>Sample code:
774    *
775    * <pre>{@code
776    * // This snippet has been automatically generated and should be regarded as a code template only.
777    * // It will require modifications to work:
778    * // - It may require correct/in-range values for request initialization.
779    * // - It may require specifying regional endpoints when creating the service client as shown in
780    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
781    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
782    *   GetDefaultBranchRequest request =
783    *       GetDefaultBranchRequest.newBuilder()
784    *           .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
785    *           .build();
786    *   ApiFuture<GetDefaultBranchResponse> future =
787    *       catalogServiceClient.getDefaultBranchCallable().futureCall(request);
788    *   // Do something.
789    *   GetDefaultBranchResponse response = future.get();
790    * }
791    * }</pre>
792    */
793   public final UnaryCallable<GetDefaultBranchRequest, GetDefaultBranchResponse>
getDefaultBranchCallable()794       getDefaultBranchCallable() {
795     return stub.getDefaultBranchCallable();
796   }
797 
798   // AUTO-GENERATED DOCUMENTATION AND METHOD.
799   /**
800    * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
801    *
802    * <p>Sample code:
803    *
804    * <pre>{@code
805    * // This snippet has been automatically generated and should be regarded as a code template only.
806    * // It will require modifications to work:
807    * // - It may require correct/in-range values for request initialization.
808    * // - It may require specifying regional endpoints when creating the service client as shown in
809    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
810    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
811    *   CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
812    *   CompletionConfig response = catalogServiceClient.getCompletionConfig(name);
813    * }
814    * }</pre>
815    *
816    * @param name Required. Full CompletionConfig resource name. Format:
817    *     `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
818    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
819    */
getCompletionConfig(CompletionConfigName name)820   public final CompletionConfig getCompletionConfig(CompletionConfigName name) {
821     GetCompletionConfigRequest request =
822         GetCompletionConfigRequest.newBuilder()
823             .setName(name == null ? null : name.toString())
824             .build();
825     return getCompletionConfig(request);
826   }
827 
828   // AUTO-GENERATED DOCUMENTATION AND METHOD.
829   /**
830    * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
831    *
832    * <p>Sample code:
833    *
834    * <pre>{@code
835    * // This snippet has been automatically generated and should be regarded as a code template only.
836    * // It will require modifications to work:
837    * // - It may require correct/in-range values for request initialization.
838    * // - It may require specifying regional endpoints when creating the service client as shown in
839    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
840    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
841    *   String name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
842    *   CompletionConfig response = catalogServiceClient.getCompletionConfig(name);
843    * }
844    * }</pre>
845    *
846    * @param name Required. Full CompletionConfig resource name. Format:
847    *     `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
848    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
849    */
getCompletionConfig(String name)850   public final CompletionConfig getCompletionConfig(String name) {
851     GetCompletionConfigRequest request =
852         GetCompletionConfigRequest.newBuilder().setName(name).build();
853     return getCompletionConfig(request);
854   }
855 
856   // AUTO-GENERATED DOCUMENTATION AND METHOD.
857   /**
858    * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
859    *
860    * <p>Sample code:
861    *
862    * <pre>{@code
863    * // This snippet has been automatically generated and should be regarded as a code template only.
864    * // It will require modifications to work:
865    * // - It may require correct/in-range values for request initialization.
866    * // - It may require specifying regional endpoints when creating the service client as shown in
867    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
868    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
869    *   GetCompletionConfigRequest request =
870    *       GetCompletionConfigRequest.newBuilder()
871    *           .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
872    *           .build();
873    *   CompletionConfig response = catalogServiceClient.getCompletionConfig(request);
874    * }
875    * }</pre>
876    *
877    * @param request The request object containing all of the parameters for the API call.
878    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
879    */
getCompletionConfig(GetCompletionConfigRequest request)880   public final CompletionConfig getCompletionConfig(GetCompletionConfigRequest request) {
881     return getCompletionConfigCallable().call(request);
882   }
883 
884   // AUTO-GENERATED DOCUMENTATION AND METHOD.
885   /**
886    * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
887    *
888    * <p>Sample code:
889    *
890    * <pre>{@code
891    * // This snippet has been automatically generated and should be regarded as a code template only.
892    * // It will require modifications to work:
893    * // - It may require correct/in-range values for request initialization.
894    * // - It may require specifying regional endpoints when creating the service client as shown in
895    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
896    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
897    *   GetCompletionConfigRequest request =
898    *       GetCompletionConfigRequest.newBuilder()
899    *           .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
900    *           .build();
901    *   ApiFuture<CompletionConfig> future =
902    *       catalogServiceClient.getCompletionConfigCallable().futureCall(request);
903    *   // Do something.
904    *   CompletionConfig response = future.get();
905    * }
906    * }</pre>
907    */
908   public final UnaryCallable<GetCompletionConfigRequest, CompletionConfig>
getCompletionConfigCallable()909       getCompletionConfigCallable() {
910     return stub.getCompletionConfigCallable();
911   }
912 
913   // AUTO-GENERATED DOCUMENTATION AND METHOD.
914   /**
915    * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
916    *
917    * <p>Sample code:
918    *
919    * <pre>{@code
920    * // This snippet has been automatically generated and should be regarded as a code template only.
921    * // It will require modifications to work:
922    * // - It may require correct/in-range values for request initialization.
923    * // - It may require specifying regional endpoints when creating the service client as shown in
924    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
925    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
926    *   CompletionConfig completionConfig = CompletionConfig.newBuilder().build();
927    *   FieldMask updateMask = FieldMask.newBuilder().build();
928    *   CompletionConfig response =
929    *       catalogServiceClient.updateCompletionConfig(completionConfig, updateMask);
930    * }
931    * }</pre>
932    *
933    * @param completionConfig Required. The
934    *     [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update.
935    *     <p>If the caller does not have permission to update the
936    *     [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a PERMISSION_DENIED error
937    *     is returned.
938    *     <p>If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update does not
939    *     exist, a NOT_FOUND error is returned.
940    * @param updateMask Indicates which fields in the provided
941    *     [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The following are
942    *     the only supported fields:
943    *     <ul>
944    *       <li>[CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
945    *       <li>[CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
946    *       <li>[CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
947    *       <li>[CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
948    *     </ul>
949    *     <p>If not set, all supported fields are updated.
950    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
951    */
updateCompletionConfig( CompletionConfig completionConfig, FieldMask updateMask)952   public final CompletionConfig updateCompletionConfig(
953       CompletionConfig completionConfig, FieldMask updateMask) {
954     UpdateCompletionConfigRequest request =
955         UpdateCompletionConfigRequest.newBuilder()
956             .setCompletionConfig(completionConfig)
957             .setUpdateMask(updateMask)
958             .build();
959     return updateCompletionConfig(request);
960   }
961 
962   // AUTO-GENERATED DOCUMENTATION AND METHOD.
963   /**
964    * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
965    *
966    * <p>Sample code:
967    *
968    * <pre>{@code
969    * // This snippet has been automatically generated and should be regarded as a code template only.
970    * // It will require modifications to work:
971    * // - It may require correct/in-range values for request initialization.
972    * // - It may require specifying regional endpoints when creating the service client as shown in
973    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
974    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
975    *   UpdateCompletionConfigRequest request =
976    *       UpdateCompletionConfigRequest.newBuilder()
977    *           .setCompletionConfig(CompletionConfig.newBuilder().build())
978    *           .setUpdateMask(FieldMask.newBuilder().build())
979    *           .build();
980    *   CompletionConfig response = catalogServiceClient.updateCompletionConfig(request);
981    * }
982    * }</pre>
983    *
984    * @param request The request object containing all of the parameters for the API call.
985    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
986    */
updateCompletionConfig(UpdateCompletionConfigRequest request)987   public final CompletionConfig updateCompletionConfig(UpdateCompletionConfigRequest request) {
988     return updateCompletionConfigCallable().call(request);
989   }
990 
991   // AUTO-GENERATED DOCUMENTATION AND METHOD.
992   /**
993    * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
994    *
995    * <p>Sample code:
996    *
997    * <pre>{@code
998    * // This snippet has been automatically generated and should be regarded as a code template only.
999    * // It will require modifications to work:
1000    * // - It may require correct/in-range values for request initialization.
1001    * // - It may require specifying regional endpoints when creating the service client as shown in
1002    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1003    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1004    *   UpdateCompletionConfigRequest request =
1005    *       UpdateCompletionConfigRequest.newBuilder()
1006    *           .setCompletionConfig(CompletionConfig.newBuilder().build())
1007    *           .setUpdateMask(FieldMask.newBuilder().build())
1008    *           .build();
1009    *   ApiFuture<CompletionConfig> future =
1010    *       catalogServiceClient.updateCompletionConfigCallable().futureCall(request);
1011    *   // Do something.
1012    *   CompletionConfig response = future.get();
1013    * }
1014    * }</pre>
1015    */
1016   public final UnaryCallable<UpdateCompletionConfigRequest, CompletionConfig>
updateCompletionConfigCallable()1017       updateCompletionConfigCallable() {
1018     return stub.updateCompletionConfigCallable();
1019   }
1020 
1021   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1022   /**
1023    * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1024    *
1025    * <p>Sample code:
1026    *
1027    * <pre>{@code
1028    * // This snippet has been automatically generated and should be regarded as a code template only.
1029    * // It will require modifications to work:
1030    * // - It may require correct/in-range values for request initialization.
1031    * // - It may require specifying regional endpoints when creating the service client as shown in
1032    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1033    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1034    *   AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
1035    *   AttributesConfig response = catalogServiceClient.getAttributesConfig(name);
1036    * }
1037    * }</pre>
1038    *
1039    * @param name Required. Full AttributesConfig resource name. Format:
1040    *     `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
1041    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1042    */
getAttributesConfig(AttributesConfigName name)1043   public final AttributesConfig getAttributesConfig(AttributesConfigName name) {
1044     GetAttributesConfigRequest request =
1045         GetAttributesConfigRequest.newBuilder()
1046             .setName(name == null ? null : name.toString())
1047             .build();
1048     return getAttributesConfig(request);
1049   }
1050 
1051   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1052   /**
1053    * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1054    *
1055    * <p>Sample code:
1056    *
1057    * <pre>{@code
1058    * // This snippet has been automatically generated and should be regarded as a code template only.
1059    * // It will require modifications to work:
1060    * // - It may require correct/in-range values for request initialization.
1061    * // - It may require specifying regional endpoints when creating the service client as shown in
1062    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1063    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1064    *   String name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
1065    *   AttributesConfig response = catalogServiceClient.getAttributesConfig(name);
1066    * }
1067    * }</pre>
1068    *
1069    * @param name Required. Full AttributesConfig resource name. Format:
1070    *     `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
1071    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1072    */
getAttributesConfig(String name)1073   public final AttributesConfig getAttributesConfig(String name) {
1074     GetAttributesConfigRequest request =
1075         GetAttributesConfigRequest.newBuilder().setName(name).build();
1076     return getAttributesConfig(request);
1077   }
1078 
1079   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1080   /**
1081    * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1082    *
1083    * <p>Sample code:
1084    *
1085    * <pre>{@code
1086    * // This snippet has been automatically generated and should be regarded as a code template only.
1087    * // It will require modifications to work:
1088    * // - It may require correct/in-range values for request initialization.
1089    * // - It may require specifying regional endpoints when creating the service client as shown in
1090    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1091    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1092    *   GetAttributesConfigRequest request =
1093    *       GetAttributesConfigRequest.newBuilder()
1094    *           .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1095    *           .build();
1096    *   AttributesConfig response = catalogServiceClient.getAttributesConfig(request);
1097    * }
1098    * }</pre>
1099    *
1100    * @param request The request object containing all of the parameters for the API call.
1101    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1102    */
getAttributesConfig(GetAttributesConfigRequest request)1103   public final AttributesConfig getAttributesConfig(GetAttributesConfigRequest request) {
1104     return getAttributesConfigCallable().call(request);
1105   }
1106 
1107   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1108   /**
1109    * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1110    *
1111    * <p>Sample code:
1112    *
1113    * <pre>{@code
1114    * // This snippet has been automatically generated and should be regarded as a code template only.
1115    * // It will require modifications to work:
1116    * // - It may require correct/in-range values for request initialization.
1117    * // - It may require specifying regional endpoints when creating the service client as shown in
1118    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1119    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1120    *   GetAttributesConfigRequest request =
1121    *       GetAttributesConfigRequest.newBuilder()
1122    *           .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1123    *           .build();
1124    *   ApiFuture<AttributesConfig> future =
1125    *       catalogServiceClient.getAttributesConfigCallable().futureCall(request);
1126    *   // Do something.
1127    *   AttributesConfig response = future.get();
1128    * }
1129    * }</pre>
1130    */
1131   public final UnaryCallable<GetAttributesConfigRequest, AttributesConfig>
getAttributesConfigCallable()1132       getAttributesConfigCallable() {
1133     return stub.getAttributesConfigCallable();
1134   }
1135 
1136   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1137   /**
1138    * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1139    *
1140    * <p>The catalog attributes in the request will be updated in the catalog, or inserted if they do
1141    * not exist. Existing catalog attributes not included in the request will remain unchanged.
1142    * Attributes that are assigned to products, but do not exist at the catalog level, are always
1143    * included in the response. The product attribute is assigned default values for missing catalog
1144    * attribute fields, e.g., searchable and dynamic facetable options.
1145    *
1146    * <p>Sample code:
1147    *
1148    * <pre>{@code
1149    * // This snippet has been automatically generated and should be regarded as a code template only.
1150    * // It will require modifications to work:
1151    * // - It may require correct/in-range values for request initialization.
1152    * // - It may require specifying regional endpoints when creating the service client as shown in
1153    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1154    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1155    *   AttributesConfig attributesConfig = AttributesConfig.newBuilder().build();
1156    *   FieldMask updateMask = FieldMask.newBuilder().build();
1157    *   AttributesConfig response =
1158    *       catalogServiceClient.updateAttributesConfig(attributesConfig, updateMask);
1159    * }
1160    * }</pre>
1161    *
1162    * @param attributesConfig Required. The
1163    *     [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update.
1164    * @param updateMask Indicates which fields in the provided
1165    *     [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The following is the
1166    *     only supported field:
1167    *     <ul>
1168    *       <li>[AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
1169    *     </ul>
1170    *     <p>If not set, all supported fields are updated.
1171    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1172    */
updateAttributesConfig( AttributesConfig attributesConfig, FieldMask updateMask)1173   public final AttributesConfig updateAttributesConfig(
1174       AttributesConfig attributesConfig, FieldMask updateMask) {
1175     UpdateAttributesConfigRequest request =
1176         UpdateAttributesConfigRequest.newBuilder()
1177             .setAttributesConfig(attributesConfig)
1178             .setUpdateMask(updateMask)
1179             .build();
1180     return updateAttributesConfig(request);
1181   }
1182 
1183   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1184   /**
1185    * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1186    *
1187    * <p>The catalog attributes in the request will be updated in the catalog, or inserted if they do
1188    * not exist. Existing catalog attributes not included in the request will remain unchanged.
1189    * Attributes that are assigned to products, but do not exist at the catalog level, are always
1190    * included in the response. The product attribute is assigned default values for missing catalog
1191    * attribute fields, e.g., searchable and dynamic facetable options.
1192    *
1193    * <p>Sample code:
1194    *
1195    * <pre>{@code
1196    * // This snippet has been automatically generated and should be regarded as a code template only.
1197    * // It will require modifications to work:
1198    * // - It may require correct/in-range values for request initialization.
1199    * // - It may require specifying regional endpoints when creating the service client as shown in
1200    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1201    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1202    *   UpdateAttributesConfigRequest request =
1203    *       UpdateAttributesConfigRequest.newBuilder()
1204    *           .setAttributesConfig(AttributesConfig.newBuilder().build())
1205    *           .setUpdateMask(FieldMask.newBuilder().build())
1206    *           .build();
1207    *   AttributesConfig response = catalogServiceClient.updateAttributesConfig(request);
1208    * }
1209    * }</pre>
1210    *
1211    * @param request The request object containing all of the parameters for the API call.
1212    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1213    */
updateAttributesConfig(UpdateAttributesConfigRequest request)1214   public final AttributesConfig updateAttributesConfig(UpdateAttributesConfigRequest request) {
1215     return updateAttributesConfigCallable().call(request);
1216   }
1217 
1218   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1219   /**
1220    * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1221    *
1222    * <p>The catalog attributes in the request will be updated in the catalog, or inserted if they do
1223    * not exist. Existing catalog attributes not included in the request will remain unchanged.
1224    * Attributes that are assigned to products, but do not exist at the catalog level, are always
1225    * included in the response. The product attribute is assigned default values for missing catalog
1226    * attribute fields, e.g., searchable and dynamic facetable options.
1227    *
1228    * <p>Sample code:
1229    *
1230    * <pre>{@code
1231    * // This snippet has been automatically generated and should be regarded as a code template only.
1232    * // It will require modifications to work:
1233    * // - It may require correct/in-range values for request initialization.
1234    * // - It may require specifying regional endpoints when creating the service client as shown in
1235    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1236    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1237    *   UpdateAttributesConfigRequest request =
1238    *       UpdateAttributesConfigRequest.newBuilder()
1239    *           .setAttributesConfig(AttributesConfig.newBuilder().build())
1240    *           .setUpdateMask(FieldMask.newBuilder().build())
1241    *           .build();
1242    *   ApiFuture<AttributesConfig> future =
1243    *       catalogServiceClient.updateAttributesConfigCallable().futureCall(request);
1244    *   // Do something.
1245    *   AttributesConfig response = future.get();
1246    * }
1247    * }</pre>
1248    */
1249   public final UnaryCallable<UpdateAttributesConfigRequest, AttributesConfig>
updateAttributesConfigCallable()1250       updateAttributesConfigCallable() {
1251     return stub.updateAttributesConfigCallable();
1252   }
1253 
1254   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1255   /**
1256    * Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
1257    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1258    *
1259    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an
1260    * ALREADY_EXISTS error is returned.
1261    *
1262    * <p>Sample code:
1263    *
1264    * <pre>{@code
1265    * // This snippet has been automatically generated and should be regarded as a code template only.
1266    * // It will require modifications to work:
1267    * // - It may require correct/in-range values for request initialization.
1268    * // - It may require specifying regional endpoints when creating the service client as shown in
1269    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1270    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1271    *   AddCatalogAttributeRequest request =
1272    *       AddCatalogAttributeRequest.newBuilder()
1273    *           .setAttributesConfig(
1274    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1275    *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
1276    *           .build();
1277    *   AttributesConfig response = catalogServiceClient.addCatalogAttribute(request);
1278    * }
1279    * }</pre>
1280    *
1281    * @param request The request object containing all of the parameters for the API call.
1282    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1283    */
addCatalogAttribute(AddCatalogAttributeRequest request)1284   public final AttributesConfig addCatalogAttribute(AddCatalogAttributeRequest request) {
1285     return addCatalogAttributeCallable().call(request);
1286   }
1287 
1288   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1289   /**
1290    * Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
1291    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1292    *
1293    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an
1294    * ALREADY_EXISTS error is returned.
1295    *
1296    * <p>Sample code:
1297    *
1298    * <pre>{@code
1299    * // This snippet has been automatically generated and should be regarded as a code template only.
1300    * // It will require modifications to work:
1301    * // - It may require correct/in-range values for request initialization.
1302    * // - It may require specifying regional endpoints when creating the service client as shown in
1303    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1304    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1305    *   AddCatalogAttributeRequest request =
1306    *       AddCatalogAttributeRequest.newBuilder()
1307    *           .setAttributesConfig(
1308    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1309    *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
1310    *           .build();
1311    *   ApiFuture<AttributesConfig> future =
1312    *       catalogServiceClient.addCatalogAttributeCallable().futureCall(request);
1313    *   // Do something.
1314    *   AttributesConfig response = future.get();
1315    * }
1316    * }</pre>
1317    */
1318   public final UnaryCallable<AddCatalogAttributeRequest, AttributesConfig>
addCatalogAttributeCallable()1319       addCatalogAttributeCallable() {
1320     return stub.addCatalogAttributeCallable();
1321   }
1322 
1323   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1324   /**
1325    * Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
1326    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1327    *
1328    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist,
1329    * a NOT_FOUND error is returned.
1330    *
1331    * <p>Sample code:
1332    *
1333    * <pre>{@code
1334    * // This snippet has been automatically generated and should be regarded as a code template only.
1335    * // It will require modifications to work:
1336    * // - It may require correct/in-range values for request initialization.
1337    * // - It may require specifying regional endpoints when creating the service client as shown in
1338    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1339    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1340    *   RemoveCatalogAttributeRequest request =
1341    *       RemoveCatalogAttributeRequest.newBuilder()
1342    *           .setAttributesConfig(
1343    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1344    *           .setKey("key106079")
1345    *           .build();
1346    *   AttributesConfig response = catalogServiceClient.removeCatalogAttribute(request);
1347    * }
1348    * }</pre>
1349    *
1350    * @param request The request object containing all of the parameters for the API call.
1351    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1352    */
removeCatalogAttribute(RemoveCatalogAttributeRequest request)1353   public final AttributesConfig removeCatalogAttribute(RemoveCatalogAttributeRequest request) {
1354     return removeCatalogAttributeCallable().call(request);
1355   }
1356 
1357   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1358   /**
1359    * Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
1360    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
1361    *
1362    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist,
1363    * a NOT_FOUND error is returned.
1364    *
1365    * <p>Sample code:
1366    *
1367    * <pre>{@code
1368    * // This snippet has been automatically generated and should be regarded as a code template only.
1369    * // It will require modifications to work:
1370    * // - It may require correct/in-range values for request initialization.
1371    * // - It may require specifying regional endpoints when creating the service client as shown in
1372    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1373    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1374    *   RemoveCatalogAttributeRequest request =
1375    *       RemoveCatalogAttributeRequest.newBuilder()
1376    *           .setAttributesConfig(
1377    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1378    *           .setKey("key106079")
1379    *           .build();
1380    *   ApiFuture<AttributesConfig> future =
1381    *       catalogServiceClient.removeCatalogAttributeCallable().futureCall(request);
1382    *   // Do something.
1383    *   AttributesConfig response = future.get();
1384    * }
1385    * }</pre>
1386    */
1387   public final UnaryCallable<RemoveCatalogAttributeRequest, AttributesConfig>
removeCatalogAttributeCallable()1388       removeCatalogAttributeCallable() {
1389     return stub.removeCatalogAttributeCallable();
1390   }
1391 
1392   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1393   /**
1394    * Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
1395    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute
1396    * with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
1397    *
1398    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not
1399    * exist, a NOT_FOUND error is returned.
1400    *
1401    * <p>Sample code:
1402    *
1403    * <pre>{@code
1404    * // This snippet has been automatically generated and should be regarded as a code template only.
1405    * // It will require modifications to work:
1406    * // - It may require correct/in-range values for request initialization.
1407    * // - It may require specifying regional endpoints when creating the service client as shown in
1408    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1409    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1410    *   ReplaceCatalogAttributeRequest request =
1411    *       ReplaceCatalogAttributeRequest.newBuilder()
1412    *           .setAttributesConfig(
1413    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1414    *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
1415    *           .setUpdateMask(FieldMask.newBuilder().build())
1416    *           .build();
1417    *   AttributesConfig response = catalogServiceClient.replaceCatalogAttribute(request);
1418    * }
1419    * }</pre>
1420    *
1421    * @param request The request object containing all of the parameters for the API call.
1422    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1423    */
replaceCatalogAttribute(ReplaceCatalogAttributeRequest request)1424   public final AttributesConfig replaceCatalogAttribute(ReplaceCatalogAttributeRequest request) {
1425     return replaceCatalogAttributeCallable().call(request);
1426   }
1427 
1428   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1429   /**
1430    * Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
1431    * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute
1432    * with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
1433    *
1434    * <p>If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not
1435    * exist, a NOT_FOUND error is returned.
1436    *
1437    * <p>Sample code:
1438    *
1439    * <pre>{@code
1440    * // This snippet has been automatically generated and should be regarded as a code template only.
1441    * // It will require modifications to work:
1442    * // - It may require correct/in-range values for request initialization.
1443    * // - It may require specifying regional endpoints when creating the service client as shown in
1444    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1445    * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
1446    *   ReplaceCatalogAttributeRequest request =
1447    *       ReplaceCatalogAttributeRequest.newBuilder()
1448    *           .setAttributesConfig(
1449    *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
1450    *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
1451    *           .setUpdateMask(FieldMask.newBuilder().build())
1452    *           .build();
1453    *   ApiFuture<AttributesConfig> future =
1454    *       catalogServiceClient.replaceCatalogAttributeCallable().futureCall(request);
1455    *   // Do something.
1456    *   AttributesConfig response = future.get();
1457    * }
1458    * }</pre>
1459    */
1460   public final UnaryCallable<ReplaceCatalogAttributeRequest, AttributesConfig>
replaceCatalogAttributeCallable()1461       replaceCatalogAttributeCallable() {
1462     return stub.replaceCatalogAttributeCallable();
1463   }
1464 
1465   @Override
close()1466   public final void close() {
1467     stub.close();
1468   }
1469 
1470   @Override
shutdown()1471   public void shutdown() {
1472     stub.shutdown();
1473   }
1474 
1475   @Override
isShutdown()1476   public boolean isShutdown() {
1477     return stub.isShutdown();
1478   }
1479 
1480   @Override
isTerminated()1481   public boolean isTerminated() {
1482     return stub.isTerminated();
1483   }
1484 
1485   @Override
shutdownNow()1486   public void shutdownNow() {
1487     stub.shutdownNow();
1488   }
1489 
1490   @Override
awaitTermination(long duration, TimeUnit unit)1491   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1492     return stub.awaitTermination(duration, unit);
1493   }
1494 
1495   public static class ListCatalogsPagedResponse
1496       extends AbstractPagedListResponse<
1497           ListCatalogsRequest,
1498           ListCatalogsResponse,
1499           Catalog,
1500           ListCatalogsPage,
1501           ListCatalogsFixedSizeCollection> {
1502 
createAsync( PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context, ApiFuture<ListCatalogsResponse> futureResponse)1503     public static ApiFuture<ListCatalogsPagedResponse> createAsync(
1504         PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context,
1505         ApiFuture<ListCatalogsResponse> futureResponse) {
1506       ApiFuture<ListCatalogsPage> futurePage =
1507           ListCatalogsPage.createEmptyPage().createPageAsync(context, futureResponse);
1508       return ApiFutures.transform(
1509           futurePage,
1510           input -> new ListCatalogsPagedResponse(input),
1511           MoreExecutors.directExecutor());
1512     }
1513 
ListCatalogsPagedResponse(ListCatalogsPage page)1514     private ListCatalogsPagedResponse(ListCatalogsPage page) {
1515       super(page, ListCatalogsFixedSizeCollection.createEmptyCollection());
1516     }
1517   }
1518 
1519   public static class ListCatalogsPage
1520       extends AbstractPage<ListCatalogsRequest, ListCatalogsResponse, Catalog, ListCatalogsPage> {
1521 
ListCatalogsPage( PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context, ListCatalogsResponse response)1522     private ListCatalogsPage(
1523         PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context,
1524         ListCatalogsResponse response) {
1525       super(context, response);
1526     }
1527 
createEmptyPage()1528     private static ListCatalogsPage createEmptyPage() {
1529       return new ListCatalogsPage(null, null);
1530     }
1531 
1532     @Override
createPage( PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context, ListCatalogsResponse response)1533     protected ListCatalogsPage createPage(
1534         PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context,
1535         ListCatalogsResponse response) {
1536       return new ListCatalogsPage(context, response);
1537     }
1538 
1539     @Override
createPageAsync( PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context, ApiFuture<ListCatalogsResponse> futureResponse)1540     public ApiFuture<ListCatalogsPage> createPageAsync(
1541         PageContext<ListCatalogsRequest, ListCatalogsResponse, Catalog> context,
1542         ApiFuture<ListCatalogsResponse> futureResponse) {
1543       return super.createPageAsync(context, futureResponse);
1544     }
1545   }
1546 
1547   public static class ListCatalogsFixedSizeCollection
1548       extends AbstractFixedSizeCollection<
1549           ListCatalogsRequest,
1550           ListCatalogsResponse,
1551           Catalog,
1552           ListCatalogsPage,
1553           ListCatalogsFixedSizeCollection> {
1554 
ListCatalogsFixedSizeCollection(List<ListCatalogsPage> pages, int collectionSize)1555     private ListCatalogsFixedSizeCollection(List<ListCatalogsPage> pages, int collectionSize) {
1556       super(pages, collectionSize);
1557     }
1558 
createEmptyCollection()1559     private static ListCatalogsFixedSizeCollection createEmptyCollection() {
1560       return new ListCatalogsFixedSizeCollection(null, 0);
1561     }
1562 
1563     @Override
createCollection( List<ListCatalogsPage> pages, int collectionSize)1564     protected ListCatalogsFixedSizeCollection createCollection(
1565         List<ListCatalogsPage> pages, int collectionSize) {
1566       return new ListCatalogsFixedSizeCollection(pages, collectionSize);
1567     }
1568   }
1569 }
1570