diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java index 7f3a9e3e..343bcc15 100644 --- a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java @@ -42,6 +42,14 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+ *   Catalog catalog = Catalog.newBuilder().build();
+ *   FieldMask updateMask = FieldMask.newBuilder().build();
+ *   Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
+ * }
+ * }
+ * *

Note: close() needs to be called on the CatalogServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -145,6 +153,17 @@ public CatalogServiceStub getStub() { /** * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. * + *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The account resource name with an associated location. *

If the caller does not have permission to list * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or @@ -163,6 +182,17 @@ public final ListCatalogsPagedResponse listCatalogs(LocationName parent) { /** * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. * + *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The account resource name with an associated location. *

If the caller does not have permission to list * [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or @@ -178,6 +208,22 @@ public final ListCatalogsPagedResponse listCatalogs(String parent) { /** * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. * + *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   ListCatalogsRequest request =
+   *       ListCatalogsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Catalog element : catalogServiceClient.listCatalogs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -190,6 +236,23 @@ public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request) * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. * *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   ListCatalogsRequest request =
+   *       ListCatalogsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.listCatalogsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Catalog element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCatalogsPagedCallable() { @@ -201,6 +264,23 @@ public final ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request) * Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project. * *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   while (true) {
+   *     ListCatalogsResponse response = catalogServiceClient.listCatalogsCallable().call(request);
+   *     for (Catalog element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCatalogsCallable() { return stub.listCatalogsCallable(); @@ -210,6 +290,16 @@ public final UnaryCallable listCatalo /** * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. * + *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   Catalog catalog = Catalog.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
+   * }
+   * }
+ * * @param catalog Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. *

If the caller does not have permission to update the * [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) { /** * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. * + *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateCatalogRequest request =
+   *       UpdateCatalogRequest.newBuilder()
+   *           .setCatalog(Catalog.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Catalog response = catalogServiceClient.updateCatalog(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -245,6 +348,19 @@ public final Catalog updateCatalog(UpdateCatalogRequest request) { * Updates the [Catalog][google.cloud.retail.v2.Catalog]s. * *

Sample code: + * + *

{@code
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateCatalogRequest request =
+   *       UpdateCatalogRequest.newBuilder()
+   *           .setCatalog(Catalog.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = catalogServiceClient.updateCatalogCallable().futureCall(request);
+   *   // Do something.
+   *   Catalog response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateCatalogCallable() { return stub.updateCatalogCallable(); diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java index 5aa33df0..8ecd3e73 100644 --- a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/PredictionServiceClient.java @@ -32,6 +32,23 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+ *   PredictRequest request =
+ *       PredictRequest.newBuilder()
+ *           .setPlacement("placement1792938725")
+ *           .setUserEvent(UserEvent.newBuilder().build())
+ *           .setPageSize(883849137)
+ *           .setPageToken("pageToken873572522")
+ *           .setFilter("filter-1274492040")
+ *           .setValidateOnly(true)
+ *           .putAllParams(new HashMap())
+ *           .putAllLabels(new HashMap())
+ *           .build();
+ *   PredictResponse response = predictionServiceClient.predict(request);
+ * }
+ * }
+ * *

Note: close() needs to be called on the PredictionServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -138,6 +155,25 @@ public PredictionServiceStub getStub() { /** * Makes a recommendation prediction. * + *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   PredictRequest request =
+   *       PredictRequest.newBuilder()
+   *           .setPlacement("placement1792938725")
+   *           .setUserEvent(UserEvent.newBuilder().build())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .setValidateOnly(true)
+   *           .putAllParams(new HashMap())
+   *           .putAllLabels(new HashMap())
+   *           .build();
+   *   PredictResponse response = predictionServiceClient.predict(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -150,6 +186,26 @@ public final PredictResponse predict(PredictRequest request) { * Makes a recommendation prediction. * *

Sample code: + * + *

{@code
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   PredictRequest request =
+   *       PredictRequest.newBuilder()
+   *           .setPlacement("placement1792938725")
+   *           .setUserEvent(UserEvent.newBuilder().build())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .setValidateOnly(true)
+   *           .putAllParams(new HashMap())
+   *           .putAllLabels(new HashMap())
+   *           .build();
+   *   ApiFuture future =
+   *       predictionServiceClient.predictCallable().futureCall(request);
+   *   // Do something.
+   *   PredictResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable predictCallable() { return stub.predictCallable(); diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java index 600fc11d..79ce2d7f 100644 --- a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java @@ -39,6 +39,15 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+ *   BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
+ *   Product product = Product.newBuilder().build();
+ *   String productId = "productId-1051830678";
+ *   Product response = productServiceClient.createProduct(parent, product, productId);
+ * }
+ * }
+ * *

Note: close() needs to be called on the ProductServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -153,6 +162,17 @@ public final OperationsClient getOperationsClient() { /** * Creates a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
+   *   Product product = Product.newBuilder().build();
+   *   String productId = "productId-1051830678";
+   *   Product response = productServiceClient.createProduct(parent, product, productId);
+   * }
+   * }
+ * * @param parent Required. The parent catalog resource name, such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. @@ -183,6 +203,17 @@ public final Product createProduct(BranchName parent, Product product, String pr /** * Creates a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   String parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString();
+   *   Product product = Product.newBuilder().build();
+   *   String productId = "productId-1051830678";
+   *   Product response = productServiceClient.createProduct(parent, product, productId);
+   * }
+   * }
+ * * @param parent Required. The parent catalog resource name, such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. * @param product Required. The [Product][google.cloud.retail.v2.Product] to create. @@ -213,6 +244,21 @@ public final Product createProduct(String parent, Product product, String produc /** * Creates a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   CreateProductRequest request =
+   *       CreateProductRequest.newBuilder()
+   *           .setParent(
+   *               BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
+   *           .setProduct(Product.newBuilder().build())
+   *           .setProductId("productId-1051830678")
+   *           .build();
+   *   Product response = productServiceClient.createProduct(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -225,6 +271,21 @@ public final Product createProduct(CreateProductRequest request) { * Creates a [Product][google.cloud.retail.v2.Product]. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   CreateProductRequest request =
+   *       CreateProductRequest.newBuilder()
+   *           .setParent(
+   *               BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString())
+   *           .setProduct(Product.newBuilder().build())
+   *           .setProductId("productId-1051830678")
+   *           .build();
+   *   ApiFuture future = productServiceClient.createProductCallable().futureCall(request);
+   *   // Do something.
+   *   Product response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createProductCallable() { return stub.createProductCallable(); @@ -234,6 +295,16 @@ public final UnaryCallable createProductCallable( /** * Gets a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   ProductName name =
+   *       ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
+   *   Product response = productServiceClient.getProduct(name);
+   * }
+   * }
+ * * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. *

If the caller does not have permission to access the @@ -253,6 +324,17 @@ public final Product getProduct(ProductName name) { /** * Gets a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   String name =
+   *       ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *           .toString();
+   *   Product response = productServiceClient.getProduct(name);
+   * }
+   * }
+ * * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. *

If the caller does not have permission to access the @@ -271,6 +353,20 @@ public final Product getProduct(String name) { /** * Gets a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   GetProductRequest request =
+   *       GetProductRequest.newBuilder()
+   *           .setName(
+   *               ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *                   .toString())
+   *           .build();
+   *   Product response = productServiceClient.getProduct(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -283,6 +379,20 @@ public final Product getProduct(GetProductRequest request) { * Gets a [Product][google.cloud.retail.v2.Product]. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   GetProductRequest request =
+   *       GetProductRequest.newBuilder()
+   *           .setName(
+   *               ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = productServiceClient.getProductCallable().futureCall(request);
+   *   // Do something.
+   *   Product response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getProductCallable() { return stub.getProductCallable(); @@ -292,6 +402,16 @@ public final UnaryCallable getProductCallable() { /** * Updates a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   Product product = Product.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Product response = productServiceClient.updateProduct(product, updateMask);
+   * }
+   * }
+ * * @param product Required. The product to update/create. *

If the caller does not have permission to update the * [Product][google.cloud.retail.v2.Product], regardless of whether or not it exists, a @@ -315,6 +435,19 @@ public final Product updateProduct(Product product, FieldMask updateMask) { /** * Updates a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   UpdateProductRequest request =
+   *       UpdateProductRequest.newBuilder()
+   *           .setProduct(Product.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Product response = productServiceClient.updateProduct(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -327,6 +460,19 @@ public final Product updateProduct(UpdateProductRequest request) { * Updates a [Product][google.cloud.retail.v2.Product]. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   UpdateProductRequest request =
+   *       UpdateProductRequest.newBuilder()
+   *           .setProduct(Product.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = productServiceClient.updateProductCallable().futureCall(request);
+   *   // Do something.
+   *   Product response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateProductCallable() { return stub.updateProductCallable(); @@ -336,6 +482,16 @@ public final UnaryCallable updateProductCallable( /** * Deletes a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   ProductName name =
+   *       ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]");
+   *   productServiceClient.deleteProduct(name);
+   * }
+   * }
+ * * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. *

If the caller does not have permission to delete the @@ -355,6 +511,17 @@ public final void deleteProduct(ProductName name) { /** * Deletes a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   String name =
+   *       ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *           .toString();
+   *   productServiceClient.deleteProduct(name);
+   * }
+   * }
+ * * @param name Required. Full resource name of [Product][google.cloud.retail.v2.Product], such as * `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. *

If the caller does not have permission to delete the @@ -373,6 +540,20 @@ public final void deleteProduct(String name) { /** * Deletes a [Product][google.cloud.retail.v2.Product]. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   DeleteProductRequest request =
+   *       DeleteProductRequest.newBuilder()
+   *           .setName(
+   *               ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *                   .toString())
+   *           .build();
+   *   productServiceClient.deleteProduct(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -385,6 +566,20 @@ public final void deleteProduct(DeleteProductRequest request) { * Deletes a [Product][google.cloud.retail.v2.Product]. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   DeleteProductRequest request =
+   *       DeleteProductRequest.newBuilder()
+   *           .setName(
+   *               ProductName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = productServiceClient.deleteProductCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteProductCallable() { return stub.deleteProductCallable(); @@ -400,6 +595,21 @@ public final UnaryCallable deleteProductCallable() *

Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to * be successfully updated. * + *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   ImportProductsRequest request =
+   *       ImportProductsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(ProductInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ImportProductsResponse response = productServiceClient.importProductsAsync(request).get();
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -419,6 +629,22 @@ public final OperationFuture importProdu * be successfully updated. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   ImportProductsRequest request =
+   *       ImportProductsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(ProductInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       productServiceClient.importProductsOperationCallable().futureCall(request);
+   *   // Do something.
+   *   ImportProductsResponse response = future.get();
+   * }
+   * }
*/ public final OperationCallable importProductsOperationCallable() { @@ -436,6 +662,22 @@ public final OperationFuture importProdu * be successfully updated. * *

Sample code: + * + *

{@code
+   * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+   *   ImportProductsRequest request =
+   *       ImportProductsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(ProductInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       productServiceClient.importProductsCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable importProductsCallable() { return stub.importProductsCallable(); diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java index 822cd792..ea1dd2e4 100644 --- a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java @@ -37,6 +37,17 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+ *   WriteUserEventRequest request =
+ *       WriteUserEventRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setUserEvent(UserEvent.newBuilder().build())
+ *           .build();
+ *   UserEvent response = userEventServiceClient.writeUserEvent(request);
+ * }
+ * }
+ * *

Note: close() needs to be called on the UserEventServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -154,6 +165,19 @@ public final OperationsClient getOperationsClient() { /** * Writes a single user event. * + *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   WriteUserEventRequest request =
+   *       WriteUserEventRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setUserEvent(UserEvent.newBuilder().build())
+   *           .build();
+   *   UserEvent response = userEventServiceClient.writeUserEvent(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -166,6 +190,20 @@ public final UserEvent writeUserEvent(WriteUserEventRequest request) { * Writes a single user event. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   WriteUserEventRequest request =
+   *       WriteUserEventRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setUserEvent(UserEvent.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       userEventServiceClient.writeUserEventCallable().futureCall(request);
+   *   // Do something.
+   *   UserEvent response = future.get();
+   * }
+   * }
*/ public final UnaryCallable writeUserEventCallable() { return stub.writeUserEventCallable(); @@ -179,6 +217,21 @@ public final UnaryCallable writeUserEventCalla *

This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users * should not call this method directly. * + *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   CollectUserEventRequest request =
+   *       CollectUserEventRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setUserEvent("userEvent315571599")
+   *           .setUri("uri116076")
+   *           .setEts(100772)
+   *           .build();
+   *   HttpBody response = userEventServiceClient.collectUserEvent(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -195,6 +248,22 @@ public final HttpBody collectUserEvent(CollectUserEventRequest request) { * should not call this method directly. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   CollectUserEventRequest request =
+   *       CollectUserEventRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setUserEvent("userEvent315571599")
+   *           .setUri("uri116076")
+   *           .setEts(100772)
+   *           .build();
+   *   ApiFuture future =
+   *       userEventServiceClient.collectUserEventCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
*/ public final UnaryCallable collectUserEventCallable() { return stub.collectUserEventCallable(); @@ -206,6 +275,20 @@ public final UnaryCallable collectUserEventCa * of events specified by the filter, this operation could take hours or days to complete. To test * a filter, use the list command first. * + *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   PurgeUserEventsRequest request =
+   *       PurgeUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setFilter("filter-1274492040")
+   *           .setForce(true)
+   *           .build();
+   *   PurgeUserEventsResponse response = userEventServiceClient.purgeUserEventsAsync(request).get();
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -221,6 +304,21 @@ public final OperationFuture purgeUserEv * a filter, use the list command first. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   PurgeUserEventsRequest request =
+   *       PurgeUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setFilter("filter-1274492040")
+   *           .setForce(true)
+   *           .build();
+   *   OperationFuture future =
+   *       userEventServiceClient.purgeUserEventsOperationCallable().futureCall(request);
+   *   // Do something.
+   *   PurgeUserEventsResponse response = future.get();
+   * }
+   * }
*/ public final OperationCallable purgeUserEventsOperationCallable() { @@ -234,6 +332,21 @@ public final OperationFuture purgeUserEv * a filter, use the list command first. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   PurgeUserEventsRequest request =
+   *       PurgeUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setFilter("filter-1274492040")
+   *           .setForce(true)
+   *           .build();
+   *   ApiFuture future =
+   *       userEventServiceClient.purgeUserEventsCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable purgeUserEventsCallable() { return stub.purgeUserEventsCallable(); @@ -247,6 +360,21 @@ public final UnaryCallable purgeUserEventsCal *

Operation.response is of type ImportResponse. Note that it is possible for a subset of the * items to be successfully inserted. Operation.metadata is of type ImportMetadata. * + *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   ImportUserEventsRequest request =
+   *       ImportUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(UserEventInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .build();
+   *   ImportUserEventsResponse response =
+   *       userEventServiceClient.importUserEventsAsync(request).get();
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -264,6 +392,21 @@ public final OperationFuture importUse * items to be successfully inserted. Operation.metadata is of type ImportMetadata. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   ImportUserEventsRequest request =
+   *       ImportUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(UserEventInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       userEventServiceClient.importUserEventsOperationCallable().futureCall(request);
+   *   // Do something.
+   *   ImportUserEventsResponse response = future.get();
+   * }
+   * }
*/ public final OperationCallable importUserEventsOperationCallable() { @@ -279,6 +422,21 @@ public final OperationFuture importUse * items to be successfully inserted. Operation.metadata is of type ImportMetadata. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   ImportUserEventsRequest request =
+   *       ImportUserEventsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInputConfig(UserEventInputConfig.newBuilder().build())
+   *           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       userEventServiceClient.importUserEventsCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable importUserEventsCallable() { return stub.importUserEventsCallable(); @@ -293,6 +451,17 @@ public final UnaryCallable importUserEventsC * with latest version of product catalog. It can also be used to correct events joined with wrong * product catalog. * + *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   RejoinUserEventsRequest request =
+   *       RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build();
+   *   RejoinUserEventsResponse response =
+   *       userEventServiceClient.rejoinUserEventsAsync(request).get();
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -311,6 +480,17 @@ public final UnaryCallable importUserEventsC * product catalog. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   RejoinUserEventsRequest request =
+   *       RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build();
+   *   OperationFuture future =
+   *       userEventServiceClient.rejoinUserEventsOperationCallable().futureCall(request);
+   *   // Do something.
+   *   RejoinUserEventsResponse response = future.get();
+   * }
+   * }
*/ public final OperationCallable< RejoinUserEventsRequest, RejoinUserEventsResponse, RejoinUserEventsMetadata> @@ -328,6 +508,17 @@ public final UnaryCallable importUserEventsC * product catalog. * *

Sample code: + * + *

{@code
+   * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+   *   RejoinUserEventsRequest request =
+   *       RejoinUserEventsRequest.newBuilder().setParent("parent-995424086").build();
+   *   ApiFuture future =
+   *       userEventServiceClient.rejoinUserEventsCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable rejoinUserEventsCallable() { return stub.rejoinUserEventsCallable(); diff --git a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java index a0001ac1..b3ac9a4f 100644 --- a/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java +++ b/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java @@ -23,12 +23,37 @@ * *

Sample for CatalogServiceClient: * + *

{@code
+ * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+ *   Catalog catalog = Catalog.newBuilder().build();
+ *   FieldMask updateMask = FieldMask.newBuilder().build();
+ *   Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask);
+ * }
+ * }
+ * *

======================= PredictionServiceClient ======================= * *

Service Description: Service for making recommendation prediction. * *

Sample for PredictionServiceClient: * + *

{@code
+ * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+ *   PredictRequest request =
+ *       PredictRequest.newBuilder()
+ *           .setPlacement("placement1792938725")
+ *           .setUserEvent(UserEvent.newBuilder().build())
+ *           .setPageSize(883849137)
+ *           .setPageToken("pageToken873572522")
+ *           .setFilter("filter-1274492040")
+ *           .setValidateOnly(true)
+ *           .putAllParams(new HashMap())
+ *           .putAllLabels(new HashMap())
+ *           .build();
+ *   PredictResponse response = predictionServiceClient.predict(request);
+ * }
+ * }
+ * *

======================= ProductServiceClient ======================= * *

Service Description: Service for ingesting [Product][google.cloud.retail.v2.Product] @@ -36,11 +61,31 @@ * *

Sample for ProductServiceClient: * + *

{@code
+ * try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
+ *   BranchName parent = BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]");
+ *   Product product = Product.newBuilder().build();
+ *   String productId = "productId-1051830678";
+ *   Product response = productServiceClient.createProduct(parent, product, productId);
+ * }
+ * }
+ * *

======================= UserEventServiceClient ======================= * *

Service Description: Service for ingesting end user actions on the customer website. * *

Sample for UserEventServiceClient: + * + *

{@code
+ * try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
+ *   WriteUserEventRequest request =
+ *       WriteUserEventRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setUserEvent(UserEvent.newBuilder().build())
+ *           .build();
+ *   UserEvent response = userEventServiceClient.writeUserEvent(request);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.retail.v2; diff --git a/synth.metadata b/synth.metadata index 68ed5a1b..0ea9db68 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-retail.git", - "sha": "d8f1274531a17dba245b64f39c30a9f0f2a600fa" + "sha": "e04c6da574a961af887ae282712f230e7bcf0ac4" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dc9821e4005ff8fecc3bfccae1c61b5815cdf9d3", - "internalRef": "352807727" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {