4242 * <p>This class provides the ability to make remote calls to the backing service through method
4343 * calls that map to API methods. Sample code to get started:
4444 *
45+ * <pre>{@code
46+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
47+ * Catalog catalog = Catalog.newBuilder().build();
48+ * FieldMask updateMask = FieldMask.newBuilder().build();
49+ * Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
50+ * }
51+ * }</pre>
52+ *
4553 * <p>Note: close() needs to be called on the CatalogServiceClient object to clean up resources such
4654 * as threads. In the example above, try-with-resources is used, which automatically calls close().
4755 *
@@ -145,6 +153,17 @@ public CatalogServiceStub getStub() {
145153 /**
146154 * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
147155 *
156+ * <p>Sample code:
157+ *
158+ * <pre>{@code
159+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
160+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
161+ * for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
162+ * // doThingsWith(element);
163+ * }
164+ * }
165+ * }</pre>
166+ *
148167 * @param parent Required. The account resource name with an associated location.
149168 * <p>If the caller does not have permission to list
150169 * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or
@@ -163,6 +182,17 @@ public final ListCatalogsPagedResponse listCatalogs(LocationName parent) {
163182 /**
164183 * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
165184 *
185+ * <p>Sample code:
186+ *
187+ * <pre>{@code
188+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
189+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
190+ * for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
191+ * // doThingsWith(element);
192+ * }
193+ * }
194+ * }</pre>
195+ *
166196 * @param parent Required. The account resource name with an associated location.
167197 * <p>If the caller does not have permission to list
168198 * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or
@@ -178,6 +208,22 @@ public final ListCatalogsPagedResponse listCatalogs(String parent) {
178208 /**
179209 * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
180210 *
211+ * <p>Sample code:
212+ *
213+ * <pre>{@code
214+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
215+ * ListCatalogsRequest request =
216+ * ListCatalogsRequest.newBuilder()
217+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
218+ * .setPageSize(883849137)
219+ * .setPageToken("pageToken873572522")
220+ * .build();
221+ * for (Catalog element : catalogServiceClient.listCatalogs(request).iterateAll()) {
222+ * // doThingsWith(element);
223+ * }
224+ * }
225+ * }</pre>
226+ *
181227 * @param request The request object containing all of the parameters for the API call.
182228 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
183229 */
@@ -190,6 +236,23 @@ public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request)
190236 * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
191237 *
192238 * <p>Sample code:
239+ *
240+ * <pre>{@code
241+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
242+ * ListCatalogsRequest request =
243+ * ListCatalogsRequest.newBuilder()
244+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
245+ * .setPageSize(883849137)
246+ * .setPageToken("pageToken873572522")
247+ * .build();
248+ * ApiFuture<Catalog> future =
249+ * catalogServiceClient.listCatalogsPagedCallable().futureCall(request);
250+ * // Do something.
251+ * for (Catalog element : future.get().iterateAll()) {
252+ * // doThingsWith(element);
253+ * }
254+ * }
255+ * }</pre>
193256 */
194257 public final UnaryCallable <ListCatalogsRequest , ListCatalogsPagedResponse >
195258 listCatalogsPagedCallable () {
@@ -201,6 +264,23 @@ public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request)
201264 * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
202265 *
203266 * <p>Sample code:
267+ *
268+ * <pre>{@code
269+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
270+ * while (true) {
271+ * ListCatalogsResponse response = catalogServiceClient.listCatalogsCallable().call(request);
272+ * for (Catalog element : response.getResponsesList()) {
273+ * // doThingsWith(element);
274+ * }
275+ * String nextPageToken = response.getNextPageToken();
276+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
277+ * request = request.toBuilder().setPageToken(nextPageToken).build();
278+ * } else {
279+ * break;
280+ * }
281+ * }
282+ * }
283+ * }</pre>
204284 */
205285 public final UnaryCallable <ListCatalogsRequest , ListCatalogsResponse > listCatalogsCallable () {
206286 return stub .listCatalogsCallable ();
@@ -210,6 +290,16 @@ public final UnaryCallable<ListCatalogsRequest, ListCatalogsResponse> listCatalo
210290 /**
211291 * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
212292 *
293+ * <p>Sample code:
294+ *
295+ * <pre>{@code
296+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
297+ * Catalog catalog = Catalog.newBuilder().build();
298+ * FieldMask updateMask = FieldMask.newBuilder().build();
299+ * Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
300+ * }
301+ * }</pre>
302+ *
213303 * @param catalog Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
214304 * <p>If the caller does not have permission to update the
215305 * [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a
@@ -233,6 +323,19 @@ public final Catalog updateCatalog(Catalog catalog, FieldMask updateMask) {
233323 /**
234324 * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
235325 *
326+ * <p>Sample code:
327+ *
328+ * <pre>{@code
329+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
330+ * UpdateCatalogRequest request =
331+ * UpdateCatalogRequest.newBuilder()
332+ * .setCatalog(Catalog.newBuilder().build())
333+ * .setUpdateMask(FieldMask.newBuilder().build())
334+ * .build();
335+ * Catalog response = catalogServiceClient.updateCatalog(request);
336+ * }
337+ * }</pre>
338+ *
236339 * @param request The request object containing all of the parameters for the API call.
237340 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
238341 */
@@ -245,6 +348,19 @@ public final Catalog updateCatalog(UpdateCatalogRequest request) {
245348 * Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
246349 *
247350 * <p>Sample code:
351+ *
352+ * <pre>{@code
353+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
354+ * UpdateCatalogRequest request =
355+ * UpdateCatalogRequest.newBuilder()
356+ * .setCatalog(Catalog.newBuilder().build())
357+ * .setUpdateMask(FieldMask.newBuilder().build())
358+ * .build();
359+ * ApiFuture<Catalog> future = catalogServiceClient.updateCatalogCallable().futureCall(request);
360+ * // Do something.
361+ * Catalog response = future.get();
362+ * }
363+ * }</pre>
248364 */
249365 public final UnaryCallable <UpdateCatalogRequest , Catalog > updateCatalogCallable () {
250366 return stub .updateCatalogCallable ();
0 commit comments