diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java index 862bd411d6de..320310e55828 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceClient.java @@ -738,6 +738,613 @@ public final GetDefaultBranchResponse getDefaultBranch(GetDefaultBranchRequest r return stub.getDefaultBranchCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   CompletionConfig response = catalogServiceClient.getCompletionConfig(name);
+   * }
+   * }
+ * + * @param name Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CompletionConfig getCompletionConfig(CompletionConfigName name) { + GetCompletionConfigRequest request = + GetCompletionConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getCompletionConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   String name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   CompletionConfig response = catalogServiceClient.getCompletionConfig(name);
+   * }
+   * }
+ * + * @param name Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CompletionConfig getCompletionConfig(String name) { + GetCompletionConfigRequest request = + GetCompletionConfigRequest.newBuilder().setName(name).build(); + return getCompletionConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   GetCompletionConfigRequest request =
+   *       GetCompletionConfigRequest.newBuilder()
+   *           .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .build();
+   *   CompletionConfig response = catalogServiceClient.getCompletionConfig(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 + */ + public final CompletionConfig getCompletionConfig(GetCompletionConfigRequest request) { + return getCompletionConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   GetCompletionConfigRequest request =
+   *       GetCompletionConfigRequest.newBuilder()
+   *           .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.getCompletionConfigCallable().futureCall(request);
+   *   // Do something.
+   *   CompletionConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + getCompletionConfigCallable() { + return stub.getCompletionConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   CompletionConfig completionConfig = CompletionConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   CompletionConfig response =
+   *       catalogServiceClient.updateCompletionConfig(completionConfig, updateMask);
+   * }
+   * }
+ * + * @param completionConfig Required. The + * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. + *

If the caller does not have permission to update the + * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a PERMISSION_DENIED error + * is returned. + *

If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update does not + * exist, a NOT_FOUND error is returned. + * @param updateMask Indicates which fields in the provided + * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The following are + * the only supported fields: + *

+ *

If not set, all supported fields are updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CompletionConfig updateCompletionConfig( + CompletionConfig completionConfig, FieldMask updateMask) { + UpdateCompletionConfigRequest request = + UpdateCompletionConfigRequest.newBuilder() + .setCompletionConfig(completionConfig) + .setUpdateMask(updateMask) + .build(); + return updateCompletionConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateCompletionConfigRequest request =
+   *       UpdateCompletionConfigRequest.newBuilder()
+   *           .setCompletionConfig(CompletionConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   CompletionConfig response = catalogServiceClient.updateCompletionConfig(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 + */ + public final CompletionConfig updateCompletionConfig(UpdateCompletionConfigRequest request) { + return updateCompletionConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateCompletionConfigRequest request =
+   *       UpdateCompletionConfigRequest.newBuilder()
+   *           .setCompletionConfig(CompletionConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.updateCompletionConfigCallable().futureCall(request);
+   *   // Do something.
+   *   CompletionConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + updateCompletionConfigCallable() { + return stub.updateCompletionConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   AttributesConfig response = catalogServiceClient.getAttributesConfig(name);
+   * }
+   * }
+ * + * @param name Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AttributesConfig getAttributesConfig(AttributesConfigName name) { + GetAttributesConfigRequest request = + GetAttributesConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getAttributesConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   String name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   AttributesConfig response = catalogServiceClient.getAttributesConfig(name);
+   * }
+   * }
+ * + * @param name Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AttributesConfig getAttributesConfig(String name) { + GetAttributesConfigRequest request = + GetAttributesConfigRequest.newBuilder().setName(name).build(); + return getAttributesConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   GetAttributesConfigRequest request =
+   *       GetAttributesConfigRequest.newBuilder()
+   *           .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .build();
+   *   AttributesConfig response = catalogServiceClient.getAttributesConfig(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 + */ + public final AttributesConfig getAttributesConfig(GetAttributesConfigRequest request) { + return getAttributesConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   GetAttributesConfigRequest request =
+   *       GetAttributesConfigRequest.newBuilder()
+   *           .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.getAttributesConfigCallable().futureCall(request);
+   *   // Do something.
+   *   AttributesConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + getAttributesConfigCallable() { + return stub.getAttributesConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

The catalog attributes in the request will be updated in the catalog, or inserted if they do + * not exist. Existing catalog attributes not included in the request will remain unchanged. + * Attributes that are assigned to products, but do not exist at the catalog level, are always + * included in the response. The product attribute is assigned default values for missing catalog + * attribute fields, e.g., searchable and dynamic facetable options. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   AttributesConfig attributesConfig = AttributesConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   AttributesConfig response =
+   *       catalogServiceClient.updateAttributesConfig(attributesConfig, updateMask);
+   * }
+   * }
+ * + * @param attributesConfig Required. The + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. + * @param updateMask Indicates which fields in the provided + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The following is the + * only supported field: + *
    + *
  • [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes] + *
+ *

If not set, all supported fields are updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AttributesConfig updateAttributesConfig( + AttributesConfig attributesConfig, FieldMask updateMask) { + UpdateAttributesConfigRequest request = + UpdateAttributesConfigRequest.newBuilder() + .setAttributesConfig(attributesConfig) + .setUpdateMask(updateMask) + .build(); + return updateAttributesConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

The catalog attributes in the request will be updated in the catalog, or inserted if they do + * not exist. Existing catalog attributes not included in the request will remain unchanged. + * Attributes that are assigned to products, but do not exist at the catalog level, are always + * included in the response. The product attribute is assigned default values for missing catalog + * attribute fields, e.g., searchable and dynamic facetable options. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateAttributesConfigRequest request =
+   *       UpdateAttributesConfigRequest.newBuilder()
+   *           .setAttributesConfig(AttributesConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   AttributesConfig response = catalogServiceClient.updateAttributesConfig(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 + */ + public final AttributesConfig updateAttributesConfig(UpdateAttributesConfigRequest request) { + return updateAttributesConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

The catalog attributes in the request will be updated in the catalog, or inserted if they do + * not exist. Existing catalog attributes not included in the request will remain unchanged. + * Attributes that are assigned to products, but do not exist at the catalog level, are always + * included in the response. The product attribute is assigned default values for missing catalog + * attribute fields, e.g., searchable and dynamic facetable options. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   UpdateAttributesConfigRequest request =
+   *       UpdateAttributesConfigRequest.newBuilder()
+   *           .setAttributesConfig(AttributesConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.updateAttributesConfigCallable().futureCall(request);
+   *   // Do something.
+   *   AttributesConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + updateAttributesConfigCallable() { + return stub.updateAttributesConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an + * ALREADY_EXISTS error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   AddCatalogAttributeRequest request =
+   *       AddCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
+   *           .build();
+   *   AttributesConfig response = catalogServiceClient.addCatalogAttribute(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 + */ + public final AttributesConfig addCatalogAttribute(AddCatalogAttributeRequest request) { + return addCatalogAttributeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an + * ALREADY_EXISTS error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   AddCatalogAttributeRequest request =
+   *       AddCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.addCatalogAttributeCallable().futureCall(request);
+   *   // Do something.
+   *   AttributesConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + addCatalogAttributeCallable() { + return stub.addCatalogAttributeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist, + * a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   RemoveCatalogAttributeRequest request =
+   *       RemoveCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setKey("key106079")
+   *           .build();
+   *   AttributesConfig response = catalogServiceClient.removeCatalogAttribute(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 + */ + public final AttributesConfig removeCatalogAttribute(RemoveCatalogAttributeRequest request) { + return removeCatalogAttributeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist, + * a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   RemoveCatalogAttributeRequest request =
+   *       RemoveCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setKey("key106079")
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.removeCatalogAttributeCallable().futureCall(request);
+   *   // Do something.
+   *   AttributesConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + removeCatalogAttributeCallable() { + return stub.removeCatalogAttributeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute + * with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not + * exist, a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   ReplaceCatalogAttributeRequest request =
+   *       ReplaceCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   AttributesConfig response = catalogServiceClient.replaceCatalogAttribute(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 + */ + public final AttributesConfig replaceCatalogAttribute(ReplaceCatalogAttributeRequest request) { + return replaceCatalogAttributeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the + * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute + * with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. + * + *

If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not + * exist, a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
+   *   ReplaceCatalogAttributeRequest request =
+   *       ReplaceCatalogAttributeRequest.newBuilder()
+   *           .setAttributesConfig(
+   *               AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setCatalogAttribute(CatalogAttribute.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       catalogServiceClient.replaceCatalogAttributeCallable().futureCall(request);
+   *   // Do something.
+   *   AttributesConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + replaceCatalogAttributeCallable() { + return stub.replaceCatalogAttributeCallable(); + } + @Override public final void close() { stub.close(); diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java index 6abdbf47cdbe..7e02a723526c 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/CatalogServiceSettings.java @@ -95,6 +95,48 @@ public UnaryCallSettings setDefaultBranchSetting return ((CatalogServiceStubSettings) getStubSettings()).getDefaultBranchSettings(); } + /** Returns the object with the settings used for calls to getCompletionConfig. */ + public UnaryCallSettings + getCompletionConfigSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).getCompletionConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateCompletionConfig. */ + public UnaryCallSettings + updateCompletionConfigSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).updateCompletionConfigSettings(); + } + + /** Returns the object with the settings used for calls to getAttributesConfig. */ + public UnaryCallSettings + getAttributesConfigSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).getAttributesConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateAttributesConfig. */ + public UnaryCallSettings + updateAttributesConfigSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).updateAttributesConfigSettings(); + } + + /** Returns the object with the settings used for calls to addCatalogAttribute. */ + public UnaryCallSettings + addCatalogAttributeSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).addCatalogAttributeSettings(); + } + + /** Returns the object with the settings used for calls to removeCatalogAttribute. */ + public UnaryCallSettings + removeCatalogAttributeSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).removeCatalogAttributeSettings(); + } + + /** Returns the object with the settings used for calls to replaceCatalogAttribute. */ + public UnaryCallSettings + replaceCatalogAttributeSettings() { + return ((CatalogServiceStubSettings) getStubSettings()).replaceCatalogAttributeSettings(); + } + public static final CatalogServiceSettings create(CatalogServiceStubSettings stub) throws IOException { return new CatalogServiceSettings.Builder(stub.toBuilder()).build(); @@ -233,6 +275,48 @@ public UnaryCallSettings.Builder setDefaultBranc return getStubSettingsBuilder().getDefaultBranchSettings(); } + /** Returns the builder for the settings used for calls to getCompletionConfig. */ + public UnaryCallSettings.Builder + getCompletionConfigSettings() { + return getStubSettingsBuilder().getCompletionConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateCompletionConfig. */ + public UnaryCallSettings.Builder + updateCompletionConfigSettings() { + return getStubSettingsBuilder().updateCompletionConfigSettings(); + } + + /** Returns the builder for the settings used for calls to getAttributesConfig. */ + public UnaryCallSettings.Builder + getAttributesConfigSettings() { + return getStubSettingsBuilder().getAttributesConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateAttributesConfig. */ + public UnaryCallSettings.Builder + updateAttributesConfigSettings() { + return getStubSettingsBuilder().updateAttributesConfigSettings(); + } + + /** Returns the builder for the settings used for calls to addCatalogAttribute. */ + public UnaryCallSettings.Builder + addCatalogAttributeSettings() { + return getStubSettingsBuilder().addCatalogAttributeSettings(); + } + + /** Returns the builder for the settings used for calls to removeCatalogAttribute. */ + public UnaryCallSettings.Builder + removeCatalogAttributeSettings() { + return getStubSettingsBuilder().removeCatalogAttributeSettings(); + } + + /** Returns the builder for the settings used for calls to replaceCatalogAttribute. */ + public UnaryCallSettings.Builder + replaceCatalogAttributeSettings() { + return getStubSettingsBuilder().replaceCatalogAttributeSettings(); + } + @Override public CatalogServiceSettings build() throws IOException { return new CatalogServiceSettings(this); diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceClient.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceClient.java new file mode 100644 index 000000000000..43d3ccb54707 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceClient.java @@ -0,0 +1,866 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.ControlServiceStub; +import com.google.cloud.retail.v2.stub.ControlServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for modifying Control. + * + *

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
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+ *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+ *   Control control = Control.newBuilder().build();
+ *   String controlId = "controlId-395080872";
+ *   Control response = controlServiceClient.createControl(parent, control, controlId);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the ControlServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ControlServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ControlServiceSettings controlServiceSettings =
+ *     ControlServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ControlServiceSettings controlServiceSettings =
+ *     ControlServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ControlServiceSettings controlServiceSettings =
+ *     ControlServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             ControlServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ControlServiceClient implements BackgroundResource { + private final ControlServiceSettings settings; + private final ControlServiceStub stub; + + /** Constructs an instance of ControlServiceClient with default settings. */ + public static final ControlServiceClient create() throws IOException { + return create(ControlServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ControlServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ControlServiceClient create(ControlServiceSettings settings) + throws IOException { + return new ControlServiceClient(settings); + } + + /** + * Constructs an instance of ControlServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(ControlServiceSettings). + */ + public static final ControlServiceClient create(ControlServiceStub stub) { + return new ControlServiceClient(stub); + } + + /** + * Constructs an instance of ControlServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected ControlServiceClient(ControlServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ControlServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected ControlServiceClient(ControlServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ControlServiceSettings getSettings() { + return settings; + } + + public ControlServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS + * error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   Control control = Control.newBuilder().build();
+   *   String controlId = "controlId-395080872";
+   *   Control response = controlServiceClient.createControl(parent, control, controlId);
+   * }
+   * }
+ * + * @param parent Required. Full resource name of parent catalog. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param control Required. The Control to create. + * @param controlId Required. The ID to use for the Control, which will become the final component + * of the Control's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Control createControl(CatalogName parent, Control control, String controlId) { + CreateControlRequest request = + CreateControlRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setControl(control) + .setControlId(controlId) + .build(); + return createControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS + * error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   Control control = Control.newBuilder().build();
+   *   String controlId = "controlId-395080872";
+   *   Control response = controlServiceClient.createControl(parent, control, controlId);
+   * }
+   * }
+ * + * @param parent Required. Full resource name of parent catalog. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param control Required. The Control to create. + * @param controlId Required. The ID to use for the Control, which will become the final component + * of the Control's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Control createControl(String parent, Control control, String controlId) { + CreateControlRequest request = + CreateControlRequest.newBuilder() + .setParent(parent) + .setControl(control) + .setControlId(controlId) + .build(); + return createControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS + * error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   CreateControlRequest request =
+   *       CreateControlRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setControl(Control.newBuilder().build())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   Control response = controlServiceClient.createControl(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 + */ + public final Control createControl(CreateControlRequest request) { + return createControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS + * error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   CreateControlRequest request =
+   *       CreateControlRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setControl(Control.newBuilder().build())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   ApiFuture future = controlServiceClient.createControlCallable().futureCall(request);
+   *   // Do something.
+   *   Control response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createControlCallable() { + return stub.createControlCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error + * is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]");
+   *   controlServiceClient.deleteControl(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteControl(ControlName name) { + DeleteControlRequest request = + DeleteControlRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error + * is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   String name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString();
+   *   controlServiceClient.deleteControl(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteControl(String name) { + DeleteControlRequest request = DeleteControlRequest.newBuilder().setName(name).build(); + deleteControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error + * is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   DeleteControlRequest request =
+   *       DeleteControlRequest.newBuilder()
+   *           .setName(
+   *               ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString())
+   *           .build();
+   *   controlServiceClient.deleteControl(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 + */ + public final void deleteControl(DeleteControlRequest request) { + deleteControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Control. + * + *

If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error + * is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   DeleteControlRequest request =
+   *       DeleteControlRequest.newBuilder()
+   *           .setName(
+   *               ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString())
+   *           .build();
+   *   ApiFuture future = controlServiceClient.deleteControlCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteControlCallable() { + return stub.deleteControlCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Control. + * + *

[Control][google.cloud.retail.v2.Control] cannot be set to a different oneof field, if so an + * INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2.Control] to update does + * not exist, a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   Control control = Control.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Control response = controlServiceClient.updateControl(control, updateMask);
+   * }
+   * }
+ * + * @param control Required. The Control to update. + * @param updateMask Indicates which fields in the provided + * [Control][google.cloud.retail.v2.Control] to update. The following are NOT supported: + *
    + *
  • [Control.name][google.cloud.retail.v2.Control.name] + *
+ *

If not set or empty, all supported fields are updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Control updateControl(Control control, FieldMask updateMask) { + UpdateControlRequest request = + UpdateControlRequest.newBuilder().setControl(control).setUpdateMask(updateMask).build(); + return updateControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Control. + * + *

[Control][google.cloud.retail.v2.Control] cannot be set to a different oneof field, if so an + * INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2.Control] to update does + * not exist, a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   UpdateControlRequest request =
+   *       UpdateControlRequest.newBuilder()
+   *           .setControl(Control.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Control response = controlServiceClient.updateControl(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 + */ + public final Control updateControl(UpdateControlRequest request) { + return updateControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Control. + * + *

[Control][google.cloud.retail.v2.Control] cannot be set to a different oneof field, if so an + * INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2.Control] to update does + * not exist, a NOT_FOUND error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   UpdateControlRequest request =
+   *       UpdateControlRequest.newBuilder()
+   *           .setControl(Control.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = controlServiceClient.updateControlCallable().futureCall(request);
+   *   // Do something.
+   *   Control response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateControlCallable() { + return stub.updateControlCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]");
+   *   Control response = controlServiceClient.getControl(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Control getControl(ControlName name) { + GetControlRequest request = + GetControlRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   String name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString();
+   *   Control response = controlServiceClient.getControl(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Control getControl(String name) { + GetControlRequest request = GetControlRequest.newBuilder().setName(name).build(); + return getControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   GetControlRequest request =
+   *       GetControlRequest.newBuilder()
+   *           .setName(
+   *               ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString())
+   *           .build();
+   *   Control response = controlServiceClient.getControl(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 + */ + public final Control getControl(GetControlRequest request) { + return getControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a Control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   GetControlRequest request =
+   *       GetControlRequest.newBuilder()
+   *           .setName(
+   *               ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString())
+   *           .build();
+   *   ApiFuture future = controlServiceClient.getControlCallable().futureCall(request);
+   *   // Do something.
+   *   Control response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getControlCallable() { + return stub.getControlCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   for (Control element : controlServiceClient.listControls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListControlsPagedResponse listControls(CatalogName parent) { + ListControlsRequest request = + ListControlsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listControls(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   for (Control element : controlServiceClient.listControls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListControlsPagedResponse listControls(String parent) { + ListControlsRequest request = ListControlsRequest.newBuilder().setParent(parent).build(); + return listControls(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   ListControlsRequest request =
+   *       ListControlsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   for (Control element : controlServiceClient.listControls(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 + */ + public final ListControlsPagedResponse listControls(ListControlsRequest request) { + return listControlsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   ListControlsRequest request =
+   *       ListControlsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   ApiFuture future =
+   *       controlServiceClient.listControlsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Control element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listControlsPagedCallable() { + return stub.listControlsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+   *   ListControlsRequest request =
+   *       ListControlsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   while (true) {
+   *     ListControlsResponse response = controlServiceClient.listControlsCallable().call(request);
+   *     for (Control element : response.getControlsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listControlsCallable() { + return stub.listControlsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListControlsPagedResponse + extends AbstractPagedListResponse< + ListControlsRequest, + ListControlsResponse, + Control, + ListControlsPage, + ListControlsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListControlsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListControlsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListControlsPagedResponse(ListControlsPage page) { + super(page, ListControlsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListControlsPage + extends AbstractPage { + + private ListControlsPage( + PageContext context, + ListControlsResponse response) { + super(context, response); + } + + private static ListControlsPage createEmptyPage() { + return new ListControlsPage(null, null); + } + + @Override + protected ListControlsPage createPage( + PageContext context, + ListControlsResponse response) { + return new ListControlsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListControlsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListControlsRequest, + ListControlsResponse, + Control, + ListControlsPage, + ListControlsFixedSizeCollection> { + + private ListControlsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListControlsFixedSizeCollection createEmptyCollection() { + return new ListControlsFixedSizeCollection(null, 0); + } + + @Override + protected ListControlsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListControlsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceSettings.java new file mode 100644 index 000000000000..b03d0aafea71 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ControlServiceSettings.java @@ -0,0 +1,249 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.ControlServiceStubSettings; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ControlServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createControl to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ControlServiceSettings.Builder controlServiceSettingsBuilder =
+ *     ControlServiceSettings.newBuilder();
+ * controlServiceSettingsBuilder
+ *     .createControlSettings()
+ *     .setRetrySettings(
+ *         controlServiceSettingsBuilder
+ *             .createControlSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ControlServiceSettings controlServiceSettings = controlServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ControlServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createControl. */ + public UnaryCallSettings createControlSettings() { + return ((ControlServiceStubSettings) getStubSettings()).createControlSettings(); + } + + /** Returns the object with the settings used for calls to deleteControl. */ + public UnaryCallSettings deleteControlSettings() { + return ((ControlServiceStubSettings) getStubSettings()).deleteControlSettings(); + } + + /** Returns the object with the settings used for calls to updateControl. */ + public UnaryCallSettings updateControlSettings() { + return ((ControlServiceStubSettings) getStubSettings()).updateControlSettings(); + } + + /** Returns the object with the settings used for calls to getControl. */ + public UnaryCallSettings getControlSettings() { + return ((ControlServiceStubSettings) getStubSettings()).getControlSettings(); + } + + /** Returns the object with the settings used for calls to listControls. */ + public PagedCallSettings + listControlsSettings() { + return ((ControlServiceStubSettings) getStubSettings()).listControlsSettings(); + } + + public static final ControlServiceSettings create(ControlServiceStubSettings stub) + throws IOException { + return new ControlServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ControlServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ControlServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ControlServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ControlServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ControlServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ControlServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ControlServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ControlServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ControlServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ControlServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ControlServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(ControlServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ControlServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ControlServiceStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ControlServiceStubSettings.newHttpJsonBuilder()); + } + + public ControlServiceStubSettings.Builder getStubSettingsBuilder() { + return ((ControlServiceStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createControl. */ + public UnaryCallSettings.Builder createControlSettings() { + return getStubSettingsBuilder().createControlSettings(); + } + + /** Returns the builder for the settings used for calls to deleteControl. */ + public UnaryCallSettings.Builder deleteControlSettings() { + return getStubSettingsBuilder().deleteControlSettings(); + } + + /** Returns the builder for the settings used for calls to updateControl. */ + public UnaryCallSettings.Builder updateControlSettings() { + return getStubSettingsBuilder().updateControlSettings(); + } + + /** Returns the builder for the settings used for calls to getControl. */ + public UnaryCallSettings.Builder getControlSettings() { + return getStubSettingsBuilder().getControlSettings(); + } + + /** Returns the builder for the settings used for calls to listControls. */ + public PagedCallSettings.Builder< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse> + listControlsSettings() { + return getStubSettingsBuilder().listControlsSettings(); + } + + @Override + public ControlServiceSettings build() throws IOException { + return new ControlServiceSettings(this); + } + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java index 7004c90b95a4..08a9c350d425 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ProductServiceClient.java @@ -990,6 +990,12 @@ public final UnaryCallable importProductsCalla * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1106,6 +1112,12 @@ public final OperationFuture setInve * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1170,6 +1182,12 @@ public final OperationFuture setInve * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1234,6 +1252,12 @@ public final OperationFuture setInve * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1273,6 +1297,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1319,6 +1349,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1364,6 +1400,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1409,6 +1451,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1454,6 +1502,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1498,6 +1552,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1544,6 +1604,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1589,6 +1655,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1634,6 +1706,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1681,6 +1759,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1730,6 +1814,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1781,6 +1871,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1831,6 +1927,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1881,6 +1983,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1931,6 +2039,12 @@ public final UnaryCallable setInventoryCallable( * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -1977,6 +2091,12 @@ public final UnaryCallable addLocalInvent * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -2026,6 +2146,12 @@ public final UnaryCallable addLocalInvent * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -2074,6 +2200,12 @@ public final UnaryCallable addLocalInvent * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -2121,6 +2253,12 @@ public final UnaryCallable addLocalInvent * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * @@ -2170,6 +2308,12 @@ public final UnaryCallable addLocalInvent * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no * effect on local inventories. * + *

The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will + * return NOT_FOUND afterwards. + * + *

If conflicting updates are issued, the [Operation][]s associated with the stale updates will + * not be marked as [done][Operation.done] until being obsolete. + * *

This feature is only available for users who have Retail Search enabled. Please enable * Retail Search on Cloud Console before using this feature. * diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceClient.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceClient.java new file mode 100644 index 000000000000..69e3c868686b --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceClient.java @@ -0,0 +1,1172 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.stub.ServingConfigServiceStub; +import com.google.cloud.retail.v2.stub.ServingConfigServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for modifying ServingConfig. + * + *

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
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ServingConfigServiceClient servingConfigServiceClient =
+ *     ServingConfigServiceClient.create()) {
+ *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+ *   ServingConfig servingConfig = ServingConfig.newBuilder().build();
+ *   String servingConfigId = "servingConfigId-831052759";
+ *   ServingConfig response =
+ *       servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the ServingConfigServiceClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ServingConfigServiceSettings + * to create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ServingConfigServiceSettings servingConfigServiceSettings =
+ *     ServingConfigServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ServingConfigServiceClient servingConfigServiceClient =
+ *     ServingConfigServiceClient.create(servingConfigServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ServingConfigServiceSettings servingConfigServiceSettings =
+ *     ServingConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ServingConfigServiceClient servingConfigServiceClient =
+ *     ServingConfigServiceClient.create(servingConfigServiceSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ServingConfigServiceSettings servingConfigServiceSettings =
+ *     ServingConfigServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             ServingConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * ServingConfigServiceClient servingConfigServiceClient =
+ *     ServingConfigServiceClient.create(servingConfigServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ServingConfigServiceClient implements BackgroundResource { + private final ServingConfigServiceSettings settings; + private final ServingConfigServiceStub stub; + + /** Constructs an instance of ServingConfigServiceClient with default settings. */ + public static final ServingConfigServiceClient create() throws IOException { + return create(ServingConfigServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ServingConfigServiceClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ServingConfigServiceClient create(ServingConfigServiceSettings settings) + throws IOException { + return new ServingConfigServiceClient(settings); + } + + /** + * Constructs an instance of ServingConfigServiceClient, using the given stub for making calls. + * This is for advanced usage - prefer using create(ServingConfigServiceSettings). + */ + public static final ServingConfigServiceClient create(ServingConfigServiceStub stub) { + return new ServingConfigServiceClient(stub); + } + + /** + * Constructs an instance of ServingConfigServiceClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected ServingConfigServiceClient(ServingConfigServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ServingConfigServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected ServingConfigServiceClient(ServingConfigServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ServingConfigServiceSettings getSettings() { + return settings; + } + + public ServingConfigServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a ServingConfig. + * + *

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a + * [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   ServingConfig servingConfig = ServingConfig.newBuilder().build();
+   *   String servingConfigId = "servingConfigId-831052759";
+   *   ServingConfig response =
+   *       servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId);
+   * }
+   * }
+ * + * @param parent Required. Full resource name of parent. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param servingConfig Required. The ServingConfig to create. + * @param servingConfigId Required. The ID to use for the ServingConfig, which will become the + * final component of the ServingConfig's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig createServingConfig( + CatalogName parent, ServingConfig servingConfig, String servingConfigId) { + CreateServingConfigRequest request = + CreateServingConfigRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setServingConfig(servingConfig) + .setServingConfigId(servingConfigId) + .build(); + return createServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a ServingConfig. + * + *

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a + * [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   ServingConfig servingConfig = ServingConfig.newBuilder().build();
+   *   String servingConfigId = "servingConfigId-831052759";
+   *   ServingConfig response =
+   *       servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId);
+   * }
+   * }
+ * + * @param parent Required. Full resource name of parent. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param servingConfig Required. The ServingConfig to create. + * @param servingConfigId Required. The ID to use for the ServingConfig, which will become the + * final component of the ServingConfig's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig createServingConfig( + String parent, ServingConfig servingConfig, String servingConfigId) { + CreateServingConfigRequest request = + CreateServingConfigRequest.newBuilder() + .setParent(parent) + .setServingConfig(servingConfig) + .setServingConfigId(servingConfigId) + .build(); + return createServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a ServingConfig. + * + *

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a + * [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   CreateServingConfigRequest request =
+   *       CreateServingConfigRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setServingConfig(ServingConfig.newBuilder().build())
+   *           .setServingConfigId("servingConfigId-831052759")
+   *           .build();
+   *   ServingConfig response = servingConfigServiceClient.createServingConfig(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 + */ + public final ServingConfig createServingConfig(CreateServingConfigRequest request) { + return createServingConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a ServingConfig. + * + *

A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a + * [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   CreateServingConfigRequest request =
+   *       CreateServingConfigRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setServingConfig(ServingConfig.newBuilder().build())
+   *           .setServingConfigId("servingConfigId-831052759")
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.createServingConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ServingConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + createServingConfigCallable() { + return stub.createServingConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ServingConfigName name =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
+   *   servingConfigServiceClient.deleteServingConfig(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteServingConfig(ServingConfigName name) { + DeleteServingConfigRequest request = + DeleteServingConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String name =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *           .toString();
+   *   servingConfigServiceClient.deleteServingConfig(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteServingConfig(String name) { + DeleteServingConfigRequest request = + DeleteServingConfigRequest.newBuilder().setName(name).build(); + deleteServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   DeleteServingConfigRequest request =
+   *       DeleteServingConfigRequest.newBuilder()
+   *           .setName(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .build();
+   *   servingConfigServiceClient.deleteServingConfig(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 + */ + public final void deleteServingConfig(DeleteServingConfigRequest request) { + deleteServingConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   DeleteServingConfigRequest request =
+   *       DeleteServingConfigRequest.newBuilder()
+   *           .setName(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.deleteServingConfigCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteServingConfigCallable() { + return stub.deleteServingConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ServingConfig servingConfig = ServingConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   ServingConfig response =
+   *       servingConfigServiceClient.updateServingConfig(servingConfig, updateMask);
+   * }
+   * }
+ * + * @param servingConfig Required. The ServingConfig to update. + * @param updateMask Indicates which fields in the provided + * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The following are NOT + * supported: + *
    + *
  • [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name] + *
+ *

If not set, all supported fields are updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig updateServingConfig( + ServingConfig servingConfig, FieldMask updateMask) { + UpdateServingConfigRequest request = + UpdateServingConfigRequest.newBuilder() + .setServingConfig(servingConfig) + .setUpdateMask(updateMask) + .build(); + return updateServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   UpdateServingConfigRequest request =
+   *       UpdateServingConfigRequest.newBuilder()
+   *           .setServingConfig(ServingConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ServingConfig response = servingConfigServiceClient.updateServingConfig(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 + */ + public final ServingConfig updateServingConfig(UpdateServingConfigRequest request) { + return updateServingConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   UpdateServingConfigRequest request =
+   *       UpdateServingConfigRequest.newBuilder()
+   *           .setServingConfig(ServingConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.updateServingConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ServingConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + updateServingConfigCallable() { + return stub.updateServingConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ServingConfigName name =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
+   *   ServingConfig response = servingConfigServiceClient.getServingConfig(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig getServingConfig(ServingConfigName name) { + GetServingConfigRequest request = + GetServingConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String name =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *           .toString();
+   *   ServingConfig response = servingConfigServiceClient.getServingConfig(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig getServingConfig(String name) { + GetServingConfigRequest request = GetServingConfigRequest.newBuilder().setName(name).build(); + return getServingConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   GetServingConfigRequest request =
+   *       GetServingConfigRequest.newBuilder()
+   *           .setName(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .build();
+   *   ServingConfig response = servingConfigServiceClient.getServingConfig(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 + */ + public final ServingConfig getServingConfig(GetServingConfigRequest request) { + return getServingConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a ServingConfig. + * + *

Returns a NotFound error if the ServingConfig does not exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   GetServingConfigRequest request =
+   *       GetServingConfigRequest.newBuilder()
+   *           .setName(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.getServingConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ServingConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getServingConfigCallable() { + return stub.getServingConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all ServingConfigs linked to this catalog. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+   *   for (ServingConfig element :
+   *       servingConfigServiceClient.listServingConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListServingConfigsPagedResponse listServingConfigs(CatalogName parent) { + ListServingConfigsRequest request = + ListServingConfigsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listServingConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all ServingConfigs linked to this catalog. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
+   *   for (ServingConfig element :
+   *       servingConfigServiceClient.listServingConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListServingConfigsPagedResponse listServingConfigs(String parent) { + ListServingConfigsRequest request = + ListServingConfigsRequest.newBuilder().setParent(parent).build(); + return listServingConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all ServingConfigs linked to this catalog. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ListServingConfigsRequest request =
+   *       ListServingConfigsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (ServingConfig element :
+   *       servingConfigServiceClient.listServingConfigs(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 + */ + public final ListServingConfigsPagedResponse listServingConfigs( + ListServingConfigsRequest request) { + return listServingConfigsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all ServingConfigs linked to this catalog. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ListServingConfigsRequest request =
+   *       ListServingConfigsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.listServingConfigsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ServingConfig element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listServingConfigsPagedCallable() { + return stub.listServingConfigsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all ServingConfigs linked to this catalog. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ListServingConfigsRequest request =
+   *       ListServingConfigsRequest.newBuilder()
+   *           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListServingConfigsResponse response =
+   *         servingConfigServiceClient.listServingConfigsCallable().call(request);
+   *     for (ServingConfig element : response.getServingConfigsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listServingConfigsCallable() { + return stub.listServingConfigsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Enables a Control on the specified ServingConfig. The control is added in the last position of + * the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the + * last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has + * already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ServingConfigName servingConfig =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
+   *   ServingConfig response = servingConfigServiceClient.addControl(servingConfig);
+   * }
+   * }
+ * + * @param servingConfig Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig addControl(ServingConfigName servingConfig) { + AddControlRequest request = + AddControlRequest.newBuilder() + .setServingConfig(servingConfig == null ? null : servingConfig.toString()) + .build(); + return addControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Enables a Control on the specified ServingConfig. The control is added in the last position of + * the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the + * last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has + * already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String servingConfig =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *           .toString();
+   *   ServingConfig response = servingConfigServiceClient.addControl(servingConfig);
+   * }
+   * }
+ * + * @param servingConfig Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig addControl(String servingConfig) { + AddControlRequest request = + AddControlRequest.newBuilder().setServingConfig(servingConfig).build(); + return addControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Enables a Control on the specified ServingConfig. The control is added in the last position of + * the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the + * last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has + * already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   AddControlRequest request =
+   *       AddControlRequest.newBuilder()
+   *           .setServingConfig(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   ServingConfig response = servingConfigServiceClient.addControl(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 + */ + public final ServingConfig addControl(AddControlRequest request) { + return addControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Enables a Control on the specified ServingConfig. The control is added in the last position of + * the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the + * last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has + * already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   AddControlRequest request =
+   *       AddControlRequest.newBuilder()
+   *           .setServingConfig(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.addControlCallable().futureCall(request);
+   *   // Do something.
+   *   ServingConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable addControlCallable() { + return stub.addControlCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Disables a Control on the specified ServingConfig. The control is removed from the + * ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   ServingConfigName servingConfig =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]");
+   *   ServingConfig response = servingConfigServiceClient.removeControl(servingConfig);
+   * }
+   * }
+ * + * @param servingConfig Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig removeControl(ServingConfigName servingConfig) { + RemoveControlRequest request = + RemoveControlRequest.newBuilder() + .setServingConfig(servingConfig == null ? null : servingConfig.toString()) + .build(); + return removeControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Disables a Control on the specified ServingConfig. The control is removed from the + * ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   String servingConfig =
+   *       ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *           .toString();
+   *   ServingConfig response = servingConfigServiceClient.removeControl(servingConfig);
+   * }
+   * }
+ * + * @param servingConfig Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ServingConfig removeControl(String servingConfig) { + RemoveControlRequest request = + RemoveControlRequest.newBuilder().setServingConfig(servingConfig).build(); + return removeControl(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Disables a Control on the specified ServingConfig. The control is removed from the + * ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   RemoveControlRequest request =
+   *       RemoveControlRequest.newBuilder()
+   *           .setServingConfig(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   ServingConfig response = servingConfigServiceClient.removeControl(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 + */ + public final ServingConfig removeControl(RemoveControlRequest request) { + return removeControlCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Disables a Control on the specified ServingConfig. The control is removed from the + * ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ServingConfigServiceClient servingConfigServiceClient =
+   *     ServingConfigServiceClient.create()) {
+   *   RemoveControlRequest request =
+   *       RemoveControlRequest.newBuilder()
+   *           .setServingConfig(
+   *               ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]")
+   *                   .toString())
+   *           .setControlId("controlId-395080872")
+   *           .build();
+   *   ApiFuture future =
+   *       servingConfigServiceClient.removeControlCallable().futureCall(request);
+   *   // Do something.
+   *   ServingConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable removeControlCallable() { + return stub.removeControlCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListServingConfigsPagedResponse + extends AbstractPagedListResponse< + ListServingConfigsRequest, + ListServingConfigsResponse, + ServingConfig, + ListServingConfigsPage, + ListServingConfigsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListServingConfigsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListServingConfigsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListServingConfigsPagedResponse(ListServingConfigsPage page) { + super(page, ListServingConfigsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListServingConfigsPage + extends AbstractPage< + ListServingConfigsRequest, + ListServingConfigsResponse, + ServingConfig, + ListServingConfigsPage> { + + private ListServingConfigsPage( + PageContext context, + ListServingConfigsResponse response) { + super(context, response); + } + + private static ListServingConfigsPage createEmptyPage() { + return new ListServingConfigsPage(null, null); + } + + @Override + protected ListServingConfigsPage createPage( + PageContext context, + ListServingConfigsResponse response) { + return new ListServingConfigsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListServingConfigsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListServingConfigsRequest, + ListServingConfigsResponse, + ServingConfig, + ListServingConfigsPage, + ListServingConfigsFixedSizeCollection> { + + private ListServingConfigsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListServingConfigsFixedSizeCollection createEmptyCollection() { + return new ListServingConfigsFixedSizeCollection(null, 0); + } + + @Override + protected ListServingConfigsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListServingConfigsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceSettings.java new file mode 100644 index 000000000000..6cbf779a1558 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceSettings.java @@ -0,0 +1,278 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.retail.v2.stub.ServingConfigServiceStubSettings; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ServingConfigServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createServingConfig to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ServingConfigServiceSettings.Builder servingConfigServiceSettingsBuilder =
+ *     ServingConfigServiceSettings.newBuilder();
+ * servingConfigServiceSettingsBuilder
+ *     .createServingConfigSettings()
+ *     .setRetrySettings(
+ *         servingConfigServiceSettingsBuilder
+ *             .createServingConfigSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ServingConfigServiceSettings servingConfigServiceSettings =
+ *     servingConfigServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ServingConfigServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createServingConfig. */ + public UnaryCallSettings + createServingConfigSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).createServingConfigSettings(); + } + + /** Returns the object with the settings used for calls to deleteServingConfig. */ + public UnaryCallSettings deleteServingConfigSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).deleteServingConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateServingConfig. */ + public UnaryCallSettings + updateServingConfigSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).updateServingConfigSettings(); + } + + /** Returns the object with the settings used for calls to getServingConfig. */ + public UnaryCallSettings getServingConfigSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).getServingConfigSettings(); + } + + /** Returns the object with the settings used for calls to listServingConfigs. */ + public PagedCallSettings< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).listServingConfigsSettings(); + } + + /** Returns the object with the settings used for calls to addControl. */ + public UnaryCallSettings addControlSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).addControlSettings(); + } + + /** Returns the object with the settings used for calls to removeControl. */ + public UnaryCallSettings removeControlSettings() { + return ((ServingConfigServiceStubSettings) getStubSettings()).removeControlSettings(); + } + + public static final ServingConfigServiceSettings create(ServingConfigServiceStubSettings stub) + throws IOException { + return new ServingConfigServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ServingConfigServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ServingConfigServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ServingConfigServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ServingConfigServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ServingConfigServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ServingConfigServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ServingConfigServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ServingConfigServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ServingConfigServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ServingConfigServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ServingConfigServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(ServingConfigServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ServingConfigServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ServingConfigServiceStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ServingConfigServiceStubSettings.newHttpJsonBuilder()); + } + + public ServingConfigServiceStubSettings.Builder getStubSettingsBuilder() { + return ((ServingConfigServiceStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createServingConfig. */ + public UnaryCallSettings.Builder + createServingConfigSettings() { + return getStubSettingsBuilder().createServingConfigSettings(); + } + + /** Returns the builder for the settings used for calls to deleteServingConfig. */ + public UnaryCallSettings.Builder + deleteServingConfigSettings() { + return getStubSettingsBuilder().deleteServingConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateServingConfig. */ + public UnaryCallSettings.Builder + updateServingConfigSettings() { + return getStubSettingsBuilder().updateServingConfigSettings(); + } + + /** Returns the builder for the settings used for calls to getServingConfig. */ + public UnaryCallSettings.Builder + getServingConfigSettings() { + return getStubSettingsBuilder().getServingConfigSettings(); + } + + /** Returns the builder for the settings used for calls to listServingConfigs. */ + public PagedCallSettings.Builder< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings() { + return getStubSettingsBuilder().listServingConfigsSettings(); + } + + /** Returns the builder for the settings used for calls to addControl. */ + public UnaryCallSettings.Builder addControlSettings() { + return getStubSettingsBuilder().addControlSettings(); + } + + /** Returns the builder for the settings used for calls to removeControl. */ + public UnaryCallSettings.Builder removeControlSettings() { + return getStubSettingsBuilder().removeControlSettings(); + } + + @Override + public ServingConfigServiceSettings build() throws IOException { + return new ServingConfigServiceSettings(this); + } + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java index a975a480c3c1..0ad6fd113816 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/UserEventServiceClient.java @@ -403,8 +403,8 @@ public final UnaryCallable purgeUserEventsCal * Bulk import of User events. Request processing might be synchronous. Events that already exist * are skipped. Use this method for backfilling historical user events. * - *

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. + *

`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: * @@ -436,8 +436,8 @@ public final OperationFuture importUse * Bulk import of User events. Request processing might be synchronous. Events that already exist * are skipped. Use this method for backfilling historical user events. * - *

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. + *

`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: * @@ -468,8 +468,8 @@ public final OperationFuture importUse * Bulk import of User events. Request processing might be synchronous. Events that already exist * are skipped. Use this method for backfilling historical user events. * - *

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. + *

`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: * diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/gapic_metadata.json b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/gapic_metadata.json index b27e46ab9dbe..fb810b2c0f00 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/gapic_metadata.json +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/gapic_metadata.json @@ -10,17 +10,38 @@ "grpc": { "libraryClient": "CatalogServiceClient", "rpcs": { + "AddCatalogAttribute": { + "methods": ["addCatalogAttribute", "addCatalogAttributeCallable"] + }, + "GetAttributesConfig": { + "methods": ["getAttributesConfig", "getAttributesConfig", "getAttributesConfig", "getAttributesConfigCallable"] + }, + "GetCompletionConfig": { + "methods": ["getCompletionConfig", "getCompletionConfig", "getCompletionConfig", "getCompletionConfigCallable"] + }, "GetDefaultBranch": { "methods": ["getDefaultBranch", "getDefaultBranch", "getDefaultBranch", "getDefaultBranchCallable"] }, "ListCatalogs": { "methods": ["listCatalogs", "listCatalogs", "listCatalogs", "listCatalogsPagedCallable", "listCatalogsCallable"] }, + "RemoveCatalogAttribute": { + "methods": ["removeCatalogAttribute", "removeCatalogAttributeCallable"] + }, + "ReplaceCatalogAttribute": { + "methods": ["replaceCatalogAttribute", "replaceCatalogAttributeCallable"] + }, "SetDefaultBranch": { "methods": ["setDefaultBranch", "setDefaultBranch", "setDefaultBranch", "setDefaultBranchCallable"] }, + "UpdateAttributesConfig": { + "methods": ["updateAttributesConfig", "updateAttributesConfig", "updateAttributesConfigCallable"] + }, "UpdateCatalog": { "methods": ["updateCatalog", "updateCatalog", "updateCatalogCallable"] + }, + "UpdateCompletionConfig": { + "methods": ["updateCompletionConfig", "updateCompletionConfig", "updateCompletionConfigCallable"] } } } @@ -41,6 +62,30 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": ["createControl", "createControl", "createControl", "createControlCallable"] + }, + "DeleteControl": { + "methods": ["deleteControl", "deleteControl", "deleteControl", "deleteControlCallable"] + }, + "GetControl": { + "methods": ["getControl", "getControl", "getControl", "getControlCallable"] + }, + "ListControls": { + "methods": ["listControls", "listControls", "listControls", "listControlsPagedCallable", "listControlsCallable"] + }, + "UpdateControl": { + "methods": ["updateControl", "updateControl", "updateControlCallable"] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -107,6 +152,36 @@ } } }, + "ServingConfigService": { + "clients": { + "grpc": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "AddControl": { + "methods": ["addControl", "addControl", "addControl", "addControlCallable"] + }, + "CreateServingConfig": { + "methods": ["createServingConfig", "createServingConfig", "createServingConfig", "createServingConfigCallable"] + }, + "DeleteServingConfig": { + "methods": ["deleteServingConfig", "deleteServingConfig", "deleteServingConfig", "deleteServingConfigCallable"] + }, + "GetServingConfig": { + "methods": ["getServingConfig", "getServingConfig", "getServingConfig", "getServingConfigCallable"] + }, + "ListServingConfigs": { + "methods": ["listServingConfigs", "listServingConfigs", "listServingConfigs", "listServingConfigsPagedCallable", "listServingConfigsCallable"] + }, + "RemoveControl": { + "methods": ["removeControl", "removeControl", "removeControl", "removeControlCallable"] + }, + "UpdateServingConfig": { + "methods": ["updateServingConfig", "updateServingConfig", "updateServingConfigCallable"] + } + } + } + } + }, "UserEventService": { "clients": { "grpc": { diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java index d2822d28d782..d6892b47a2bc 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/package-info.java @@ -62,6 +62,23 @@ * } * } * + *

======================= ControlServiceClient ======================= + * + *

Service Description: Service for modifying Control. + * + *

Sample for ControlServiceClient: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
+ *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+ *   Control control = Control.newBuilder().build();
+ *   String controlId = "controlId-395080872";
+ *   Control response = controlServiceClient.createControl(parent, control, controlId);
+ * }
+ * }
+ * *

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

Service Description: Service for making recommendation prediction. @@ -148,6 +165,25 @@ * } * } * + *

======================= ServingConfigServiceClient ======================= + * + *

Service Description: Service for modifying ServingConfig. + * + *

Sample for ServingConfigServiceClient: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ServingConfigServiceClient servingConfigServiceClient =
+ *     ServingConfigServiceClient.create()) {
+ *   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
+ *   ServingConfig servingConfig = ServingConfig.newBuilder().build();
+ *   String servingConfigId = "servingConfigId-831052759";
+ *   ServingConfig response =
+ *       servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId);
+ * }
+ * }
+ * *

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

Service Description: Service for ingesting end user actions on the customer website. diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java index d9b20854a453..d3f66147e0cb 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStub.java @@ -20,13 +20,22 @@ import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; import com.google.cloud.retail.v2.GetDefaultBranchRequest; import com.google.cloud.retail.v2.GetDefaultBranchResponse; import com.google.cloud.retail.v2.ListCatalogsRequest; import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; import com.google.cloud.retail.v2.SetDefaultBranchRequest; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -60,6 +69,38 @@ public UnaryCallable setDefaultBranchCallable() throw new UnsupportedOperationException("Not implemented: getDefaultBranchCallable()"); } + public UnaryCallable getCompletionConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getCompletionConfigCallable()"); + } + + public UnaryCallable + updateCompletionConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateCompletionConfigCallable()"); + } + + public UnaryCallable getAttributesConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getAttributesConfigCallable()"); + } + + public UnaryCallable + updateAttributesConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateAttributesConfigCallable()"); + } + + public UnaryCallable addCatalogAttributeCallable() { + throw new UnsupportedOperationException("Not implemented: addCatalogAttributeCallable()"); + } + + public UnaryCallable + removeCatalogAttributeCallable() { + throw new UnsupportedOperationException("Not implemented: removeCatalogAttributeCallable()"); + } + + public UnaryCallable + replaceCatalogAttributeCallable() { + throw new UnsupportedOperationException("Not implemented: replaceCatalogAttributeCallable()"); + } + @Override public abstract void close(); } diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java index 0da1d1a23ea3..0b80cc4ab22c 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/CatalogServiceStubSettings.java @@ -43,13 +43,22 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; import com.google.cloud.retail.v2.GetDefaultBranchRequest; import com.google.cloud.retail.v2.GetDefaultBranchResponse; import com.google.cloud.retail.v2.ListCatalogsRequest; import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; import com.google.cloud.retail.v2.SetDefaultBranchRequest; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -107,6 +116,20 @@ public class CatalogServiceStubSettings extends StubSettings setDefaultBranchSettings; private final UnaryCallSettings getDefaultBranchSettings; + private final UnaryCallSettings + getCompletionConfigSettings; + private final UnaryCallSettings + updateCompletionConfigSettings; + private final UnaryCallSettings + getAttributesConfigSettings; + private final UnaryCallSettings + updateAttributesConfigSettings; + private final UnaryCallSettings + addCatalogAttributeSettings; + private final UnaryCallSettings + removeCatalogAttributeSettings; + private final UnaryCallSettings + replaceCatalogAttributeSettings; private static final PagedListDescriptor LIST_CATALOGS_PAGE_STR_DESC = @@ -183,6 +206,48 @@ public UnaryCallSettings setDefaultBranchSetting return getDefaultBranchSettings; } + /** Returns the object with the settings used for calls to getCompletionConfig. */ + public UnaryCallSettings + getCompletionConfigSettings() { + return getCompletionConfigSettings; + } + + /** Returns the object with the settings used for calls to updateCompletionConfig. */ + public UnaryCallSettings + updateCompletionConfigSettings() { + return updateCompletionConfigSettings; + } + + /** Returns the object with the settings used for calls to getAttributesConfig. */ + public UnaryCallSettings + getAttributesConfigSettings() { + return getAttributesConfigSettings; + } + + /** Returns the object with the settings used for calls to updateAttributesConfig. */ + public UnaryCallSettings + updateAttributesConfigSettings() { + return updateAttributesConfigSettings; + } + + /** Returns the object with the settings used for calls to addCatalogAttribute. */ + public UnaryCallSettings + addCatalogAttributeSettings() { + return addCatalogAttributeSettings; + } + + /** Returns the object with the settings used for calls to removeCatalogAttribute. */ + public UnaryCallSettings + removeCatalogAttributeSettings() { + return removeCatalogAttributeSettings; + } + + /** Returns the object with the settings used for calls to replaceCatalogAttribute. */ + public UnaryCallSettings + replaceCatalogAttributeSettings() { + return replaceCatalogAttributeSettings; + } + public CatalogServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -293,6 +358,13 @@ protected CatalogServiceStubSettings(Builder settingsBuilder) throws IOException updateCatalogSettings = settingsBuilder.updateCatalogSettings().build(); setDefaultBranchSettings = settingsBuilder.setDefaultBranchSettings().build(); getDefaultBranchSettings = settingsBuilder.getDefaultBranchSettings().build(); + getCompletionConfigSettings = settingsBuilder.getCompletionConfigSettings().build(); + updateCompletionConfigSettings = settingsBuilder.updateCompletionConfigSettings().build(); + getAttributesConfigSettings = settingsBuilder.getAttributesConfigSettings().build(); + updateAttributesConfigSettings = settingsBuilder.updateAttributesConfigSettings().build(); + addCatalogAttributeSettings = settingsBuilder.addCatalogAttributeSettings().build(); + removeCatalogAttributeSettings = settingsBuilder.removeCatalogAttributeSettings().build(); + replaceCatalogAttributeSettings = settingsBuilder.replaceCatalogAttributeSettings().build(); } /** Builder for CatalogServiceStubSettings. */ @@ -306,6 +378,20 @@ public static class Builder extends StubSettings.Builder getDefaultBranchSettings; + private final UnaryCallSettings.Builder + getCompletionConfigSettings; + private final UnaryCallSettings.Builder + updateCompletionConfigSettings; + private final UnaryCallSettings.Builder + getAttributesConfigSettings; + private final UnaryCallSettings.Builder + updateAttributesConfigSettings; + private final UnaryCallSettings.Builder + addCatalogAttributeSettings; + private final UnaryCallSettings.Builder + removeCatalogAttributeSettings; + private final UnaryCallSettings.Builder + replaceCatalogAttributeSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -350,13 +436,27 @@ protected Builder(ClientContext clientContext) { updateCatalogSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); setDefaultBranchSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); getDefaultBranchSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getCompletionConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateCompletionConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getAttributesConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateAttributesConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + addCatalogAttributeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + removeCatalogAttributeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + replaceCatalogAttributeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( listCatalogsSettings, updateCatalogSettings, setDefaultBranchSettings, - getDefaultBranchSettings); + getDefaultBranchSettings, + getCompletionConfigSettings, + updateCompletionConfigSettings, + getAttributesConfigSettings, + updateAttributesConfigSettings, + addCatalogAttributeSettings, + removeCatalogAttributeSettings, + replaceCatalogAttributeSettings); initDefaults(this); } @@ -367,13 +467,27 @@ protected Builder(CatalogServiceStubSettings settings) { updateCatalogSettings = settings.updateCatalogSettings.toBuilder(); setDefaultBranchSettings = settings.setDefaultBranchSettings.toBuilder(); getDefaultBranchSettings = settings.getDefaultBranchSettings.toBuilder(); + getCompletionConfigSettings = settings.getCompletionConfigSettings.toBuilder(); + updateCompletionConfigSettings = settings.updateCompletionConfigSettings.toBuilder(); + getAttributesConfigSettings = settings.getAttributesConfigSettings.toBuilder(); + updateAttributesConfigSettings = settings.updateAttributesConfigSettings.toBuilder(); + addCatalogAttributeSettings = settings.addCatalogAttributeSettings.toBuilder(); + removeCatalogAttributeSettings = settings.removeCatalogAttributeSettings.toBuilder(); + replaceCatalogAttributeSettings = settings.replaceCatalogAttributeSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( listCatalogsSettings, updateCatalogSettings, setDefaultBranchSettings, - getDefaultBranchSettings); + getDefaultBranchSettings, + getCompletionConfigSettings, + updateCompletionConfigSettings, + getAttributesConfigSettings, + updateAttributesConfigSettings, + addCatalogAttributeSettings, + removeCatalogAttributeSettings, + replaceCatalogAttributeSettings); } private static Builder createDefault() { @@ -423,6 +537,41 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .getCompletionConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateCompletionConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getAttributesConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateAttributesConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .addCatalogAttributeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .removeCatalogAttributeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .replaceCatalogAttributeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -464,6 +613,48 @@ public UnaryCallSettings.Builder setDefaultBranc return getDefaultBranchSettings; } + /** Returns the builder for the settings used for calls to getCompletionConfig. */ + public UnaryCallSettings.Builder + getCompletionConfigSettings() { + return getCompletionConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateCompletionConfig. */ + public UnaryCallSettings.Builder + updateCompletionConfigSettings() { + return updateCompletionConfigSettings; + } + + /** Returns the builder for the settings used for calls to getAttributesConfig. */ + public UnaryCallSettings.Builder + getAttributesConfigSettings() { + return getAttributesConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateAttributesConfig. */ + public UnaryCallSettings.Builder + updateAttributesConfigSettings() { + return updateAttributesConfigSettings; + } + + /** Returns the builder for the settings used for calls to addCatalogAttribute. */ + public UnaryCallSettings.Builder + addCatalogAttributeSettings() { + return addCatalogAttributeSettings; + } + + /** Returns the builder for the settings used for calls to removeCatalogAttribute. */ + public UnaryCallSettings.Builder + removeCatalogAttributeSettings() { + return removeCatalogAttributeSettings; + } + + /** Returns the builder for the settings used for calls to replaceCatalogAttribute. */ + public UnaryCallSettings.Builder + replaceCatalogAttributeSettings() { + return replaceCatalogAttributeSettings; + } + @Override public CatalogServiceStubSettings build() throws IOException { return new CatalogServiceStubSettings(this); diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStub.java new file mode 100644 index 000000000000..f3f810a18068 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStub.java @@ -0,0 +1,68 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.CreateControlRequest; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.cloud.retail.v2.GetControlRequest; +import com.google.cloud.retail.v2.ListControlsRequest; +import com.google.cloud.retail.v2.ListControlsResponse; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ControlService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ControlServiceStub implements BackgroundResource { + + public UnaryCallable createControlCallable() { + throw new UnsupportedOperationException("Not implemented: createControlCallable()"); + } + + public UnaryCallable deleteControlCallable() { + throw new UnsupportedOperationException("Not implemented: deleteControlCallable()"); + } + + public UnaryCallable updateControlCallable() { + throw new UnsupportedOperationException("Not implemented: updateControlCallable()"); + } + + public UnaryCallable getControlCallable() { + throw new UnsupportedOperationException("Not implemented: getControlCallable()"); + } + + public UnaryCallable listControlsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listControlsPagedCallable()"); + } + + public UnaryCallable listControlsCallable() { + throw new UnsupportedOperationException("Not implemented: listControlsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStubSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStubSettings.java new file mode 100644 index 000000000000..5a26e32c0a51 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ControlServiceStubSettings.java @@ -0,0 +1,475 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.CreateControlRequest; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.cloud.retail.v2.GetControlRequest; +import com.google.cloud.retail.v2.ListControlsRequest; +import com.google.cloud.retail.v2.ListControlsResponse; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ControlServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createControl to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ControlServiceStubSettings.Builder controlServiceSettingsBuilder =
+ *     ControlServiceStubSettings.newBuilder();
+ * controlServiceSettingsBuilder
+ *     .createControlSettings()
+ *     .setRetrySettings(
+ *         controlServiceSettingsBuilder
+ *             .createControlSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ControlServiceStubSettings controlServiceSettings = controlServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ControlServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createControlSettings; + private final UnaryCallSettings deleteControlSettings; + private final UnaryCallSettings updateControlSettings; + private final UnaryCallSettings getControlSettings; + private final PagedCallSettings< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse> + listControlsSettings; + + private static final PagedListDescriptor + LIST_CONTROLS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListControlsRequest injectToken(ListControlsRequest payload, String token) { + return ListControlsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListControlsRequest injectPageSize(ListControlsRequest payload, int pageSize) { + return ListControlsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListControlsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListControlsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListControlsResponse payload) { + return payload.getControlsList() == null + ? ImmutableList.of() + : payload.getControlsList(); + } + }; + + private static final PagedListResponseFactory< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse> + LIST_CONTROLS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListControlsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_CONTROLS_PAGE_STR_DESC, request, context); + return ListControlsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createControl. */ + public UnaryCallSettings createControlSettings() { + return createControlSettings; + } + + /** Returns the object with the settings used for calls to deleteControl. */ + public UnaryCallSettings deleteControlSettings() { + return deleteControlSettings; + } + + /** Returns the object with the settings used for calls to updateControl. */ + public UnaryCallSettings updateControlSettings() { + return updateControlSettings; + } + + /** Returns the object with the settings used for calls to getControl. */ + public UnaryCallSettings getControlSettings() { + return getControlSettings; + } + + /** Returns the object with the settings used for calls to listControls. */ + public PagedCallSettings + listControlsSettings() { + return listControlsSettings; + } + + public ControlServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcControlServiceStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonControlServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "retail.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ControlServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ControlServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ControlServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ControlServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createControlSettings = settingsBuilder.createControlSettings().build(); + deleteControlSettings = settingsBuilder.deleteControlSettings().build(); + updateControlSettings = settingsBuilder.updateControlSettings().build(); + getControlSettings = settingsBuilder.getControlSettings().build(); + listControlsSettings = settingsBuilder.listControlsSettings().build(); + } + + /** Builder for ControlServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createControlSettings; + private final UnaryCallSettings.Builder deleteControlSettings; + private final UnaryCallSettings.Builder updateControlSettings; + private final UnaryCallSettings.Builder getControlSettings; + private final PagedCallSettings.Builder< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse> + listControlsSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listControlsSettings = PagedCallSettings.newBuilder(LIST_CONTROLS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createControlSettings, + deleteControlSettings, + updateControlSettings, + getControlSettings, + listControlsSettings); + initDefaults(this); + } + + protected Builder(ControlServiceStubSettings settings) { + super(settings); + + createControlSettings = settings.createControlSettings.toBuilder(); + deleteControlSettings = settings.deleteControlSettings.toBuilder(); + updateControlSettings = settings.updateControlSettings.toBuilder(); + getControlSettings = settings.getControlSettings.toBuilder(); + listControlsSettings = settings.listControlsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createControlSettings, + deleteControlSettings, + updateControlSettings, + getControlSettings, + listControlsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listControlsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createControl. */ + public UnaryCallSettings.Builder createControlSettings() { + return createControlSettings; + } + + /** Returns the builder for the settings used for calls to deleteControl. */ + public UnaryCallSettings.Builder deleteControlSettings() { + return deleteControlSettings; + } + + /** Returns the builder for the settings used for calls to updateControl. */ + public UnaryCallSettings.Builder updateControlSettings() { + return updateControlSettings; + } + + /** Returns the builder for the settings used for calls to getControl. */ + public UnaryCallSettings.Builder getControlSettings() { + return getControlSettings; + } + + /** Returns the builder for the settings used for calls to listControls. */ + public PagedCallSettings.Builder< + ListControlsRequest, ListControlsResponse, ListControlsPagedResponse> + listControlsSettings() { + return listControlsSettings; + } + + @Override + public ControlServiceStubSettings build() throws IOException { + return new ControlServiceStubSettings(this); + } + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java index 68ee398a04f5..6113045bc173 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcCatalogServiceStub.java @@ -24,13 +24,22 @@ import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; import com.google.cloud.retail.v2.GetDefaultBranchRequest; import com.google.cloud.retail.v2.GetDefaultBranchResponse; import com.google.cloud.retail.v2.ListCatalogsRequest; import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; import com.google.cloud.retail.v2.SetDefaultBranchRequest; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -89,6 +98,76 @@ public class GrpcCatalogServiceStub extends CatalogServiceStub { ProtoUtils.marshaller(GetDefaultBranchResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + getCompletionConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/GetCompletionConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(GetCompletionConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CompletionConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateCompletionConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/UpdateCompletionConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCompletionConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CompletionConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getAttributesConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/GetAttributesConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(GetAttributesConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AttributesConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateAttributesConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/UpdateAttributesConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateAttributesConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AttributesConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + addCatalogAttributeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/AddCatalogAttribute") + .setRequestMarshaller( + ProtoUtils.marshaller(AddCatalogAttributeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AttributesConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + removeCatalogAttributeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/RemoveCatalogAttribute") + .setRequestMarshaller( + ProtoUtils.marshaller(RemoveCatalogAttributeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AttributesConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + replaceCatalogAttributeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.CatalogService/ReplaceCatalogAttribute") + .setRequestMarshaller( + ProtoUtils.marshaller(ReplaceCatalogAttributeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AttributesConfig.getDefaultInstance())) + .build(); + private final UnaryCallable listCatalogsCallable; private final UnaryCallable listCatalogsPagedCallable; @@ -96,6 +175,20 @@ public class GrpcCatalogServiceStub extends CatalogServiceStub { private final UnaryCallable setDefaultBranchCallable; private final UnaryCallable getDefaultBranchCallable; + private final UnaryCallable + getCompletionConfigCallable; + private final UnaryCallable + updateCompletionConfigCallable; + private final UnaryCallable + getAttributesConfigCallable; + private final UnaryCallable + updateAttributesConfigCallable; + private final UnaryCallable + addCatalogAttributeCallable; + private final UnaryCallable + removeCatalogAttributeCallable; + private final UnaryCallable + replaceCatalogAttributeCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -182,6 +275,90 @@ protected GrpcCatalogServiceStub( return params.build(); }) .build(); + GrpcCallSettings + getCompletionConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getCompletionConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + updateCompletionConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCompletionConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "completion_config.name", + String.valueOf(request.getCompletionConfig().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + getAttributesConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getAttributesConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + updateAttributesConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateAttributesConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "attributes_config.name", + String.valueOf(request.getAttributesConfig().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + addCatalogAttributeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(addCatalogAttributeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "attributes_config", String.valueOf(request.getAttributesConfig())); + return params.build(); + }) + .build(); + GrpcCallSettings + removeCatalogAttributeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(removeCatalogAttributeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "attributes_config", String.valueOf(request.getAttributesConfig())); + return params.build(); + }) + .build(); + GrpcCallSettings + replaceCatalogAttributeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(replaceCatalogAttributeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "attributes_config", String.valueOf(request.getAttributesConfig())); + return params.build(); + }) + .build(); this.listCatalogsCallable = callableFactory.createUnaryCallable( @@ -198,6 +375,41 @@ protected GrpcCatalogServiceStub( this.getDefaultBranchCallable = callableFactory.createUnaryCallable( getDefaultBranchTransportSettings, settings.getDefaultBranchSettings(), clientContext); + this.getCompletionConfigCallable = + callableFactory.createUnaryCallable( + getCompletionConfigTransportSettings, + settings.getCompletionConfigSettings(), + clientContext); + this.updateCompletionConfigCallable = + callableFactory.createUnaryCallable( + updateCompletionConfigTransportSettings, + settings.updateCompletionConfigSettings(), + clientContext); + this.getAttributesConfigCallable = + callableFactory.createUnaryCallable( + getAttributesConfigTransportSettings, + settings.getAttributesConfigSettings(), + clientContext); + this.updateAttributesConfigCallable = + callableFactory.createUnaryCallable( + updateAttributesConfigTransportSettings, + settings.updateAttributesConfigSettings(), + clientContext); + this.addCatalogAttributeCallable = + callableFactory.createUnaryCallable( + addCatalogAttributeTransportSettings, + settings.addCatalogAttributeSettings(), + clientContext); + this.removeCatalogAttributeCallable = + callableFactory.createUnaryCallable( + removeCatalogAttributeTransportSettings, + settings.removeCatalogAttributeSettings(), + clientContext); + this.replaceCatalogAttributeCallable = + callableFactory.createUnaryCallable( + replaceCatalogAttributeTransportSettings, + settings.replaceCatalogAttributeSettings(), + clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -233,6 +445,45 @@ public UnaryCallable setDefaultBranchCallable() return getDefaultBranchCallable; } + @Override + public UnaryCallable getCompletionConfigCallable() { + return getCompletionConfigCallable; + } + + @Override + public UnaryCallable + updateCompletionConfigCallable() { + return updateCompletionConfigCallable; + } + + @Override + public UnaryCallable getAttributesConfigCallable() { + return getAttributesConfigCallable; + } + + @Override + public UnaryCallable + updateAttributesConfigCallable() { + return updateAttributesConfigCallable; + } + + @Override + public UnaryCallable addCatalogAttributeCallable() { + return addCatalogAttributeCallable; + } + + @Override + public UnaryCallable + removeCatalogAttributeCallable() { + return removeCatalogAttributeCallable; + } + + @Override + public UnaryCallable + replaceCatalogAttributeCallable() { + return replaceCatalogAttributeCallable; + } + @Override public final void close() { try { diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceCallableFactory.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceCallableFactory.java new file mode 100644 index 000000000000..a806d295ef79 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ControlService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcControlServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceStub.java new file mode 100644 index 000000000000..fa4d46a79a62 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcControlServiceStub.java @@ -0,0 +1,292 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.CreateControlRequest; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.cloud.retail.v2.GetControlRequest; +import com.google.cloud.retail.v2.ListControlsRequest; +import com.google.cloud.retail.v2.ListControlsResponse; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ControlService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcControlServiceStub extends ControlServiceStub { + private static final MethodDescriptor + createControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ControlService/CreateControl") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Control.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ControlService/DeleteControl") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ControlService/UpdateControl") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Control.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ControlService/GetControl") + .setRequestMarshaller(ProtoUtils.marshaller(GetControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Control.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listControlsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ControlService/ListControls") + .setRequestMarshaller(ProtoUtils.marshaller(ListControlsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListControlsResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable createControlCallable; + private final UnaryCallable deleteControlCallable; + private final UnaryCallable updateControlCallable; + private final UnaryCallable getControlCallable; + private final UnaryCallable listControlsCallable; + private final UnaryCallable + listControlsPagedCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcControlServiceStub create(ControlServiceStubSettings settings) + throws IOException { + return new GrpcControlServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcControlServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcControlServiceStub( + ControlServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcControlServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcControlServiceStub( + ControlServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcControlServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcControlServiceStub(ControlServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcControlServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcControlServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcControlServiceStub( + ControlServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("control.name", String.valueOf(request.getControl().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings listControlsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listControlsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + + this.createControlCallable = + callableFactory.createUnaryCallable( + createControlTransportSettings, settings.createControlSettings(), clientContext); + this.deleteControlCallable = + callableFactory.createUnaryCallable( + deleteControlTransportSettings, settings.deleteControlSettings(), clientContext); + this.updateControlCallable = + callableFactory.createUnaryCallable( + updateControlTransportSettings, settings.updateControlSettings(), clientContext); + this.getControlCallable = + callableFactory.createUnaryCallable( + getControlTransportSettings, settings.getControlSettings(), clientContext); + this.listControlsCallable = + callableFactory.createUnaryCallable( + listControlsTransportSettings, settings.listControlsSettings(), clientContext); + this.listControlsPagedCallable = + callableFactory.createPagedCallable( + listControlsTransportSettings, settings.listControlsSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createControlCallable() { + return createControlCallable; + } + + @Override + public UnaryCallable deleteControlCallable() { + return deleteControlCallable; + } + + @Override + public UnaryCallable updateControlCallable() { + return updateControlCallable; + } + + @Override + public UnaryCallable getControlCallable() { + return getControlCallable; + } + + @Override + public UnaryCallable listControlsCallable() { + return listControlsCallable; + } + + @Override + public UnaryCallable listControlsPagedCallable() { + return listControlsPagedCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceCallableFactory.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceCallableFactory.java new file mode 100644 index 000000000000..65e3e4f491c1 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ServingConfigService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcServingConfigServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceStub.java new file mode 100644 index 000000000000..ffe5dc715cb1 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/GrpcServingConfigServiceStub.java @@ -0,0 +1,376 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ListServingConfigsResponse; +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ServingConfigService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcServingConfigServiceStub extends ServingConfigServiceStub { + private static final MethodDescriptor + createServingConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/CreateServingConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateServingConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ServingConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteServingConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/DeleteServingConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteServingConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateServingConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/UpdateServingConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateServingConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ServingConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getServingConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/GetServingConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(GetServingConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ServingConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listServingConfigsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/ListServingConfigs") + .setRequestMarshaller( + ProtoUtils.marshaller(ListServingConfigsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListServingConfigsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + addControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/AddControl") + .setRequestMarshaller(ProtoUtils.marshaller(AddControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ServingConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + removeControlMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/RemoveControl") + .setRequestMarshaller( + ProtoUtils.marshaller(RemoveControlRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ServingConfig.getDefaultInstance())) + .build(); + + private final UnaryCallable + createServingConfigCallable; + private final UnaryCallable deleteServingConfigCallable; + private final UnaryCallable + updateServingConfigCallable; + private final UnaryCallable getServingConfigCallable; + private final UnaryCallable + listServingConfigsCallable; + private final UnaryCallable + listServingConfigsPagedCallable; + private final UnaryCallable addControlCallable; + private final UnaryCallable removeControlCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcServingConfigServiceStub create(ServingConfigServiceStubSettings settings) + throws IOException { + return new GrpcServingConfigServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcServingConfigServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcServingConfigServiceStub( + ServingConfigServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcServingConfigServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcServingConfigServiceStub( + ServingConfigServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcServingConfigServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcServingConfigServiceStub( + ServingConfigServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcServingConfigServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcServingConfigServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcServingConfigServiceStub( + ServingConfigServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings + createServingConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createServingConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteServingConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteServingConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + updateServingConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateServingConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "serving_config.name", + String.valueOf(request.getServingConfig().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getServingConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getServingConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + listServingConfigsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listServingConfigsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings addControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(addControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("serving_config", String.valueOf(request.getServingConfig())); + return params.build(); + }) + .build(); + GrpcCallSettings removeControlTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(removeControlMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("serving_config", String.valueOf(request.getServingConfig())); + return params.build(); + }) + .build(); + + this.createServingConfigCallable = + callableFactory.createUnaryCallable( + createServingConfigTransportSettings, + settings.createServingConfigSettings(), + clientContext); + this.deleteServingConfigCallable = + callableFactory.createUnaryCallable( + deleteServingConfigTransportSettings, + settings.deleteServingConfigSettings(), + clientContext); + this.updateServingConfigCallable = + callableFactory.createUnaryCallable( + updateServingConfigTransportSettings, + settings.updateServingConfigSettings(), + clientContext); + this.getServingConfigCallable = + callableFactory.createUnaryCallable( + getServingConfigTransportSettings, settings.getServingConfigSettings(), clientContext); + this.listServingConfigsCallable = + callableFactory.createUnaryCallable( + listServingConfigsTransportSettings, + settings.listServingConfigsSettings(), + clientContext); + this.listServingConfigsPagedCallable = + callableFactory.createPagedCallable( + listServingConfigsTransportSettings, + settings.listServingConfigsSettings(), + clientContext); + this.addControlCallable = + callableFactory.createUnaryCallable( + addControlTransportSettings, settings.addControlSettings(), clientContext); + this.removeControlCallable = + callableFactory.createUnaryCallable( + removeControlTransportSettings, settings.removeControlSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createServingConfigCallable() { + return createServingConfigCallable; + } + + @Override + public UnaryCallable deleteServingConfigCallable() { + return deleteServingConfigCallable; + } + + @Override + public UnaryCallable updateServingConfigCallable() { + return updateServingConfigCallable; + } + + @Override + public UnaryCallable getServingConfigCallable() { + return getServingConfigCallable; + } + + @Override + public UnaryCallable + listServingConfigsCallable() { + return listServingConfigsCallable; + } + + @Override + public UnaryCallable + listServingConfigsPagedCallable() { + return listServingConfigsPagedCallable; + } + + @Override + public UnaryCallable addControlCallable() { + return addControlCallable; + } + + @Override + public UnaryCallable removeControlCallable() { + return removeControlCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonCatalogServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonCatalogServiceStub.java index 5a2088da34ba..47a3738d0b0c 100644 --- a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonCatalogServiceStub.java +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonCatalogServiceStub.java @@ -30,13 +30,22 @@ import com.google.api.gax.httpjson.ProtoRestSerializer; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; import com.google.cloud.retail.v2.Catalog; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; import com.google.cloud.retail.v2.GetDefaultBranchRequest; import com.google.cloud.retail.v2.GetDefaultBranchResponse; import com.google.cloud.retail.v2.ListCatalogsRequest; import com.google.cloud.retail.v2.ListCatalogsResponse; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; import com.google.cloud.retail.v2.SetDefaultBranchRequest; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; import com.google.cloud.retail.v2.UpdateCatalogRequest; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -199,6 +208,263 @@ public class HttpJsonCatalogServiceStub extends CatalogServiceStub { .build()) .build(); + private static final ApiMethodDescriptor + getCompletionConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/GetCompletionConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CompletionConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCompletionConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/UpdateCompletionConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{completionConfig.name=projects/*/locations/*/catalogs/*/completionConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "completionConfig.name", + request.getCompletionConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("completionConfig", request.getCompletionConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CompletionConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getAttributesConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/GetAttributesConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AttributesConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateAttributesConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/UpdateAttributesConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{attributesConfig.name=projects/*/locations/*/catalogs/*/attributesConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "attributesConfig.name", + request.getAttributesConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("attributesConfig", request.getAttributesConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AttributesConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + addCatalogAttributeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/AddCatalogAttribute") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{attributesConfig=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attributesConfig", request.getAttributesConfig()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAttributesConfig().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AttributesConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + removeCatalogAttributeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/RemoveCatalogAttribute") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{attributesConfig=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attributesConfig", request.getAttributesConfig()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAttributesConfig().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AttributesConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + replaceCatalogAttributeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.CatalogService/ReplaceCatalogAttribute") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{attributesConfig=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attributesConfig", request.getAttributesConfig()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAttributesConfig().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AttributesConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listCatalogsCallable; private final UnaryCallable listCatalogsPagedCallable; @@ -206,6 +472,20 @@ public class HttpJsonCatalogServiceStub extends CatalogServiceStub { private final UnaryCallable setDefaultBranchCallable; private final UnaryCallable getDefaultBranchCallable; + private final UnaryCallable + getCompletionConfigCallable; + private final UnaryCallable + updateCompletionConfigCallable; + private final UnaryCallable + getAttributesConfigCallable; + private final UnaryCallable + updateAttributesConfigCallable; + private final UnaryCallable + addCatalogAttributeCallable; + private final UnaryCallable + removeCatalogAttributeCallable; + private final UnaryCallable + replaceCatalogAttributeCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -270,6 +550,48 @@ protected HttpJsonCatalogServiceStub( .setMethodDescriptor(getDefaultBranchMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + getCompletionConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCompletionConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCompletionConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCompletionConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getAttributesConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAttributesConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateAttributesConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAttributesConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + addCatalogAttributeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addCatalogAttributeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + removeCatalogAttributeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removeCatalogAttributeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + replaceCatalogAttributeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(replaceCatalogAttributeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listCatalogsCallable = callableFactory.createUnaryCallable( @@ -286,6 +608,41 @@ protected HttpJsonCatalogServiceStub( this.getDefaultBranchCallable = callableFactory.createUnaryCallable( getDefaultBranchTransportSettings, settings.getDefaultBranchSettings(), clientContext); + this.getCompletionConfigCallable = + callableFactory.createUnaryCallable( + getCompletionConfigTransportSettings, + settings.getCompletionConfigSettings(), + clientContext); + this.updateCompletionConfigCallable = + callableFactory.createUnaryCallable( + updateCompletionConfigTransportSettings, + settings.updateCompletionConfigSettings(), + clientContext); + this.getAttributesConfigCallable = + callableFactory.createUnaryCallable( + getAttributesConfigTransportSettings, + settings.getAttributesConfigSettings(), + clientContext); + this.updateAttributesConfigCallable = + callableFactory.createUnaryCallable( + updateAttributesConfigTransportSettings, + settings.updateAttributesConfigSettings(), + clientContext); + this.addCatalogAttributeCallable = + callableFactory.createUnaryCallable( + addCatalogAttributeTransportSettings, + settings.addCatalogAttributeSettings(), + clientContext); + this.removeCatalogAttributeCallable = + callableFactory.createUnaryCallable( + removeCatalogAttributeTransportSettings, + settings.removeCatalogAttributeSettings(), + clientContext); + this.replaceCatalogAttributeCallable = + callableFactory.createUnaryCallable( + replaceCatalogAttributeTransportSettings, + settings.replaceCatalogAttributeSettings(), + clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -298,6 +655,13 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateCatalogMethodDescriptor); methodDescriptors.add(setDefaultBranchMethodDescriptor); methodDescriptors.add(getDefaultBranchMethodDescriptor); + methodDescriptors.add(getCompletionConfigMethodDescriptor); + methodDescriptors.add(updateCompletionConfigMethodDescriptor); + methodDescriptors.add(getAttributesConfigMethodDescriptor); + methodDescriptors.add(updateAttributesConfigMethodDescriptor); + methodDescriptors.add(addCatalogAttributeMethodDescriptor); + methodDescriptors.add(removeCatalogAttributeMethodDescriptor); + methodDescriptors.add(replaceCatalogAttributeMethodDescriptor); return methodDescriptors; } @@ -327,6 +691,45 @@ public UnaryCallable setDefaultBranchCallable() return getDefaultBranchCallable; } + @Override + public UnaryCallable getCompletionConfigCallable() { + return getCompletionConfigCallable; + } + + @Override + public UnaryCallable + updateCompletionConfigCallable() { + return updateCompletionConfigCallable; + } + + @Override + public UnaryCallable getAttributesConfigCallable() { + return getAttributesConfigCallable; + } + + @Override + public UnaryCallable + updateAttributesConfigCallable() { + return updateAttributesConfigCallable; + } + + @Override + public UnaryCallable addCatalogAttributeCallable() { + return addCatalogAttributeCallable; + } + + @Override + public UnaryCallable + removeCatalogAttributeCallable() { + return removeCatalogAttributeCallable; + } + + @Override + public UnaryCallable + replaceCatalogAttributeCallable() { + return replaceCatalogAttributeCallable; + } + @Override public final void close() { try { diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceCallableFactory.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceCallableFactory.java new file mode 100644 index 000000000000..ad512c5fe70b --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the ControlService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonControlServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceStub.java new file mode 100644 index 000000000000..bade560cb82e --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonControlServiceStub.java @@ -0,0 +1,410 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.CreateControlRequest; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.cloud.retail.v2.GetControlRequest; +import com.google.cloud.retail.v2.ListControlsRequest; +import com.google.cloud.retail.v2.ListControlsResponse; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the ControlService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonControlServiceStub extends ControlServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + createControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ControlService/CreateControl") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/catalogs/*}/controls", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "controlId", request.getControlId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("control", request.getControl())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Control.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ControlService/DeleteControl") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ControlService/UpdateControl") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "control.name", request.getControl().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("control", request.getControl())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Control.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ControlService/GetControl") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Control.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listControlsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ControlService/ListControls") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/catalogs/*}/controls", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListControlsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createControlCallable; + private final UnaryCallable deleteControlCallable; + private final UnaryCallable updateControlCallable; + private final UnaryCallable getControlCallable; + private final UnaryCallable listControlsCallable; + private final UnaryCallable + listControlsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonControlServiceStub create(ControlServiceStubSettings settings) + throws IOException { + return new HttpJsonControlServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonControlServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonControlServiceStub( + ControlServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonControlServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonControlServiceStub( + ControlServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonControlServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonControlServiceStub( + ControlServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonControlServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonControlServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonControlServiceStub( + ControlServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings createControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listControlsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listControlsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createControlCallable = + callableFactory.createUnaryCallable( + createControlTransportSettings, settings.createControlSettings(), clientContext); + this.deleteControlCallable = + callableFactory.createUnaryCallable( + deleteControlTransportSettings, settings.deleteControlSettings(), clientContext); + this.updateControlCallable = + callableFactory.createUnaryCallable( + updateControlTransportSettings, settings.updateControlSettings(), clientContext); + this.getControlCallable = + callableFactory.createUnaryCallable( + getControlTransportSettings, settings.getControlSettings(), clientContext); + this.listControlsCallable = + callableFactory.createUnaryCallable( + listControlsTransportSettings, settings.listControlsSettings(), clientContext); + this.listControlsPagedCallable = + callableFactory.createPagedCallable( + listControlsTransportSettings, settings.listControlsSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createControlMethodDescriptor); + methodDescriptors.add(deleteControlMethodDescriptor); + methodDescriptors.add(updateControlMethodDescriptor); + methodDescriptors.add(getControlMethodDescriptor); + methodDescriptors.add(listControlsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createControlCallable() { + return createControlCallable; + } + + @Override + public UnaryCallable deleteControlCallable() { + return deleteControlCallable; + } + + @Override + public UnaryCallable updateControlCallable() { + return updateControlCallable; + } + + @Override + public UnaryCallable getControlCallable() { + return getControlCallable; + } + + @Override + public UnaryCallable listControlsCallable() { + return listControlsCallable; + } + + @Override + public UnaryCallable listControlsPagedCallable() { + return listControlsPagedCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceCallableFactory.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceCallableFactory.java new file mode 100644 index 000000000000..b40bfd4a8fba --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the ServingConfigService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonServingConfigServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceStub.java new file mode 100644 index 000000000000..9c741946eae1 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/HttpJsonServingConfigServiceStub.java @@ -0,0 +1,539 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ListServingConfigsResponse; +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the ServingConfigService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonServingConfigServiceStub extends ServingConfigServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + createServingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/CreateServingConfig") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "servingConfigId", request.getServingConfigId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("servingConfig", request.getServingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ServingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteServingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/DeleteServingConfig") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateServingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/UpdateServingConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{servingConfig.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "servingConfig.name", request.getServingConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("servingConfig", request.getServingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ServingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getServingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/GetServingConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ServingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listServingConfigsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/ListServingConfigs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListServingConfigsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + addControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/AddControl") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{servingConfig=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "servingConfig", request.getServingConfig()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearServingConfig().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ServingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + removeControlMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.retail.v2.ServingConfigService/RemoveControl") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{servingConfig=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "servingConfig", request.getServingConfig()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearServingConfig().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ServingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + createServingConfigCallable; + private final UnaryCallable deleteServingConfigCallable; + private final UnaryCallable + updateServingConfigCallable; + private final UnaryCallable getServingConfigCallable; + private final UnaryCallable + listServingConfigsCallable; + private final UnaryCallable + listServingConfigsPagedCallable; + private final UnaryCallable addControlCallable; + private final UnaryCallable removeControlCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonServingConfigServiceStub create( + ServingConfigServiceStubSettings settings) throws IOException { + return new HttpJsonServingConfigServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonServingConfigServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonServingConfigServiceStub( + ServingConfigServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonServingConfigServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonServingConfigServiceStub( + ServingConfigServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonServingConfigServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonServingConfigServiceStub( + ServingConfigServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonServingConfigServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonServingConfigServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonServingConfigServiceStub( + ServingConfigServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + createServingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createServingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteServingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteServingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateServingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateServingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getServingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getServingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listServingConfigsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listServingConfigsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings addControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings removeControlTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removeControlMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createServingConfigCallable = + callableFactory.createUnaryCallable( + createServingConfigTransportSettings, + settings.createServingConfigSettings(), + clientContext); + this.deleteServingConfigCallable = + callableFactory.createUnaryCallable( + deleteServingConfigTransportSettings, + settings.deleteServingConfigSettings(), + clientContext); + this.updateServingConfigCallable = + callableFactory.createUnaryCallable( + updateServingConfigTransportSettings, + settings.updateServingConfigSettings(), + clientContext); + this.getServingConfigCallable = + callableFactory.createUnaryCallable( + getServingConfigTransportSettings, settings.getServingConfigSettings(), clientContext); + this.listServingConfigsCallable = + callableFactory.createUnaryCallable( + listServingConfigsTransportSettings, + settings.listServingConfigsSettings(), + clientContext); + this.listServingConfigsPagedCallable = + callableFactory.createPagedCallable( + listServingConfigsTransportSettings, + settings.listServingConfigsSettings(), + clientContext); + this.addControlCallable = + callableFactory.createUnaryCallable( + addControlTransportSettings, settings.addControlSettings(), clientContext); + this.removeControlCallable = + callableFactory.createUnaryCallable( + removeControlTransportSettings, settings.removeControlSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createServingConfigMethodDescriptor); + methodDescriptors.add(deleteServingConfigMethodDescriptor); + methodDescriptors.add(updateServingConfigMethodDescriptor); + methodDescriptors.add(getServingConfigMethodDescriptor); + methodDescriptors.add(listServingConfigsMethodDescriptor); + methodDescriptors.add(addControlMethodDescriptor); + methodDescriptors.add(removeControlMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createServingConfigCallable() { + return createServingConfigCallable; + } + + @Override + public UnaryCallable deleteServingConfigCallable() { + return deleteServingConfigCallable; + } + + @Override + public UnaryCallable updateServingConfigCallable() { + return updateServingConfigCallable; + } + + @Override + public UnaryCallable getServingConfigCallable() { + return getServingConfigCallable; + } + + @Override + public UnaryCallable + listServingConfigsCallable() { + return listServingConfigsCallable; + } + + @Override + public UnaryCallable + listServingConfigsPagedCallable() { + return listServingConfigsPagedCallable; + } + + @Override + public UnaryCallable addControlCallable() { + return addControlCallable; + } + + @Override + public UnaryCallable removeControlCallable() { + return removeControlCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStub.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStub.java new file mode 100644 index 000000000000..3db2ddbfea33 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStub.java @@ -0,0 +1,80 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ListServingConfigsResponse; +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ServingConfigService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ServingConfigServiceStub implements BackgroundResource { + + public UnaryCallable createServingConfigCallable() { + throw new UnsupportedOperationException("Not implemented: createServingConfigCallable()"); + } + + public UnaryCallable deleteServingConfigCallable() { + throw new UnsupportedOperationException("Not implemented: deleteServingConfigCallable()"); + } + + public UnaryCallable updateServingConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateServingConfigCallable()"); + } + + public UnaryCallable getServingConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getServingConfigCallable()"); + } + + public UnaryCallable + listServingConfigsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listServingConfigsPagedCallable()"); + } + + public UnaryCallable + listServingConfigsCallable() { + throw new UnsupportedOperationException("Not implemented: listServingConfigsCallable()"); + } + + public UnaryCallable addControlCallable() { + throw new UnsupportedOperationException("Not implemented: addControlCallable()"); + } + + public UnaryCallable removeControlCallable() { + throw new UnsupportedOperationException("Not implemented: removeControlCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStubSettings.java b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStubSettings.java new file mode 100644 index 000000000000..d05ff8018784 --- /dev/null +++ b/java-retail/google-cloud-retail/src/main/java/com/google/cloud/retail/v2/stub/ServingConfigServiceStubSettings.java @@ -0,0 +1,546 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ListServingConfigsResponse; +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ServingConfigServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (retail.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createServingConfig to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ServingConfigServiceStubSettings.Builder servingConfigServiceSettingsBuilder =
+ *     ServingConfigServiceStubSettings.newBuilder();
+ * servingConfigServiceSettingsBuilder
+ *     .createServingConfigSettings()
+ *     .setRetrySettings(
+ *         servingConfigServiceSettingsBuilder
+ *             .createServingConfigSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ServingConfigServiceStubSettings servingConfigServiceSettings =
+ *     servingConfigServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ServingConfigServiceStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings + createServingConfigSettings; + private final UnaryCallSettings deleteServingConfigSettings; + private final UnaryCallSettings + updateServingConfigSettings; + private final UnaryCallSettings getServingConfigSettings; + private final PagedCallSettings< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings; + private final UnaryCallSettings addControlSettings; + private final UnaryCallSettings removeControlSettings; + + private static final PagedListDescriptor< + ListServingConfigsRequest, ListServingConfigsResponse, ServingConfig> + LIST_SERVING_CONFIGS_PAGE_STR_DESC = + new PagedListDescriptor< + ListServingConfigsRequest, ListServingConfigsResponse, ServingConfig>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListServingConfigsRequest injectToken( + ListServingConfigsRequest payload, String token) { + return ListServingConfigsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListServingConfigsRequest injectPageSize( + ListServingConfigsRequest payload, int pageSize) { + return ListServingConfigsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListServingConfigsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListServingConfigsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListServingConfigsResponse payload) { + return payload.getServingConfigsList() == null + ? ImmutableList.of() + : payload.getServingConfigsList(); + } + }; + + private static final PagedListResponseFactory< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + LIST_SERVING_CONFIGS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListServingConfigsRequest, + ListServingConfigsResponse, + ListServingConfigsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListServingConfigsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_SERVING_CONFIGS_PAGE_STR_DESC, request, context); + return ListServingConfigsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createServingConfig. */ + public UnaryCallSettings + createServingConfigSettings() { + return createServingConfigSettings; + } + + /** Returns the object with the settings used for calls to deleteServingConfig. */ + public UnaryCallSettings deleteServingConfigSettings() { + return deleteServingConfigSettings; + } + + /** Returns the object with the settings used for calls to updateServingConfig. */ + public UnaryCallSettings + updateServingConfigSettings() { + return updateServingConfigSettings; + } + + /** Returns the object with the settings used for calls to getServingConfig. */ + public UnaryCallSettings getServingConfigSettings() { + return getServingConfigSettings; + } + + /** Returns the object with the settings used for calls to listServingConfigs. */ + public PagedCallSettings< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings() { + return listServingConfigsSettings; + } + + /** Returns the object with the settings used for calls to addControl. */ + public UnaryCallSettings addControlSettings() { + return addControlSettings; + } + + /** Returns the object with the settings used for calls to removeControl. */ + public UnaryCallSettings removeControlSettings() { + return removeControlSettings; + } + + public ServingConfigServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcServingConfigServiceStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonServingConfigServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "retail.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "retail.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ServingConfigServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ServingConfigServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ServingConfigServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ServingConfigServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createServingConfigSettings = settingsBuilder.createServingConfigSettings().build(); + deleteServingConfigSettings = settingsBuilder.deleteServingConfigSettings().build(); + updateServingConfigSettings = settingsBuilder.updateServingConfigSettings().build(); + getServingConfigSettings = settingsBuilder.getServingConfigSettings().build(); + listServingConfigsSettings = settingsBuilder.listServingConfigsSettings().build(); + addControlSettings = settingsBuilder.addControlSettings().build(); + removeControlSettings = settingsBuilder.removeControlSettings().build(); + } + + /** Builder for ServingConfigServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + createServingConfigSettings; + private final UnaryCallSettings.Builder + deleteServingConfigSettings; + private final UnaryCallSettings.Builder + updateServingConfigSettings; + private final UnaryCallSettings.Builder + getServingConfigSettings; + private final PagedCallSettings.Builder< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings; + private final UnaryCallSettings.Builder addControlSettings; + private final UnaryCallSettings.Builder + removeControlSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createServingConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteServingConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateServingConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getServingConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listServingConfigsSettings = PagedCallSettings.newBuilder(LIST_SERVING_CONFIGS_PAGE_STR_FACT); + addControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + removeControlSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createServingConfigSettings, + deleteServingConfigSettings, + updateServingConfigSettings, + getServingConfigSettings, + listServingConfigsSettings, + addControlSettings, + removeControlSettings); + initDefaults(this); + } + + protected Builder(ServingConfigServiceStubSettings settings) { + super(settings); + + createServingConfigSettings = settings.createServingConfigSettings.toBuilder(); + deleteServingConfigSettings = settings.deleteServingConfigSettings.toBuilder(); + updateServingConfigSettings = settings.updateServingConfigSettings.toBuilder(); + getServingConfigSettings = settings.getServingConfigSettings.toBuilder(); + listServingConfigsSettings = settings.listServingConfigsSettings.toBuilder(); + addControlSettings = settings.addControlSettings.toBuilder(); + removeControlSettings = settings.removeControlSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createServingConfigSettings, + deleteServingConfigSettings, + updateServingConfigSettings, + getServingConfigSettings, + listServingConfigsSettings, + addControlSettings, + removeControlSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createServingConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteServingConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateServingConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getServingConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listServingConfigsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .addControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .removeControlSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createServingConfig. */ + public UnaryCallSettings.Builder + createServingConfigSettings() { + return createServingConfigSettings; + } + + /** Returns the builder for the settings used for calls to deleteServingConfig. */ + public UnaryCallSettings.Builder + deleteServingConfigSettings() { + return deleteServingConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateServingConfig. */ + public UnaryCallSettings.Builder + updateServingConfigSettings() { + return updateServingConfigSettings; + } + + /** Returns the builder for the settings used for calls to getServingConfig. */ + public UnaryCallSettings.Builder + getServingConfigSettings() { + return getServingConfigSettings; + } + + /** Returns the builder for the settings used for calls to listServingConfigs. */ + public PagedCallSettings.Builder< + ListServingConfigsRequest, ListServingConfigsResponse, ListServingConfigsPagedResponse> + listServingConfigsSettings() { + return listServingConfigsSettings; + } + + /** Returns the builder for the settings used for calls to addControl. */ + public UnaryCallSettings.Builder addControlSettings() { + return addControlSettings; + } + + /** Returns the builder for the settings used for calls to removeControl. */ + public UnaryCallSettings.Builder removeControlSettings() { + return removeControlSettings; + } + + @Override + public ServingConfigServiceStubSettings build() throws IOException { + return new ServingConfigServiceStubSettings(this); + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientHttpJsonTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientHttpJsonTest.java index 2dfe6eba3c6c..ca088a2ce3e6 100644 --- a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientHttpJsonTest.java +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientHttpJsonTest.java @@ -34,6 +34,7 @@ import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -407,4 +408,518 @@ public void getDefaultBranchExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void getCompletionConfigTest() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockService.addResponse(expectedResponse); + + CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + CompletionConfig actualResponse = client.getCompletionConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCompletionConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.getCompletionConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCompletionConfigTest2() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6627/locations/location-6627/catalogs/catalog-6627/completionConfig"; + + CompletionConfig actualResponse = client.getCompletionConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCompletionConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6627/locations/location-6627/catalogs/catalog-6627/completionConfig"; + client.getCompletionConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCompletionConfigTest() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockService.addResponse(expectedResponse); + + CompletionConfig completionConfig = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CompletionConfig actualResponse = client.updateCompletionConfig(completionConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCompletionConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CompletionConfig completionConfig = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCompletionConfig(completionConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttributesConfigTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + AttributesConfig actualResponse = client.getAttributesConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttributesConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.getAttributesConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttributesConfigTest2() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9790/locations/location-9790/catalogs/catalog-9790/attributesConfig"; + + AttributesConfig actualResponse = client.getAttributesConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttributesConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9790/locations/location-9790/catalogs/catalog-9790/attributesConfig"; + client.getAttributesConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateAttributesConfigTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + AttributesConfig attributesConfig = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AttributesConfig actualResponse = client.updateAttributesConfig(attributesConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAttributesConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttributesConfig attributesConfig = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAttributesConfig(attributesConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + + AttributesConfig actualResponse = client.addCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void addCatalogAttributeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + client.addCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + + AttributesConfig actualResponse = client.removeCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void removeCatalogAttributeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + client.removeCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void replaceCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + AttributesConfig actualResponse = client.replaceCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void replaceCatalogAttributeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.replaceCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java index d8410283de7c..341b660178e9 100644 --- a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/CatalogServiceClientTest.java @@ -33,6 +33,7 @@ import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -359,4 +360,434 @@ public void getDefaultBranchExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void getCompletionConfigTest() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockCatalogService.addResponse(expectedResponse); + + CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + CompletionConfig actualResponse = client.getCompletionConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCompletionConfigRequest actualRequest = ((GetCompletionConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getCompletionConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.getCompletionConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCompletionConfigTest2() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockCatalogService.addResponse(expectedResponse); + + String name = "name3373707"; + + CompletionConfig actualResponse = client.getCompletionConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCompletionConfigRequest actualRequest = ((GetCompletionConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getCompletionConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + String name = "name3373707"; + client.getCompletionConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCompletionConfigTest() throws Exception { + CompletionConfig expectedResponse = + CompletionConfig.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setMatchingOrder("matchingOrder-1366761135") + .setMaxSuggestions(618824852) + .setMinPrefixLength(96853510) + .setAutoLearning(true) + .setSuggestionsInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastSuggestionsImportOperation("lastSuggestionsImportOperation-245829751") + .setDenylistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastDenylistImportOperation("lastDenylistImportOperation1262341570") + .setAllowlistInputConfig(CompletionDataInputConfig.newBuilder().build()) + .setLastAllowlistImportOperation("lastAllowlistImportOperation1624716689") + .build(); + mockCatalogService.addResponse(expectedResponse); + + CompletionConfig completionConfig = CompletionConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CompletionConfig actualResponse = client.updateCompletionConfig(completionConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCompletionConfigRequest actualRequest = + ((UpdateCompletionConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(completionConfig, actualRequest.getCompletionConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateCompletionConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + CompletionConfig completionConfig = CompletionConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCompletionConfig(completionConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttributesConfigTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + AttributesConfig actualResponse = client.getAttributesConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAttributesConfigRequest actualRequest = ((GetAttributesConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getAttributesConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.getAttributesConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttributesConfigTest2() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + String name = "name3373707"; + + AttributesConfig actualResponse = client.getAttributesConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAttributesConfigRequest actualRequest = ((GetAttributesConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getAttributesConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + String name = "name3373707"; + client.getAttributesConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateAttributesConfigTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + AttributesConfig attributesConfig = AttributesConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AttributesConfig actualResponse = client.updateAttributesConfig(attributesConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateAttributesConfigRequest actualRequest = + ((UpdateAttributesConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(attributesConfig, actualRequest.getAttributesConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateAttributesConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + AttributesConfig attributesConfig = AttributesConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAttributesConfig(attributesConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + + AttributesConfig actualResponse = client.addCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AddCatalogAttributeRequest actualRequest = ((AddCatalogAttributeRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getAttributesConfig(), actualRequest.getAttributesConfig()); + Assert.assertEquals(request.getCatalogAttribute(), actualRequest.getCatalogAttribute()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void addCatalogAttributeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + client.addCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + + AttributesConfig actualResponse = client.removeCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RemoveCatalogAttributeRequest actualRequest = + ((RemoveCatalogAttributeRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getAttributesConfig(), actualRequest.getAttributesConfig()); + Assert.assertEquals(request.getKey(), actualRequest.getKey()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void removeCatalogAttributeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + client.removeCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void replaceCatalogAttributeTest() throws Exception { + AttributesConfig expectedResponse = + AttributesConfig.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .putAllCatalogAttributes(new HashMap()) + .setAttributeConfigLevel(AttributeConfigLevel.forNumber(0)) + .build(); + mockCatalogService.addResponse(expectedResponse); + + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + AttributesConfig actualResponse = client.replaceCatalogAttribute(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCatalogService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ReplaceCatalogAttributeRequest actualRequest = + ((ReplaceCatalogAttributeRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getAttributesConfig(), actualRequest.getAttributesConfig()); + Assert.assertEquals(request.getCatalogAttribute(), actualRequest.getCatalogAttribute()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void replaceCatalogAttributeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCatalogService.addException(exception); + + try { + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.replaceCatalogAttribute(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientHttpJsonTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientHttpJsonTest.java new file mode 100644 index 000000000000..e7fb2ae47349 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientHttpJsonTest.java @@ -0,0 +1,529 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.retail.v2.stub.HttpJsonControlServiceStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ControlServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static ControlServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonControlServiceStub.getMethodDescriptors(), + ControlServiceSettings.getDefaultEndpoint()); + ControlServiceSettings settings = + ControlServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + ControlServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ControlServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + + Control actualResponse = client.createControl(parent, control, controlId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + client.createControl(parent, control, controlId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createControlTest2() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + + Control actualResponse = client.createControl(parent, control, controlId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createControlExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + client.createControl(parent, control, controlId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteControlTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + + client.deleteControl(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + client.deleteControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteControlTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-7366/locations/location-7366/catalogs/catalog-7366/controls/control-7366"; + + client.deleteControl(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteControlExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-7366/locations/location-7366/catalogs/catalog-7366/controls/control-7366"; + client.deleteControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Control control = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Control actualResponse = client.updateControl(control, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Control control = + Control.newBuilder() + .setName( + ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateControl(control, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + + Control actualResponse = client.getControl(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + client.getControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getControlTest2() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-7366/locations/location-7366/catalogs/catalog-7366/controls/control-7366"; + + Control actualResponse = client.getControl(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getControlExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-7366/locations/location-7366/catalogs/catalog-7366/controls/control-7366"; + client.getControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listControlsTest() throws Exception { + Control responsesElement = Control.newBuilder().build(); + ListControlsResponse expectedResponse = + ListControlsResponse.newBuilder() + .setNextPageToken("") + .addAllControls(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + ListControlsPagedResponse pagedListResponse = client.listControls(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getControlsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listControlsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.listControls(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listControlsTest2() throws Exception { + Control responsesElement = Control.newBuilder().build(); + ListControlsResponse expectedResponse = + ListControlsResponse.newBuilder() + .setNextPageToken("") + .addAllControls(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + + ListControlsPagedResponse pagedListResponse = client.listControls(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getControlsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listControlsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + client.listControls(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientTest.java new file mode 100644 index 000000000000..93c584466dcb --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ControlServiceClientTest.java @@ -0,0 +1,464 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ControlServiceClient.ListControlsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ControlServiceClientTest { + private static MockControlService mockControlService; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private ControlServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockControlService = new MockControlService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockControlService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ControlServiceSettings settings = + ControlServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ControlServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockControlService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + + Control actualResponse = client.createControl(parent, control, controlId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateControlRequest actualRequest = ((CreateControlRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(control, actualRequest.getControl()); + Assert.assertEquals(controlId, actualRequest.getControlId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + client.createControl(parent, control, controlId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createControlTest2() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockControlService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + + Control actualResponse = client.createControl(parent, control, controlId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateControlRequest actualRequest = ((CreateControlRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(control, actualRequest.getControl()); + Assert.assertEquals(controlId, actualRequest.getControlId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createControlExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + String parent = "parent-995424086"; + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + client.createControl(parent, control, controlId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteControlTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockControlService.addResponse(expectedResponse); + + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + + client.deleteControl(name); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteControlRequest actualRequest = ((DeleteControlRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + client.deleteControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteControlTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockControlService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteControl(name); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteControlRequest actualRequest = ((DeleteControlRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteControlExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + String name = "name3373707"; + client.deleteControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockControlService.addResponse(expectedResponse); + + Control control = Control.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Control actualResponse = client.updateControl(control, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateControlRequest actualRequest = ((UpdateControlRequest) actualRequests.get(0)); + + Assert.assertEquals(control, actualRequest.getControl()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + Control control = Control.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateControl(control, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getControlTest() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockControlService.addResponse(expectedResponse); + + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + + Control actualResponse = client.getControl(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetControlRequest actualRequest = ((GetControlRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + client.getControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getControlTest2() throws Exception { + Control expectedResponse = + Control.newBuilder() + .setName(ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .setDisplayName("displayName1714148973") + .addAllAssociatedServingConfigIds(new ArrayList()) + .addAllSolutionTypes(new ArrayList()) + .addAllSearchSolutionUseCase(new ArrayList()) + .build(); + mockControlService.addResponse(expectedResponse); + + String name = "name3373707"; + + Control actualResponse = client.getControl(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetControlRequest actualRequest = ((GetControlRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getControlExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + String name = "name3373707"; + client.getControl(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listControlsTest() throws Exception { + Control responsesElement = Control.newBuilder().build(); + ListControlsResponse expectedResponse = + ListControlsResponse.newBuilder() + .setNextPageToken("") + .addAllControls(Arrays.asList(responsesElement)) + .build(); + mockControlService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + ListControlsPagedResponse pagedListResponse = client.listControls(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getControlsList().get(0), resources.get(0)); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListControlsRequest actualRequest = ((ListControlsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listControlsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.listControls(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listControlsTest2() throws Exception { + Control responsesElement = Control.newBuilder().build(); + ListControlsResponse expectedResponse = + ListControlsResponse.newBuilder() + .setNextPageToken("") + .addAllControls(Arrays.asList(responsesElement)) + .build(); + mockControlService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListControlsPagedResponse pagedListResponse = client.listControls(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getControlsList().get(0), resources.get(0)); + + List actualRequests = mockControlService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListControlsRequest actualRequest = ((ListControlsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listControlsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockControlService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listControls(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java index 12fcf6b3279d..af2ba9809f8d 100644 --- a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockCatalogServiceImpl.java @@ -142,4 +142,151 @@ public void getDefaultBranch( Exception.class.getName()))); } } + + @Override + public void getCompletionConfig( + GetCompletionConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof CompletionConfig) { + requests.add(request); + responseObserver.onNext(((CompletionConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetCompletionConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + CompletionConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateCompletionConfig( + UpdateCompletionConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof CompletionConfig) { + requests.add(request); + responseObserver.onNext(((CompletionConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateCompletionConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + CompletionConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getAttributesConfig( + GetAttributesConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AttributesConfig) { + requests.add(request); + responseObserver.onNext(((AttributesConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetAttributesConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AttributesConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateAttributesConfig( + UpdateAttributesConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AttributesConfig) { + requests.add(request); + responseObserver.onNext(((AttributesConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateAttributesConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AttributesConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void addCatalogAttribute( + AddCatalogAttributeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AttributesConfig) { + requests.add(request); + responseObserver.onNext(((AttributesConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AddCatalogAttribute, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AttributesConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void removeCatalogAttribute( + RemoveCatalogAttributeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AttributesConfig) { + requests.add(request); + responseObserver.onNext(((AttributesConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method RemoveCatalogAttribute, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AttributesConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void replaceCatalogAttribute( + ReplaceCatalogAttributeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AttributesConfig) { + requests.add(request); + responseObserver.onNext(((AttributesConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ReplaceCatalogAttribute, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AttributesConfig.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlService.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlService.java new file mode 100644 index 000000000000..93acdc9a0b21 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockControlService implements MockGrpcService { + private final MockControlServiceImpl serviceImpl; + + public MockControlService() { + serviceImpl = new MockControlServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlServiceImpl.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlServiceImpl.java new file mode 100644 index 000000000000..4e2edcc9c0ab --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockControlServiceImpl.java @@ -0,0 +1,164 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.ControlServiceGrpc.ControlServiceImplBase; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockControlServiceImpl extends ControlServiceImplBase { + private List requests; + private Queue responses; + + public MockControlServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createControl( + CreateControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Control) { + requests.add(request); + responseObserver.onNext(((Control) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Control.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteControl(DeleteControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateControl( + UpdateControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Control) { + requests.add(request); + responseObserver.onNext(((Control) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Control.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getControl(GetControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Control) { + requests.add(request); + responseObserver.onNext(((Control) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Control.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listControls( + ListControlsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListControlsResponse) { + requests.add(request); + responseObserver.onNext(((ListControlsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListControls, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListControlsResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigService.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigService.java new file mode 100644 index 000000000000..24c6f84229a1 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockServingConfigService implements MockGrpcService { + private final MockServingConfigServiceImpl serviceImpl; + + public MockServingConfigService() { + serviceImpl = new MockServingConfigServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigServiceImpl.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigServiceImpl.java new file mode 100644 index 000000000000..fd98685adac9 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/MockServingConfigServiceImpl.java @@ -0,0 +1,209 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.retail.v2.ServingConfigServiceGrpc.ServingConfigServiceImplBase; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockServingConfigServiceImpl extends ServingConfigServiceImplBase { + private List requests; + private Queue responses; + + public MockServingConfigServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createServingConfig( + CreateServingConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ServingConfig) { + requests.add(request); + responseObserver.onNext(((ServingConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateServingConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ServingConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteServingConfig( + DeleteServingConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteServingConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateServingConfig( + UpdateServingConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ServingConfig) { + requests.add(request); + responseObserver.onNext(((ServingConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateServingConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ServingConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getServingConfig( + GetServingConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ServingConfig) { + requests.add(request); + responseObserver.onNext(((ServingConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetServingConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ServingConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listServingConfigs( + ListServingConfigsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListServingConfigsResponse) { + requests.add(request); + responseObserver.onNext(((ListServingConfigsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListServingConfigs, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListServingConfigsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void addControl( + AddControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ServingConfig) { + requests.add(request); + responseObserver.onNext(((ServingConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AddControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ServingConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void removeControl( + RemoveControlRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ServingConfig) { + requests.add(request); + responseObserver.onNext(((ServingConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method RemoveControl, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ServingConfig.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientHttpJsonTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientHttpJsonTest.java index d6d5296ce0f5..c09ccc6243cd 100644 --- a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientHttpJsonTest.java +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientHttpJsonTest.java @@ -120,6 +120,7 @@ public void createProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockService.addResponse(expectedResponse); @@ -198,6 +199,7 @@ public void createProductTest2() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockService.addResponse(expectedResponse); @@ -278,6 +280,7 @@ public void getProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockService.addResponse(expectedResponse); @@ -354,6 +357,7 @@ public void getProductTest2() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockService.addResponse(expectedResponse); @@ -532,6 +536,7 @@ public void updateProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockService.addResponse(expectedResponse); @@ -568,6 +573,7 @@ public void updateProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); @@ -630,6 +636,7 @@ public void updateProductExceptionTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); client.updateProduct(product, updateMask); @@ -834,6 +841,7 @@ public void setInventoryTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); FieldMask setMask = FieldMask.newBuilder().build(); @@ -896,6 +904,7 @@ public void setInventoryExceptionTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); FieldMask setMask = FieldMask.newBuilder().build(); client.setInventoryAsync(inventory, setMask).get(); diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java index 73b79a94d948..2ab5645fcd1a 100644 --- a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ProductServiceClientTest.java @@ -124,6 +124,7 @@ public void createProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockProductService.addResponse(expectedResponse); @@ -198,6 +199,7 @@ public void createProductTest2() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockProductService.addResponse(expectedResponse); @@ -272,6 +274,7 @@ public void getProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockProductService.addResponse(expectedResponse); @@ -342,6 +345,7 @@ public void getProductTest2() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockProductService.addResponse(expectedResponse); @@ -498,6 +502,7 @@ public void updateProductTest() throws Exception { .setPublishTime(Timestamp.newBuilder().build()) .setRetrievableFields(FieldMask.newBuilder().build()) .addAllVariants(new ArrayList()) + .addAllLocalInventories(new ArrayList()) .build(); mockProductService.addResponse(expectedResponse); diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientHttpJsonTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientHttpJsonTest.java new file mode 100644 index 000000000000..a71d33ddaaa1 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientHttpJsonTest.java @@ -0,0 +1,899 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.retail.v2.stub.HttpJsonServingConfigServiceStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ServingConfigServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static ServingConfigServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonServingConfigServiceStub.getMethodDescriptors(), + ServingConfigServiceSettings.getDefaultEndpoint()); + ServingConfigServiceSettings settings = + ServingConfigServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + ServingConfigServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ServingConfigServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + + ServingConfig actualResponse = + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createServingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createServingConfigTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + + ServingConfig actualResponse = + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createServingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteServingConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + client.deleteServingConfig(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteServingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.deleteServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteServingConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-4507/locations/location-4507/catalogs/catalog-4507/servingConfigs/servingConfig-4507"; + + client.deleteServingConfig(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteServingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-4507/locations/location-4507/catalogs/catalog-4507/servingConfigs/servingConfig-4507"; + client.deleteServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + ServingConfig servingConfig = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ServingConfig actualResponse = client.updateServingConfig(servingConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateServingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ServingConfig servingConfig = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateServingConfig(servingConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.getServingConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getServingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.getServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getServingConfigTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-4507/locations/location-4507/catalogs/catalog-4507/servingConfigs/servingConfig-4507"; + + ServingConfig actualResponse = client.getServingConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getServingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-4507/locations/location-4507/catalogs/catalog-4507/servingConfigs/servingConfig-4507"; + client.getServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listServingConfigsTest() throws Exception { + ServingConfig responsesElement = ServingConfig.newBuilder().build(); + ListServingConfigsResponse expectedResponse = + ListServingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllServingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + ListServingConfigsPagedResponse pagedListResponse = client.listServingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServingConfigsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listServingConfigsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.listServingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listServingConfigsTest2() throws Exception { + ServingConfig responsesElement = ServingConfig.newBuilder().build(); + ListServingConfigsResponse expectedResponse = + ListServingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllServingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + + ListServingConfigsPagedResponse pagedListResponse = client.listServingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServingConfigsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listServingConfigsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6267/locations/location-6267/catalogs/catalog-6267"; + client.listServingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addControlTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.addControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void addControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.addControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addControlTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String servingConfig = + "projects/project-1064/locations/location-1064/catalogs/catalog-1064/servingConfigs/servingConfig-1064"; + + ServingConfig actualResponse = client.addControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void addControlExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String servingConfig = + "projects/project-1064/locations/location-1064/catalogs/catalog-1064/servingConfigs/servingConfig-1064"; + client.addControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeControlTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.removeControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void removeControlExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.removeControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeControlTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String servingConfig = + "projects/project-1064/locations/location-1064/catalogs/catalog-1064/servingConfigs/servingConfig-1064"; + + ServingConfig actualResponse = client.removeControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void removeControlExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String servingConfig = + "projects/project-1064/locations/location-1064/catalogs/catalog-1064/servingConfigs/servingConfig-1064"; + client.removeControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientTest.java b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientTest.java new file mode 100644 index 000000000000..7df391ebdfe4 --- /dev/null +++ b/java-retail/google-cloud-retail/src/test/java/com/google/cloud/retail/v2/ServingConfigServiceClientTest.java @@ -0,0 +1,777 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import static com.google.cloud.retail.v2.ServingConfigServiceClient.ListServingConfigsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ServingConfigServiceClientTest { + private static MockServiceHelper mockServiceHelper; + private static MockServingConfigService mockServingConfigService; + private LocalChannelProvider channelProvider; + private ServingConfigServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockServingConfigService = new MockServingConfigService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockServingConfigService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ServingConfigServiceSettings settings = + ServingConfigServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ServingConfigServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + + ServingConfig actualResponse = + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateServingConfigRequest actualRequest = ((CreateServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(servingConfig, actualRequest.getServingConfig()); + Assert.assertEquals(servingConfigId, actualRequest.getServingConfigId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createServingConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createServingConfigTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + + ServingConfig actualResponse = + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateServingConfigRequest actualRequest = ((CreateServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(servingConfig, actualRequest.getServingConfig()); + Assert.assertEquals(servingConfigId, actualRequest.getServingConfigId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createServingConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String parent = "parent-995424086"; + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + client.createServingConfig(parent, servingConfig, servingConfigId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteServingConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockServingConfigService.addResponse(expectedResponse); + + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + client.deleteServingConfig(name); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteServingConfigRequest actualRequest = ((DeleteServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteServingConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.deleteServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteServingConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockServingConfigService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteServingConfig(name); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteServingConfigRequest actualRequest = ((DeleteServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteServingConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String name = "name3373707"; + client.deleteServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ServingConfig actualResponse = client.updateServingConfig(servingConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateServingConfigRequest actualRequest = ((UpdateServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(servingConfig, actualRequest.getServingConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateServingConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateServingConfig(servingConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getServingConfigTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.getServingConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetServingConfigRequest actualRequest = ((GetServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getServingConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.getServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getServingConfigTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + String name = "name3373707"; + + ServingConfig actualResponse = client.getServingConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetServingConfigRequest actualRequest = ((GetServingConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getServingConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String name = "name3373707"; + client.getServingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listServingConfigsTest() throws Exception { + ServingConfig responsesElement = ServingConfig.newBuilder().build(); + ListServingConfigsResponse expectedResponse = + ListServingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllServingConfigs(Arrays.asList(responsesElement)) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + + ListServingConfigsPagedResponse pagedListResponse = client.listServingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServingConfigsList().get(0), resources.get(0)); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListServingConfigsRequest actualRequest = ((ListServingConfigsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listServingConfigsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + client.listServingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listServingConfigsTest2() throws Exception { + ServingConfig responsesElement = ServingConfig.newBuilder().build(); + ListServingConfigsResponse expectedResponse = + ListServingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllServingConfigs(Arrays.asList(responsesElement)) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListServingConfigsPagedResponse pagedListResponse = client.listServingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServingConfigsList().get(0), resources.get(0)); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListServingConfigsRequest actualRequest = ((ListServingConfigsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listServingConfigsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listServingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addControlTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.addControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AddControlRequest actualRequest = ((AddControlRequest) actualRequests.get(0)); + + Assert.assertEquals(servingConfig.toString(), actualRequest.getServingConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void addControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.addControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void addControlTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + String servingConfig = "servingConfig1237122670"; + + ServingConfig actualResponse = client.addControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AddControlRequest actualRequest = ((AddControlRequest) actualRequests.get(0)); + + Assert.assertEquals(servingConfig, actualRequest.getServingConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void addControlExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String servingConfig = "servingConfig1237122670"; + client.addControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeControlTest() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + + ServingConfig actualResponse = client.removeControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RemoveControlRequest actualRequest = ((RemoveControlRequest) actualRequests.get(0)); + + Assert.assertEquals(servingConfig.toString(), actualRequest.getServingConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void removeControlExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + client.removeControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void removeControlTest2() throws Exception { + ServingConfig expectedResponse = + ServingConfig.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setDisplayName("displayName1714148973") + .setModelId("modelId1226956324") + .setPriceRerankingLevel("priceRerankingLevel-1925548982") + .addAllFacetControlIds(new ArrayList()) + .setDynamicFacetSpec(SearchRequest.DynamicFacetSpec.newBuilder().build()) + .addAllBoostControlIds(new ArrayList()) + .addAllFilterControlIds(new ArrayList()) + .addAllRedirectControlIds(new ArrayList()) + .addAllTwowaySynonymsControlIds(new ArrayList()) + .addAllOnewaySynonymsControlIds(new ArrayList()) + .addAllDoNotAssociateControlIds(new ArrayList()) + .addAllReplacementControlIds(new ArrayList()) + .addAllIgnoreControlIds(new ArrayList()) + .setDiversityLevel("diversityLevel578206123") + .setEnableCategoryFilterLevel("enableCategoryFilterLevel-1232535413") + .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build()) + .addAllSolutionTypes(new ArrayList()) + .build(); + mockServingConfigService.addResponse(expectedResponse); + + String servingConfig = "servingConfig1237122670"; + + ServingConfig actualResponse = client.removeControl(servingConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServingConfigService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RemoveControlRequest actualRequest = ((RemoveControlRequest) actualRequests.get(0)); + + Assert.assertEquals(servingConfig, actualRequest.getServingConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void removeControlExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServingConfigService.addException(exception); + + try { + String servingConfig = "servingConfig1237122670"; + client.removeControl(servingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java index 872460edf400..83ed2efd57a6 100644 --- a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java +++ b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogServiceGrpc.java @@ -212,6 +212,346 @@ private CatalogServiceGrpc() {} return getGetDefaultBranchMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getGetCompletionConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetCompletionConfig", + requestType = com.google.cloud.retail.v2.GetCompletionConfigRequest.class, + responseType = com.google.cloud.retail.v2.CompletionConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getGetCompletionConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getGetCompletionConfigMethod; + if ((getGetCompletionConfigMethod = CatalogServiceGrpc.getGetCompletionConfigMethod) == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getGetCompletionConfigMethod = CatalogServiceGrpc.getGetCompletionConfigMethod) + == null) { + CatalogServiceGrpc.getGetCompletionConfigMethod = + getGetCompletionConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "GetCompletionConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.GetCompletionConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("GetCompletionConfig")) + .build(); + } + } + } + return getGetCompletionConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getUpdateCompletionConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateCompletionConfig", + requestType = com.google.cloud.retail.v2.UpdateCompletionConfigRequest.class, + responseType = com.google.cloud.retail.v2.CompletionConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getUpdateCompletionConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig> + getUpdateCompletionConfigMethod; + if ((getUpdateCompletionConfigMethod = CatalogServiceGrpc.getUpdateCompletionConfigMethod) + == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getUpdateCompletionConfigMethod = CatalogServiceGrpc.getUpdateCompletionConfigMethod) + == null) { + CatalogServiceGrpc.getUpdateCompletionConfigMethod = + getUpdateCompletionConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateCompletionConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("UpdateCompletionConfig")) + .build(); + } + } + } + return getUpdateCompletionConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getGetAttributesConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetAttributesConfig", + requestType = com.google.cloud.retail.v2.GetAttributesConfigRequest.class, + responseType = com.google.cloud.retail.v2.AttributesConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getGetAttributesConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getGetAttributesConfigMethod; + if ((getGetAttributesConfigMethod = CatalogServiceGrpc.getGetAttributesConfigMethod) == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getGetAttributesConfigMethod = CatalogServiceGrpc.getGetAttributesConfigMethod) + == null) { + CatalogServiceGrpc.getGetAttributesConfigMethod = + getGetAttributesConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "GetAttributesConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.GetAttributesConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("GetAttributesConfig")) + .build(); + } + } + } + return getGetAttributesConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getUpdateAttributesConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateAttributesConfig", + requestType = com.google.cloud.retail.v2.UpdateAttributesConfigRequest.class, + responseType = com.google.cloud.retail.v2.AttributesConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getUpdateAttributesConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig> + getUpdateAttributesConfigMethod; + if ((getUpdateAttributesConfigMethod = CatalogServiceGrpc.getUpdateAttributesConfigMethod) + == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getUpdateAttributesConfigMethod = CatalogServiceGrpc.getUpdateAttributesConfigMethod) + == null) { + CatalogServiceGrpc.getUpdateAttributesConfigMethod = + getUpdateAttributesConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateAttributesConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("UpdateAttributesConfig")) + .build(); + } + } + } + return getUpdateAttributesConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getAddCatalogAttributeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AddCatalogAttribute", + requestType = com.google.cloud.retail.v2.AddCatalogAttributeRequest.class, + responseType = com.google.cloud.retail.v2.AttributesConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getAddCatalogAttributeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getAddCatalogAttributeMethod; + if ((getAddCatalogAttributeMethod = CatalogServiceGrpc.getAddCatalogAttributeMethod) == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getAddCatalogAttributeMethod = CatalogServiceGrpc.getAddCatalogAttributeMethod) + == null) { + CatalogServiceGrpc.getAddCatalogAttributeMethod = + getAddCatalogAttributeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "AddCatalogAttribute")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AddCatalogAttributeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("AddCatalogAttribute")) + .build(); + } + } + } + return getAddCatalogAttributeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getRemoveCatalogAttributeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RemoveCatalogAttribute", + requestType = com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.class, + responseType = com.google.cloud.retail.v2.AttributesConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getRemoveCatalogAttributeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getRemoveCatalogAttributeMethod; + if ((getRemoveCatalogAttributeMethod = CatalogServiceGrpc.getRemoveCatalogAttributeMethod) + == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getRemoveCatalogAttributeMethod = CatalogServiceGrpc.getRemoveCatalogAttributeMethod) + == null) { + CatalogServiceGrpc.getRemoveCatalogAttributeMethod = + getRemoveCatalogAttributeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "RemoveCatalogAttribute")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("RemoveCatalogAttribute")) + .build(); + } + } + } + return getRemoveCatalogAttributeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getReplaceCatalogAttributeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ReplaceCatalogAttribute", + requestType = com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.class, + responseType = com.google.cloud.retail.v2.AttributesConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getReplaceCatalogAttributeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig> + getReplaceCatalogAttributeMethod; + if ((getReplaceCatalogAttributeMethod = CatalogServiceGrpc.getReplaceCatalogAttributeMethod) + == null) { + synchronized (CatalogServiceGrpc.class) { + if ((getReplaceCatalogAttributeMethod = CatalogServiceGrpc.getReplaceCatalogAttributeMethod) + == null) { + CatalogServiceGrpc.getReplaceCatalogAttributeMethod = + getReplaceCatalogAttributeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ReplaceCatalogAttribute")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance())) + .setSchemaDescriptor( + new CatalogServiceMethodDescriptorSupplier("ReplaceCatalogAttribute")) + .build(); + } + } + } + return getReplaceCatalogAttributeMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static CatalogServiceStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -350,6 +690,124 @@ public void getDefaultBranch( getGetDefaultBranchMethod(), responseObserver); } + /** + * + * + *
+     * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
+     * 
+ */ + public void getCompletionConfig( + com.google.cloud.retail.v2.GetCompletionConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetCompletionConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
+     * 
+ */ + public void updateCompletionConfig( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateCompletionConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * 
+ */ + public void getAttributesConfig( + com.google.cloud.retail.v2.GetAttributesConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetAttributesConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * The catalog attributes in the request will be updated in the catalog, or
+     * inserted if they do not exist. Existing catalog attributes not included in
+     * the request will remain unchanged. Attributes that are assigned to
+     * products, but do not exist at the catalog level, are always included in the
+     * response. The product attribute is assigned default values for missing
+     * catalog attribute fields, e.g., searchable and dynamic facetable options.
+     * 
+ */ + public void updateAttributesConfig( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateAttributesConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Adds the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add
+     * already exists, an ALREADY_EXISTS error is returned.
+     * 
+ */ + public void addCatalogAttribute( + com.google.cloud.retail.v2.AddCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getAddCatalogAttributeMethod(), responseObserver); + } + + /** + * + * + *
+     * Removes the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * remove does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public void removeCatalogAttribute( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getRemoveCatalogAttributeMethod(), responseObserver); + } + + /** + * + * + *
+     * Replaces the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the
+     * catalog attribute with the same
+     * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * replace does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public void replaceCatalogAttribute( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getReplaceCatalogAttributeMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) @@ -379,6 +837,55 @@ public final io.grpc.ServerServiceDefinition bindService() { com.google.cloud.retail.v2.GetDefaultBranchRequest, com.google.cloud.retail.v2.GetDefaultBranchResponse>( this, METHODID_GET_DEFAULT_BRANCH))) + .addMethod( + getGetCompletionConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.GetCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig>( + this, METHODID_GET_COMPLETION_CONFIG))) + .addMethod( + getUpdateCompletionConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateCompletionConfigRequest, + com.google.cloud.retail.v2.CompletionConfig>( + this, METHODID_UPDATE_COMPLETION_CONFIG))) + .addMethod( + getGetAttributesConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.GetAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig>( + this, METHODID_GET_ATTRIBUTES_CONFIG))) + .addMethod( + getUpdateAttributesConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateAttributesConfigRequest, + com.google.cloud.retail.v2.AttributesConfig>( + this, METHODID_UPDATE_ATTRIBUTES_CONFIG))) + .addMethod( + getAddCatalogAttributeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.AddCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig>( + this, METHODID_ADD_CATALOG_ATTRIBUTE))) + .addMethod( + getRemoveCatalogAttributeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig>( + this, METHODID_REMOVE_CATALOG_ATTRIBUTE))) + .addMethod( + getReplaceCatalogAttributeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest, + com.google.cloud.retail.v2.AttributesConfig>( + this, METHODID_REPLACE_CATALOG_ATTRIBUTE))) .build(); } } @@ -496,6 +1003,138 @@ public void getDefaultBranch( request, responseObserver); } + + /** + * + * + *
+     * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
+     * 
+ */ + public void getCompletionConfig( + com.google.cloud.retail.v2.GetCompletionConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetCompletionConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
+     * 
+ */ + public void updateCompletionConfig( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateCompletionConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * 
+ */ + public void getAttributesConfig( + com.google.cloud.retail.v2.GetAttributesConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetAttributesConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * The catalog attributes in the request will be updated in the catalog, or
+     * inserted if they do not exist. Existing catalog attributes not included in
+     * the request will remain unchanged. Attributes that are assigned to
+     * products, but do not exist at the catalog level, are always included in the
+     * response. The product attribute is assigned default values for missing
+     * catalog attribute fields, e.g., searchable and dynamic facetable options.
+     * 
+ */ + public void updateAttributesConfig( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateAttributesConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Adds the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add
+     * already exists, an ALREADY_EXISTS error is returned.
+     * 
+ */ + public void addCatalogAttribute( + com.google.cloud.retail.v2.AddCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAddCatalogAttributeMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Removes the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * remove does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public void removeCatalogAttribute( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRemoveCatalogAttributeMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Replaces the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the
+     * catalog attribute with the same
+     * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * replace does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public void replaceCatalogAttribute( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getReplaceCatalogAttributeMethod(), getCallOptions()), + request, + responseObserver); + } } /** @@ -598,6 +1237,117 @@ public com.google.cloud.retail.v2.GetDefaultBranchResponse getDefaultBranch( return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getGetDefaultBranchMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
+     * 
+ */ + public com.google.cloud.retail.v2.CompletionConfig getCompletionConfig( + com.google.cloud.retail.v2.GetCompletionConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetCompletionConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
+     * 
+ */ + public com.google.cloud.retail.v2.CompletionConfig updateCompletionConfig( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateCompletionConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * 
+ */ + public com.google.cloud.retail.v2.AttributesConfig getAttributesConfig( + com.google.cloud.retail.v2.GetAttributesConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetAttributesConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * The catalog attributes in the request will be updated in the catalog, or
+     * inserted if they do not exist. Existing catalog attributes not included in
+     * the request will remain unchanged. Attributes that are assigned to
+     * products, but do not exist at the catalog level, are always included in the
+     * response. The product attribute is assigned default values for missing
+     * catalog attribute fields, e.g., searchable and dynamic facetable options.
+     * 
+ */ + public com.google.cloud.retail.v2.AttributesConfig updateAttributesConfig( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateAttributesConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Adds the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add
+     * already exists, an ALREADY_EXISTS error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.AttributesConfig addCatalogAttribute( + com.google.cloud.retail.v2.AddCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAddCatalogAttributeMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Removes the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * remove does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.AttributesConfig removeCatalogAttribute( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRemoveCatalogAttributeMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Replaces the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the
+     * catalog attribute with the same
+     * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * replace does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.AttributesConfig replaceCatalogAttribute( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getReplaceCatalogAttributeMethod(), getCallOptions(), request); + } } /** @@ -702,12 +1452,137 @@ protected CatalogServiceFutureStub build( return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getGetDefaultBranchMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.CompletionConfig> + getCompletionConfig(com.google.cloud.retail.v2.GetCompletionConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetCompletionConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.CompletionConfig> + updateCompletionConfig(com.google.cloud.retail.v2.UpdateCompletionConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateCompletionConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.AttributesConfig> + getAttributesConfig(com.google.cloud.retail.v2.GetAttributesConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetAttributesConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * The catalog attributes in the request will be updated in the catalog, or
+     * inserted if they do not exist. Existing catalog attributes not included in
+     * the request will remain unchanged. Attributes that are assigned to
+     * products, but do not exist at the catalog level, are always included in the
+     * response. The product attribute is assigned default values for missing
+     * catalog attribute fields, e.g., searchable and dynamic facetable options.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.AttributesConfig> + updateAttributesConfig(com.google.cloud.retail.v2.UpdateAttributesConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateAttributesConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Adds the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add
+     * already exists, an ALREADY_EXISTS error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.AttributesConfig> + addCatalogAttribute(com.google.cloud.retail.v2.AddCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAddCatalogAttributeMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Removes the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * remove does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.AttributesConfig> + removeCatalogAttribute(com.google.cloud.retail.v2.RemoveCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRemoveCatalogAttributeMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Replaces the specified
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the
+     * catalog attribute with the same
+     * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
+     * If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
+     * replace does not exist, a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.AttributesConfig> + replaceCatalogAttribute(com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getReplaceCatalogAttributeMethod(), getCallOptions()), request); + } } private static final int METHODID_LIST_CATALOGS = 0; private static final int METHODID_UPDATE_CATALOG = 1; private static final int METHODID_SET_DEFAULT_BRANCH = 2; private static final int METHODID_GET_DEFAULT_BRANCH = 3; + private static final int METHODID_GET_COMPLETION_CONFIG = 4; + private static final int METHODID_UPDATE_COMPLETION_CONFIG = 5; + private static final int METHODID_GET_ATTRIBUTES_CONFIG = 6; + private static final int METHODID_UPDATE_ATTRIBUTES_CONFIG = 7; + private static final int METHODID_ADD_CATALOG_ATTRIBUTE = 8; + private static final int METHODID_REMOVE_CATALOG_ATTRIBUTE = 9; + private static final int METHODID_REPLACE_CATALOG_ATTRIBUTE = 10; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -748,6 +1623,48 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_COMPLETION_CONFIG: + serviceImpl.getCompletionConfig( + (com.google.cloud.retail.v2.GetCompletionConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_COMPLETION_CONFIG: + serviceImpl.updateCompletionConfig( + (com.google.cloud.retail.v2.UpdateCompletionConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_ATTRIBUTES_CONFIG: + serviceImpl.getAttributesConfig( + (com.google.cloud.retail.v2.GetAttributesConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_ATTRIBUTES_CONFIG: + serviceImpl.updateAttributesConfig( + (com.google.cloud.retail.v2.UpdateAttributesConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_ADD_CATALOG_ATTRIBUTE: + serviceImpl.addCatalogAttribute( + (com.google.cloud.retail.v2.AddCatalogAttributeRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_REMOVE_CATALOG_ATTRIBUTE: + serviceImpl.removeCatalogAttribute( + (com.google.cloud.retail.v2.RemoveCatalogAttributeRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_REPLACE_CATALOG_ATTRIBUTE: + serviceImpl.replaceCatalogAttribute( + (com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; default: throw new AssertionError(); } @@ -816,6 +1733,13 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getUpdateCatalogMethod()) .addMethod(getSetDefaultBranchMethod()) .addMethod(getGetDefaultBranchMethod()) + .addMethod(getGetCompletionConfigMethod()) + .addMethod(getUpdateCompletionConfigMethod()) + .addMethod(getGetAttributesConfigMethod()) + .addMethod(getUpdateAttributesConfigMethod()) + .addMethod(getAddCatalogAttributeMethod()) + .addMethod(getRemoveCatalogAttributeMethod()) + .addMethod(getReplaceCatalogAttributeMethod()) .build(); } } diff --git a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlServiceGrpc.java b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlServiceGrpc.java new file mode 100644 index 000000000000..a0fcb7e5ced2 --- /dev/null +++ b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlServiceGrpc.java @@ -0,0 +1,836 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Service for modifying Control.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/control_service.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ControlServiceGrpc { + + private ControlServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.ControlService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateControlRequest, com.google.cloud.retail.v2.Control> + getCreateControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateControl", + requestType = com.google.cloud.retail.v2.CreateControlRequest.class, + responseType = com.google.cloud.retail.v2.Control.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateControlRequest, com.google.cloud.retail.v2.Control> + getCreateControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateControlRequest, com.google.cloud.retail.v2.Control> + getCreateControlMethod; + if ((getCreateControlMethod = ControlServiceGrpc.getCreateControlMethod) == null) { + synchronized (ControlServiceGrpc.class) { + if ((getCreateControlMethod = ControlServiceGrpc.getCreateControlMethod) == null) { + ControlServiceGrpc.getCreateControlMethod = + getCreateControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CreateControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Control.getDefaultInstance())) + .setSchemaDescriptor( + new ControlServiceMethodDescriptorSupplier("CreateControl")) + .build(); + } + } + } + return getCreateControlMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteControlRequest, com.google.protobuf.Empty> + getDeleteControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteControl", + requestType = com.google.cloud.retail.v2.DeleteControlRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteControlRequest, com.google.protobuf.Empty> + getDeleteControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteControlRequest, com.google.protobuf.Empty> + getDeleteControlMethod; + if ((getDeleteControlMethod = ControlServiceGrpc.getDeleteControlMethod) == null) { + synchronized (ControlServiceGrpc.class) { + if ((getDeleteControlMethod = ControlServiceGrpc.getDeleteControlMethod) == null) { + ControlServiceGrpc.getDeleteControlMethod = + getDeleteControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.DeleteControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new ControlServiceMethodDescriptorSupplier("DeleteControl")) + .build(); + } + } + } + return getDeleteControlMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateControlRequest, com.google.cloud.retail.v2.Control> + getUpdateControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateControl", + requestType = com.google.cloud.retail.v2.UpdateControlRequest.class, + responseType = com.google.cloud.retail.v2.Control.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateControlRequest, com.google.cloud.retail.v2.Control> + getUpdateControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateControlRequest, com.google.cloud.retail.v2.Control> + getUpdateControlMethod; + if ((getUpdateControlMethod = ControlServiceGrpc.getUpdateControlMethod) == null) { + synchronized (ControlServiceGrpc.class) { + if ((getUpdateControlMethod = ControlServiceGrpc.getUpdateControlMethod) == null) { + ControlServiceGrpc.getUpdateControlMethod = + getUpdateControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Control.getDefaultInstance())) + .setSchemaDescriptor( + new ControlServiceMethodDescriptorSupplier("UpdateControl")) + .build(); + } + } + } + return getUpdateControlMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetControlRequest, com.google.cloud.retail.v2.Control> + getGetControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetControl", + requestType = com.google.cloud.retail.v2.GetControlRequest.class, + responseType = com.google.cloud.retail.v2.Control.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetControlRequest, com.google.cloud.retail.v2.Control> + getGetControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetControlRequest, com.google.cloud.retail.v2.Control> + getGetControlMethod; + if ((getGetControlMethod = ControlServiceGrpc.getGetControlMethod) == null) { + synchronized (ControlServiceGrpc.class) { + if ((getGetControlMethod = ControlServiceGrpc.getGetControlMethod) == null) { + ControlServiceGrpc.getGetControlMethod = + getGetControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.GetControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.Control.getDefaultInstance())) + .setSchemaDescriptor(new ControlServiceMethodDescriptorSupplier("GetControl")) + .build(); + } + } + } + return getGetControlMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListControlsRequest, + com.google.cloud.retail.v2.ListControlsResponse> + getListControlsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListControls", + requestType = com.google.cloud.retail.v2.ListControlsRequest.class, + responseType = com.google.cloud.retail.v2.ListControlsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListControlsRequest, + com.google.cloud.retail.v2.ListControlsResponse> + getListControlsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListControlsRequest, + com.google.cloud.retail.v2.ListControlsResponse> + getListControlsMethod; + if ((getListControlsMethod = ControlServiceGrpc.getListControlsMethod) == null) { + synchronized (ControlServiceGrpc.class) { + if ((getListControlsMethod = ControlServiceGrpc.getListControlsMethod) == null) { + ControlServiceGrpc.getListControlsMethod = + getListControlsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListControls")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListControlsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListControlsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new ControlServiceMethodDescriptorSupplier("ListControls")) + .build(); + } + } + } + return getListControlsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ControlServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ControlServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceStub(channel, callOptions); + } + }; + return ControlServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ControlServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ControlServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceBlockingStub(channel, callOptions); + } + }; + return ControlServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ControlServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ControlServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceFutureStub(channel, callOptions); + } + }; + return ControlServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for modifying Control.
+   * 
+ */ + public abstract static class ControlServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to create already exists,
+     * an ALREADY_EXISTS error is returned.
+     * 
+ */ + public void createControl( + com.google.cloud.retail.v2.CreateControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateControlMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ */ + public void deleteControl( + com.google.cloud.retail.v2.DeleteControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteControlMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a Control.
+     * [Control][google.cloud.retail.v2.Control] cannot be set to a different
+     * oneof field, if so an INVALID_ARGUMENT is returned. If the
+     * [Control][google.cloud.retail.v2.Control] to update does not exist, a
+     * NOT_FOUND error is returned.
+     * 
+ */ + public void updateControl( + com.google.cloud.retail.v2.UpdateControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateControlMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a Control.
+     * 
+ */ + public void getControl( + com.google.cloud.retail.v2.GetControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetControlMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists all Controls by their parent
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * 
+ */ + public void listControls( + com.google.cloud.retail.v2.ListControlsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListControlsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.CreateControlRequest, + com.google.cloud.retail.v2.Control>(this, METHODID_CREATE_CONTROL))) + .addMethod( + getDeleteControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.DeleteControlRequest, com.google.protobuf.Empty>( + this, METHODID_DELETE_CONTROL))) + .addMethod( + getUpdateControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateControlRequest, + com.google.cloud.retail.v2.Control>(this, METHODID_UPDATE_CONTROL))) + .addMethod( + getGetControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.GetControlRequest, + com.google.cloud.retail.v2.Control>(this, METHODID_GET_CONTROL))) + .addMethod( + getListControlsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ListControlsRequest, + com.google.cloud.retail.v2.ListControlsResponse>( + this, METHODID_LIST_CONTROLS))) + .build(); + } + } + + /** + * + * + *
+   * Service for modifying Control.
+   * 
+ */ + public static final class ControlServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private ControlServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ControlServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to create already exists,
+     * an ALREADY_EXISTS error is returned.
+     * 
+ */ + public void createControl( + com.google.cloud.retail.v2.CreateControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateControlMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ */ + public void deleteControl( + com.google.cloud.retail.v2.DeleteControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteControlMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a Control.
+     * [Control][google.cloud.retail.v2.Control] cannot be set to a different
+     * oneof field, if so an INVALID_ARGUMENT is returned. If the
+     * [Control][google.cloud.retail.v2.Control] to update does not exist, a
+     * NOT_FOUND error is returned.
+     * 
+ */ + public void updateControl( + com.google.cloud.retail.v2.UpdateControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateControlMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a Control.
+     * 
+ */ + public void getControl( + com.google.cloud.retail.v2.GetControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetControlMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Lists all Controls by their parent
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * 
+ */ + public void listControls( + com.google.cloud.retail.v2.ListControlsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListControlsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service for modifying Control.
+   * 
+ */ + public static final class ControlServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ControlServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ControlServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to create already exists,
+     * an ALREADY_EXISTS error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.Control createControl( + com.google.cloud.retail.v2.CreateControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateControlMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.protobuf.Empty deleteControl( + com.google.cloud.retail.v2.DeleteControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteControlMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a Control.
+     * [Control][google.cloud.retail.v2.Control] cannot be set to a different
+     * oneof field, if so an INVALID_ARGUMENT is returned. If the
+     * [Control][google.cloud.retail.v2.Control] to update does not exist, a
+     * NOT_FOUND error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.Control updateControl( + com.google.cloud.retail.v2.UpdateControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateControlMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a Control.
+     * 
+ */ + public com.google.cloud.retail.v2.Control getControl( + com.google.cloud.retail.v2.GetControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetControlMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists all Controls by their parent
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * 
+ */ + public com.google.cloud.retail.v2.ListControlsResponse listControls( + com.google.cloud.retail.v2.ListControlsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListControlsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for modifying Control.
+   * 
+ */ + public static final class ControlServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ControlServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ControlServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ControlServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to create already exists,
+     * an ALREADY_EXISTS error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createControl(com.google.cloud.retail.v2.CreateControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateControlMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a Control.
+     * If the [Control][google.cloud.retail.v2.Control] to delete does not exist,
+     * a NOT_FOUND error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteControl(com.google.cloud.retail.v2.DeleteControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteControlMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a Control.
+     * [Control][google.cloud.retail.v2.Control] cannot be set to a different
+     * oneof field, if so an INVALID_ARGUMENT is returned. If the
+     * [Control][google.cloud.retail.v2.Control] to update does not exist, a
+     * NOT_FOUND error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateControl(com.google.cloud.retail.v2.UpdateControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateControlMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a Control.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getControl(com.google.cloud.retail.v2.GetControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetControlMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists all Controls by their parent
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ListControlsResponse> + listControls(com.google.cloud.retail.v2.ListControlsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListControlsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_CONTROL = 0; + private static final int METHODID_DELETE_CONTROL = 1; + private static final int METHODID_UPDATE_CONTROL = 2; + private static final int METHODID_GET_CONTROL = 3; + private static final int METHODID_LIST_CONTROLS = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ControlServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ControlServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_CONTROL: + serviceImpl.createControl( + (com.google.cloud.retail.v2.CreateControlRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_CONTROL: + serviceImpl.deleteControl( + (com.google.cloud.retail.v2.DeleteControlRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_CONTROL: + serviceImpl.updateControl( + (com.google.cloud.retail.v2.UpdateControlRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CONTROL: + serviceImpl.getControl( + (com.google.cloud.retail.v2.GetControlRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_CONTROLS: + serviceImpl.listControls( + (com.google.cloud.retail.v2.ListControlsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ControlServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ControlServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ControlService"); + } + } + + private static final class ControlServiceFileDescriptorSupplier + extends ControlServiceBaseDescriptorSupplier { + ControlServiceFileDescriptorSupplier() {} + } + + private static final class ControlServiceMethodDescriptorSupplier + extends ControlServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ControlServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ControlServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ControlServiceFileDescriptorSupplier()) + .addMethod(getCreateControlMethod()) + .addMethod(getDeleteControlMethod()) + .addMethod(getUpdateControlMethod()) + .addMethod(getGetControlMethod()) + .addMethod(getListControlsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java index e922cc86d63b..e24fe482f535 100644 --- a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java +++ b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductServiceGrpc.java @@ -700,6 +700,11 @@ public void importProducts( * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -726,6 +731,11 @@ public void setInventory( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -752,6 +762,11 @@ public void addFulfillmentPlaces( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -784,6 +799,11 @@ public void removeFulfillmentPlaces( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -814,6 +834,11 @@ public void addLocalInventories( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1056,6 +1081,11 @@ public void importProducts( * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1084,6 +1114,11 @@ public void setInventory( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1112,6 +1147,11 @@ public void addFulfillmentPlaces( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1146,6 +1186,11 @@ public void removeFulfillmentPlaces( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1178,6 +1223,11 @@ public void addLocalInventories( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1333,6 +1383,11 @@ public com.google.longrunning.Operation importProducts( * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1358,6 +1413,11 @@ public com.google.longrunning.Operation setInventory( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1383,6 +1443,11 @@ public com.google.longrunning.Operation addFulfillmentPlaces( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1414,6 +1479,11 @@ public com.google.longrunning.Operation removeFulfillmentPlaces( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1443,6 +1513,11 @@ public com.google.longrunning.Operation addLocalInventories( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1596,6 +1671,11 @@ protected ProductServiceFutureStub build( * [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], * and * [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1621,6 +1701,11 @@ protected ProductServiceFutureStub build( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1646,6 +1731,11 @@ protected ProductServiceFutureStub build( * [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] * or * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1677,6 +1767,11 @@ protected ProductServiceFutureStub build( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1706,6 +1801,11 @@ protected ProductServiceFutureStub build( * and * [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] * has no effect on local inventories. + * The returned [Operation][]s will be obsolete after 1 day, and + * [GetOperation][] API will return NOT_FOUND afterwards. + * If conflicting updates are issued, the [Operation][]s associated with the + * stale updates will not be marked as [done][Operation.done] until being + * obsolete. * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * diff --git a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceGrpc.java b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceGrpc.java new file mode 100644 index 000000000000..46784b2a9e5d --- /dev/null +++ b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigServiceGrpc.java @@ -0,0 +1,1123 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.retail.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Service for modifying ServingConfig.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/retail/v2/serving_config_service.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ServingConfigServiceGrpc { + + private ServingConfigServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.retail.v2.ServingConfigService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getCreateServingConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateServingConfig", + requestType = com.google.cloud.retail.v2.CreateServingConfigRequest.class, + responseType = com.google.cloud.retail.v2.ServingConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getCreateServingConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.CreateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getCreateServingConfigMethod; + if ((getCreateServingConfigMethod = ServingConfigServiceGrpc.getCreateServingConfigMethod) + == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getCreateServingConfigMethod = ServingConfigServiceGrpc.getCreateServingConfigMethod) + == null) { + ServingConfigServiceGrpc.getCreateServingConfigMethod = + getCreateServingConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "CreateServingConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.CreateServingConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ServingConfig.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("CreateServingConfig")) + .build(); + } + } + } + return getCreateServingConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteServingConfigRequest, com.google.protobuf.Empty> + getDeleteServingConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteServingConfig", + requestType = com.google.cloud.retail.v2.DeleteServingConfigRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteServingConfigRequest, com.google.protobuf.Empty> + getDeleteServingConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.DeleteServingConfigRequest, com.google.protobuf.Empty> + getDeleteServingConfigMethod; + if ((getDeleteServingConfigMethod = ServingConfigServiceGrpc.getDeleteServingConfigMethod) + == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getDeleteServingConfigMethod = ServingConfigServiceGrpc.getDeleteServingConfigMethod) + == null) { + ServingConfigServiceGrpc.getDeleteServingConfigMethod = + getDeleteServingConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "DeleteServingConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.DeleteServingConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("DeleteServingConfig")) + .build(); + } + } + } + return getDeleteServingConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getUpdateServingConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateServingConfig", + requestType = com.google.cloud.retail.v2.UpdateServingConfigRequest.class, + responseType = com.google.cloud.retail.v2.ServingConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getUpdateServingConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.UpdateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getUpdateServingConfigMethod; + if ((getUpdateServingConfigMethod = ServingConfigServiceGrpc.getUpdateServingConfigMethod) + == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getUpdateServingConfigMethod = ServingConfigServiceGrpc.getUpdateServingConfigMethod) + == null) { + ServingConfigServiceGrpc.getUpdateServingConfigMethod = + getUpdateServingConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateServingConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.UpdateServingConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ServingConfig.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("UpdateServingConfig")) + .build(); + } + } + } + return getUpdateServingConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getGetServingConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetServingConfig", + requestType = com.google.cloud.retail.v2.GetServingConfigRequest.class, + responseType = com.google.cloud.retail.v2.ServingConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getGetServingConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.GetServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig> + getGetServingConfigMethod; + if ((getGetServingConfigMethod = ServingConfigServiceGrpc.getGetServingConfigMethod) == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getGetServingConfigMethod = ServingConfigServiceGrpc.getGetServingConfigMethod) + == null) { + ServingConfigServiceGrpc.getGetServingConfigMethod = + getGetServingConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetServingConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.GetServingConfigRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ServingConfig.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("GetServingConfig")) + .build(); + } + } + } + return getGetServingConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListServingConfigsRequest, + com.google.cloud.retail.v2.ListServingConfigsResponse> + getListServingConfigsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListServingConfigs", + requestType = com.google.cloud.retail.v2.ListServingConfigsRequest.class, + responseType = com.google.cloud.retail.v2.ListServingConfigsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListServingConfigsRequest, + com.google.cloud.retail.v2.ListServingConfigsResponse> + getListServingConfigsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.ListServingConfigsRequest, + com.google.cloud.retail.v2.ListServingConfigsResponse> + getListServingConfigsMethod; + if ((getListServingConfigsMethod = ServingConfigServiceGrpc.getListServingConfigsMethod) + == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getListServingConfigsMethod = ServingConfigServiceGrpc.getListServingConfigsMethod) + == null) { + ServingConfigServiceGrpc.getListServingConfigsMethod = + getListServingConfigsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListServingConfigs")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListServingConfigsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ListServingConfigsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("ListServingConfigs")) + .build(); + } + } + } + return getListServingConfigsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddControlRequest, com.google.cloud.retail.v2.ServingConfig> + getAddControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AddControl", + requestType = com.google.cloud.retail.v2.AddControlRequest.class, + responseType = com.google.cloud.retail.v2.ServingConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddControlRequest, com.google.cloud.retail.v2.ServingConfig> + getAddControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.AddControlRequest, com.google.cloud.retail.v2.ServingConfig> + getAddControlMethod; + if ((getAddControlMethod = ServingConfigServiceGrpc.getAddControlMethod) == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getAddControlMethod = ServingConfigServiceGrpc.getAddControlMethod) == null) { + ServingConfigServiceGrpc.getAddControlMethod = + getAddControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AddControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.AddControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ServingConfig.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("AddControl")) + .build(); + } + } + } + return getAddControlMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveControlRequest, com.google.cloud.retail.v2.ServingConfig> + getRemoveControlMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RemoveControl", + requestType = com.google.cloud.retail.v2.RemoveControlRequest.class, + responseType = com.google.cloud.retail.v2.ServingConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveControlRequest, com.google.cloud.retail.v2.ServingConfig> + getRemoveControlMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.retail.v2.RemoveControlRequest, + com.google.cloud.retail.v2.ServingConfig> + getRemoveControlMethod; + if ((getRemoveControlMethod = ServingConfigServiceGrpc.getRemoveControlMethod) == null) { + synchronized (ServingConfigServiceGrpc.class) { + if ((getRemoveControlMethod = ServingConfigServiceGrpc.getRemoveControlMethod) == null) { + ServingConfigServiceGrpc.getRemoveControlMethod = + getRemoveControlMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RemoveControl")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.RemoveControlRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.retail.v2.ServingConfig.getDefaultInstance())) + .setSchemaDescriptor( + new ServingConfigServiceMethodDescriptorSupplier("RemoveControl")) + .build(); + } + } + } + return getRemoveControlMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ServingConfigServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServingConfigServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceStub(channel, callOptions); + } + }; + return ServingConfigServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ServingConfigServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServingConfigServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceBlockingStub(channel, callOptions); + } + }; + return ServingConfigServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ServingConfigServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServingConfigServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceFutureStub(channel, callOptions); + } + }; + return ServingConfigServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service for modifying ServingConfig.
+   * 
+ */ + public abstract static class ServingConfigServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a ServingConfig.
+     * A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are
+     * allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a
+     * FAILED_PRECONDITION error is returned.
+     * 
+ */ + public void createServingConfig( + com.google.cloud.retail.v2.CreateServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateServingConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public void deleteServingConfig( + com.google.cloud.retail.v2.DeleteServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteServingConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a ServingConfig.
+     * 
+ */ + public void updateServingConfig( + com.google.cloud.retail.v2.UpdateServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateServingConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public void getServingConfig( + com.google.cloud.retail.v2.GetServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetServingConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists all ServingConfigs linked to this catalog.
+     * 
+ */ + public void listServingConfigs( + com.google.cloud.retail.v2.ListServingConfigsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListServingConfigsMethod(), responseObserver); + } + + /** + * + * + *
+     * Enables a Control on the specified ServingConfig.
+     * The control is added in the last position of the list of controls
+     * it belongs to (e.g. if it's a facet spec control it will be applied
+     * in the last position of servingConfig.facetSpecIds)
+     * Returns a ALREADY_EXISTS error if the control has already been applied.
+     * Returns a FAILED_PRECONDITION error if the addition could exceed maximum
+     * number of control allowed for that type of control.
+     * 
+ */ + public void addControl( + com.google.cloud.retail.v2.AddControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAddControlMethod(), responseObserver); + } + + /** + * + * + *
+     * Disables a Control on the specified ServingConfig.
+     * The control is removed from the ServingConfig.
+     * Returns a NOT_FOUND error if the Control is not enabled for the
+     * ServingConfig.
+     * 
+ */ + public void removeControl( + com.google.cloud.retail.v2.RemoveControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getRemoveControlMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateServingConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.CreateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig>( + this, METHODID_CREATE_SERVING_CONFIG))) + .addMethod( + getDeleteServingConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.DeleteServingConfigRequest, + com.google.protobuf.Empty>(this, METHODID_DELETE_SERVING_CONFIG))) + .addMethod( + getUpdateServingConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.UpdateServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig>( + this, METHODID_UPDATE_SERVING_CONFIG))) + .addMethod( + getGetServingConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.GetServingConfigRequest, + com.google.cloud.retail.v2.ServingConfig>(this, METHODID_GET_SERVING_CONFIG))) + .addMethod( + getListServingConfigsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.ListServingConfigsRequest, + com.google.cloud.retail.v2.ListServingConfigsResponse>( + this, METHODID_LIST_SERVING_CONFIGS))) + .addMethod( + getAddControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.AddControlRequest, + com.google.cloud.retail.v2.ServingConfig>(this, METHODID_ADD_CONTROL))) + .addMethod( + getRemoveControlMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.retail.v2.RemoveControlRequest, + com.google.cloud.retail.v2.ServingConfig>(this, METHODID_REMOVE_CONTROL))) + .build(); + } + } + + /** + * + * + *
+   * Service for modifying ServingConfig.
+   * 
+ */ + public static final class ServingConfigServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private ServingConfigServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServingConfigServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a ServingConfig.
+     * A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are
+     * allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a
+     * FAILED_PRECONDITION error is returned.
+     * 
+ */ + public void createServingConfig( + com.google.cloud.retail.v2.CreateServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateServingConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public void deleteServingConfig( + com.google.cloud.retail.v2.DeleteServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteServingConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a ServingConfig.
+     * 
+ */ + public void updateServingConfig( + com.google.cloud.retail.v2.UpdateServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateServingConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public void getServingConfig( + com.google.cloud.retail.v2.GetServingConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetServingConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists all ServingConfigs linked to this catalog.
+     * 
+ */ + public void listServingConfigs( + com.google.cloud.retail.v2.ListServingConfigsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListServingConfigsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Enables a Control on the specified ServingConfig.
+     * The control is added in the last position of the list of controls
+     * it belongs to (e.g. if it's a facet spec control it will be applied
+     * in the last position of servingConfig.facetSpecIds)
+     * Returns a ALREADY_EXISTS error if the control has already been applied.
+     * Returns a FAILED_PRECONDITION error if the addition could exceed maximum
+     * number of control allowed for that type of control.
+     * 
+ */ + public void addControl( + com.google.cloud.retail.v2.AddControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAddControlMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Disables a Control on the specified ServingConfig.
+     * The control is removed from the ServingConfig.
+     * Returns a NOT_FOUND error if the Control is not enabled for the
+     * ServingConfig.
+     * 
+ */ + public void removeControl( + com.google.cloud.retail.v2.RemoveControlRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRemoveControlMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service for modifying ServingConfig.
+   * 
+ */ + public static final class ServingConfigServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ServingConfigServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServingConfigServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a ServingConfig.
+     * A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are
+     * allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a
+     * FAILED_PRECONDITION error is returned.
+     * 
+ */ + public com.google.cloud.retail.v2.ServingConfig createServingConfig( + com.google.cloud.retail.v2.CreateServingConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateServingConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public com.google.protobuf.Empty deleteServingConfig( + com.google.cloud.retail.v2.DeleteServingConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteServingConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a ServingConfig.
+     * 
+ */ + public com.google.cloud.retail.v2.ServingConfig updateServingConfig( + com.google.cloud.retail.v2.UpdateServingConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateServingConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public com.google.cloud.retail.v2.ServingConfig getServingConfig( + com.google.cloud.retail.v2.GetServingConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetServingConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists all ServingConfigs linked to this catalog.
+     * 
+ */ + public com.google.cloud.retail.v2.ListServingConfigsResponse listServingConfigs( + com.google.cloud.retail.v2.ListServingConfigsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListServingConfigsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Enables a Control on the specified ServingConfig.
+     * The control is added in the last position of the list of controls
+     * it belongs to (e.g. if it's a facet spec control it will be applied
+     * in the last position of servingConfig.facetSpecIds)
+     * Returns a ALREADY_EXISTS error if the control has already been applied.
+     * Returns a FAILED_PRECONDITION error if the addition could exceed maximum
+     * number of control allowed for that type of control.
+     * 
+ */ + public com.google.cloud.retail.v2.ServingConfig addControl( + com.google.cloud.retail.v2.AddControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAddControlMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Disables a Control on the specified ServingConfig.
+     * The control is removed from the ServingConfig.
+     * Returns a NOT_FOUND error if the Control is not enabled for the
+     * ServingConfig.
+     * 
+ */ + public com.google.cloud.retail.v2.ServingConfig removeControl( + com.google.cloud.retail.v2.RemoveControlRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRemoveControlMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service for modifying ServingConfig.
+   * 
+ */ + public static final class ServingConfigServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ServingConfigServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServingConfigServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServingConfigServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a ServingConfig.
+     * A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are
+     * allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a
+     * FAILED_PRECONDITION error is returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ServingConfig> + createServingConfig(com.google.cloud.retail.v2.CreateServingConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateServingConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteServingConfig(com.google.cloud.retail.v2.DeleteServingConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteServingConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a ServingConfig.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ServingConfig> + updateServingConfig(com.google.cloud.retail.v2.UpdateServingConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateServingConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a ServingConfig.
+     * Returns a NotFound error if the ServingConfig does not exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ServingConfig> + getServingConfig(com.google.cloud.retail.v2.GetServingConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetServingConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists all ServingConfigs linked to this catalog.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ListServingConfigsResponse> + listServingConfigs(com.google.cloud.retail.v2.ListServingConfigsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListServingConfigsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Enables a Control on the specified ServingConfig.
+     * The control is added in the last position of the list of controls
+     * it belongs to (e.g. if it's a facet spec control it will be applied
+     * in the last position of servingConfig.facetSpecIds)
+     * Returns a ALREADY_EXISTS error if the control has already been applied.
+     * Returns a FAILED_PRECONDITION error if the addition could exceed maximum
+     * number of control allowed for that type of control.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ServingConfig> + addControl(com.google.cloud.retail.v2.AddControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAddControlMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Disables a Control on the specified ServingConfig.
+     * The control is removed from the ServingConfig.
+     * Returns a NOT_FOUND error if the Control is not enabled for the
+     * ServingConfig.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.retail.v2.ServingConfig> + removeControl(com.google.cloud.retail.v2.RemoveControlRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRemoveControlMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_SERVING_CONFIG = 0; + private static final int METHODID_DELETE_SERVING_CONFIG = 1; + private static final int METHODID_UPDATE_SERVING_CONFIG = 2; + private static final int METHODID_GET_SERVING_CONFIG = 3; + private static final int METHODID_LIST_SERVING_CONFIGS = 4; + private static final int METHODID_ADD_CONTROL = 5; + private static final int METHODID_REMOVE_CONTROL = 6; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ServingConfigServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ServingConfigServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_SERVING_CONFIG: + serviceImpl.createServingConfig( + (com.google.cloud.retail.v2.CreateServingConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_SERVING_CONFIG: + serviceImpl.deleteServingConfig( + (com.google.cloud.retail.v2.DeleteServingConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_SERVING_CONFIG: + serviceImpl.updateServingConfig( + (com.google.cloud.retail.v2.UpdateServingConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_SERVING_CONFIG: + serviceImpl.getServingConfig( + (com.google.cloud.retail.v2.GetServingConfigRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_SERVING_CONFIGS: + serviceImpl.listServingConfigs( + (com.google.cloud.retail.v2.ListServingConfigsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_ADD_CONTROL: + serviceImpl.addControl( + (com.google.cloud.retail.v2.AddControlRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_REMOVE_CONTROL: + serviceImpl.removeControl( + (com.google.cloud.retail.v2.RemoveControlRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ServingConfigServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ServingConfigServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ServingConfigService"); + } + } + + private static final class ServingConfigServiceFileDescriptorSupplier + extends ServingConfigServiceBaseDescriptorSupplier { + ServingConfigServiceFileDescriptorSupplier() {} + } + + private static final class ServingConfigServiceMethodDescriptorSupplier + extends ServingConfigServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ServingConfigServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ServingConfigServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ServingConfigServiceFileDescriptorSupplier()) + .addMethod(getCreateServingConfigMethod()) + .addMethod(getDeleteServingConfigMethod()) + .addMethod(getUpdateServingConfigMethod()) + .addMethod(getGetServingConfigMethod()) + .addMethod(getListServingConfigsMethod()) + .addMethod(getAddControlMethod()) + .addMethod(getRemoveControlMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java index ea163958844d..ffff48c5b1ba 100644 --- a/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java +++ b/java-retail/grpc-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UserEventServiceGrpc.java @@ -354,9 +354,9 @@ public void purgeUserEvents( * Bulk import of User events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. - * Operation.response is of type ImportResponse. Note that it is + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * */ public void importUserEvents( @@ -503,9 +503,9 @@ public void purgeUserEvents( * Bulk import of User events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. - * Operation.response is of type ImportResponse. Note that it is + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * */ public void importUserEvents( @@ -612,9 +612,9 @@ public com.google.longrunning.Operation purgeUserEvents( * Bulk import of User events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. - * Operation.response is of type ImportResponse. Note that it is + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * */ public com.google.longrunning.Operation importUserEvents( @@ -715,9 +715,9 @@ protected UserEventServiceFutureStub build( * Bulk import of User events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. - * Operation.response is of type ImportResponse. Note that it is + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * */ public com.google.common.util.concurrent.ListenableFuture diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequest.java new file mode 100644 index 000000000000..8ed2a86c7608 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequest.java @@ -0,0 +1,978 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AddCatalogAttributeRequest} + */ +public final class AddCatalogAttributeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.AddCatalogAttributeRequest) + AddCatalogAttributeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use AddCatalogAttributeRequest.newBuilder() to construct. + private AddCatalogAttributeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AddCatalogAttributeRequest() { + attributesConfig_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AddCatalogAttributeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AddCatalogAttributeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + attributesConfig_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.CatalogAttribute.Builder subBuilder = null; + if (catalogAttribute_ != null) { + subBuilder = catalogAttribute_.toBuilder(); + } + catalogAttribute_ = + input.readMessage( + com.google.cloud.retail.v2.CatalogAttribute.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(catalogAttribute_); + catalogAttribute_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_AddCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_AddCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AddCatalogAttributeRequest.class, + com.google.cloud.retail.v2.AddCatalogAttributeRequest.Builder.class); + } + + public static final int ATTRIBUTES_CONFIG_FIELD_NUMBER = 1; + private volatile java.lang.Object attributesConfig_; + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + @java.lang.Override + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATALOG_ATTRIBUTE_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.CatalogAttribute catalogAttribute_; + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + @java.lang.Override + public boolean hasCatalogAttribute() { + return catalogAttribute_ != null; + } + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute() { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder() { + return getCatalogAttribute(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attributesConfig_); + } + if (catalogAttribute_ != null) { + output.writeMessage(2, getCatalogAttribute()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, attributesConfig_); + } + if (catalogAttribute_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCatalogAttribute()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.AddCatalogAttributeRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.AddCatalogAttributeRequest other = + (com.google.cloud.retail.v2.AddCatalogAttributeRequest) obj; + + if (!getAttributesConfig().equals(other.getAttributesConfig())) return false; + if (hasCatalogAttribute() != other.hasCatalogAttribute()) return false; + if (hasCatalogAttribute()) { + if (!getCatalogAttribute().equals(other.getCatalogAttribute())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ATTRIBUTES_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAttributesConfig().hashCode(); + if (hasCatalogAttribute()) { + hash = (37 * hash) + CATALOG_ATTRIBUTE_FIELD_NUMBER; + hash = (53 * hash) + getCatalogAttribute().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.AddCatalogAttributeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AddCatalogAttributeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.AddCatalogAttributeRequest) + com.google.cloud.retail.v2.AddCatalogAttributeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_AddCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_AddCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AddCatalogAttributeRequest.class, + com.google.cloud.retail.v2.AddCatalogAttributeRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.AddCatalogAttributeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + attributesConfig_ = ""; + + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = null; + } else { + catalogAttribute_ = null; + catalogAttributeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_AddCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddCatalogAttributeRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.AddCatalogAttributeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddCatalogAttributeRequest build() { + com.google.cloud.retail.v2.AddCatalogAttributeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddCatalogAttributeRequest buildPartial() { + com.google.cloud.retail.v2.AddCatalogAttributeRequest result = + new com.google.cloud.retail.v2.AddCatalogAttributeRequest(this); + result.attributesConfig_ = attributesConfig_; + if (catalogAttributeBuilder_ == null) { + result.catalogAttribute_ = catalogAttribute_; + } else { + result.catalogAttribute_ = catalogAttributeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.AddCatalogAttributeRequest) { + return mergeFrom((com.google.cloud.retail.v2.AddCatalogAttributeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.AddCatalogAttributeRequest other) { + if (other == com.google.cloud.retail.v2.AddCatalogAttributeRequest.getDefaultInstance()) + return this; + if (!other.getAttributesConfig().isEmpty()) { + attributesConfig_ = other.attributesConfig_; + onChanged(); + } + if (other.hasCatalogAttribute()) { + mergeCatalogAttribute(other.getCatalogAttribute()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.AddCatalogAttributeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.AddCatalogAttributeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object attributesConfig_ = ""; + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attributesConfig_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearAttributesConfig() { + + attributesConfig_ = getDefaultInstance().getAttributesConfig(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attributesConfig_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.CatalogAttribute catalogAttribute_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder> + catalogAttributeBuilder_; + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + public boolean hasCatalogAttribute() { + return catalogAttributeBuilder_ != null || catalogAttribute_ != null; + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute() { + if (catalogAttributeBuilder_ == null) { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } else { + return catalogAttributeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalogAttribute(com.google.cloud.retail.v2.CatalogAttribute value) { + if (catalogAttributeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + catalogAttribute_ = value; + onChanged(); + } else { + catalogAttributeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalogAttribute( + com.google.cloud.retail.v2.CatalogAttribute.Builder builderForValue) { + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = builderForValue.build(); + onChanged(); + } else { + catalogAttributeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCatalogAttribute(com.google.cloud.retail.v2.CatalogAttribute value) { + if (catalogAttributeBuilder_ == null) { + if (catalogAttribute_ != null) { + catalogAttribute_ = + com.google.cloud.retail.v2.CatalogAttribute.newBuilder(catalogAttribute_) + .mergeFrom(value) + .buildPartial(); + } else { + catalogAttribute_ = value; + } + onChanged(); + } else { + catalogAttributeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCatalogAttribute() { + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = null; + onChanged(); + } else { + catalogAttribute_ = null; + catalogAttributeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CatalogAttribute.Builder getCatalogAttributeBuilder() { + + onChanged(); + return getCatalogAttributeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder() { + if (catalogAttributeBuilder_ != null) { + return catalogAttributeBuilder_.getMessageOrBuilder(); + } else { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } + } + /** + * + * + *
+     * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+     * to add.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder> + getCatalogAttributeFieldBuilder() { + if (catalogAttributeBuilder_ == null) { + catalogAttributeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder>( + getCatalogAttribute(), getParentForChildren(), isClean()); + catalogAttribute_ = null; + } + return catalogAttributeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.AddCatalogAttributeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.AddCatalogAttributeRequest) + private static final com.google.cloud.retail.v2.AddCatalogAttributeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.AddCatalogAttributeRequest(); + } + + public static com.google.cloud.retail.v2.AddCatalogAttributeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AddCatalogAttributeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AddCatalogAttributeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddCatalogAttributeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequestOrBuilder.java new file mode 100644 index 000000000000..3e9bb365306b --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddCatalogAttributeRequestOrBuilder.java @@ -0,0 +1,100 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface AddCatalogAttributeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.AddCatalogAttributeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + java.lang.String getAttributesConfig(); + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + com.google.protobuf.ByteString getAttributesConfigBytes(); + + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + boolean hasCatalogAttribute(); + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute(); + /** + * + * + *
+   * Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
+   * to add.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequest.java new file mode 100644 index 000000000000..01dbf7a3401b --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequest.java @@ -0,0 +1,843 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for AddControl method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AddControlRequest} + */ +public final class AddControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.AddControlRequest) + AddControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use AddControlRequest.newBuilder() to construct. + private AddControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AddControlRequest() { + servingConfig_ = ""; + controlId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AddControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AddControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + servingConfig_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + controlId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_AddControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_AddControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AddControlRequest.class, + com.google.cloud.retail.v2.AddControlRequest.Builder.class); + } + + public static final int SERVING_CONFIG_FIELD_NUMBER = 1; + private volatile java.lang.Object servingConfig_; + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + @java.lang.Override + public java.lang.String getServingConfig() { + java.lang.Object ref = servingConfig_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfig_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServingConfigBytes() { + java.lang.Object ref = servingConfig_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTROL_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object controlId_; + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config - if id is not found a NOT_FOUND error is returned.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + @java.lang.Override + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config - if id is not found a NOT_FOUND error is returned.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfig_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, servingConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, controlId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfig_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, servingConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, controlId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.AddControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.AddControlRequest other = + (com.google.cloud.retail.v2.AddControlRequest) obj; + + if (!getServingConfig().equals(other.getServingConfig())) return false; + if (!getControlId().equals(other.getControlId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getServingConfig().hashCode(); + hash = (37 * hash) + CONTROL_ID_FIELD_NUMBER; + hash = (53 * hash) + getControlId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AddControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.AddControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for AddControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AddControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.AddControlRequest) + com.google.cloud.retail.v2.AddControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_AddControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_AddControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AddControlRequest.class, + com.google.cloud.retail.v2.AddControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.AddControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + servingConfig_ = ""; + + controlId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_AddControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.AddControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddControlRequest build() { + com.google.cloud.retail.v2.AddControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddControlRequest buildPartial() { + com.google.cloud.retail.v2.AddControlRequest result = + new com.google.cloud.retail.v2.AddControlRequest(this); + result.servingConfig_ = servingConfig_; + result.controlId_ = controlId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.AddControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.AddControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.AddControlRequest other) { + if (other == com.google.cloud.retail.v2.AddControlRequest.getDefaultInstance()) return this; + if (!other.getServingConfig().isEmpty()) { + servingConfig_ = other.servingConfig_; + onChanged(); + } + if (!other.getControlId().isEmpty()) { + controlId_ = other.controlId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.AddControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.AddControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object servingConfig_ = ""; + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + public java.lang.String getServingConfig() { + java.lang.Object ref = servingConfig_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfig_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + public com.google.protobuf.ByteString getServingConfigBytes() { + java.lang.Object ref = servingConfig_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The servingConfig to set. + * @return This builder for chaining. + */ + public Builder setServingConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + servingConfig_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearServingConfig() { + + servingConfig_ = getDefaultInstance().getServingConfig(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for servingConfig to set. + * @return This builder for chaining. + */ + public Builder setServingConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + servingConfig_ = value; + onChanged(); + return this; + } + + private java.lang.Object controlId_ = ""; + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config - if id is not found a NOT_FOUND error is returned.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config - if id is not found a NOT_FOUND error is returned.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config - if id is not found a NOT_FOUND error is returned.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The controlId to set. + * @return This builder for chaining. + */ + public Builder setControlId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + controlId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config - if id is not found a NOT_FOUND error is returned.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearControlId() { + + controlId_ = getDefaultInstance().getControlId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config - if id is not found a NOT_FOUND error is returned.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for controlId to set. + * @return This builder for chaining. + */ + public Builder setControlIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + controlId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.AddControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.AddControlRequest) + private static final com.google.cloud.retail.v2.AddControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.AddControlRequest(); + } + + public static com.google.cloud.retail.v2.AddControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AddControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AddControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AddControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequestOrBuilder.java new file mode 100644 index 000000000000..29049e29a0d1 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AddControlRequestOrBuilder.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface AddControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.AddControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + java.lang.String getServingConfig(); + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + com.google.protobuf.ByteString getServingConfigBytes(); + + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config - if id is not found a NOT_FOUND error is returned.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + java.lang.String getControlId(); + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config - if id is not found a NOT_FOUND error is returned.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + com.google.protobuf.ByteString getControlIdBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributeConfigLevel.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributeConfigLevel.java new file mode 100644 index 000000000000..7df5bc86bcb7 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributeConfigLevel.java @@ -0,0 +1,185 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * At which level we offer configuration for attributes.
+ * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.AttributeConfigLevel} + */ +public enum AttributeConfigLevel implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Value used when unset. In this case, server behavior defaults to
+   * [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
+   * 
+ * + * ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + */ + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED(0), + /** + * + * + *
+   * At this level, we honor the attribute configurations set in
+   * [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + */ + PRODUCT_LEVEL_ATTRIBUTE_CONFIG(1), + /** + * + * + *
+   * At this level, we honor the attribute configurations set in
+   * [CatalogConfig.attribute_configs][].
+   * 
+ * + * CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; + */ + CATALOG_LEVEL_ATTRIBUTE_CONFIG(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Value used when unset. In this case, server behavior defaults to
+   * [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
+   * 
+ * + * ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + */ + public static final int ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * At this level, we honor the attribute configurations set in
+   * [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + */ + public static final int PRODUCT_LEVEL_ATTRIBUTE_CONFIG_VALUE = 1; + /** + * + * + *
+   * At this level, we honor the attribute configurations set in
+   * [CatalogConfig.attribute_configs][].
+   * 
+ * + * CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; + */ + public static final int CATALOG_LEVEL_ATTRIBUTE_CONFIG_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AttributeConfigLevel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AttributeConfigLevel forNumber(int value) { + switch (value) { + case 0: + return ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED; + case 1: + return PRODUCT_LEVEL_ATTRIBUTE_CONFIG; + case 2: + return CATALOG_LEVEL_ATTRIBUTE_CONFIG; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public AttributeConfigLevel findValueByNumber(int number) { + return AttributeConfigLevel.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto.getDescriptor().getEnumTypes().get(0); + } + + private static final AttributeConfigLevel[] VALUES = values(); + + public static AttributeConfigLevel valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private AttributeConfigLevel(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.AttributeConfigLevel) +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfig.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfig.java new file mode 100644 index 000000000000..f8d4320c9341 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfig.java @@ -0,0 +1,1281 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Catalog level attribute config.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AttributesConfig} + */ +public final class AttributesConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.AttributesConfig) + AttributesConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use AttributesConfig.newBuilder() to construct. + private AttributesConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AttributesConfig() { + name_ = ""; + attributeConfigLevel_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AttributesConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AttributesConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + catalogAttributes_ = + com.google.protobuf.MapField.newMapField( + CatalogAttributesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + catalogAttributes__ = + input.readMessage( + CatalogAttributesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + catalogAttributes_ + .getMutableMap() + .put(catalogAttributes__.getKey(), catalogAttributes__.getValue()); + break; + } + case 24: + { + int rawValue = input.readEnum(); + + attributeConfigLevel_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetCatalogAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AttributesConfig.class, + com.google.cloud.retail.v2.AttributesConfig.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the attribute
+   * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the attribute
+   * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATALOG_ATTRIBUTES_FIELD_NUMBER = 2; + + private static final class CatalogAttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_CatalogAttributesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance()); + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + catalogAttributes_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + internalGetCatalogAttributes() { + if (catalogAttributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + CatalogAttributesDefaultEntryHolder.defaultEntry); + } + return catalogAttributes_; + } + + public int getCatalogAttributesCount() { + return internalGetCatalogAttributes().getMap().size(); + } + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public boolean containsCatalogAttributes(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetCatalogAttributes().getMap().containsKey(key); + } + /** Use {@link #getCatalogAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getCatalogAttributes() { + return getCatalogAttributesMap(); + } + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public java.util.Map + getCatalogAttributesMap() { + return internalGetCatalogAttributes().getMap(); + } + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CatalogAttribute defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetCatalogAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrThrow( + java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetCatalogAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ATTRIBUTE_CONFIG_LEVEL_FIELD_NUMBER = 3; + private int attributeConfigLevel_; + /** + * + * + *
+   * Output only. The
+   * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+   * for this catalog.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for attributeConfigLevel. + */ + @java.lang.Override + public int getAttributeConfigLevelValue() { + return attributeConfigLevel_; + } + /** + * + * + *
+   * Output only. The
+   * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+   * for this catalog.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The attributeConfigLevel. + */ + @java.lang.Override + public com.google.cloud.retail.v2.AttributeConfigLevel getAttributeConfigLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.AttributeConfigLevel result = + com.google.cloud.retail.v2.AttributeConfigLevel.valueOf(attributeConfigLevel_); + return result == null ? com.google.cloud.retail.v2.AttributeConfigLevel.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, + internalGetCatalogAttributes(), + CatalogAttributesDefaultEntryHolder.defaultEntry, + 2); + if (attributeConfigLevel_ + != com.google.cloud.retail.v2.AttributeConfigLevel.ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, attributeConfigLevel_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + for (java.util.Map.Entry entry : + internalGetCatalogAttributes().getMap().entrySet()) { + com.google.protobuf.MapEntry + catalogAttributes__ = + CatalogAttributesDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, catalogAttributes__); + } + if (attributeConfigLevel_ + != com.google.cloud.retail.v2.AttributeConfigLevel.ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, attributeConfigLevel_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.AttributesConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.AttributesConfig other = + (com.google.cloud.retail.v2.AttributesConfig) obj; + + if (!getName().equals(other.getName())) return false; + if (!internalGetCatalogAttributes().equals(other.internalGetCatalogAttributes())) return false; + if (attributeConfigLevel_ != other.attributeConfigLevel_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (!internalGetCatalogAttributes().getMap().isEmpty()) { + hash = (37 * hash) + CATALOG_ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + internalGetCatalogAttributes().hashCode(); + } + hash = (37 * hash) + ATTRIBUTE_CONFIG_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + attributeConfigLevel_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.AttributesConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.AttributesConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Catalog level attribute config.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.AttributesConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.AttributesConfig) + com.google.cloud.retail.v2.AttributesConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetCatalogAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 2: + return internalGetMutableCatalogAttributes(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.AttributesConfig.class, + com.google.cloud.retail.v2.AttributesConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.AttributesConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + internalGetMutableCatalogAttributes().clear(); + attributeConfigLevel_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_AttributesConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfig build() { + com.google.cloud.retail.v2.AttributesConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfig buildPartial() { + com.google.cloud.retail.v2.AttributesConfig result = + new com.google.cloud.retail.v2.AttributesConfig(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.catalogAttributes_ = internalGetCatalogAttributes(); + result.catalogAttributes_.makeImmutable(); + result.attributeConfigLevel_ = attributeConfigLevel_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.AttributesConfig) { + return mergeFrom((com.google.cloud.retail.v2.AttributesConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.AttributesConfig other) { + if (other == com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + internalGetMutableCatalogAttributes().mergeFrom(other.internalGetCatalogAttributes()); + if (other.attributeConfigLevel_ != 0) { + setAttributeConfigLevelValue(other.getAttributeConfigLevelValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.AttributesConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.AttributesConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the attribute
+     * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the attribute
+     * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the attribute
+     * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the attribute
+     * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The fully qualified resource name of the attribute
+     * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + catalogAttributes_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + internalGetCatalogAttributes() { + if (catalogAttributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + CatalogAttributesDefaultEntryHolder.defaultEntry); + } + return catalogAttributes_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.retail.v2.CatalogAttribute> + internalGetMutableCatalogAttributes() { + onChanged(); + ; + if (catalogAttributes_ == null) { + catalogAttributes_ = + com.google.protobuf.MapField.newMapField( + CatalogAttributesDefaultEntryHolder.defaultEntry); + } + if (!catalogAttributes_.isMutable()) { + catalogAttributes_ = catalogAttributes_.copy(); + } + return catalogAttributes_; + } + + public int getCatalogAttributesCount() { + return internalGetCatalogAttributes().getMap().size(); + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public boolean containsCatalogAttributes(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetCatalogAttributes().getMap().containsKey(key); + } + /** Use {@link #getCatalogAttributesMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getCatalogAttributes() { + return getCatalogAttributesMap(); + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public java.util.Map + getCatalogAttributesMap() { + return internalGetCatalogAttributes().getMap(); + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrDefault( + java.lang.String key, com.google.cloud.retail.v2.CatalogAttribute defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetCatalogAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrThrow( + java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetCatalogAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearCatalogAttributes() { + internalGetMutableCatalogAttributes().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + public Builder removeCatalogAttributes(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableCatalogAttributes().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableCatalogAttributes() { + return internalGetMutableCatalogAttributes().getMutableMap(); + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + public Builder putCatalogAttributes( + java.lang.String key, com.google.cloud.retail.v2.CatalogAttribute value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableCatalogAttributes().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Enable attribute(s) config at catalog level.
+     * For example, indexable, dynamic_facetable, or searchable for each
+     * attribute.
+     * The key is catalog attribute's name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * The maximum number of catalog attributes allowed in a request is 1000.
+     * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + public Builder putAllCatalogAttributes( + java.util.Map values) { + internalGetMutableCatalogAttributes().getMutableMap().putAll(values); + return this; + } + + private int attributeConfigLevel_ = 0; + /** + * + * + *
+     * Output only. The
+     * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+     * for this catalog.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for attributeConfigLevel. + */ + @java.lang.Override + public int getAttributeConfigLevelValue() { + return attributeConfigLevel_; + } + /** + * + * + *
+     * Output only. The
+     * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+     * for this catalog.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for attributeConfigLevel to set. + * @return This builder for chaining. + */ + public Builder setAttributeConfigLevelValue(int value) { + + attributeConfigLevel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The
+     * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+     * for this catalog.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The attributeConfigLevel. + */ + @java.lang.Override + public com.google.cloud.retail.v2.AttributeConfigLevel getAttributeConfigLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.AttributeConfigLevel result = + com.google.cloud.retail.v2.AttributeConfigLevel.valueOf(attributeConfigLevel_); + return result == null ? com.google.cloud.retail.v2.AttributeConfigLevel.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Output only. The
+     * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+     * for this catalog.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The attributeConfigLevel to set. + * @return This builder for chaining. + */ + public Builder setAttributeConfigLevel(com.google.cloud.retail.v2.AttributeConfigLevel value) { + if (value == null) { + throw new NullPointerException(); + } + + attributeConfigLevel_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The
+     * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+     * for this catalog.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearAttributeConfigLevel() { + + attributeConfigLevel_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.AttributesConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.AttributesConfig) + private static final com.google.cloud.retail.v2.AttributesConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.AttributesConfig(); + } + + public static com.google.cloud.retail.v2.AttributesConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AttributesConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AttributesConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigName.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigName.java new file mode 100644 index 000000000000..b37f8bf65e01 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class AttributesConfigName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + + @Deprecated + protected AttributesConfigName() { + project = null; + location = null; + catalog = null; + } + + private AttributesConfigName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static AttributesConfigName of(String project, String location, String catalog) { + return newBuilder().setProject(project).setLocation(location).setCatalog(catalog).build(); + } + + public static String format(String project, String location, String catalog) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .build() + .toString(); + } + + public static AttributesConfigName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG.validatedMatch( + formattedString, "AttributesConfigName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("catalog")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (AttributesConfigName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG.instantiate( + "project", project, "location", location, "catalog", catalog); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AttributesConfigName that = ((AttributesConfigName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + return h; + } + + /** Builder for projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig. */ + public static class Builder { + private String project; + private String location; + private String catalog; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + private Builder(AttributesConfigName attributesConfigName) { + this.project = attributesConfigName.project; + this.location = attributesConfigName.location; + this.catalog = attributesConfigName.catalog; + } + + public AttributesConfigName build() { + return new AttributesConfigName(this); + } + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigOrBuilder.java new file mode 100644 index 000000000000..52eccdccbe81 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/AttributesConfigOrBuilder.java @@ -0,0 +1,185 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public interface AttributesConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.AttributesConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the attribute
+   * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Immutable. The fully qualified resource name of the attribute
+   * config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + int getCatalogAttributesCount(); + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + boolean containsCatalogAttributes(java.lang.String key); + /** Use {@link #getCatalogAttributesMap()} instead. */ + @java.lang.Deprecated + java.util.Map + getCatalogAttributes(); + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + java.util.Map + getCatalogAttributesMap(); + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + + /* nullable */ + com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.retail.v2.CatalogAttribute defaultValue); + /** + * + * + *
+   * Enable attribute(s) config at catalog level.
+   * For example, indexable, dynamic_facetable, or searchable for each
+   * attribute.
+   * The key is catalog attribute's name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * The maximum number of catalog attributes allowed in a request is 1000.
+   * 
+ * + * map<string, .google.cloud.retail.v2.CatalogAttribute> catalog_attributes = 2; + * + */ + com.google.cloud.retail.v2.CatalogAttribute getCatalogAttributesOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. The
+   * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+   * for this catalog.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for attributeConfigLevel. + */ + int getAttributeConfigLevelValue(); + /** + * + * + *
+   * Output only. The
+   * [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
+   * for this catalog.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributeConfigLevel attribute_config_level = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The attributeConfigLevel. + */ + com.google.cloud.retail.v2.AttributeConfigLevel getAttributeConfigLevel(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java index 4b0aaab244c7..0dc9303540ac 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySource.java @@ -209,9 +209,8 @@ public PartitionCase getPartitionCase() { * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -227,9 +226,8 @@ public boolean hasPartitionDate() { * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -248,9 +246,8 @@ public com.google.type.Date getPartitionDate() { * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -490,8 +487,7 @@ public com.google.protobuf.ByteString getGcsStagingDirBytes() { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -533,8 +529,7 @@ public java.lang.String getDataSchema() { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -1007,9 +1002,8 @@ public Builder clearPartition() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1025,9 +1019,8 @@ public boolean hasPartitionDate() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1053,9 +1046,8 @@ public com.google.type.Date getPartitionDate() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1078,9 +1070,8 @@ public Builder setPartitionDate(com.google.type.Date value) { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1100,9 +1091,8 @@ public Builder setPartitionDate(com.google.type.Date.Builder builderForValue) { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1133,9 +1123,8 @@ public Builder mergePartitionDate(com.google.type.Date value) { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1161,9 +1150,8 @@ public Builder clearPartitionDate() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1176,9 +1164,8 @@ public com.google.type.Date.Builder getPartitionDateBuilder() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1199,9 +1186,8 @@ public com.google.type.DateOrBuilder getPartitionDateOrBuilder() { * *
      * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Only supported in
+     * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
      * 
* * .google.type.Date partition_date = 6; @@ -1697,8 +1683,7 @@ public Builder setGcsStagingDirBytes(com.google.protobuf.ByteString value) { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -1739,8 +1724,7 @@ public java.lang.String getDataSchema() { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -1781,8 +1765,7 @@ public com.google.protobuf.ByteString getDataSchemaBytes() { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -1822,8 +1805,7 @@ public Builder setDataSchema(java.lang.String value) { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -1859,8 +1841,7 @@ public Builder clearDataSchema() { * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java index c981a74e9c02..d372eed37f00 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/BigQuerySourceOrBuilder.java @@ -28,9 +28,8 @@ public interface BigQuerySourceOrBuilder * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -43,9 +42,8 @@ public interface BigQuerySourceOrBuilder * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -58,9 +56,8 @@ public interface BigQuerySourceOrBuilder * *
    * BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Only supported in
+   * [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
    * 
* * .google.type.Date partition_date = 6; @@ -196,8 +193,7 @@ public interface BigQuerySourceOrBuilder * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: @@ -228,8 +224,7 @@ public interface BigQuerySourceOrBuilder * * `user_event_ga360`: * The schema is available here: * https://support.google.com/analytics/answer/3437719. - * * `user_event_ga4`: This feature is in private preview. Please contact the - * support team for importing Google Analytics 4 events. + * * `user_event_ga4`: * The schema is available here: * https://support.google.com/analytics/answer/7029846. * Supported values for auto-completion imports: diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttribute.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttribute.java new file mode 100644 index 000000000000..09f06e0f5109 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttribute.java @@ -0,0 +1,2270 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Catalog level attribute config for an attribute. For example, if customers
+ * want to enable/disable facet for a specific attribute.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CatalogAttribute} + */ +public final class CatalogAttribute extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CatalogAttribute) + CatalogAttributeOrBuilder { + private static final long serialVersionUID = 0L; + // Use CatalogAttribute.newBuilder() to construct. + private CatalogAttribute(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CatalogAttribute() { + key_ = ""; + type_ = 0; + indexableOption_ = 0; + dynamicFacetableOption_ = 0; + searchableOption_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CatalogAttribute(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CatalogAttribute( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + case 40: + { + int rawValue = input.readEnum(); + + indexableOption_ = rawValue; + break; + } + case 48: + { + int rawValue = input.readEnum(); + + dynamicFacetableOption_ = rawValue; + break; + } + case 56: + { + int rawValue = input.readEnum(); + + searchableOption_ = rawValue; + break; + } + case 72: + { + inUse_ = input.readBool(); + break; + } + case 80: + { + int rawValue = input.readEnum(); + + type_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CatalogAttribute_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CatalogAttribute_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CatalogAttribute.class, + com.google.cloud.retail.v2.CatalogAttribute.Builder.class); + } + + /** + * + * + *
+   * The type of an attribute.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.CatalogAttribute.AttributeType} + */ + public enum AttributeType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * The type of the attribute is unknown.
+     * Used when type cannot be derived from attribute that is not
+     * [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
+     * 
+ * + * UNKNOWN = 0; + */ + UNKNOWN(0), + /** + * + * + *
+     * Textual attribute.
+     * 
+ * + * TEXTUAL = 1; + */ + TEXTUAL(1), + /** + * + * + *
+     * Numerical attribute.
+     * 
+ * + * NUMERICAL = 2; + */ + NUMERICAL(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * The type of the attribute is unknown.
+     * Used when type cannot be derived from attribute that is not
+     * [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
+     * 
+ * + * UNKNOWN = 0; + */ + public static final int UNKNOWN_VALUE = 0; + /** + * + * + *
+     * Textual attribute.
+     * 
+ * + * TEXTUAL = 1; + */ + public static final int TEXTUAL_VALUE = 1; + /** + * + * + *
+     * Numerical attribute.
+     * 
+ * + * NUMERICAL = 2; + */ + public static final int NUMERICAL_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AttributeType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AttributeType forNumber(int value) { + switch (value) { + case 0: + return UNKNOWN; + case 1: + return TEXTUAL; + case 2: + return NUMERICAL; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public AttributeType findValueByNumber(int number) { + return AttributeType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogAttribute.getDescriptor().getEnumTypes().get(0); + } + + private static final AttributeType[] VALUES = values(); + + public static AttributeType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private AttributeType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.CatalogAttribute.AttributeType) + } + + /** + * + * + *
+   * The status of the indexable option of a catalog attribute.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.CatalogAttribute.IndexableOption} + */ + public enum IndexableOption implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [INDEXABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED].
+     * 
+ * + * INDEXABLE_OPTION_UNSPECIFIED = 0; + */ + INDEXABLE_OPTION_UNSPECIFIED(0), + /** + * + * + *
+     * Indexable option enabled for an attribute.
+     * 
+ * + * INDEXABLE_ENABLED = 1; + */ + INDEXABLE_ENABLED(1), + /** + * + * + *
+     * Indexable option disabled for an attribute.
+     * 
+ * + * INDEXABLE_DISABLED = 2; + */ + INDEXABLE_DISABLED(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [INDEXABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED].
+     * 
+ * + * INDEXABLE_OPTION_UNSPECIFIED = 0; + */ + public static final int INDEXABLE_OPTION_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Indexable option enabled for an attribute.
+     * 
+ * + * INDEXABLE_ENABLED = 1; + */ + public static final int INDEXABLE_ENABLED_VALUE = 1; + /** + * + * + *
+     * Indexable option disabled for an attribute.
+     * 
+ * + * INDEXABLE_DISABLED = 2; + */ + public static final int INDEXABLE_DISABLED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static IndexableOption valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static IndexableOption forNumber(int value) { + switch (value) { + case 0: + return INDEXABLE_OPTION_UNSPECIFIED; + case 1: + return INDEXABLE_ENABLED; + case 2: + return INDEXABLE_DISABLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public IndexableOption findValueByNumber(int number) { + return IndexableOption.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogAttribute.getDescriptor().getEnumTypes().get(1); + } + + private static final IndexableOption[] VALUES = values(); + + public static IndexableOption valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private IndexableOption(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.CatalogAttribute.IndexableOption) + } + + /** + * + * + *
+   * The status of the dynamic facetable option of a catalog attribute.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption} + */ + public enum DynamicFacetableOption implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED].
+     * 
+ * + * DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + */ + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED(0), + /** + * + * + *
+     * Dynamic facetable option enabled for an attribute.
+     * 
+ * + * DYNAMIC_FACETABLE_ENABLED = 1; + */ + DYNAMIC_FACETABLE_ENABLED(1), + /** + * + * + *
+     * Dynamic facetable option disabled for an attribute.
+     * 
+ * + * DYNAMIC_FACETABLE_DISABLED = 2; + */ + DYNAMIC_FACETABLE_DISABLED(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED].
+     * 
+ * + * DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + */ + public static final int DYNAMIC_FACETABLE_OPTION_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Dynamic facetable option enabled for an attribute.
+     * 
+ * + * DYNAMIC_FACETABLE_ENABLED = 1; + */ + public static final int DYNAMIC_FACETABLE_ENABLED_VALUE = 1; + /** + * + * + *
+     * Dynamic facetable option disabled for an attribute.
+     * 
+ * + * DYNAMIC_FACETABLE_DISABLED = 2; + */ + public static final int DYNAMIC_FACETABLE_DISABLED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DynamicFacetableOption valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DynamicFacetableOption forNumber(int value) { + switch (value) { + case 0: + return DYNAMIC_FACETABLE_OPTION_UNSPECIFIED; + case 1: + return DYNAMIC_FACETABLE_ENABLED; + case 2: + return DYNAMIC_FACETABLE_DISABLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DynamicFacetableOption findValueByNumber(int number) { + return DynamicFacetableOption.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogAttribute.getDescriptor().getEnumTypes().get(2); + } + + private static final DynamicFacetableOption[] VALUES = values(); + + public static DynamicFacetableOption valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DynamicFacetableOption(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption) + } + + /** + * + * + *
+   * The status of the searchable option of a catalog attribute.
+   * 
+ * + * Protobuf enum {@code google.cloud.retail.v2.CatalogAttribute.SearchableOption} + */ + public enum SearchableOption implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED].
+     * 
+ * + * SEARCHABLE_OPTION_UNSPECIFIED = 0; + */ + SEARCHABLE_OPTION_UNSPECIFIED(0), + /** + * + * + *
+     * Searchable option enabled for an attribute.
+     * 
+ * + * SEARCHABLE_ENABLED = 1; + */ + SEARCHABLE_ENABLED(1), + /** + * + * + *
+     * Searchable option disabled for an attribute.
+     * 
+ * + * SEARCHABLE_DISABLED = 2; + */ + SEARCHABLE_DISABLED(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Value used when unset. Defaults to
+     * [SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED].
+     * 
+ * + * SEARCHABLE_OPTION_UNSPECIFIED = 0; + */ + public static final int SEARCHABLE_OPTION_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Searchable option enabled for an attribute.
+     * 
+ * + * SEARCHABLE_ENABLED = 1; + */ + public static final int SEARCHABLE_ENABLED_VALUE = 1; + /** + * + * + *
+     * Searchable option disabled for an attribute.
+     * 
+ * + * SEARCHABLE_DISABLED = 2; + */ + public static final int SEARCHABLE_DISABLED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SearchableOption valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static SearchableOption forNumber(int value) { + switch (value) { + case 0: + return SEARCHABLE_OPTION_UNSPECIFIED; + case 1: + return SEARCHABLE_ENABLED; + case 2: + return SEARCHABLE_DISABLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SearchableOption findValueByNumber(int number) { + return SearchableOption.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogAttribute.getDescriptor().getEnumTypes().get(3); + } + + private static final SearchableOption[] VALUES = values(); + + public static SearchableOption valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private SearchableOption(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.CatalogAttribute.SearchableOption) + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * + * + *
+   * Required. Attribute name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * To be indexable, the attribute name can contain only alpha-numeric
+   * characters and underscores. For example, an attribute named
+   * `attributes.abc_xyz` can be indexed, but an attribute named
+   * `attributes.abc-xyz` cannot be indexed.
+   * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Attribute name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * To be indexable, the attribute name can contain only alpha-numeric
+   * characters and underscores. For example, an attribute named
+   * `attributes.abc_xyz` can be indexed, but an attribute named
+   * `attributes.abc-xyz` cannot be indexed.
+   * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IN_USE_FIELD_NUMBER = 9; + private boolean inUse_; + /** + * + * + *
+   * Output only. Indicates whether this attribute has been used by any
+   * products. `True` if at least one [Product][google.cloud.retail.v2.Product]
+   * is using this attribute in
+   * [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
+   * this field is `False`.
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
+   * pre-loaded by using
+   * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
+   * [CatalogService.ImportCatalogAttributes][], or
+   * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+   * APIs. This field is `False` for pre-loaded
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
+   * Only pre-loaded
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+   * neither in use by products nor predefined can be deleted.
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+   * either in use by products or are predefined cannot be deleted; however,
+   * their configuration properties will reset to default values upon removal
+   * request.
+   * After catalog changes, it takes about 10 minutes for this field to update.
+   * 
+ * + * bool in_use = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The inUse. + */ + @java.lang.Override + public boolean getInUse() { + return inUse_; + } + + public static final int TYPE_FIELD_NUMBER = 10; + private int type_; + /** + * + * + *
+   * Output only. The type of this attribute. This is derived from the attribute
+   * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for type. + */ + @java.lang.Override + public int getTypeValue() { + return type_; + } + /** + * + * + *
+   * Output only. The type of this attribute. This is derived from the attribute
+   * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The type. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.AttributeType getType() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.AttributeType result = + com.google.cloud.retail.v2.CatalogAttribute.AttributeType.valueOf(type_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.AttributeType.UNRECOGNIZED + : result; + } + + public static final int INDEXABLE_OPTION_FIELD_NUMBER = 5; + private int indexableOption_; + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+   * are indexed so that it can be filtered, faceted, or boosted in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The enum numeric value on the wire for indexableOption. + */ + @java.lang.Override + public int getIndexableOptionValue() { + return indexableOption_; + } + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+   * are indexed so that it can be filtered, faceted, or boosted in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The indexableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.IndexableOption getIndexableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption result = + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.valueOf(indexableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.UNRECOGNIZED + : result; + } + + public static final int DYNAMIC_FACETABLE_OPTION_FIELD_NUMBER = 6; + private int dynamicFacetableOption_; + /** + * + * + *
+   * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+   * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+   * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+   * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The enum numeric value on the wire for dynamicFacetableOption. + */ + @java.lang.Override + public int getDynamicFacetableOptionValue() { + return dynamicFacetableOption_; + } + /** + * + * + *
+   * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+   * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+   * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+   * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The dynamicFacetableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption + getDynamicFacetableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption result = + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.valueOf( + dynamicFacetableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.UNRECOGNIZED + : result; + } + + public static final int SEARCHABLE_OPTION_FIELD_NUMBER = 7; + private int searchableOption_; + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+   * are searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+   * will not be searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+   * there are no text values associated to numerical attributes.
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The enum numeric value on the wire for searchableOption. + */ + @java.lang.Override + public int getSearchableOptionValue() { + return searchableOption_; + } + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+   * are searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+   * will not be searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+   * there are no text values associated to numerical attributes.
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The searchableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.SearchableOption getSearchableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption result = + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption.valueOf(searchableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.SearchableOption.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (indexableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_OPTION_UNSPECIFIED + .getNumber()) { + output.writeEnum(5, indexableOption_); + } + if (dynamicFacetableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption + .DYNAMIC_FACETABLE_OPTION_UNSPECIFIED + .getNumber()) { + output.writeEnum(6, dynamicFacetableOption_); + } + if (searchableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.SearchableOption + .SEARCHABLE_OPTION_UNSPECIFIED + .getNumber()) { + output.writeEnum(7, searchableOption_); + } + if (inUse_ != false) { + output.writeBool(9, inUse_); + } + if (type_ != com.google.cloud.retail.v2.CatalogAttribute.AttributeType.UNKNOWN.getNumber()) { + output.writeEnum(10, type_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (indexableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_OPTION_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, indexableOption_); + } + if (dynamicFacetableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption + .DYNAMIC_FACETABLE_OPTION_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, dynamicFacetableOption_); + } + if (searchableOption_ + != com.google.cloud.retail.v2.CatalogAttribute.SearchableOption + .SEARCHABLE_OPTION_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(7, searchableOption_); + } + if (inUse_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(9, inUse_); + } + if (type_ != com.google.cloud.retail.v2.CatalogAttribute.AttributeType.UNKNOWN.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(10, type_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CatalogAttribute)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CatalogAttribute other = + (com.google.cloud.retail.v2.CatalogAttribute) obj; + + if (!getKey().equals(other.getKey())) return false; + if (getInUse() != other.getInUse()) return false; + if (type_ != other.type_) return false; + if (indexableOption_ != other.indexableOption_) return false; + if (dynamicFacetableOption_ != other.dynamicFacetableOption_) return false; + if (searchableOption_ != other.searchableOption_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + IN_USE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getInUse()); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + type_; + hash = (37 * hash) + INDEXABLE_OPTION_FIELD_NUMBER; + hash = (53 * hash) + indexableOption_; + hash = (37 * hash) + DYNAMIC_FACETABLE_OPTION_FIELD_NUMBER; + hash = (53 * hash) + dynamicFacetableOption_; + hash = (37 * hash) + SEARCHABLE_OPTION_FIELD_NUMBER; + hash = (53 * hash) + searchableOption_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CatalogAttribute parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CatalogAttribute prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Catalog level attribute config for an attribute. For example, if customers
+   * want to enable/disable facet for a specific attribute.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CatalogAttribute} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CatalogAttribute) + com.google.cloud.retail.v2.CatalogAttributeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CatalogAttribute_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CatalogAttribute_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CatalogAttribute.class, + com.google.cloud.retail.v2.CatalogAttribute.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CatalogAttribute.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + key_ = ""; + + inUse_ = false; + + type_ = 0; + + indexableOption_ = 0; + + dynamicFacetableOption_ = 0; + + searchableOption_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CatalogAttribute_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute build() { + com.google.cloud.retail.v2.CatalogAttribute result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute buildPartial() { + com.google.cloud.retail.v2.CatalogAttribute result = + new com.google.cloud.retail.v2.CatalogAttribute(this); + result.key_ = key_; + result.inUse_ = inUse_; + result.type_ = type_; + result.indexableOption_ = indexableOption_; + result.dynamicFacetableOption_ = dynamicFacetableOption_; + result.searchableOption_ = searchableOption_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CatalogAttribute) { + return mergeFrom((com.google.cloud.retail.v2.CatalogAttribute) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CatalogAttribute other) { + if (other == com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + if (other.getInUse() != false) { + setInUse(other.getInUse()); + } + if (other.type_ != 0) { + setTypeValue(other.getTypeValue()); + } + if (other.indexableOption_ != 0) { + setIndexableOptionValue(other.getIndexableOptionValue()); + } + if (other.dynamicFacetableOption_ != 0) { + setDynamicFacetableOptionValue(other.getDynamicFacetableOptionValue()); + } + if (other.searchableOption_ != 0) { + setSearchableOptionValue(other.getSearchableOptionValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CatalogAttribute parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.CatalogAttribute) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * + * + *
+     * Required. Attribute name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * To be indexable, the attribute name can contain only alpha-numeric
+     * characters and underscores. For example, an attribute named
+     * `attributes.abc_xyz` can be indexed, but an attribute named
+     * `attributes.abc-xyz` cannot be indexed.
+     * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Attribute name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * To be indexable, the attribute name can contain only alpha-numeric
+     * characters and underscores. For example, an attribute named
+     * `attributes.abc_xyz` can be indexed, but an attribute named
+     * `attributes.abc-xyz` cannot be indexed.
+     * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Attribute name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * To be indexable, the attribute name can contain only alpha-numeric
+     * characters and underscores. For example, an attribute named
+     * `attributes.abc_xyz` can be indexed, but an attribute named
+     * `attributes.abc-xyz` cannot be indexed.
+     * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Attribute name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * To be indexable, the attribute name can contain only alpha-numeric
+     * characters and underscores. For example, an attribute named
+     * `attributes.abc_xyz` can be indexed, but an attribute named
+     * `attributes.abc-xyz` cannot be indexed.
+     * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Attribute name.
+     * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+     * `attributes.xyz`.
+     * To be indexable, the attribute name can contain only alpha-numeric
+     * characters and underscores. For example, an attribute named
+     * `attributes.abc_xyz` can be indexed, but an attribute named
+     * `attributes.abc-xyz` cannot be indexed.
+     * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + private boolean inUse_; + /** + * + * + *
+     * Output only. Indicates whether this attribute has been used by any
+     * products. `True` if at least one [Product][google.cloud.retail.v2.Product]
+     * is using this attribute in
+     * [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
+     * this field is `False`.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
+     * pre-loaded by using
+     * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
+     * [CatalogService.ImportCatalogAttributes][], or
+     * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+     * APIs. This field is `False` for pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
+     * Only pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * neither in use by products nor predefined can be deleted.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * either in use by products or are predefined cannot be deleted; however,
+     * their configuration properties will reset to default values upon removal
+     * request.
+     * After catalog changes, it takes about 10 minutes for this field to update.
+     * 
+ * + * bool in_use = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The inUse. + */ + @java.lang.Override + public boolean getInUse() { + return inUse_; + } + /** + * + * + *
+     * Output only. Indicates whether this attribute has been used by any
+     * products. `True` if at least one [Product][google.cloud.retail.v2.Product]
+     * is using this attribute in
+     * [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
+     * this field is `False`.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
+     * pre-loaded by using
+     * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
+     * [CatalogService.ImportCatalogAttributes][], or
+     * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+     * APIs. This field is `False` for pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
+     * Only pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * neither in use by products nor predefined can be deleted.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * either in use by products or are predefined cannot be deleted; however,
+     * their configuration properties will reset to default values upon removal
+     * request.
+     * After catalog changes, it takes about 10 minutes for this field to update.
+     * 
+ * + * bool in_use = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The inUse to set. + * @return This builder for chaining. + */ + public Builder setInUse(boolean value) { + + inUse_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Indicates whether this attribute has been used by any
+     * products. `True` if at least one [Product][google.cloud.retail.v2.Product]
+     * is using this attribute in
+     * [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
+     * this field is `False`.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
+     * pre-loaded by using
+     * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
+     * [CatalogService.ImportCatalogAttributes][], or
+     * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+     * APIs. This field is `False` for pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
+     * Only pre-loaded
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * neither in use by products nor predefined can be deleted.
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+     * either in use by products or are predefined cannot be deleted; however,
+     * their configuration properties will reset to default values upon removal
+     * request.
+     * After catalog changes, it takes about 10 minutes for this field to update.
+     * 
+ * + * bool in_use = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearInUse() { + + inUse_ = false; + onChanged(); + return this; + } + + private int type_ = 0; + /** + * + * + *
+     * Output only. The type of this attribute. This is derived from the attribute
+     * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for type. + */ + @java.lang.Override + public int getTypeValue() { + return type_; + } + /** + * + * + *
+     * Output only. The type of this attribute. This is derived from the attribute
+     * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for type to set. + * @return This builder for chaining. + */ + public Builder setTypeValue(int value) { + + type_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The type of this attribute. This is derived from the attribute
+     * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The type. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.AttributeType getType() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.AttributeType result = + com.google.cloud.retail.v2.CatalogAttribute.AttributeType.valueOf(type_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.AttributeType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. The type of this attribute. This is derived from the attribute
+     * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The type to set. + * @return This builder for chaining. + */ + public Builder setType(com.google.cloud.retail.v2.CatalogAttribute.AttributeType value) { + if (value == null) { + throw new NullPointerException(); + } + + type_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The type of this attribute. This is derived from the attribute
+     * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearType() { + + type_ = 0; + onChanged(); + return this; + } + + private int indexableOption_ = 0; + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+     * are indexed so that it can be filtered, faceted, or boosted in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The enum numeric value on the wire for indexableOption. + */ + @java.lang.Override + public int getIndexableOptionValue() { + return indexableOption_; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+     * are indexed so that it can be filtered, faceted, or boosted in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @param value The enum numeric value on the wire for indexableOption to set. + * @return This builder for chaining. + */ + public Builder setIndexableOptionValue(int value) { + + indexableOption_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+     * are indexed so that it can be filtered, faceted, or boosted in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The indexableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.IndexableOption getIndexableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption result = + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.valueOf(indexableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.IndexableOption.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+     * are indexed so that it can be filtered, faceted, or boosted in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @param value The indexableOption to set. + * @return This builder for chaining. + */ + public Builder setIndexableOption( + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption value) { + if (value == null) { + throw new NullPointerException(); + } + + indexableOption_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+     * are indexed so that it can be filtered, faceted, or boosted in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return This builder for chaining. + */ + public Builder clearIndexableOption() { + + indexableOption_ = 0; + onChanged(); + return this; + } + + private int dynamicFacetableOption_ = 0; + /** + * + * + *
+     * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+     * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+     * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+     * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The enum numeric value on the wire for dynamicFacetableOption. + */ + @java.lang.Override + public int getDynamicFacetableOptionValue() { + return dynamicFacetableOption_; + } + /** + * + * + *
+     * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+     * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+     * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+     * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @param value The enum numeric value on the wire for dynamicFacetableOption to set. + * @return This builder for chaining. + */ + public Builder setDynamicFacetableOptionValue(int value) { + + dynamicFacetableOption_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+     * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+     * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+     * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The dynamicFacetableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption + getDynamicFacetableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption result = + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.valueOf( + dynamicFacetableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+     * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+     * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+     * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @param value The dynamicFacetableOption to set. + * @return This builder for chaining. + */ + public Builder setDynamicFacetableOption( + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption value) { + if (value == null) { + throw new NullPointerException(); + } + + dynamicFacetableOption_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+     * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+     * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+     * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return This builder for chaining. + */ + public Builder clearDynamicFacetableOption() { + + dynamicFacetableOption_ = 0; + onChanged(); + return this; + } + + private int searchableOption_ = 0; + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+     * are searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+     * will not be searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+     * there are no text values associated to numerical attributes.
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The enum numeric value on the wire for searchableOption. + */ + @java.lang.Override + public int getSearchableOptionValue() { + return searchableOption_; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+     * are searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+     * will not be searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+     * there are no text values associated to numerical attributes.
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @param value The enum numeric value on the wire for searchableOption to set. + * @return This builder for chaining. + */ + public Builder setSearchableOptionValue(int value) { + + searchableOption_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+     * are searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+     * will not be searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+     * there are no text values associated to numerical attributes.
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The searchableOption. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute.SearchableOption getSearchableOption() { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption result = + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption.valueOf(searchableOption_); + return result == null + ? com.google.cloud.retail.v2.CatalogAttribute.SearchableOption.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+     * are searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+     * will not be searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+     * there are no text values associated to numerical attributes.
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @param value The searchableOption to set. + * @return This builder for chaining. + */ + public Builder setSearchableOption( + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption value) { + if (value == null) { + throw new NullPointerException(); + } + + searchableOption_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * When
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+     * are searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+     * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+     * will not be searchable by text queries in
+     * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+     * there are no text values associated to numerical attributes.
+     * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return This builder for chaining. + */ + public Builder clearSearchableOption() { + + searchableOption_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CatalogAttribute) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CatalogAttribute) + private static final com.google.cloud.retail.v2.CatalogAttribute DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CatalogAttribute(); + } + + public static com.google.cloud.retail.v2.CatalogAttribute getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CatalogAttribute parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CatalogAttribute(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttributeOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttributeOrBuilder.java new file mode 100644 index 000000000000..6e24c8e3f23d --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogAttributeOrBuilder.java @@ -0,0 +1,234 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public interface CatalogAttributeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CatalogAttribute) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Attribute name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * To be indexable, the attribute name can contain only alpha-numeric
+   * characters and underscores. For example, an attribute named
+   * `attributes.abc_xyz` can be indexed, but an attribute named
+   * `attributes.abc-xyz` cannot be indexed.
+   * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + java.lang.String getKey(); + /** + * + * + *
+   * Required. Attribute name.
+   * For example: `color`, `brands`, `attributes.custom_attribute`, such as
+   * `attributes.xyz`.
+   * To be indexable, the attribute name can contain only alpha-numeric
+   * characters and underscores. For example, an attribute named
+   * `attributes.abc_xyz` can be indexed, but an attribute named
+   * `attributes.abc-xyz` cannot be indexed.
+   * 
+ * + * string key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + com.google.protobuf.ByteString getKeyBytes(); + + /** + * + * + *
+   * Output only. Indicates whether this attribute has been used by any
+   * products. `True` if at least one [Product][google.cloud.retail.v2.Product]
+   * is using this attribute in
+   * [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
+   * this field is `False`.
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
+   * pre-loaded by using
+   * [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
+   * [CatalogService.ImportCatalogAttributes][], or
+   * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+   * APIs. This field is `False` for pre-loaded
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
+   * Only pre-loaded
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+   * neither in use by products nor predefined can be deleted.
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
+   * either in use by products or are predefined cannot be deleted; however,
+   * their configuration properties will reset to default values upon removal
+   * request.
+   * After catalog changes, it takes about 10 minutes for this field to update.
+   * 
+ * + * bool in_use = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The inUse. + */ + boolean getInUse(); + + /** + * + * + *
+   * Output only. The type of this attribute. This is derived from the attribute
+   * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for type. + */ + int getTypeValue(); + /** + * + * + *
+   * Output only. The type of this attribute. This is derived from the attribute
+   * in [Product.attributes][google.cloud.retail.v2.Product.attributes].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.AttributeType type = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The type. + */ + com.google.cloud.retail.v2.CatalogAttribute.AttributeType getType(); + + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+   * are indexed so that it can be filtered, faceted, or boosted in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The enum numeric value on the wire for indexableOption. + */ + int getIndexableOptionValue(); + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
+   * are indexed so that it can be filtered, faceted, or boosted in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.IndexableOption indexable_option = 5; + * + * @return The indexableOption. + */ + com.google.cloud.retail.v2.CatalogAttribute.IndexableOption getIndexableOption(); + + /** + * + * + *
+   * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+   * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+   * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+   * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The enum numeric value on the wire for dynamicFacetableOption. + */ + int getDynamicFacetableOptionValue(); + /** + * + * + *
+   * If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
+   * facet. Could only be DYNAMIC_FACETABLE_DISABLED if
+   * [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
+   * is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption dynamic_facetable_option = 6; + * + * + * @return The dynamicFacetableOption. + */ + com.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption getDynamicFacetableOption(); + + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+   * are searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+   * will not be searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+   * there are no text values associated to numerical attributes.
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The enum numeric value on the wire for searchableOption. + */ + int getSearchableOptionValue(); + /** + * + * + *
+   * When
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
+   * are searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
+   * If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
+   * will not be searchable by text queries in
+   * [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
+   * there are no text values associated to numerical attributes.
+   * 
+ * + * .google.cloud.retail.v2.CatalogAttribute.SearchableOption searchable_option = 7; + * + * @return The searchableOption. + */ + com.google.cloud.retail.v2.CatalogAttribute.SearchableOption getSearchableOption(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java index 3df5a0d9ea62..cde0dc192a9c 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CatalogProto.java @@ -31,6 +31,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_retail_v2_ProductLevelConfig_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_retail_v2_ProductLevelConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_CatalogAttribute_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_CatalogAttribute_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_AttributesConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_AttributesConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_AttributesConfig_CatalogAttributesEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_AttributesConfig_CatalogAttributesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_CompletionConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_CompletionConfig_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_retail_v2_Catalog_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -47,20 +63,70 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "\n$google/cloud/retail/v2/catalog.proto\022\026" + "google.cloud.retail.v2\032\037google/api/field" + "_behavior.proto\032\031google/api/resource.pro" - + "to\"^\n\022ProductLevelConfig\022\036\n\026ingestion_pr" - + "oduct_type\030\001 \001(\t\022(\n merchant_center_prod" - + "uct_id_field\030\002 \001(\t\"\354\001\n\007Catalog\022\024\n\004name\030\001" - + " \001(\tB\006\340A\002\340A\005\022\034\n\014display_name\030\002 \001(\tB\006\340A\002\340" - + "A\005\022M\n\024product_level_config\030\004 \001(\0132*.googl" - + "e.cloud.retail.v2.ProductLevelConfigB\003\340A" - + "\002:^\352A[\n\035retail.googleapis.com/Catalog\022:p" - + "rojects/{project}/locations/{location}/c" - + "atalogs/{catalog}B\301\001\n\032com.google.cloud.r" - + "etail.v2B\014CatalogProtoP\001Z * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value [CompletionConfig.max_suggestions][]. + * to the configured value + * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. * @@ -1908,7 +1909,8 @@ public Builder setDatasetBytes(com.google.protobuf.ByteString value) { * *
      * Completion max suggestions. If left unset or set to 0, then will fallback
-     * to the configured value [CompletionConfig.max_suggestions][].
+     * to the configured value
+     * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
      * The maximum allowed max suggestions is 20. If it is set higher, it will be
      * capped by 20.
      * 
@@ -1926,7 +1928,8 @@ public int getMaxSuggestions() { * *
      * Completion max suggestions. If left unset or set to 0, then will fallback
-     * to the configured value [CompletionConfig.max_suggestions][].
+     * to the configured value
+     * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
      * The maximum allowed max suggestions is 20. If it is set higher, it will be
      * capped by 20.
      * 
@@ -1947,7 +1950,8 @@ public Builder setMaxSuggestions(int value) { * *
      * Completion max suggestions. If left unset or set to 0, then will fallback
-     * to the configured value [CompletionConfig.max_suggestions][].
+     * to the configured value
+     * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
      * The maximum allowed max suggestions is 20. If it is set higher, it will be
      * capped by 20.
      * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompleteQueryRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompleteQueryRequestOrBuilder.java index f8e8fd6e51a0..3ed3df694913 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompleteQueryRequestOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompleteQueryRequestOrBuilder.java @@ -286,7 +286,8 @@ public interface CompleteQueryRequestOrBuilder * *
    * Completion max suggestions. If left unset or set to 0, then will fallback
-   * to the configured value [CompletionConfig.max_suggestions][].
+   * to the configured value
+   * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
    * The maximum allowed max suggestions is 20. If it is set higher, it will be
    * capped by 20.
    * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfig.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfig.java new file mode 100644 index 000000000000..61b7792611c5 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfig.java @@ -0,0 +1,2781 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Catalog level autocomplete config for customers to customize autocomplete
+ * feature's settings.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CompletionConfig} + */ +public final class CompletionConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CompletionConfig) + CompletionConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use CompletionConfig.newBuilder() to construct. + private CompletionConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CompletionConfig() { + name_ = ""; + matchingOrder_ = ""; + lastSuggestionsImportOperation_ = ""; + lastDenylistImportOperation_ = ""; + lastAllowlistImportOperation_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CompletionConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CompletionConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + matchingOrder_ = s; + break; + } + case 24: + { + maxSuggestions_ = input.readInt32(); + break; + } + case 32: + { + minPrefixLength_ = input.readInt32(); + break; + } + case 42: + { + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder subBuilder = null; + if (suggestionsInputConfig_ != null) { + subBuilder = suggestionsInputConfig_.toBuilder(); + } + suggestionsInputConfig_ = + input.readMessage( + com.google.cloud.retail.v2.CompletionDataInputConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(suggestionsInputConfig_); + suggestionsInputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + lastSuggestionsImportOperation_ = s; + break; + } + case 58: + { + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder subBuilder = null; + if (denylistInputConfig_ != null) { + subBuilder = denylistInputConfig_.toBuilder(); + } + denylistInputConfig_ = + input.readMessage( + com.google.cloud.retail.v2.CompletionDataInputConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(denylistInputConfig_); + denylistInputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + lastDenylistImportOperation_ = s; + break; + } + case 74: + { + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder subBuilder = null; + if (allowlistInputConfig_ != null) { + subBuilder = allowlistInputConfig_.toBuilder(); + } + allowlistInputConfig_ = + input.readMessage( + com.google.cloud.retail.v2.CompletionDataInputConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(allowlistInputConfig_); + allowlistInputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + + lastAllowlistImportOperation_ = s; + break; + } + case 88: + { + autoLearning_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CompletionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CompletionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CompletionConfig.class, + com.google.cloud.retail.v2.CompletionConfig.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Immutable. Fully qualified name
+   * `projects/*/locations/*/catalogs/*/completionConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Immutable. Fully qualified name
+   * `projects/*/locations/*/catalogs/*/completionConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MATCHING_ORDER_FIELD_NUMBER = 2; + private volatile java.lang.Object matchingOrder_; + /** + * + * + *
+   * Specifies the matching order for autocomplete suggestions, e.g., a query
+   * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+   * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+   * suggest "red shoes". Currently supported values:
+   * * 'out-of-order'
+   * * 'exact-prefix'
+   * Default value: 'exact-prefix'.
+   * 
+ * + * string matching_order = 2; + * + * @return The matchingOrder. + */ + @java.lang.Override + public java.lang.String getMatchingOrder() { + java.lang.Object ref = matchingOrder_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + matchingOrder_ = s; + return s; + } + } + /** + * + * + *
+   * Specifies the matching order for autocomplete suggestions, e.g., a query
+   * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+   * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+   * suggest "red shoes". Currently supported values:
+   * * 'out-of-order'
+   * * 'exact-prefix'
+   * Default value: 'exact-prefix'.
+   * 
+ * + * string matching_order = 2; + * + * @return The bytes for matchingOrder. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMatchingOrderBytes() { + java.lang.Object ref = matchingOrder_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + matchingOrder_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MAX_SUGGESTIONS_FIELD_NUMBER = 3; + private int maxSuggestions_; + /** + * + * + *
+   * The maximum number of autocomplete suggestions returned per term. Default
+   * value is 20. If left unset or set to 0, then will fallback to default
+   * value.
+   * Value range is 1 to 20.
+   * 
+ * + * int32 max_suggestions = 3; + * + * @return The maxSuggestions. + */ + @java.lang.Override + public int getMaxSuggestions() { + return maxSuggestions_; + } + + public static final int MIN_PREFIX_LENGTH_FIELD_NUMBER = 4; + private int minPrefixLength_; + /** + * + * + *
+   * The minimum number of characters needed to be typed in order to get
+   * suggestions. Default value is 2. If left unset or set to 0, then will
+   * fallback to default value.
+   * Value range is 1 to 20.
+   * 
+ * + * int32 min_prefix_length = 4; + * + * @return The minPrefixLength. + */ + @java.lang.Override + public int getMinPrefixLength() { + return minPrefixLength_; + } + + public static final int AUTO_LEARNING_FIELD_NUMBER = 11; + private boolean autoLearning_; + /** + * + * + *
+   * If set to true, the auto learning function is enabled. Auto learning uses
+   * user data to generate suggestions using ML techniques. Default value is
+   * false. Only after enabling auto learning can users use `cloud-retail`
+   * data in
+   * [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
+   * 
+ * + * bool auto_learning = 11; + * + * @return The autoLearning. + */ + @java.lang.Override + public boolean getAutoLearning() { + return autoLearning_; + } + + public static final int SUGGESTIONS_INPUT_CONFIG_FIELD_NUMBER = 5; + private com.google.cloud.retail.v2.CompletionDataInputConfig suggestionsInputConfig_; + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the suggestionsInputConfig field is set. + */ + @java.lang.Override + public boolean hasSuggestionsInputConfig() { + return suggestionsInputConfig_ != null; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The suggestionsInputConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfig getSuggestionsInputConfig() { + return suggestionsInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : suggestionsInputConfig_; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getSuggestionsInputConfigOrBuilder() { + return getSuggestionsInputConfig(); + } + + public static final int LAST_SUGGESTIONS_IMPORT_OPERATION_FIELD_NUMBER = 6; + private volatile java.lang.Object lastSuggestionsImportOperation_; + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest suggestion terms
+   * list import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastSuggestionsImportOperation. + */ + @java.lang.Override + public java.lang.String getLastSuggestionsImportOperation() { + java.lang.Object ref = lastSuggestionsImportOperation_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastSuggestionsImportOperation_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest suggestion terms
+   * list import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastSuggestionsImportOperation. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastSuggestionsImportOperationBytes() { + java.lang.Object ref = lastSuggestionsImportOperation_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastSuggestionsImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DENYLIST_INPUT_CONFIG_FIELD_NUMBER = 7; + private com.google.cloud.retail.v2.CompletionDataInputConfig denylistInputConfig_; + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the denylistInputConfig field is set. + */ + @java.lang.Override + public boolean hasDenylistInputConfig() { + return denylistInputConfig_ != null; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The denylistInputConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfig getDenylistInputConfig() { + return denylistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : denylistInputConfig_; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getDenylistInputConfigOrBuilder() { + return getDenylistInputConfig(); + } + + public static final int LAST_DENYLIST_IMPORT_OPERATION_FIELD_NUMBER = 8; + private volatile java.lang.Object lastDenylistImportOperation_; + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest denylist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastDenylistImportOperation. + */ + @java.lang.Override + public java.lang.String getLastDenylistImportOperation() { + java.lang.Object ref = lastDenylistImportOperation_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastDenylistImportOperation_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest denylist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastDenylistImportOperation. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastDenylistImportOperationBytes() { + java.lang.Object ref = lastDenylistImportOperation_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastDenylistImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ALLOWLIST_INPUT_CONFIG_FIELD_NUMBER = 9; + private com.google.cloud.retail.v2.CompletionDataInputConfig allowlistInputConfig_; + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the allowlistInputConfig field is set. + */ + @java.lang.Override + public boolean hasAllowlistInputConfig() { + return allowlistInputConfig_ != null; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowlistInputConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfig getAllowlistInputConfig() { + return allowlistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : allowlistInputConfig_; + } + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getAllowlistInputConfigOrBuilder() { + return getAllowlistInputConfig(); + } + + public static final int LAST_ALLOWLIST_IMPORT_OPERATION_FIELD_NUMBER = 10; + private volatile java.lang.Object lastAllowlistImportOperation_; + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest allowlist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAllowlistImportOperation. + */ + @java.lang.Override + public java.lang.String getLastAllowlistImportOperation() { + java.lang.Object ref = lastAllowlistImportOperation_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastAllowlistImportOperation_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest allowlist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastAllowlistImportOperation. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastAllowlistImportOperationBytes() { + java.lang.Object ref = lastAllowlistImportOperation_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastAllowlistImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(matchingOrder_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, matchingOrder_); + } + if (maxSuggestions_ != 0) { + output.writeInt32(3, maxSuggestions_); + } + if (minPrefixLength_ != 0) { + output.writeInt32(4, minPrefixLength_); + } + if (suggestionsInputConfig_ != null) { + output.writeMessage(5, getSuggestionsInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastSuggestionsImportOperation_)) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 6, lastSuggestionsImportOperation_); + } + if (denylistInputConfig_ != null) { + output.writeMessage(7, getDenylistInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastDenylistImportOperation_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, lastDenylistImportOperation_); + } + if (allowlistInputConfig_ != null) { + output.writeMessage(9, getAllowlistInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAllowlistImportOperation_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, lastAllowlistImportOperation_); + } + if (autoLearning_ != false) { + output.writeBool(11, autoLearning_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(matchingOrder_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, matchingOrder_); + } + if (maxSuggestions_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, maxSuggestions_); + } + if (minPrefixLength_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, minPrefixLength_); + } + if (suggestionsInputConfig_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(5, getSuggestionsInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastSuggestionsImportOperation_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize( + 6, lastSuggestionsImportOperation_); + } + if (denylistInputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getDenylistInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastDenylistImportOperation_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize(8, lastDenylistImportOperation_); + } + if (allowlistInputConfig_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(9, getAllowlistInputConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAllowlistImportOperation_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize( + 10, lastAllowlistImportOperation_); + } + if (autoLearning_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(11, autoLearning_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CompletionConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CompletionConfig other = + (com.google.cloud.retail.v2.CompletionConfig) obj; + + if (!getName().equals(other.getName())) return false; + if (!getMatchingOrder().equals(other.getMatchingOrder())) return false; + if (getMaxSuggestions() != other.getMaxSuggestions()) return false; + if (getMinPrefixLength() != other.getMinPrefixLength()) return false; + if (getAutoLearning() != other.getAutoLearning()) return false; + if (hasSuggestionsInputConfig() != other.hasSuggestionsInputConfig()) return false; + if (hasSuggestionsInputConfig()) { + if (!getSuggestionsInputConfig().equals(other.getSuggestionsInputConfig())) return false; + } + if (!getLastSuggestionsImportOperation().equals(other.getLastSuggestionsImportOperation())) + return false; + if (hasDenylistInputConfig() != other.hasDenylistInputConfig()) return false; + if (hasDenylistInputConfig()) { + if (!getDenylistInputConfig().equals(other.getDenylistInputConfig())) return false; + } + if (!getLastDenylistImportOperation().equals(other.getLastDenylistImportOperation())) + return false; + if (hasAllowlistInputConfig() != other.hasAllowlistInputConfig()) return false; + if (hasAllowlistInputConfig()) { + if (!getAllowlistInputConfig().equals(other.getAllowlistInputConfig())) return false; + } + if (!getLastAllowlistImportOperation().equals(other.getLastAllowlistImportOperation())) + return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + MATCHING_ORDER_FIELD_NUMBER; + hash = (53 * hash) + getMatchingOrder().hashCode(); + hash = (37 * hash) + MAX_SUGGESTIONS_FIELD_NUMBER; + hash = (53 * hash) + getMaxSuggestions(); + hash = (37 * hash) + MIN_PREFIX_LENGTH_FIELD_NUMBER; + hash = (53 * hash) + getMinPrefixLength(); + hash = (37 * hash) + AUTO_LEARNING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAutoLearning()); + if (hasSuggestionsInputConfig()) { + hash = (37 * hash) + SUGGESTIONS_INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getSuggestionsInputConfig().hashCode(); + } + hash = (37 * hash) + LAST_SUGGESTIONS_IMPORT_OPERATION_FIELD_NUMBER; + hash = (53 * hash) + getLastSuggestionsImportOperation().hashCode(); + if (hasDenylistInputConfig()) { + hash = (37 * hash) + DENYLIST_INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getDenylistInputConfig().hashCode(); + } + hash = (37 * hash) + LAST_DENYLIST_IMPORT_OPERATION_FIELD_NUMBER; + hash = (53 * hash) + getLastDenylistImportOperation().hashCode(); + if (hasAllowlistInputConfig()) { + hash = (37 * hash) + ALLOWLIST_INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAllowlistInputConfig().hashCode(); + } + hash = (37 * hash) + LAST_ALLOWLIST_IMPORT_OPERATION_FIELD_NUMBER; + hash = (53 * hash) + getLastAllowlistImportOperation().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CompletionConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CompletionConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Catalog level autocomplete config for customers to customize autocomplete
+   * feature's settings.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CompletionConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CompletionConfig) + com.google.cloud.retail.v2.CompletionConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CompletionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CompletionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CompletionConfig.class, + com.google.cloud.retail.v2.CompletionConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CompletionConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + matchingOrder_ = ""; + + maxSuggestions_ = 0; + + minPrefixLength_ = 0; + + autoLearning_ = false; + + if (suggestionsInputConfigBuilder_ == null) { + suggestionsInputConfig_ = null; + } else { + suggestionsInputConfig_ = null; + suggestionsInputConfigBuilder_ = null; + } + lastSuggestionsImportOperation_ = ""; + + if (denylistInputConfigBuilder_ == null) { + denylistInputConfig_ = null; + } else { + denylistInputConfig_ = null; + denylistInputConfigBuilder_ = null; + } + lastDenylistImportOperation_ = ""; + + if (allowlistInputConfigBuilder_ == null) { + allowlistInputConfig_ = null; + } else { + allowlistInputConfig_ = null; + allowlistInputConfigBuilder_ = null; + } + lastAllowlistImportOperation_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogProto + .internal_static_google_cloud_retail_v2_CompletionConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfig build() { + com.google.cloud.retail.v2.CompletionConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfig buildPartial() { + com.google.cloud.retail.v2.CompletionConfig result = + new com.google.cloud.retail.v2.CompletionConfig(this); + result.name_ = name_; + result.matchingOrder_ = matchingOrder_; + result.maxSuggestions_ = maxSuggestions_; + result.minPrefixLength_ = minPrefixLength_; + result.autoLearning_ = autoLearning_; + if (suggestionsInputConfigBuilder_ == null) { + result.suggestionsInputConfig_ = suggestionsInputConfig_; + } else { + result.suggestionsInputConfig_ = suggestionsInputConfigBuilder_.build(); + } + result.lastSuggestionsImportOperation_ = lastSuggestionsImportOperation_; + if (denylistInputConfigBuilder_ == null) { + result.denylistInputConfig_ = denylistInputConfig_; + } else { + result.denylistInputConfig_ = denylistInputConfigBuilder_.build(); + } + result.lastDenylistImportOperation_ = lastDenylistImportOperation_; + if (allowlistInputConfigBuilder_ == null) { + result.allowlistInputConfig_ = allowlistInputConfig_; + } else { + result.allowlistInputConfig_ = allowlistInputConfigBuilder_.build(); + } + result.lastAllowlistImportOperation_ = lastAllowlistImportOperation_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CompletionConfig) { + return mergeFrom((com.google.cloud.retail.v2.CompletionConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CompletionConfig other) { + if (other == com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getMatchingOrder().isEmpty()) { + matchingOrder_ = other.matchingOrder_; + onChanged(); + } + if (other.getMaxSuggestions() != 0) { + setMaxSuggestions(other.getMaxSuggestions()); + } + if (other.getMinPrefixLength() != 0) { + setMinPrefixLength(other.getMinPrefixLength()); + } + if (other.getAutoLearning() != false) { + setAutoLearning(other.getAutoLearning()); + } + if (other.hasSuggestionsInputConfig()) { + mergeSuggestionsInputConfig(other.getSuggestionsInputConfig()); + } + if (!other.getLastSuggestionsImportOperation().isEmpty()) { + lastSuggestionsImportOperation_ = other.lastSuggestionsImportOperation_; + onChanged(); + } + if (other.hasDenylistInputConfig()) { + mergeDenylistInputConfig(other.getDenylistInputConfig()); + } + if (!other.getLastDenylistImportOperation().isEmpty()) { + lastDenylistImportOperation_ = other.lastDenylistImportOperation_; + onChanged(); + } + if (other.hasAllowlistInputConfig()) { + mergeAllowlistInputConfig(other.getAllowlistInputConfig()); + } + if (!other.getLastAllowlistImportOperation().isEmpty()) { + lastAllowlistImportOperation_ = other.lastAllowlistImportOperation_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CompletionConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.CompletionConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Immutable. Fully qualified name
+     * `projects/*/locations/*/catalogs/*/completionConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Immutable. Fully qualified name
+     * `projects/*/locations/*/catalogs/*/completionConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Immutable. Fully qualified name
+     * `projects/*/locations/*/catalogs/*/completionConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Fully qualified name
+     * `projects/*/locations/*/catalogs/*/completionConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Fully qualified name
+     * `projects/*/locations/*/catalogs/*/completionConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object matchingOrder_ = ""; + /** + * + * + *
+     * Specifies the matching order for autocomplete suggestions, e.g., a query
+     * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+     * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+     * suggest "red shoes". Currently supported values:
+     * * 'out-of-order'
+     * * 'exact-prefix'
+     * Default value: 'exact-prefix'.
+     * 
+ * + * string matching_order = 2; + * + * @return The matchingOrder. + */ + public java.lang.String getMatchingOrder() { + java.lang.Object ref = matchingOrder_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + matchingOrder_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Specifies the matching order for autocomplete suggestions, e.g., a query
+     * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+     * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+     * suggest "red shoes". Currently supported values:
+     * * 'out-of-order'
+     * * 'exact-prefix'
+     * Default value: 'exact-prefix'.
+     * 
+ * + * string matching_order = 2; + * + * @return The bytes for matchingOrder. + */ + public com.google.protobuf.ByteString getMatchingOrderBytes() { + java.lang.Object ref = matchingOrder_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + matchingOrder_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Specifies the matching order for autocomplete suggestions, e.g., a query
+     * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+     * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+     * suggest "red shoes". Currently supported values:
+     * * 'out-of-order'
+     * * 'exact-prefix'
+     * Default value: 'exact-prefix'.
+     * 
+ * + * string matching_order = 2; + * + * @param value The matchingOrder to set. + * @return This builder for chaining. + */ + public Builder setMatchingOrder(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + matchingOrder_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the matching order for autocomplete suggestions, e.g., a query
+     * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+     * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+     * suggest "red shoes". Currently supported values:
+     * * 'out-of-order'
+     * * 'exact-prefix'
+     * Default value: 'exact-prefix'.
+     * 
+ * + * string matching_order = 2; + * + * @return This builder for chaining. + */ + public Builder clearMatchingOrder() { + + matchingOrder_ = getDefaultInstance().getMatchingOrder(); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the matching order for autocomplete suggestions, e.g., a query
+     * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+     * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+     * suggest "red shoes". Currently supported values:
+     * * 'out-of-order'
+     * * 'exact-prefix'
+     * Default value: 'exact-prefix'.
+     * 
+ * + * string matching_order = 2; + * + * @param value The bytes for matchingOrder to set. + * @return This builder for chaining. + */ + public Builder setMatchingOrderBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + matchingOrder_ = value; + onChanged(); + return this; + } + + private int maxSuggestions_; + /** + * + * + *
+     * The maximum number of autocomplete suggestions returned per term. Default
+     * value is 20. If left unset or set to 0, then will fallback to default
+     * value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 max_suggestions = 3; + * + * @return The maxSuggestions. + */ + @java.lang.Override + public int getMaxSuggestions() { + return maxSuggestions_; + } + /** + * + * + *
+     * The maximum number of autocomplete suggestions returned per term. Default
+     * value is 20. If left unset or set to 0, then will fallback to default
+     * value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 max_suggestions = 3; + * + * @param value The maxSuggestions to set. + * @return This builder for chaining. + */ + public Builder setMaxSuggestions(int value) { + + maxSuggestions_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of autocomplete suggestions returned per term. Default
+     * value is 20. If left unset or set to 0, then will fallback to default
+     * value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 max_suggestions = 3; + * + * @return This builder for chaining. + */ + public Builder clearMaxSuggestions() { + + maxSuggestions_ = 0; + onChanged(); + return this; + } + + private int minPrefixLength_; + /** + * + * + *
+     * The minimum number of characters needed to be typed in order to get
+     * suggestions. Default value is 2. If left unset or set to 0, then will
+     * fallback to default value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 min_prefix_length = 4; + * + * @return The minPrefixLength. + */ + @java.lang.Override + public int getMinPrefixLength() { + return minPrefixLength_; + } + /** + * + * + *
+     * The minimum number of characters needed to be typed in order to get
+     * suggestions. Default value is 2. If left unset or set to 0, then will
+     * fallback to default value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 min_prefix_length = 4; + * + * @param value The minPrefixLength to set. + * @return This builder for chaining. + */ + public Builder setMinPrefixLength(int value) { + + minPrefixLength_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The minimum number of characters needed to be typed in order to get
+     * suggestions. Default value is 2. If left unset or set to 0, then will
+     * fallback to default value.
+     * Value range is 1 to 20.
+     * 
+ * + * int32 min_prefix_length = 4; + * + * @return This builder for chaining. + */ + public Builder clearMinPrefixLength() { + + minPrefixLength_ = 0; + onChanged(); + return this; + } + + private boolean autoLearning_; + /** + * + * + *
+     * If set to true, the auto learning function is enabled. Auto learning uses
+     * user data to generate suggestions using ML techniques. Default value is
+     * false. Only after enabling auto learning can users use `cloud-retail`
+     * data in
+     * [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
+     * 
+ * + * bool auto_learning = 11; + * + * @return The autoLearning. + */ + @java.lang.Override + public boolean getAutoLearning() { + return autoLearning_; + } + /** + * + * + *
+     * If set to true, the auto learning function is enabled. Auto learning uses
+     * user data to generate suggestions using ML techniques. Default value is
+     * false. Only after enabling auto learning can users use `cloud-retail`
+     * data in
+     * [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
+     * 
+ * + * bool auto_learning = 11; + * + * @param value The autoLearning to set. + * @return This builder for chaining. + */ + public Builder setAutoLearning(boolean value) { + + autoLearning_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, the auto learning function is enabled. Auto learning uses
+     * user data to generate suggestions using ML techniques. Default value is
+     * false. Only after enabling auto learning can users use `cloud-retail`
+     * data in
+     * [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
+     * 
+ * + * bool auto_learning = 11; + * + * @return This builder for chaining. + */ + public Builder clearAutoLearning() { + + autoLearning_ = false; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.CompletionDataInputConfig suggestionsInputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + suggestionsInputConfigBuilder_; + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the suggestionsInputConfig field is set. + */ + public boolean hasSuggestionsInputConfig() { + return suggestionsInputConfigBuilder_ != null || suggestionsInputConfig_ != null; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The suggestionsInputConfig. + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig getSuggestionsInputConfig() { + if (suggestionsInputConfigBuilder_ == null) { + return suggestionsInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : suggestionsInputConfig_; + } else { + return suggestionsInputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSuggestionsInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (suggestionsInputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + suggestionsInputConfig_ = value; + onChanged(); + } else { + suggestionsInputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSuggestionsInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder builderForValue) { + if (suggestionsInputConfigBuilder_ == null) { + suggestionsInputConfig_ = builderForValue.build(); + onChanged(); + } else { + suggestionsInputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeSuggestionsInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (suggestionsInputConfigBuilder_ == null) { + if (suggestionsInputConfig_ != null) { + suggestionsInputConfig_ = + com.google.cloud.retail.v2.CompletionDataInputConfig.newBuilder( + suggestionsInputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + suggestionsInputConfig_ = value; + } + onChanged(); + } else { + suggestionsInputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearSuggestionsInputConfig() { + if (suggestionsInputConfigBuilder_ == null) { + suggestionsInputConfig_ = null; + onChanged(); + } else { + suggestionsInputConfig_ = null; + suggestionsInputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig.Builder + getSuggestionsInputConfigBuilder() { + + onChanged(); + return getSuggestionsInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getSuggestionsInputConfigOrBuilder() { + if (suggestionsInputConfigBuilder_ != null) { + return suggestionsInputConfigBuilder_.getMessageOrBuilder(); + } else { + return suggestionsInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : suggestionsInputConfig_; + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * suggestion phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + getSuggestionsInputConfigFieldBuilder() { + if (suggestionsInputConfigBuilder_ == null) { + suggestionsInputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder>( + getSuggestionsInputConfig(), getParentForChildren(), isClean()); + suggestionsInputConfig_ = null; + } + return suggestionsInputConfigBuilder_; + } + + private java.lang.Object lastSuggestionsImportOperation_ = ""; + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest suggestion terms
+     * list import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastSuggestionsImportOperation. + */ + public java.lang.String getLastSuggestionsImportOperation() { + java.lang.Object ref = lastSuggestionsImportOperation_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastSuggestionsImportOperation_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest suggestion terms
+     * list import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastSuggestionsImportOperation. + */ + public com.google.protobuf.ByteString getLastSuggestionsImportOperationBytes() { + java.lang.Object ref = lastSuggestionsImportOperation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastSuggestionsImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest suggestion terms
+     * list import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The lastSuggestionsImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastSuggestionsImportOperation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + lastSuggestionsImportOperation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest suggestion terms
+     * list import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearLastSuggestionsImportOperation() { + + lastSuggestionsImportOperation_ = getDefaultInstance().getLastSuggestionsImportOperation(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest suggestion terms
+     * list import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for lastSuggestionsImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastSuggestionsImportOperationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + lastSuggestionsImportOperation_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.CompletionDataInputConfig denylistInputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + denylistInputConfigBuilder_; + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the denylistInputConfig field is set. + */ + public boolean hasDenylistInputConfig() { + return denylistInputConfigBuilder_ != null || denylistInputConfig_ != null; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The denylistInputConfig. + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig getDenylistInputConfig() { + if (denylistInputConfigBuilder_ == null) { + return denylistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : denylistInputConfig_; + } else { + return denylistInputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDenylistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (denylistInputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + denylistInputConfig_ = value; + onChanged(); + } else { + denylistInputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDenylistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder builderForValue) { + if (denylistInputConfigBuilder_ == null) { + denylistInputConfig_ = builderForValue.build(); + onChanged(); + } else { + denylistInputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDenylistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (denylistInputConfigBuilder_ == null) { + if (denylistInputConfig_ != null) { + denylistInputConfig_ = + com.google.cloud.retail.v2.CompletionDataInputConfig.newBuilder(denylistInputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + denylistInputConfig_ = value; + } + onChanged(); + } else { + denylistInputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDenylistInputConfig() { + if (denylistInputConfigBuilder_ == null) { + denylistInputConfig_ = null; + onChanged(); + } else { + denylistInputConfig_ = null; + denylistInputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig.Builder + getDenylistInputConfigBuilder() { + + onChanged(); + return getDenylistInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getDenylistInputConfigOrBuilder() { + if (denylistInputConfigBuilder_ != null) { + return denylistInputConfigBuilder_.getMessageOrBuilder(); + } else { + return denylistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : denylistInputConfig_; + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * denylist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + getDenylistInputConfigFieldBuilder() { + if (denylistInputConfigBuilder_ == null) { + denylistInputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder>( + getDenylistInputConfig(), getParentForChildren(), isClean()); + denylistInputConfig_ = null; + } + return denylistInputConfigBuilder_; + } + + private java.lang.Object lastDenylistImportOperation_ = ""; + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest denylist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastDenylistImportOperation. + */ + public java.lang.String getLastDenylistImportOperation() { + java.lang.Object ref = lastDenylistImportOperation_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastDenylistImportOperation_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest denylist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastDenylistImportOperation. + */ + public com.google.protobuf.ByteString getLastDenylistImportOperationBytes() { + java.lang.Object ref = lastDenylistImportOperation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastDenylistImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest denylist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The lastDenylistImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastDenylistImportOperation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + lastDenylistImportOperation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest denylist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearLastDenylistImportOperation() { + + lastDenylistImportOperation_ = getDefaultInstance().getLastDenylistImportOperation(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest denylist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for lastDenylistImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastDenylistImportOperationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + lastDenylistImportOperation_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.CompletionDataInputConfig allowlistInputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + allowlistInputConfigBuilder_; + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the allowlistInputConfig field is set. + */ + public boolean hasAllowlistInputConfig() { + return allowlistInputConfigBuilder_ != null || allowlistInputConfig_ != null; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowlistInputConfig. + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig getAllowlistInputConfig() { + if (allowlistInputConfigBuilder_ == null) { + return allowlistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : allowlistInputConfig_; + } else { + return allowlistInputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setAllowlistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (allowlistInputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + allowlistInputConfig_ = value; + onChanged(); + } else { + allowlistInputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setAllowlistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder builderForValue) { + if (allowlistInputConfigBuilder_ == null) { + allowlistInputConfig_ = builderForValue.build(); + onChanged(); + } else { + allowlistInputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeAllowlistInputConfig( + com.google.cloud.retail.v2.CompletionDataInputConfig value) { + if (allowlistInputConfigBuilder_ == null) { + if (allowlistInputConfig_ != null) { + allowlistInputConfig_ = + com.google.cloud.retail.v2.CompletionDataInputConfig.newBuilder(allowlistInputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + allowlistInputConfig_ = value; + } + onChanged(); + } else { + allowlistInputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearAllowlistInputConfig() { + if (allowlistInputConfigBuilder_ == null) { + allowlistInputConfig_ = null; + onChanged(); + } else { + allowlistInputConfig_ = null; + allowlistInputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfig.Builder + getAllowlistInputConfigBuilder() { + + onChanged(); + return getAllowlistInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getAllowlistInputConfigOrBuilder() { + if (allowlistInputConfigBuilder_ != null) { + return allowlistInputConfigBuilder_.getMessageOrBuilder(); + } else { + return allowlistInputConfig_ == null + ? com.google.cloud.retail.v2.CompletionDataInputConfig.getDefaultInstance() + : allowlistInputConfig_; + } + } + /** + * + * + *
+     * Output only. The source data for the latest import of the autocomplete
+     * allowlist phrases.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder> + getAllowlistInputConfigFieldBuilder() { + if (allowlistInputConfigBuilder_ == null) { + allowlistInputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionDataInputConfig, + com.google.cloud.retail.v2.CompletionDataInputConfig.Builder, + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder>( + getAllowlistInputConfig(), getParentForChildren(), isClean()); + allowlistInputConfig_ = null; + } + return allowlistInputConfigBuilder_; + } + + private java.lang.Object lastAllowlistImportOperation_ = ""; + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest allowlist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAllowlistImportOperation. + */ + public java.lang.String getLastAllowlistImportOperation() { + java.lang.Object ref = lastAllowlistImportOperation_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastAllowlistImportOperation_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest allowlist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastAllowlistImportOperation. + */ + public com.google.protobuf.ByteString getLastAllowlistImportOperationBytes() { + java.lang.Object ref = lastAllowlistImportOperation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastAllowlistImportOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest allowlist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The lastAllowlistImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastAllowlistImportOperation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + lastAllowlistImportOperation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest allowlist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearLastAllowlistImportOperation() { + + lastAllowlistImportOperation_ = getDefaultInstance().getLastAllowlistImportOperation(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the LRO corresponding to the latest allowlist import.
+     * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+     * retrieve the latest state of the Long Running Operation.
+     * 
+ * + * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for lastAllowlistImportOperation to set. + * @return This builder for chaining. + */ + public Builder setLastAllowlistImportOperationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + lastAllowlistImportOperation_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CompletionConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CompletionConfig) + private static final com.google.cloud.retail.v2.CompletionConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CompletionConfig(); + } + + public static com.google.cloud.retail.v2.CompletionConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CompletionConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CompletionConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigName.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigName.java new file mode 100644 index 000000000000..cebf811d4eb1 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class CompletionConfigName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + + @Deprecated + protected CompletionConfigName() { + project = null; + location = null; + catalog = null; + } + + private CompletionConfigName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static CompletionConfigName of(String project, String location, String catalog) { + return newBuilder().setProject(project).setLocation(location).setCatalog(catalog).build(); + } + + public static String format(String project, String location, String catalog) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .build() + .toString(); + } + + public static CompletionConfigName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG.validatedMatch( + formattedString, "CompletionConfigName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("catalog")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (CompletionConfigName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG.instantiate( + "project", project, "location", location, "catalog", catalog); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + CompletionConfigName that = ((CompletionConfigName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + return h; + } + + /** Builder for projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig. */ + public static class Builder { + private String project; + private String location; + private String catalog; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + private Builder(CompletionConfigName completionConfigName) { + this.project = completionConfigName.project; + this.location = completionConfigName.location; + this.catalog = completionConfigName.catalog; + } + + public CompletionConfigName build() { + return new CompletionConfigName(this); + } + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigOrBuilder.java new file mode 100644 index 000000000000..c65b27977ace --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CompletionConfigOrBuilder.java @@ -0,0 +1,372 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog.proto + +package com.google.cloud.retail.v2; + +public interface CompletionConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CompletionConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Immutable. Fully qualified name
+   * `projects/*/locations/*/catalogs/*/completionConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Immutable. Fully qualified name
+   * `projects/*/locations/*/catalogs/*/completionConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Specifies the matching order for autocomplete suggestions, e.g., a query
+   * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+   * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+   * suggest "red shoes". Currently supported values:
+   * * 'out-of-order'
+   * * 'exact-prefix'
+   * Default value: 'exact-prefix'.
+   * 
+ * + * string matching_order = 2; + * + * @return The matchingOrder. + */ + java.lang.String getMatchingOrder(); + /** + * + * + *
+   * Specifies the matching order for autocomplete suggestions, e.g., a query
+   * consisting of 'sh' with 'out-of-order' specified would suggest "women's
+   * shoes", whereas a query of 'red s' with 'exact-prefix' specified would
+   * suggest "red shoes". Currently supported values:
+   * * 'out-of-order'
+   * * 'exact-prefix'
+   * Default value: 'exact-prefix'.
+   * 
+ * + * string matching_order = 2; + * + * @return The bytes for matchingOrder. + */ + com.google.protobuf.ByteString getMatchingOrderBytes(); + + /** + * + * + *
+   * The maximum number of autocomplete suggestions returned per term. Default
+   * value is 20. If left unset or set to 0, then will fallback to default
+   * value.
+   * Value range is 1 to 20.
+   * 
+ * + * int32 max_suggestions = 3; + * + * @return The maxSuggestions. + */ + int getMaxSuggestions(); + + /** + * + * + *
+   * The minimum number of characters needed to be typed in order to get
+   * suggestions. Default value is 2. If left unset or set to 0, then will
+   * fallback to default value.
+   * Value range is 1 to 20.
+   * 
+ * + * int32 min_prefix_length = 4; + * + * @return The minPrefixLength. + */ + int getMinPrefixLength(); + + /** + * + * + *
+   * If set to true, the auto learning function is enabled. Auto learning uses
+   * user data to generate suggestions using ML techniques. Default value is
+   * false. Only after enabling auto learning can users use `cloud-retail`
+   * data in
+   * [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
+   * 
+ * + * bool auto_learning = 11; + * + * @return The autoLearning. + */ + boolean getAutoLearning(); + + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the suggestionsInputConfig field is set. + */ + boolean hasSuggestionsInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The suggestionsInputConfig. + */ + com.google.cloud.retail.v2.CompletionDataInputConfig getSuggestionsInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * suggestion phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig suggestions_input_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder + getSuggestionsInputConfigOrBuilder(); + + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest suggestion terms
+   * list import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastSuggestionsImportOperation. + */ + java.lang.String getLastSuggestionsImportOperation(); + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest suggestion terms
+   * list import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * + * string last_suggestions_import_operation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastSuggestionsImportOperation. + */ + com.google.protobuf.ByteString getLastSuggestionsImportOperationBytes(); + + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the denylistInputConfig field is set. + */ + boolean hasDenylistInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The denylistInputConfig. + */ + com.google.cloud.retail.v2.CompletionDataInputConfig getDenylistInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * denylist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig denylist_input_config = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder getDenylistInputConfigOrBuilder(); + + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest denylist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastDenylistImportOperation. + */ + java.lang.String getLastDenylistImportOperation(); + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest denylist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_denylist_import_operation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastDenylistImportOperation. + */ + com.google.protobuf.ByteString getLastDenylistImportOperationBytes(); + + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the allowlistInputConfig field is set. + */ + boolean hasAllowlistInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowlistInputConfig. + */ + com.google.cloud.retail.v2.CompletionDataInputConfig getAllowlistInputConfig(); + /** + * + * + *
+   * Output only. The source data for the latest import of the autocomplete
+   * allowlist phrases.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionDataInputConfig allowlist_input_config = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder getAllowlistInputConfigOrBuilder(); + + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest allowlist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAllowlistImportOperation. + */ + java.lang.String getLastAllowlistImportOperation(); + /** + * + * + *
+   * Output only. Name of the LRO corresponding to the latest allowlist import.
+   * Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
+   * retrieve the latest state of the Long Running Operation.
+   * 
+ * + * string last_allowlist_import_operation = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for lastAllowlistImportOperation. + */ + com.google.protobuf.ByteString getLastAllowlistImportOperationBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Condition.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Condition.java new file mode 100644 index 000000000000..0c04714f9d5a --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Condition.java @@ -0,0 +1,3415 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Metadata that is used to define a condition that triggers an action.
+ * A valid condition must specify at least one of 'query_terms' or
+ * 'products_filter'. If multiple fields are specified, the condition is met if
+ * all the fields are satisfied e.g. if a set of query terms and product_filter
+ * are set, then only items matching the product_filter for requests with a
+ * query matching the query terms wil get boosted.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition} + */ +public final class Condition extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Condition) + ConditionOrBuilder { + private static final long serialVersionUID = 0L; + // Use Condition.newBuilder() to construct. + private Condition(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Condition() { + queryTerms_ = java.util.Collections.emptyList(); + activeTimeRange_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Condition(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Condition( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + queryTerms_.add( + input.readMessage( + com.google.cloud.retail.v2.Condition.QueryTerm.parser(), extensionRegistry)); + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + activeTimeRange_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + activeTimeRange_.add( + input.readMessage( + com.google.cloud.retail.v2.Condition.TimeRange.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = java.util.Collections.unmodifiableList(queryTerms_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + activeTimeRange_ = java.util.Collections.unmodifiableList(activeTimeRange_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.class, + com.google.cloud.retail.v2.Condition.Builder.class); + } + + public interface QueryTermOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Condition.QueryTerm) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The value of the term to match on.
+     * Value cannot be empty.
+     * Value can have at most 3 terms if specified as a partial match. Each
+     * space separated string is considered as one term.
+     * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+     * allowed for partial match.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + java.lang.String getValue(); + /** + * + * + *
+     * The value of the term to match on.
+     * Value cannot be empty.
+     * Value can have at most 3 terms if specified as a partial match. Each
+     * space separated string is considered as one term.
+     * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+     * allowed for partial match.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + com.google.protobuf.ByteString getValueBytes(); + + /** + * + * + *
+     * Whether this is supposed to be a full or partial match.
+     * 
+ * + * bool full_match = 2; + * + * @return The fullMatch. + */ + boolean getFullMatch(); + } + /** + * + * + *
+   * Query terms that we want to match on.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition.QueryTerm} + */ + public static final class QueryTerm extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Condition.QueryTerm) + QueryTermOrBuilder { + private static final long serialVersionUID = 0L; + // Use QueryTerm.newBuilder() to construct. + private QueryTerm(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private QueryTerm() { + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new QueryTerm(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private QueryTerm( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + case 16: + { + fullMatch_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_QueryTerm_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_QueryTerm_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.QueryTerm.class, + com.google.cloud.retail.v2.Condition.QueryTerm.Builder.class); + } + + public static final int VALUE_FIELD_NUMBER = 1; + private volatile java.lang.Object value_; + /** + * + * + *
+     * The value of the term to match on.
+     * Value cannot be empty.
+     * Value can have at most 3 terms if specified as a partial match. Each
+     * space separated string is considered as one term.
+     * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+     * allowed for partial match.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * + * + *
+     * The value of the term to match on.
+     * Value cannot be empty.
+     * Value can have at most 3 terms if specified as a partial match. Each
+     * space separated string is considered as one term.
+     * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+     * allowed for partial match.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FULL_MATCH_FIELD_NUMBER = 2; + private boolean fullMatch_; + /** + * + * + *
+     * Whether this is supposed to be a full or partial match.
+     * 
+ * + * bool full_match = 2; + * + * @return The fullMatch. + */ + @java.lang.Override + public boolean getFullMatch() { + return fullMatch_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + } + if (fullMatch_ != false) { + output.writeBool(2, fullMatch_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + } + if (fullMatch_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, fullMatch_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Condition.QueryTerm)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Condition.QueryTerm other = + (com.google.cloud.retail.v2.Condition.QueryTerm) obj; + + if (!getValue().equals(other.getValue())) return false; + if (getFullMatch() != other.getFullMatch()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (37 * hash) + FULL_MATCH_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getFullMatch()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Condition.QueryTerm prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Query terms that we want to match on.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition.QueryTerm} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Condition.QueryTerm) + com.google.cloud.retail.v2.Condition.QueryTermOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_QueryTerm_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_QueryTerm_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.QueryTerm.class, + com.google.cloud.retail.v2.Condition.QueryTerm.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Condition.QueryTerm.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + value_ = ""; + + fullMatch_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_QueryTerm_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTerm getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Condition.QueryTerm.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTerm build() { + com.google.cloud.retail.v2.Condition.QueryTerm result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTerm buildPartial() { + com.google.cloud.retail.v2.Condition.QueryTerm result = + new com.google.cloud.retail.v2.Condition.QueryTerm(this); + result.value_ = value_; + result.fullMatch_ = fullMatch_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Condition.QueryTerm) { + return mergeFrom((com.google.cloud.retail.v2.Condition.QueryTerm) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Condition.QueryTerm other) { + if (other == com.google.cloud.retail.v2.Condition.QueryTerm.getDefaultInstance()) + return this; + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + if (other.getFullMatch() != false) { + setFullMatch(other.getFullMatch()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Condition.QueryTerm parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Condition.QueryTerm) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object value_ = ""; + /** + * + * + *
+       * The value of the term to match on.
+       * Value cannot be empty.
+       * Value can have at most 3 terms if specified as a partial match. Each
+       * space separated string is considered as one term.
+       * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+       * allowed for partial match.
+       * 
+ * + * string value = 1; + * + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The value of the term to match on.
+       * Value cannot be empty.
+       * Value can have at most 3 terms if specified as a partial match. Each
+       * space separated string is considered as one term.
+       * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+       * allowed for partial match.
+       * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The value of the term to match on.
+       * Value cannot be empty.
+       * Value can have at most 3 terms if specified as a partial match. Each
+       * space separated string is considered as one term.
+       * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+       * allowed for partial match.
+       * 
+ * + * string value = 1; + * + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The value of the term to match on.
+       * Value cannot be empty.
+       * Value can have at most 3 terms if specified as a partial match. Each
+       * space separated string is considered as one term.
+       * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+       * allowed for partial match.
+       * 
+ * + * string value = 1; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * + * + *
+       * The value of the term to match on.
+       * Value cannot be empty.
+       * Value can have at most 3 terms if specified as a partial match. Each
+       * space separated string is considered as one term.
+       * Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not
+       * allowed for partial match.
+       * 
+ * + * string value = 1; + * + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + + private boolean fullMatch_; + /** + * + * + *
+       * Whether this is supposed to be a full or partial match.
+       * 
+ * + * bool full_match = 2; + * + * @return The fullMatch. + */ + @java.lang.Override + public boolean getFullMatch() { + return fullMatch_; + } + /** + * + * + *
+       * Whether this is supposed to be a full or partial match.
+       * 
+ * + * bool full_match = 2; + * + * @param value The fullMatch to set. + * @return This builder for chaining. + */ + public Builder setFullMatch(boolean value) { + + fullMatch_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Whether this is supposed to be a full or partial match.
+       * 
+ * + * bool full_match = 2; + * + * @return This builder for chaining. + */ + public Builder clearFullMatch() { + + fullMatch_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Condition.QueryTerm) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Condition.QueryTerm) + private static final com.google.cloud.retail.v2.Condition.QueryTerm DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Condition.QueryTerm(); + } + + public static com.google.cloud.retail.v2.Condition.QueryTerm getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public QueryTerm parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new QueryTerm(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTerm getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface TimeRangeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Condition.TimeRange) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); + } + /** + * + * + *
+   * Used for time-dependent conditions.
+   * Example: Want to have rule applied for week long sale.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition.TimeRange} + */ + public static final class TimeRange extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Condition.TimeRange) + TimeRangeOrBuilder { + private static final long serialVersionUID = 0L; + // Use TimeRange.newBuilder() to construct. + private TimeRange(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TimeRange() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new TimeRange(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TimeRange( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (startTime_ != null) { + subBuilder = startTime_.toBuilder(); + } + startTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(startTime_); + startTime_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_TimeRange_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_TimeRange_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.TimeRange.class, + com.google.cloud.retail.v2.Condition.TimeRange.Builder.class); + } + + public static final int START_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+     * Start of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return getStartTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return Whether the endTime field is set. + */ + @java.lang.Override + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return The endTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+     * End of time range. Range is inclusive.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (startTime_ != null) { + output.writeMessage(1, getStartTime()); + } + if (endTime_ != null) { + output.writeMessage(2, getEndTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStartTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getEndTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Condition.TimeRange)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Condition.TimeRange other = + (com.google.cloud.retail.v2.Condition.TimeRange) obj; + + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Condition.TimeRange prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Used for time-dependent conditions.
+     * Example: Want to have rule applied for week long sale.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition.TimeRange} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Condition.TimeRange) + com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_TimeRange_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_TimeRange_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.TimeRange.class, + com.google.cloud.retail.v2.Condition.TimeRange.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Condition.TimeRange.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (startTimeBuilder_ == null) { + startTime_ = null; + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_TimeRange_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRange getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Condition.TimeRange.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRange build() { + com.google.cloud.retail.v2.Condition.TimeRange result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRange buildPartial() { + com.google.cloud.retail.v2.Condition.TimeRange result = + new com.google.cloud.retail.v2.Condition.TimeRange(this); + if (startTimeBuilder_ == null) { + result.startTime_ = startTime_; + } else { + result.startTime_ = startTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Condition.TimeRange) { + return mergeFrom((com.google.cloud.retail.v2.Condition.TimeRange) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Condition.TimeRange other) { + if (other == com.google.cloud.retail.v2.Condition.TimeRange.getDefaultInstance()) + return this; + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Condition.TimeRange parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Condition.TimeRange) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTimeBuilder_ != null || startTime_ != null; + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + onChanged(); + } else { + startTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + onChanged(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (startTime_ != null) { + startTime_ = + com.google.protobuf.Timestamp.newBuilder(startTime_) + .mergeFrom(value) + .buildPartial(); + } else { + startTime_ = value; + } + onChanged(); + } else { + startTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder clearStartTime() { + if (startTimeBuilder_ == null) { + startTime_ = null; + onChanged(); + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : startTime_; + } + } + /** + * + * + *
+       * Start of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+       * End of time range. Range is inclusive.
+       * 
+ * + * .google.protobuf.Timestamp end_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Condition.TimeRange) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Condition.TimeRange) + private static final com.google.cloud.retail.v2.Condition.TimeRange DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Condition.TimeRange(); + } + + public static com.google.cloud.retail.v2.Condition.TimeRange getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TimeRange parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TimeRange(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRange getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int QUERY_TERMS_FIELD_NUMBER = 1; + private java.util.List queryTerms_; + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + @java.lang.Override + public java.util.List getQueryTermsList() { + return queryTerms_; + } + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + @java.lang.Override + public java.util.List + getQueryTermsOrBuilderList() { + return queryTerms_; + } + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + @java.lang.Override + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTerm getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Condition.QueryTermOrBuilder getQueryTermsOrBuilder(int index) { + return queryTerms_.get(index); + } + + public static final int ACTIVE_TIME_RANGE_FIELD_NUMBER = 3; + private java.util.List activeTimeRange_; + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + @java.lang.Override + public java.util.List getActiveTimeRangeList() { + return activeTimeRange_; + } + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + @java.lang.Override + public java.util.List + getActiveTimeRangeOrBuilderList() { + return activeTimeRange_; + } + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + @java.lang.Override + public int getActiveTimeRangeCount() { + return activeTimeRange_.size(); + } + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRange getActiveTimeRange(int index) { + return activeTimeRange_.get(index); + } + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder getActiveTimeRangeOrBuilder( + int index) { + return activeTimeRange_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < queryTerms_.size(); i++) { + output.writeMessage(1, queryTerms_.get(i)); + } + for (int i = 0; i < activeTimeRange_.size(); i++) { + output.writeMessage(3, activeTimeRange_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < queryTerms_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, queryTerms_.get(i)); + } + for (int i = 0; i < activeTimeRange_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, activeTimeRange_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Condition)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Condition other = (com.google.cloud.retail.v2.Condition) obj; + + if (!getQueryTermsList().equals(other.getQueryTermsList())) return false; + if (!getActiveTimeRangeList().equals(other.getActiveTimeRangeList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getQueryTermsCount() > 0) { + hash = (37 * hash) + QUERY_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getQueryTermsList().hashCode(); + } + if (getActiveTimeRangeCount() > 0) { + hash = (37 * hash) + ACTIVE_TIME_RANGE_FIELD_NUMBER; + hash = (53 * hash) + getActiveTimeRangeList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Condition parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Condition parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Condition prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata that is used to define a condition that triggers an action.
+   * A valid condition must specify at least one of 'query_terms' or
+   * 'products_filter'. If multiple fields are specified, the condition is met if
+   * all the fields are satisfied e.g. if a set of query terms and product_filter
+   * are set, then only items matching the product_filter for requests with a
+   * query matching the query terms wil get boosted.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Condition} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Condition) + com.google.cloud.retail.v2.ConditionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Condition.class, + com.google.cloud.retail.v2.Condition.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Condition.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getQueryTermsFieldBuilder(); + getActiveTimeRangeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (queryTermsBuilder_ == null) { + queryTerms_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + queryTermsBuilder_.clear(); + } + if (activeTimeRangeBuilder_ == null) { + activeTimeRange_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + activeTimeRangeBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Condition_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Condition.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition build() { + com.google.cloud.retail.v2.Condition result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition buildPartial() { + com.google.cloud.retail.v2.Condition result = new com.google.cloud.retail.v2.Condition(this); + int from_bitField0_ = bitField0_; + if (queryTermsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = java.util.Collections.unmodifiableList(queryTerms_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.queryTerms_ = queryTerms_; + } else { + result.queryTerms_ = queryTermsBuilder_.build(); + } + if (activeTimeRangeBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + activeTimeRange_ = java.util.Collections.unmodifiableList(activeTimeRange_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.activeTimeRange_ = activeTimeRange_; + } else { + result.activeTimeRange_ = activeTimeRangeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Condition) { + return mergeFrom((com.google.cloud.retail.v2.Condition) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Condition other) { + if (other == com.google.cloud.retail.v2.Condition.getDefaultInstance()) return this; + if (queryTermsBuilder_ == null) { + if (!other.queryTerms_.isEmpty()) { + if (queryTerms_.isEmpty()) { + queryTerms_ = other.queryTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureQueryTermsIsMutable(); + queryTerms_.addAll(other.queryTerms_); + } + onChanged(); + } + } else { + if (!other.queryTerms_.isEmpty()) { + if (queryTermsBuilder_.isEmpty()) { + queryTermsBuilder_.dispose(); + queryTermsBuilder_ = null; + queryTerms_ = other.queryTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + queryTermsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getQueryTermsFieldBuilder() + : null; + } else { + queryTermsBuilder_.addAllMessages(other.queryTerms_); + } + } + } + if (activeTimeRangeBuilder_ == null) { + if (!other.activeTimeRange_.isEmpty()) { + if (activeTimeRange_.isEmpty()) { + activeTimeRange_ = other.activeTimeRange_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.addAll(other.activeTimeRange_); + } + onChanged(); + } + } else { + if (!other.activeTimeRange_.isEmpty()) { + if (activeTimeRangeBuilder_.isEmpty()) { + activeTimeRangeBuilder_.dispose(); + activeTimeRangeBuilder_ = null; + activeTimeRange_ = other.activeTimeRange_; + bitField0_ = (bitField0_ & ~0x00000002); + activeTimeRangeBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getActiveTimeRangeFieldBuilder() + : null; + } else { + activeTimeRangeBuilder_.addAllMessages(other.activeTimeRange_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Condition parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Condition) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List queryTerms_ = + java.util.Collections.emptyList(); + + private void ensureQueryTermsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = + new java.util.ArrayList(queryTerms_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.QueryTerm, + com.google.cloud.retail.v2.Condition.QueryTerm.Builder, + com.google.cloud.retail.v2.Condition.QueryTermOrBuilder> + queryTermsBuilder_; + + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public java.util.List getQueryTermsList() { + if (queryTermsBuilder_ == null) { + return java.util.Collections.unmodifiableList(queryTerms_); + } else { + return queryTermsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public int getQueryTermsCount() { + if (queryTermsBuilder_ == null) { + return queryTerms_.size(); + } else { + return queryTermsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public com.google.cloud.retail.v2.Condition.QueryTerm getQueryTerms(int index) { + if (queryTermsBuilder_ == null) { + return queryTerms_.get(index); + } else { + return queryTermsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder setQueryTerms(int index, com.google.cloud.retail.v2.Condition.QueryTerm value) { + if (queryTermsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.set(index, value); + onChanged(); + } else { + queryTermsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder setQueryTerms( + int index, com.google.cloud.retail.v2.Condition.QueryTerm.Builder builderForValue) { + if (queryTermsBuilder_ == null) { + ensureQueryTermsIsMutable(); + queryTerms_.set(index, builderForValue.build()); + onChanged(); + } else { + queryTermsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder addQueryTerms(com.google.cloud.retail.v2.Condition.QueryTerm value) { + if (queryTermsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + } else { + queryTermsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder addQueryTerms(int index, com.google.cloud.retail.v2.Condition.QueryTerm value) { + if (queryTermsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.add(index, value); + onChanged(); + } else { + queryTermsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder addQueryTerms( + com.google.cloud.retail.v2.Condition.QueryTerm.Builder builderForValue) { + if (queryTermsBuilder_ == null) { + ensureQueryTermsIsMutable(); + queryTerms_.add(builderForValue.build()); + onChanged(); + } else { + queryTermsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder addQueryTerms( + int index, com.google.cloud.retail.v2.Condition.QueryTerm.Builder builderForValue) { + if (queryTermsBuilder_ == null) { + ensureQueryTermsIsMutable(); + queryTerms_.add(index, builderForValue.build()); + onChanged(); + } else { + queryTermsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder addAllQueryTerms( + java.lang.Iterable values) { + if (queryTermsBuilder_ == null) { + ensureQueryTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, queryTerms_); + onChanged(); + } else { + queryTermsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder clearQueryTerms() { + if (queryTermsBuilder_ == null) { + queryTerms_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + queryTermsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public Builder removeQueryTerms(int index) { + if (queryTermsBuilder_ == null) { + ensureQueryTermsIsMutable(); + queryTerms_.remove(index); + onChanged(); + } else { + queryTermsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public com.google.cloud.retail.v2.Condition.QueryTerm.Builder getQueryTermsBuilder(int index) { + return getQueryTermsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public com.google.cloud.retail.v2.Condition.QueryTermOrBuilder getQueryTermsOrBuilder( + int index) { + if (queryTermsBuilder_ == null) { + return queryTerms_.get(index); + } else { + return queryTermsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public java.util.List + getQueryTermsOrBuilderList() { + if (queryTermsBuilder_ != null) { + return queryTermsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(queryTerms_); + } + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public com.google.cloud.retail.v2.Condition.QueryTerm.Builder addQueryTermsBuilder() { + return getQueryTermsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Condition.QueryTerm.getDefaultInstance()); + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public com.google.cloud.retail.v2.Condition.QueryTerm.Builder addQueryTermsBuilder(int index) { + return getQueryTermsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Condition.QueryTerm.getDefaultInstance()); + } + /** + * + * + *
+     * A list (up to 10 entries) of terms to match the query on. If not
+     * specified, match all queries.
+     * If many query terms are specified, the condition
+     * is matched if any of the terms is a match (i.e. using the OR operator).
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + public java.util.List + getQueryTermsBuilderList() { + return getQueryTermsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.QueryTerm, + com.google.cloud.retail.v2.Condition.QueryTerm.Builder, + com.google.cloud.retail.v2.Condition.QueryTermOrBuilder> + getQueryTermsFieldBuilder() { + if (queryTermsBuilder_ == null) { + queryTermsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.QueryTerm, + com.google.cloud.retail.v2.Condition.QueryTerm.Builder, + com.google.cloud.retail.v2.Condition.QueryTermOrBuilder>( + queryTerms_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + queryTerms_ = null; + } + return queryTermsBuilder_; + } + + private java.util.List activeTimeRange_ = + java.util.Collections.emptyList(); + + private void ensureActiveTimeRangeIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + activeTimeRange_ = + new java.util.ArrayList( + activeTimeRange_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.TimeRange, + com.google.cloud.retail.v2.Condition.TimeRange.Builder, + com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder> + activeTimeRangeBuilder_; + + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public java.util.List getActiveTimeRangeList() { + if (activeTimeRangeBuilder_ == null) { + return java.util.Collections.unmodifiableList(activeTimeRange_); + } else { + return activeTimeRangeBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public int getActiveTimeRangeCount() { + if (activeTimeRangeBuilder_ == null) { + return activeTimeRange_.size(); + } else { + return activeTimeRangeBuilder_.getCount(); + } + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public com.google.cloud.retail.v2.Condition.TimeRange getActiveTimeRange(int index) { + if (activeTimeRangeBuilder_ == null) { + return activeTimeRange_.get(index); + } else { + return activeTimeRangeBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder setActiveTimeRange( + int index, com.google.cloud.retail.v2.Condition.TimeRange value) { + if (activeTimeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.set(index, value); + onChanged(); + } else { + activeTimeRangeBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder setActiveTimeRange( + int index, com.google.cloud.retail.v2.Condition.TimeRange.Builder builderForValue) { + if (activeTimeRangeBuilder_ == null) { + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.set(index, builderForValue.build()); + onChanged(); + } else { + activeTimeRangeBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder addActiveTimeRange(com.google.cloud.retail.v2.Condition.TimeRange value) { + if (activeTimeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.add(value); + onChanged(); + } else { + activeTimeRangeBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder addActiveTimeRange( + int index, com.google.cloud.retail.v2.Condition.TimeRange value) { + if (activeTimeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.add(index, value); + onChanged(); + } else { + activeTimeRangeBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder addActiveTimeRange( + com.google.cloud.retail.v2.Condition.TimeRange.Builder builderForValue) { + if (activeTimeRangeBuilder_ == null) { + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.add(builderForValue.build()); + onChanged(); + } else { + activeTimeRangeBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder addActiveTimeRange( + int index, com.google.cloud.retail.v2.Condition.TimeRange.Builder builderForValue) { + if (activeTimeRangeBuilder_ == null) { + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.add(index, builderForValue.build()); + onChanged(); + } else { + activeTimeRangeBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder addAllActiveTimeRange( + java.lang.Iterable values) { + if (activeTimeRangeBuilder_ == null) { + ensureActiveTimeRangeIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, activeTimeRange_); + onChanged(); + } else { + activeTimeRangeBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder clearActiveTimeRange() { + if (activeTimeRangeBuilder_ == null) { + activeTimeRange_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + activeTimeRangeBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public Builder removeActiveTimeRange(int index) { + if (activeTimeRangeBuilder_ == null) { + ensureActiveTimeRangeIsMutable(); + activeTimeRange_.remove(index); + onChanged(); + } else { + activeTimeRangeBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public com.google.cloud.retail.v2.Condition.TimeRange.Builder getActiveTimeRangeBuilder( + int index) { + return getActiveTimeRangeFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder getActiveTimeRangeOrBuilder( + int index) { + if (activeTimeRangeBuilder_ == null) { + return activeTimeRange_.get(index); + } else { + return activeTimeRangeBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public java.util.List + getActiveTimeRangeOrBuilderList() { + if (activeTimeRangeBuilder_ != null) { + return activeTimeRangeBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(activeTimeRange_); + } + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public com.google.cloud.retail.v2.Condition.TimeRange.Builder addActiveTimeRangeBuilder() { + return getActiveTimeRangeFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Condition.TimeRange.getDefaultInstance()); + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public com.google.cloud.retail.v2.Condition.TimeRange.Builder addActiveTimeRangeBuilder( + int index) { + return getActiveTimeRangeFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Condition.TimeRange.getDefaultInstance()); + } + /** + * + * + *
+     * Range of time(s) specifying when Condition is active.
+     * Condition true if any time range matches.
+     * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + public java.util.List + getActiveTimeRangeBuilderList() { + return getActiveTimeRangeFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.TimeRange, + com.google.cloud.retail.v2.Condition.TimeRange.Builder, + com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder> + getActiveTimeRangeFieldBuilder() { + if (activeTimeRangeBuilder_ == null) { + activeTimeRangeBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Condition.TimeRange, + com.google.cloud.retail.v2.Condition.TimeRange.Builder, + com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder>( + activeTimeRange_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + activeTimeRange_ = null; + } + return activeTimeRangeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Condition) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Condition) + private static final com.google.cloud.retail.v2.Condition DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Condition(); + } + + public static com.google.cloud.retail.v2.Condition getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Condition parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Condition(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Condition getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ConditionOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ConditionOrBuilder.java new file mode 100644 index 000000000000..5ccd2b402aff --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ConditionOrBuilder.java @@ -0,0 +1,149 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface ConditionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Condition) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + java.util.List getQueryTermsList(); + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + com.google.cloud.retail.v2.Condition.QueryTerm getQueryTerms(int index); + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + int getQueryTermsCount(); + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + java.util.List + getQueryTermsOrBuilderList(); + /** + * + * + *
+   * A list (up to 10 entries) of terms to match the query on. If not
+   * specified, match all queries.
+   * If many query terms are specified, the condition
+   * is matched if any of the terms is a match (i.e. using the OR operator).
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.QueryTerm query_terms = 1; + */ + com.google.cloud.retail.v2.Condition.QueryTermOrBuilder getQueryTermsOrBuilder(int index); + + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + java.util.List getActiveTimeRangeList(); + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + com.google.cloud.retail.v2.Condition.TimeRange getActiveTimeRange(int index); + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + int getActiveTimeRangeCount(); + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + java.util.List + getActiveTimeRangeOrBuilderList(); + /** + * + * + *
+   * Range of time(s) specifying when Condition is active.
+   * Condition true if any time range matches.
+   * 
+ * + * repeated .google.cloud.retail.v2.Condition.TimeRange active_time_range = 3; + */ + com.google.cloud.retail.v2.Condition.TimeRangeOrBuilder getActiveTimeRangeOrBuilder(int index); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Control.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Control.java new file mode 100644 index 000000000000..234038ed97e5 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Control.java @@ -0,0 +1,2629 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Configures dynamic metadata that can be linked to a
+ * [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
+ * recommendation results at serving time.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Control} + */ +public final class Control extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Control) + ControlOrBuilder { + private static final long serialVersionUID = 0L; + // Use Control.newBuilder() to construct. + private Control(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Control() { + name_ = ""; + displayName_ = ""; + associatedServingConfigIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + solutionTypes_ = java.util.Collections.emptyList(); + searchSolutionUseCase_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Control(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Control( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 34: + { + com.google.cloud.retail.v2.Rule.Builder subBuilder = null; + if (controlCase_ == 4) { + subBuilder = ((com.google.cloud.retail.v2.Rule) control_).toBuilder(); + } + control_ = + input.readMessage(com.google.cloud.retail.v2.Rule.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule) control_); + control_ = subBuilder.buildPartial(); + } + controlCase_ = 4; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + associatedServingConfigIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + associatedServingConfigIds_.add(s); + break; + } + case 48: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + solutionTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + solutionTypes_.add(rawValue); + break; + } + case 50: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + solutionTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + solutionTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + case 56: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + searchSolutionUseCase_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + searchSolutionUseCase_.add(rawValue); + break; + } + case 58: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + searchSolutionUseCase_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + searchSolutionUseCase_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + associatedServingConfigIds_ = associatedServingConfigIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + solutionTypes_ = java.util.Collections.unmodifiableList(solutionTypes_); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + searchSolutionUseCase_ = java.util.Collections.unmodifiableList(searchSolutionUseCase_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlProto + .internal_static_google_cloud_retail_v2_Control_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlProto + .internal_static_google_cloud_retail_v2_Control_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Control.class, + com.google.cloud.retail.v2.Control.Builder.class); + } + + private int controlCase_ = 0; + private java.lang.Object control_; + + public enum ControlCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + RULE(4), + CONTROL_NOT_SET(0); + private final int value; + + private ControlCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ControlCase valueOf(int value) { + return forNumber(value); + } + + public static ControlCase forNumber(int value) { + switch (value) { + case 4: + return RULE; + case 0: + return CONTROL_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ControlCase getControlCase() { + return ControlCase.forNumber(controlCase_); + } + + public static final int RULE_FIELD_NUMBER = 4; + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return Whether the rule field is set. + */ + @java.lang.Override + public boolean hasRule() { + return controlCase_ == 4; + } + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return The rule. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule getRule() { + if (controlCase_ == 4) { + return (com.google.cloud.retail.v2.Rule) control_; + } + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + @java.lang.Override + public com.google.cloud.retail.v2.RuleOrBuilder getRuleOrBuilder() { + if (controlCase_ == 4) { + return (com.google.cloud.retail.v2.Rule) control_; + } + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/controls/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/controls/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * Required. The human readable control display name. Used in Retail UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The human readable control display name. Used in Retail UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ASSOCIATED_SERVING_CONFIG_IDS_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList associatedServingConfigIds_; + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the associatedServingConfigIds. + */ + public com.google.protobuf.ProtocolStringList getAssociatedServingConfigIdsList() { + return associatedServingConfigIds_; + } + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of associatedServingConfigIds. + */ + public int getAssociatedServingConfigIdsCount() { + return associatedServingConfigIds_.size(); + } + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The associatedServingConfigIds at the given index. + */ + public java.lang.String getAssociatedServingConfigIds(int index) { + return associatedServingConfigIds_.get(index); + } + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the associatedServingConfigIds at the given index. + */ + public com.google.protobuf.ByteString getAssociatedServingConfigIdsBytes(int index) { + return associatedServingConfigIds_.getByteString(index); + } + + public static final int SOLUTION_TYPES_FIELD_NUMBER = 6; + private java.util.List solutionTypes_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType> + solutionTypes_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>() { + public com.google.cloud.retail.v2.SolutionType convert(java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.SolutionType result = + com.google.cloud.retail.v2.SolutionType.valueOf(from); + return result == null ? com.google.cloud.retail.v2.SolutionType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + @java.lang.Override + public java.util.List getSolutionTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>( + solutionTypes_, solutionTypes_converter_); + } + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + @java.lang.Override + public int getSolutionTypesCount() { + return solutionTypes_.size(); + } + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + @java.lang.Override + public com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index) { + return solutionTypes_converter_.convert(solutionTypes_.get(index)); + } + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + @java.lang.Override + public java.util.List getSolutionTypesValueList() { + return solutionTypes_; + } + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + @java.lang.Override + public int getSolutionTypesValue(int index) { + return solutionTypes_.get(index); + } + + private int solutionTypesMemoizedSerializedSize; + + public static final int SEARCH_SOLUTION_USE_CASE_FIELD_NUMBER = 7; + private java.util.List searchSolutionUseCase_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SearchSolutionUseCase> + searchSolutionUseCase_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SearchSolutionUseCase>() { + public com.google.cloud.retail.v2.SearchSolutionUseCase convert( + java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.SearchSolutionUseCase result = + com.google.cloud.retail.v2.SearchSolutionUseCase.valueOf(from); + return result == null + ? com.google.cloud.retail.v2.SearchSolutionUseCase.UNRECOGNIZED + : result; + } + }; + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the searchSolutionUseCase. + */ + @java.lang.Override + public java.util.List + getSearchSolutionUseCaseList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SearchSolutionUseCase>( + searchSolutionUseCase_, searchSolutionUseCase_converter_); + } + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return The count of searchSolutionUseCase. + */ + @java.lang.Override + public int getSearchSolutionUseCaseCount() { + return searchSolutionUseCase_.size(); + } + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the element to return. + * @return The searchSolutionUseCase at the given index. + */ + @java.lang.Override + public com.google.cloud.retail.v2.SearchSolutionUseCase getSearchSolutionUseCase(int index) { + return searchSolutionUseCase_converter_.convert(searchSolutionUseCase_.get(index)); + } + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the enum numeric values on the wire for searchSolutionUseCase. + */ + @java.lang.Override + public java.util.List getSearchSolutionUseCaseValueList() { + return searchSolutionUseCase_; + } + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of searchSolutionUseCase at the given index. + */ + @java.lang.Override + public int getSearchSolutionUseCaseValue(int index) { + return searchSolutionUseCase_.get(index); + } + + private int searchSolutionUseCaseMemoizedSerializedSize; + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (controlCase_ == 4) { + output.writeMessage(4, (com.google.cloud.retail.v2.Rule) control_); + } + for (int i = 0; i < associatedServingConfigIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 5, associatedServingConfigIds_.getRaw(i)); + } + if (getSolutionTypesList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(solutionTypesMemoizedSerializedSize); + } + for (int i = 0; i < solutionTypes_.size(); i++) { + output.writeEnumNoTag(solutionTypes_.get(i)); + } + if (getSearchSolutionUseCaseList().size() > 0) { + output.writeUInt32NoTag(58); + output.writeUInt32NoTag(searchSolutionUseCaseMemoizedSerializedSize); + } + for (int i = 0; i < searchSolutionUseCase_.size(); i++) { + output.writeEnumNoTag(searchSolutionUseCase_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (controlCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.cloud.retail.v2.Rule) control_); + } + { + int dataSize = 0; + for (int i = 0; i < associatedServingConfigIds_.size(); i++) { + dataSize += computeStringSizeNoTag(associatedServingConfigIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getAssociatedServingConfigIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < solutionTypes_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(solutionTypes_.get(i)); + } + size += dataSize; + if (!getSolutionTypesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + solutionTypesMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < searchSolutionUseCase_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag( + searchSolutionUseCase_.get(i)); + } + size += dataSize; + if (!getSearchSolutionUseCaseList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + searchSolutionUseCaseMemoizedSerializedSize = dataSize; + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Control)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Control other = (com.google.cloud.retail.v2.Control) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getAssociatedServingConfigIdsList().equals(other.getAssociatedServingConfigIdsList())) + return false; + if (!solutionTypes_.equals(other.solutionTypes_)) return false; + if (!searchSolutionUseCase_.equals(other.searchSolutionUseCase_)) return false; + if (!getControlCase().equals(other.getControlCase())) return false; + switch (controlCase_) { + case 4: + if (!getRule().equals(other.getRule())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (getAssociatedServingConfigIdsCount() > 0) { + hash = (37 * hash) + ASSOCIATED_SERVING_CONFIG_IDS_FIELD_NUMBER; + hash = (53 * hash) + getAssociatedServingConfigIdsList().hashCode(); + } + if (getSolutionTypesCount() > 0) { + hash = (37 * hash) + SOLUTION_TYPES_FIELD_NUMBER; + hash = (53 * hash) + solutionTypes_.hashCode(); + } + if (getSearchSolutionUseCaseCount() > 0) { + hash = (37 * hash) + SEARCH_SOLUTION_USE_CASE_FIELD_NUMBER; + hash = (53 * hash) + searchSolutionUseCase_.hashCode(); + } + switch (controlCase_) { + case 4: + hash = (37 * hash) + RULE_FIELD_NUMBER; + hash = (53 * hash) + getRule().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Control parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Control parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Control parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Control parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Control parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Control parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Control parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Control prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configures dynamic metadata that can be linked to a
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
+   * recommendation results at serving time.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Control} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Control) + com.google.cloud.retail.v2.ControlOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlProto + .internal_static_google_cloud_retail_v2_Control_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlProto + .internal_static_google_cloud_retail_v2_Control_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Control.class, + com.google.cloud.retail.v2.Control.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Control.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + displayName_ = ""; + + associatedServingConfigIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + solutionTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + searchSolutionUseCase_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + controlCase_ = 0; + control_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlProto + .internal_static_google_cloud_retail_v2_Control_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Control getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Control.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Control build() { + com.google.cloud.retail.v2.Control result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Control buildPartial() { + com.google.cloud.retail.v2.Control result = new com.google.cloud.retail.v2.Control(this); + int from_bitField0_ = bitField0_; + if (controlCase_ == 4) { + if (ruleBuilder_ == null) { + result.control_ = control_; + } else { + result.control_ = ruleBuilder_.build(); + } + } + result.name_ = name_; + result.displayName_ = displayName_; + if (((bitField0_ & 0x00000001) != 0)) { + associatedServingConfigIds_ = associatedServingConfigIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.associatedServingConfigIds_ = associatedServingConfigIds_; + if (((bitField0_ & 0x00000002) != 0)) { + solutionTypes_ = java.util.Collections.unmodifiableList(solutionTypes_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.solutionTypes_ = solutionTypes_; + if (((bitField0_ & 0x00000004) != 0)) { + searchSolutionUseCase_ = java.util.Collections.unmodifiableList(searchSolutionUseCase_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.searchSolutionUseCase_ = searchSolutionUseCase_; + result.controlCase_ = controlCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Control) { + return mergeFrom((com.google.cloud.retail.v2.Control) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Control other) { + if (other == com.google.cloud.retail.v2.Control.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.associatedServingConfigIds_.isEmpty()) { + if (associatedServingConfigIds_.isEmpty()) { + associatedServingConfigIds_ = other.associatedServingConfigIds_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAssociatedServingConfigIdsIsMutable(); + associatedServingConfigIds_.addAll(other.associatedServingConfigIds_); + } + onChanged(); + } + if (!other.solutionTypes_.isEmpty()) { + if (solutionTypes_.isEmpty()) { + solutionTypes_ = other.solutionTypes_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureSolutionTypesIsMutable(); + solutionTypes_.addAll(other.solutionTypes_); + } + onChanged(); + } + if (!other.searchSolutionUseCase_.isEmpty()) { + if (searchSolutionUseCase_.isEmpty()) { + searchSolutionUseCase_ = other.searchSolutionUseCase_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureSearchSolutionUseCaseIsMutable(); + searchSolutionUseCase_.addAll(other.searchSolutionUseCase_); + } + onChanged(); + } + switch (other.getControlCase()) { + case RULE: + { + mergeRule(other.getRule()); + break; + } + case CONTROL_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Control parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Control) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int controlCase_ = 0; + private java.lang.Object control_; + + public ControlCase getControlCase() { + return ControlCase.forNumber(controlCase_); + } + + public Builder clearControl() { + controlCase_ = 0; + control_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule, + com.google.cloud.retail.v2.Rule.Builder, + com.google.cloud.retail.v2.RuleOrBuilder> + ruleBuilder_; + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return Whether the rule field is set. + */ + @java.lang.Override + public boolean hasRule() { + return controlCase_ == 4; + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return The rule. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule getRule() { + if (ruleBuilder_ == null) { + if (controlCase_ == 4) { + return (com.google.cloud.retail.v2.Rule) control_; + } + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } else { + if (controlCase_ == 4) { + return ruleBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + public Builder setRule(com.google.cloud.retail.v2.Rule value) { + if (ruleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + control_ = value; + onChanged(); + } else { + ruleBuilder_.setMessage(value); + } + controlCase_ = 4; + return this; + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + public Builder setRule(com.google.cloud.retail.v2.Rule.Builder builderForValue) { + if (ruleBuilder_ == null) { + control_ = builderForValue.build(); + onChanged(); + } else { + ruleBuilder_.setMessage(builderForValue.build()); + } + controlCase_ = 4; + return this; + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + public Builder mergeRule(com.google.cloud.retail.v2.Rule value) { + if (ruleBuilder_ == null) { + if (controlCase_ == 4 && control_ != com.google.cloud.retail.v2.Rule.getDefaultInstance()) { + control_ = + com.google.cloud.retail.v2.Rule.newBuilder((com.google.cloud.retail.v2.Rule) control_) + .mergeFrom(value) + .buildPartial(); + } else { + control_ = value; + } + onChanged(); + } else { + if (controlCase_ == 4) { + ruleBuilder_.mergeFrom(value); + } else { + ruleBuilder_.setMessage(value); + } + } + controlCase_ = 4; + return this; + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + public Builder clearRule() { + if (ruleBuilder_ == null) { + if (controlCase_ == 4) { + controlCase_ = 0; + control_ = null; + onChanged(); + } + } else { + if (controlCase_ == 4) { + controlCase_ = 0; + control_ = null; + } + ruleBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + public com.google.cloud.retail.v2.Rule.Builder getRuleBuilder() { + return getRuleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + @java.lang.Override + public com.google.cloud.retail.v2.RuleOrBuilder getRuleOrBuilder() { + if ((controlCase_ == 4) && (ruleBuilder_ != null)) { + return ruleBuilder_.getMessageOrBuilder(); + } else { + if (controlCase_ == 4) { + return (com.google.cloud.retail.v2.Rule) control_; + } + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule control - a condition-action pair.
+     * Enacts a set action when the condition is triggered.
+     * For example: Boost "gShoe" when query full matches "Running Shoes".
+     * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule, + com.google.cloud.retail.v2.Rule.Builder, + com.google.cloud.retail.v2.RuleOrBuilder> + getRuleFieldBuilder() { + if (ruleBuilder_ == null) { + if (!(controlCase_ == 4)) { + control_ = com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + ruleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule, + com.google.cloud.retail.v2.Rule.Builder, + com.google.cloud.retail.v2.RuleOrBuilder>( + (com.google.cloud.retail.v2.Rule) control_, getParentForChildren(), isClean()); + control_ = null; + } + controlCase_ = 4; + onChanged(); + ; + return ruleBuilder_; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/controls/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/controls/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/controls/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/controls/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/controls/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Required. The human readable control display name. Used in Retail UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The human readable control display name. Used in Retail UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The human readable control display name. Used in Retail UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The human readable control display name. Used in Retail UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The human readable control display name. Used in Retail UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList associatedServingConfigIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAssociatedServingConfigIdsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + associatedServingConfigIds_ = + new com.google.protobuf.LazyStringArrayList(associatedServingConfigIds_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the associatedServingConfigIds. + */ + public com.google.protobuf.ProtocolStringList getAssociatedServingConfigIdsList() { + return associatedServingConfigIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of associatedServingConfigIds. + */ + public int getAssociatedServingConfigIdsCount() { + return associatedServingConfigIds_.size(); + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The associatedServingConfigIds at the given index. + */ + public java.lang.String getAssociatedServingConfigIds(int index) { + return associatedServingConfigIds_.get(index); + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the associatedServingConfigIds at the given index. + */ + public com.google.protobuf.ByteString getAssociatedServingConfigIdsBytes(int index) { + return associatedServingConfigIds_.getByteString(index); + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index to set the value at. + * @param value The associatedServingConfigIds to set. + * @return This builder for chaining. + */ + public Builder setAssociatedServingConfigIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssociatedServingConfigIdsIsMutable(); + associatedServingConfigIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The associatedServingConfigIds to add. + * @return This builder for chaining. + */ + public Builder addAssociatedServingConfigIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssociatedServingConfigIdsIsMutable(); + associatedServingConfigIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param values The associatedServingConfigIds to add. + * @return This builder for chaining. + */ + public Builder addAllAssociatedServingConfigIds(java.lang.Iterable values) { + ensureAssociatedServingConfigIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, associatedServingConfigIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearAssociatedServingConfigIds() { + associatedServingConfigIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. List of [serving
+     * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+     * associated with this control in the same
+     * [Catalog][google.cloud.retail.v2.Catalog].
+     * Note the association is managed via the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+     * only denormalized view.
+     * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes of the associatedServingConfigIds to add. + * @return This builder for chaining. + */ + public Builder addAssociatedServingConfigIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAssociatedServingConfigIdsIsMutable(); + associatedServingConfigIds_.add(value); + onChanged(); + return this; + } + + private java.util.List solutionTypes_ = java.util.Collections.emptyList(); + + private void ensureSolutionTypesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + solutionTypes_ = new java.util.ArrayList(solutionTypes_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + public java.util.List getSolutionTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>( + solutionTypes_, solutionTypes_converter_); + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + public int getSolutionTypesCount() { + return solutionTypes_.size(); + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + public com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index) { + return solutionTypes_converter_.convert(solutionTypes_.get(index)); + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index to set the value at. + * @param value The solutionTypes to set. + * @return This builder for chaining. + */ + public Builder setSolutionTypes(int index, com.google.cloud.retail.v2.SolutionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSolutionTypesIsMutable(); + solutionTypes_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addSolutionTypes(com.google.cloud.retail.v2.SolutionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSolutionTypesIsMutable(); + solutionTypes_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param values The solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addAllSolutionTypes( + java.lang.Iterable values) { + ensureSolutionTypesIsMutable(); + for (com.google.cloud.retail.v2.SolutionType value : values) { + solutionTypes_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearSolutionTypes() { + solutionTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + public java.util.List getSolutionTypesValueList() { + return java.util.Collections.unmodifiableList(solutionTypes_); + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + public int getSolutionTypesValue(int index) { + return solutionTypes_.get(index); + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for solutionTypes to set. + * @return This builder for chaining. + */ + public Builder setSolutionTypesValue(int index, int value) { + ensureSolutionTypesIsMutable(); + solutionTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The enum numeric value on the wire for solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addSolutionTypesValue(int value) { + ensureSolutionTypesIsMutable(); + solutionTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. The solution types that the control is used for.
+     * Currently we support setting only one type of solution at creation time.
+     * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+     * If no solution type is provided at creation time, will default to
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param values The enum numeric values on the wire for solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addAllSolutionTypesValue(java.lang.Iterable values) { + ensureSolutionTypesIsMutable(); + for (int value : values) { + solutionTypes_.add(value); + } + onChanged(); + return this; + } + + private java.util.List searchSolutionUseCase_ = + java.util.Collections.emptyList(); + + private void ensureSearchSolutionUseCaseIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + searchSolutionUseCase_ = new java.util.ArrayList(searchSolutionUseCase_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the searchSolutionUseCase. + */ + public java.util.List + getSearchSolutionUseCaseList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SearchSolutionUseCase>( + searchSolutionUseCase_, searchSolutionUseCase_converter_); + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return The count of searchSolutionUseCase. + */ + public int getSearchSolutionUseCaseCount() { + return searchSolutionUseCase_.size(); + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the element to return. + * @return The searchSolutionUseCase at the given index. + */ + public com.google.cloud.retail.v2.SearchSolutionUseCase getSearchSolutionUseCase(int index) { + return searchSolutionUseCase_converter_.convert(searchSolutionUseCase_.get(index)); + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index to set the value at. + * @param value The searchSolutionUseCase to set. + * @return This builder for chaining. + */ + public Builder setSearchSolutionUseCase( + int index, com.google.cloud.retail.v2.SearchSolutionUseCase value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSearchSolutionUseCaseIsMutable(); + searchSolutionUseCase_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param value The searchSolutionUseCase to add. + * @return This builder for chaining. + */ + public Builder addSearchSolutionUseCase( + com.google.cloud.retail.v2.SearchSolutionUseCase value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSearchSolutionUseCaseIsMutable(); + searchSolutionUseCase_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param values The searchSolutionUseCase to add. + * @return This builder for chaining. + */ + public Builder addAllSearchSolutionUseCase( + java.lang.Iterable values) { + ensureSearchSolutionUseCaseIsMutable(); + for (com.google.cloud.retail.v2.SearchSolutionUseCase value : values) { + searchSolutionUseCase_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return This builder for chaining. + */ + public Builder clearSearchSolutionUseCase() { + searchSolutionUseCase_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the enum numeric values on the wire for searchSolutionUseCase. + */ + public java.util.List getSearchSolutionUseCaseValueList() { + return java.util.Collections.unmodifiableList(searchSolutionUseCase_); + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of searchSolutionUseCase at the given index. + */ + public int getSearchSolutionUseCaseValue(int index) { + return searchSolutionUseCase_.get(index); + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for searchSolutionUseCase to set. + * @return This builder for chaining. + */ + public Builder setSearchSolutionUseCaseValue(int index, int value) { + ensureSearchSolutionUseCaseIsMutable(); + searchSolutionUseCase_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param value The enum numeric value on the wire for searchSolutionUseCase to add. + * @return This builder for chaining. + */ + public Builder addSearchSolutionUseCaseValue(int value) { + ensureSearchSolutionUseCaseIsMutable(); + searchSolutionUseCase_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the use case for the control.
+     * Affects what condition fields can be set.
+     * Only settable by search controls.
+     * Will default to
+     * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+     * if not specified. Currently only allow one search_solution_use_case per
+     * control.
+     * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param values The enum numeric values on the wire for searchSolutionUseCase to add. + * @return This builder for chaining. + */ + public Builder addAllSearchSolutionUseCaseValue(java.lang.Iterable values) { + ensureSearchSolutionUseCaseIsMutable(); + for (int value : values) { + searchSolutionUseCase_.add(value); + } + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Control) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Control) + private static final com.google.cloud.retail.v2.Control DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Control(); + } + + public static com.google.cloud.retail.v2.Control getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Control parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Control(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Control getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlName.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlName.java new file mode 100644 index 000000000000..a0ab5394501a --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlName.java @@ -0,0 +1,257 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ControlName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG_CONTROL = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + private final String control; + + @Deprecated + protected ControlName() { + project = null; + location = null; + catalog = null; + control = null; + } + + private ControlName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + control = Preconditions.checkNotNull(builder.getControl()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getControl() { + return control; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ControlName of(String project, String location, String catalog, String control) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setControl(control) + .build(); + } + + public static String format(String project, String location, String catalog, String control) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setControl(control) + .build() + .toString(); + } + + public static ControlName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG_CONTROL.validatedMatch( + formattedString, "ControlName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("catalog"), + matchMap.get("control")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ControlName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG_CONTROL.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + if (control != null) { + fieldMapBuilder.put("control", control); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG_CONTROL.instantiate( + "project", project, "location", location, "catalog", catalog, "control", control); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ControlName that = ((ControlName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog) + && Objects.equals(this.control, that.control); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + h *= 1000003; + h ^= Objects.hashCode(control); + return h; + } + + /** Builder for projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}. */ + public static class Builder { + private String project; + private String location; + private String catalog; + private String control; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getControl() { + return control; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + public Builder setControl(String control) { + this.control = control; + return this; + } + + private Builder(ControlName controlName) { + this.project = controlName.project; + this.location = controlName.location; + this.catalog = controlName.catalog; + this.control = controlName.control; + } + + public ControlName build() { + return new ControlName(this); + } + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlOrBuilder.java new file mode 100644 index 000000000000..2c41fa2f5e8e --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlOrBuilder.java @@ -0,0 +1,398 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control.proto + +package com.google.cloud.retail.v2; + +public interface ControlOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Control) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return Whether the rule field is set. + */ + boolean hasRule(); + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + * + * @return The rule. + */ + com.google.cloud.retail.v2.Rule getRule(); + /** + * + * + *
+   * A rule control - a condition-action pair.
+   * Enacts a set action when the condition is triggered.
+   * For example: Boost "gShoe" when query full matches "Running Shoes".
+   * 
+ * + * .google.cloud.retail.v2.Rule rule = 4; + */ + com.google.cloud.retail.v2.RuleOrBuilder getRuleOrBuilder(); + + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/controls/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/controls/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The human readable control display name. Used in Retail UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Required. The human readable control display name. Used in Retail UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is thrown.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the associatedServingConfigIds. + */ + java.util.List getAssociatedServingConfigIdsList(); + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of associatedServingConfigIds. + */ + int getAssociatedServingConfigIdsCount(); + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The associatedServingConfigIds at the given index. + */ + java.lang.String getAssociatedServingConfigIds(int index); + /** + * + * + *
+   * Output only. List of [serving
+   * configuration][google.cloud.retail.v2.ServingConfig] ids that are
+   * associated with this control in the same
+   * [Catalog][google.cloud.retail.v2.Catalog].
+   * Note the association is managed via the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
+   * only denormalized view.
+   * 
+ * + * + * repeated string associated_serving_config_ids = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the associatedServingConfigIds at the given index. + */ + com.google.protobuf.ByteString getAssociatedServingConfigIdsBytes(int index); + + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + java.util.List getSolutionTypesList(); + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + int getSolutionTypesCount(); + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index); + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + java.util.List getSolutionTypesValueList(); + /** + * + * + *
+   * Required. Immutable. The solution types that the control is used for.
+   * Currently we support setting only one type of solution at creation time.
+   * Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
+   * If no solution type is provided at creation time, will default to
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + int getSolutionTypesValue(int index); + + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the searchSolutionUseCase. + */ + java.util.List getSearchSolutionUseCaseList(); + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return The count of searchSolutionUseCase. + */ + int getSearchSolutionUseCaseCount(); + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the element to return. + * @return The searchSolutionUseCase at the given index. + */ + com.google.cloud.retail.v2.SearchSolutionUseCase getSearchSolutionUseCase(int index); + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @return A list containing the enum numeric values on the wire for searchSolutionUseCase. + */ + java.util.List getSearchSolutionUseCaseValueList(); + /** + * + * + *
+   * Specifies the use case for the control.
+   * Affects what condition fields can be set.
+   * Only settable by search controls.
+   * Will default to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
+   * if not specified. Currently only allow one search_solution_use_case per
+   * control.
+   * 
+ * + * repeated .google.cloud.retail.v2.SearchSolutionUseCase search_solution_use_case = 7; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of searchSolutionUseCase at the given index. + */ + int getSearchSolutionUseCaseValue(int index); + + public com.google.cloud.retail.v2.Control.ControlCase getControlCase(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlProto.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlProto.java new file mode 100644 index 000000000000..a07d7ff65e13 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ControlProto.java @@ -0,0 +1,98 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control.proto + +package com.google.cloud.retail.v2; + +public final class ControlProto { + private ControlProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_Control_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_Control_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n$google/cloud/retail/v2/control.proto\022\026" + + "google.cloud.retail.v2\032\037google/api/field" + + "_behavior.proto\032\031google/api/resource.pro" + + "to\032#google/cloud/retail/v2/common.proto\"" + + "\246\003\n\007Control\022,\n\004rule\030\004 \001(\0132\034.google.cloud" + + ".retail.v2.RuleH\000\022\021\n\004name\030\001 \001(\tB\003\340A\005\022\031\n\014" + + "display_name\030\002 \001(\tB\003\340A\002\022*\n\035associated_se" + + "rving_config_ids\030\005 \003(\tB\003\340A\003\022D\n\016solution_" + + "types\030\006 \003(\0162$.google.cloud.retail.v2.Sol" + + "utionTypeB\006\340A\002\340A\005\022O\n\030search_solution_use" + + "_case\030\007 \003(\0162-.google.cloud.retail.v2.Sea" + + "rchSolutionUseCase:q\352An\n\035retail.googleap" + + "is.com/Control\022Mprojects/{project}/locat" + + "ions/{location}/catalogs/{catalog}/contr" + + "ols/{control}B\t\n\007controlB\301\001\n\032com.google." + + "cloud.retail.v2B\014ControlProtoP\001Z + * Request for CreateControl method. + * + * + * Protobuf type {@code google.cloud.retail.v2.CreateControlRequest} + */ +public final class CreateControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CreateControlRequest) + CreateControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateControlRequest.newBuilder() to construct. + private CreateControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateControlRequest() { + parent_ = ""; + controlId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.Control.Builder subBuilder = null; + if (control_ != null) { + subBuilder = control_.toBuilder(); + } + control_ = + input.readMessage(com.google.cloud.retail.v2.Control.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(control_); + control_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + controlId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_CreateControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_CreateControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateControlRequest.class, + com.google.cloud.retail.v2.CreateControlRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Full resource name of parent catalog. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full resource name of parent catalog. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTROL_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.Control control_; + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + @java.lang.Override + public boolean hasControl() { + return control_ != null; + } + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Control getControl() { + return control_ == null ? com.google.cloud.retail.v2.Control.getDefaultInstance() : control_; + } + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder() { + return getControl(); + } + + public static final int CONTROL_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object controlId_; + /** + * + * + *
+   * Required. The ID to use for the Control, which will become the final
+   * component of the Control's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + @java.lang.Override + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The ID to use for the Control, which will become the final
+   * component of the Control's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (control_ != null) { + output.writeMessage(2, getControl()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, controlId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (control_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getControl()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, controlId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CreateControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CreateControlRequest other = + (com.google.cloud.retail.v2.CreateControlRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasControl() != other.hasControl()) return false; + if (hasControl()) { + if (!getControl().equals(other.getControl())) return false; + } + if (!getControlId().equals(other.getControlId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasControl()) { + hash = (37 * hash) + CONTROL_FIELD_NUMBER; + hash = (53 * hash) + getControl().hashCode(); + } + hash = (37 * hash) + CONTROL_ID_FIELD_NUMBER; + hash = (53 * hash) + getControlId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.CreateControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for CreateControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CreateControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CreateControlRequest) + com.google.cloud.retail.v2.CreateControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_CreateControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_CreateControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateControlRequest.class, + com.google.cloud.retail.v2.CreateControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CreateControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (controlBuilder_ == null) { + control_ = null; + } else { + control_ = null; + controlBuilder_ = null; + } + controlId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_CreateControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CreateControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateControlRequest build() { + com.google.cloud.retail.v2.CreateControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateControlRequest buildPartial() { + com.google.cloud.retail.v2.CreateControlRequest result = + new com.google.cloud.retail.v2.CreateControlRequest(this); + result.parent_ = parent_; + if (controlBuilder_ == null) { + result.control_ = control_; + } else { + result.control_ = controlBuilder_.build(); + } + result.controlId_ = controlId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CreateControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.CreateControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CreateControlRequest other) { + if (other == com.google.cloud.retail.v2.CreateControlRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasControl()) { + mergeControl(other.getControl()); + } + if (!other.getControlId().isEmpty()) { + controlId_ = other.controlId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CreateControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.CreateControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Full resource name of parent catalog. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of parent catalog. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of parent catalog. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of parent catalog. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of parent catalog. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.Control control_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + controlBuilder_; + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + public boolean hasControl() { + return controlBuilder_ != null || control_ != null; + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + public com.google.cloud.retail.v2.Control getControl() { + if (controlBuilder_ == null) { + return control_ == null + ? com.google.cloud.retail.v2.Control.getDefaultInstance() + : control_; + } else { + return controlBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setControl(com.google.cloud.retail.v2.Control value) { + if (controlBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + control_ = value; + onChanged(); + } else { + controlBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setControl(com.google.cloud.retail.v2.Control.Builder builderForValue) { + if (controlBuilder_ == null) { + control_ = builderForValue.build(); + onChanged(); + } else { + controlBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeControl(com.google.cloud.retail.v2.Control value) { + if (controlBuilder_ == null) { + if (control_ != null) { + control_ = + com.google.cloud.retail.v2.Control.newBuilder(control_) + .mergeFrom(value) + .buildPartial(); + } else { + control_ = value; + } + onChanged(); + } else { + controlBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearControl() { + if (controlBuilder_ == null) { + control_ = null; + onChanged(); + } else { + control_ = null; + controlBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Control.Builder getControlBuilder() { + + onChanged(); + return getControlFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder() { + if (controlBuilder_ != null) { + return controlBuilder_.getMessageOrBuilder(); + } else { + return control_ == null + ? com.google.cloud.retail.v2.Control.getDefaultInstance() + : control_; + } + } + /** + * + * + *
+     * Required. The Control to create.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + getControlFieldBuilder() { + if (controlBuilder_ == null) { + controlBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder>( + getControl(), getParentForChildren(), isClean()); + control_ = null; + } + return controlBuilder_; + } + + private java.lang.Object controlId_ = ""; + /** + * + * + *
+     * Required. The ID to use for the Control, which will become the final
+     * component of the Control's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the Control, which will become the final
+     * component of the Control's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the Control, which will become the final
+     * component of the Control's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The controlId to set. + * @return This builder for chaining. + */ + public Builder setControlId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + controlId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the Control, which will become the final
+     * component of the Control's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearControlId() { + + controlId_ = getDefaultInstance().getControlId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the Control, which will become the final
+     * component of the Control's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for controlId to set. + * @return This builder for chaining. + */ + public Builder setControlIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + controlId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CreateControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CreateControlRequest) + private static final com.google.cloud.retail.v2.CreateControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CreateControlRequest(); + } + + public static com.google.cloud.retail.v2.CreateControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateControlRequestOrBuilder.java new file mode 100644 index 000000000000..92a05cc28b4c --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateControlRequestOrBuilder.java @@ -0,0 +1,125 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface CreateControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CreateControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full resource name of parent catalog. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Full resource name of parent catalog. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + boolean hasControl(); + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + com.google.cloud.retail.v2.Control getControl(); + /** + * + * + *
+   * Required. The Control to create.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder(); + + /** + * + * + *
+   * Required. The ID to use for the Control, which will become the final
+   * component of the Control's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + java.lang.String getControlId(); + /** + * + * + *
+   * Required. The ID to use for the Control, which will become the final
+   * component of the Control's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + com.google.protobuf.ByteString getControlIdBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequest.java new file mode 100644 index 000000000000..0a3d9e2c7b1d --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequest.java @@ -0,0 +1,1162 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for CreateServingConfig method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CreateServingConfigRequest} + */ +public final class CreateServingConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CreateServingConfigRequest) + CreateServingConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateServingConfigRequest.newBuilder() to construct. + private CreateServingConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateServingConfigRequest() { + parent_ = ""; + servingConfigId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateServingConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateServingConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.ServingConfig.Builder subBuilder = null; + if (servingConfig_ != null) { + subBuilder = servingConfig_.toBuilder(); + } + servingConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ServingConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(servingConfig_); + servingConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + servingConfigId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_CreateServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_CreateServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateServingConfigRequest.class, + com.google.cloud.retail.v2.CreateServingConfigRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Full resource name of parent. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full resource name of parent. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVING_CONFIG_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.ServingConfig servingConfig_; + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + @java.lang.Override + public boolean hasServingConfig() { + return servingConfig_ != null; + } + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig getServingConfig() { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder() { + return getServingConfig(); + } + + public static final int SERVING_CONFIG_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object servingConfigId_; + /** + * + * + *
+   * Required. The ID to use for the ServingConfig, which will become the final
+   * component of the ServingConfig's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The servingConfigId. + */ + @java.lang.Override + public java.lang.String getServingConfigId() { + java.lang.Object ref = servingConfigId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfigId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The ID to use for the ServingConfig, which will become the final
+   * component of the ServingConfig's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for servingConfigId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServingConfigIdBytes() { + java.lang.Object ref = servingConfigId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (servingConfig_ != null) { + output.writeMessage(2, getServingConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfigId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, servingConfigId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (servingConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getServingConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfigId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, servingConfigId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.CreateServingConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.CreateServingConfigRequest other = + (com.google.cloud.retail.v2.CreateServingConfigRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasServingConfig() != other.hasServingConfig()) return false; + if (hasServingConfig()) { + if (!getServingConfig().equals(other.getServingConfig())) return false; + } + if (!getServingConfigId().equals(other.getServingConfigId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasServingConfig()) { + hash = (37 * hash) + SERVING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getServingConfig().hashCode(); + } + hash = (37 * hash) + SERVING_CONFIG_ID_FIELD_NUMBER; + hash = (53 * hash) + getServingConfigId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.CreateServingConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for CreateServingConfig method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.CreateServingConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CreateServingConfigRequest) + com.google.cloud.retail.v2.CreateServingConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_CreateServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_CreateServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.CreateServingConfigRequest.class, + com.google.cloud.retail.v2.CreateServingConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.CreateServingConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (servingConfigBuilder_ == null) { + servingConfig_ = null; + } else { + servingConfig_ = null; + servingConfigBuilder_ = null; + } + servingConfigId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_CreateServingConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateServingConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.CreateServingConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateServingConfigRequest build() { + com.google.cloud.retail.v2.CreateServingConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateServingConfigRequest buildPartial() { + com.google.cloud.retail.v2.CreateServingConfigRequest result = + new com.google.cloud.retail.v2.CreateServingConfigRequest(this); + result.parent_ = parent_; + if (servingConfigBuilder_ == null) { + result.servingConfig_ = servingConfig_; + } else { + result.servingConfig_ = servingConfigBuilder_.build(); + } + result.servingConfigId_ = servingConfigId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.CreateServingConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.CreateServingConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.CreateServingConfigRequest other) { + if (other == com.google.cloud.retail.v2.CreateServingConfigRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasServingConfig()) { + mergeServingConfig(other.getServingConfig()); + } + if (!other.getServingConfigId().isEmpty()) { + servingConfigId_ = other.servingConfigId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.CreateServingConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.CreateServingConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Full resource name of parent. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of parent. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full resource name of parent. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of parent. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full resource name of parent. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.ServingConfig servingConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + servingConfigBuilder_; + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + public boolean hasServingConfig() { + return servingConfigBuilder_ != null || servingConfig_ != null; + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + public com.google.cloud.retail.v2.ServingConfig getServingConfig() { + if (servingConfigBuilder_ == null) { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } else { + return servingConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setServingConfig(com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + servingConfig_ = value; + onChanged(); + } else { + servingConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setServingConfig( + com.google.cloud.retail.v2.ServingConfig.Builder builderForValue) { + if (servingConfigBuilder_ == null) { + servingConfig_ = builderForValue.build(); + onChanged(); + } else { + servingConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeServingConfig(com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigBuilder_ == null) { + if (servingConfig_ != null) { + servingConfig_ = + com.google.cloud.retail.v2.ServingConfig.newBuilder(servingConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + servingConfig_ = value; + } + onChanged(); + } else { + servingConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearServingConfig() { + if (servingConfigBuilder_ == null) { + servingConfig_ = null; + onChanged(); + } else { + servingConfig_ = null; + servingConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ServingConfig.Builder getServingConfigBuilder() { + + onChanged(); + return getServingConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder() { + if (servingConfigBuilder_ != null) { + return servingConfigBuilder_.getMessageOrBuilder(); + } else { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } + } + /** + * + * + *
+     * Required. The ServingConfig to create.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + getServingConfigFieldBuilder() { + if (servingConfigBuilder_ == null) { + servingConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder>( + getServingConfig(), getParentForChildren(), isClean()); + servingConfig_ = null; + } + return servingConfigBuilder_; + } + + private java.lang.Object servingConfigId_ = ""; + /** + * + * + *
+     * Required. The ID to use for the ServingConfig, which will become the final
+     * component of the ServingConfig's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The servingConfigId. + */ + public java.lang.String getServingConfigId() { + java.lang.Object ref = servingConfigId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfigId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the ServingConfig, which will become the final
+     * component of the ServingConfig's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for servingConfigId. + */ + public com.google.protobuf.ByteString getServingConfigIdBytes() { + java.lang.Object ref = servingConfigId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The ID to use for the ServingConfig, which will become the final
+     * component of the ServingConfig's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The servingConfigId to set. + * @return This builder for chaining. + */ + public Builder setServingConfigId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + servingConfigId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the ServingConfig, which will become the final
+     * component of the ServingConfig's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearServingConfigId() { + + servingConfigId_ = getDefaultInstance().getServingConfigId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID to use for the ServingConfig, which will become the final
+     * component of the ServingConfig's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-_/.
+     * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for servingConfigId to set. + * @return This builder for chaining. + */ + public Builder setServingConfigIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + servingConfigId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CreateServingConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CreateServingConfigRequest) + private static final com.google.cloud.retail.v2.CreateServingConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CreateServingConfigRequest(); + } + + public static com.google.cloud.retail.v2.CreateServingConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateServingConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateServingConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.CreateServingConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequestOrBuilder.java new file mode 100644 index 000000000000..3957e63aad3f --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CreateServingConfigRequestOrBuilder.java @@ -0,0 +1,128 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface CreateServingConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.CreateServingConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full resource name of parent. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Full resource name of parent. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + boolean hasServingConfig(); + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + com.google.cloud.retail.v2.ServingConfig getServingConfig(); + /** + * + * + *
+   * Required. The ServingConfig to create.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder(); + + /** + * + * + *
+   * Required. The ID to use for the ServingConfig, which will become the final
+   * component of the ServingConfig's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The servingConfigId. + */ + java.lang.String getServingConfigId(); + /** + * + * + *
+   * Required. The ID to use for the ServingConfig, which will become the final
+   * component of the ServingConfig's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-_/.
+   * 
+ * + * string serving_config_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for servingConfigId. + */ + com.google.protobuf.ByteString getServingConfigIdBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java index 09f6ebc7340b..4dfb69fb6332 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttribute.java @@ -314,8 +314,8 @@ public double getNumbers(int index) { * *
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -329,7 +329,7 @@ public double getNumbers(int index) {
    * optional bool searchable = 3 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=130
+   *     google/cloud/retail/v2/common.proto;l=407
    * @return Whether the searchable field is set.
    */
   @java.lang.Override
@@ -342,8 +342,8 @@ public boolean hasSearchable() {
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -357,7 +357,7 @@ public boolean hasSearchable() {
    * optional bool searchable = 3 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=130
+   *     google/cloud/retail/v2/common.proto;l=407
    * @return The searchable.
    */
   @java.lang.Override
@@ -373,8 +373,8 @@ public boolean getSearchable() {
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -392,7 +392,7 @@ public boolean getSearchable() {
    * optional bool indexable = 4 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=149
+   *     google/cloud/retail/v2/common.proto;l=426
    * @return Whether the indexable field is set.
    */
   @java.lang.Override
@@ -405,8 +405,8 @@ public boolean hasIndexable() {
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -424,7 +424,7 @@ public boolean hasIndexable() {
    * optional bool indexable = 4 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=149
+   *     google/cloud/retail/v2/common.proto;l=426
    * @return The indexable.
    */
   @java.lang.Override
@@ -1240,8 +1240,8 @@ public Builder clearNumbers() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1255,7 +1255,7 @@ public Builder clearNumbers() {
      * optional bool searchable = 3 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=130
+     *     google/cloud/retail/v2/common.proto;l=407
      * @return Whether the searchable field is set.
      */
     @java.lang.Override
@@ -1268,8 +1268,8 @@ public boolean hasSearchable() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1283,7 +1283,7 @@ public boolean hasSearchable() {
      * optional bool searchable = 3 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=130
+     *     google/cloud/retail/v2/common.proto;l=407
      * @return The searchable.
      */
     @java.lang.Override
@@ -1296,8 +1296,8 @@ public boolean getSearchable() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1311,7 +1311,7 @@ public boolean getSearchable() {
      * optional bool searchable = 3 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=130
+     *     google/cloud/retail/v2/common.proto;l=407
      * @param value The searchable to set.
      * @return This builder for chaining.
      */
@@ -1327,8 +1327,8 @@ public Builder setSearchable(boolean value) {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1342,7 +1342,7 @@ public Builder setSearchable(boolean value) {
      * optional bool searchable = 3 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=130
+     *     google/cloud/retail/v2/common.proto;l=407
      * @return This builder for chaining.
      */
     @java.lang.Deprecated
@@ -1359,8 +1359,8 @@ public Builder clearSearchable() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1378,7 +1378,7 @@ public Builder clearSearchable() {
      * optional bool indexable = 4 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=149
+     *     google/cloud/retail/v2/common.proto;l=426
      * @return Whether the indexable field is set.
      */
     @java.lang.Override
@@ -1391,8 +1391,8 @@ public boolean hasIndexable() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1410,7 +1410,7 @@ public boolean hasIndexable() {
      * optional bool indexable = 4 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=149
+     *     google/cloud/retail/v2/common.proto;l=426
      * @return The indexable.
      */
     @java.lang.Override
@@ -1423,8 +1423,8 @@ public boolean getIndexable() {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1442,7 +1442,7 @@ public boolean getIndexable() {
      * optional bool indexable = 4 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=149
+     *     google/cloud/retail/v2/common.proto;l=426
      * @param value The indexable to set.
      * @return This builder for chaining.
      */
@@ -1458,8 +1458,8 @@ public Builder setIndexable(boolean value) {
      *
      * 
      * This field is normally ignored unless
-     * [AttributesConfig.attribute_config_level][] of the
-     * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+     * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+     * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
      * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
      * attribute configuration, see [Configuration
      * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -1477,7 +1477,7 @@ public Builder setIndexable(boolean value) {
      * optional bool indexable = 4 [deprecated = true];
      *
      * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-     *     google/cloud/retail/v2/common.proto;l=149
+     *     google/cloud/retail/v2/common.proto;l=426
      * @return This builder for chaining.
      */
     @java.lang.Deprecated
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java
index 95528f27c8be..493aa90b07ff 100644
--- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java
+++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/CustomAttributeOrBuilder.java
@@ -153,8 +153,8 @@ public interface CustomAttributeOrBuilder
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -168,7 +168,7 @@ public interface CustomAttributeOrBuilder
    * optional bool searchable = 3 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=130
+   *     google/cloud/retail/v2/common.proto;l=407
    * @return Whether the searchable field is set.
    */
   @java.lang.Deprecated
@@ -178,8 +178,8 @@ public interface CustomAttributeOrBuilder
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -193,7 +193,7 @@ public interface CustomAttributeOrBuilder
    * optional bool searchable = 3 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.searchable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=130
+   *     google/cloud/retail/v2/common.proto;l=407
    * @return The searchable.
    */
   @java.lang.Deprecated
@@ -204,8 +204,8 @@ public interface CustomAttributeOrBuilder
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -223,7 +223,7 @@ public interface CustomAttributeOrBuilder
    * optional bool indexable = 4 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=149
+   *     google/cloud/retail/v2/common.proto;l=426
    * @return Whether the indexable field is set.
    */
   @java.lang.Deprecated
@@ -233,8 +233,8 @@ public interface CustomAttributeOrBuilder
    *
    * 
    * This field is normally ignored unless
-   * [AttributesConfig.attribute_config_level][] of the
-   * [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
+   * [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
+   * of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
    * 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
    * attribute configuration, see [Configuration
    * modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
@@ -252,7 +252,7 @@ public interface CustomAttributeOrBuilder
    * optional bool indexable = 4 [deprecated = true];
    *
    * @deprecated google.cloud.retail.v2.CustomAttribute.indexable is deprecated. See
-   *     google/cloud/retail/v2/common.proto;l=149
+   *     google/cloud/retail/v2/common.proto;l=426
    * @return The indexable.
    */
   @java.lang.Deprecated
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequest.java
new file mode 100644
index 000000000000..cebd7f8553a6
--- /dev/null
+++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequest.java
@@ -0,0 +1,658 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: google/cloud/retail/v2/control_service.proto
+
+package com.google.cloud.retail.v2;
+
+/**
+ *
+ *
+ * 
+ * Request for DeleteControl method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteControlRequest} + */ +public final class DeleteControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.DeleteControlRequest) + DeleteControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteControlRequest.newBuilder() to construct. + private DeleteControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteControlRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_DeleteControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_DeleteControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteControlRequest.class, + com.google.cloud.retail.v2.DeleteControlRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the Control to delete. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the Control to delete. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.DeleteControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.DeleteControlRequest other = + (com.google.cloud.retail.v2.DeleteControlRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.DeleteControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for DeleteControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.DeleteControlRequest) + com.google.cloud.retail.v2.DeleteControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_DeleteControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_DeleteControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteControlRequest.class, + com.google.cloud.retail.v2.DeleteControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.DeleteControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_DeleteControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.DeleteControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteControlRequest build() { + com.google.cloud.retail.v2.DeleteControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteControlRequest buildPartial() { + com.google.cloud.retail.v2.DeleteControlRequest result = + new com.google.cloud.retail.v2.DeleteControlRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.DeleteControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.DeleteControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.DeleteControlRequest other) { + if (other == com.google.cloud.retail.v2.DeleteControlRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.DeleteControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.DeleteControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the Control to delete. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Control to delete. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Control to delete. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Control to delete. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Control to delete. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.DeleteControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.DeleteControlRequest) + private static final com.google.cloud.retail.v2.DeleteControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.DeleteControlRequest(); + } + + public static com.google.cloud.retail.v2.DeleteControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequestOrBuilder.java new file mode 100644 index 000000000000..1e5b27a7086e --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteControlRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface DeleteControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.DeleteControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the Control to delete. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the Control to delete. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequest.java new file mode 100644 index 000000000000..9f088a4493ed --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequest.java @@ -0,0 +1,660 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for DeleteServingConfig method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteServingConfigRequest} + */ +public final class DeleteServingConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.DeleteServingConfigRequest) + DeleteServingConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteServingConfigRequest.newBuilder() to construct. + private DeleteServingConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteServingConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteServingConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteServingConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_DeleteServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_DeleteServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteServingConfigRequest.class, + com.google.cloud.retail.v2.DeleteServingConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the ServingConfig to delete. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the ServingConfig to delete. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.DeleteServingConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.DeleteServingConfigRequest other = + (com.google.cloud.retail.v2.DeleteServingConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.DeleteServingConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for DeleteServingConfig method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.DeleteServingConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.DeleteServingConfigRequest) + com.google.cloud.retail.v2.DeleteServingConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_DeleteServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_DeleteServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.DeleteServingConfigRequest.class, + com.google.cloud.retail.v2.DeleteServingConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.DeleteServingConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_DeleteServingConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteServingConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.DeleteServingConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteServingConfigRequest build() { + com.google.cloud.retail.v2.DeleteServingConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteServingConfigRequest buildPartial() { + com.google.cloud.retail.v2.DeleteServingConfigRequest result = + new com.google.cloud.retail.v2.DeleteServingConfigRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.DeleteServingConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.DeleteServingConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.DeleteServingConfigRequest other) { + if (other == com.google.cloud.retail.v2.DeleteServingConfigRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.DeleteServingConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.DeleteServingConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the ServingConfig to delete. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to delete. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to delete. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to delete. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to delete. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.DeleteServingConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.DeleteServingConfigRequest) + private static final com.google.cloud.retail.v2.DeleteServingConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.DeleteServingConfigRequest(); + } + + public static com.google.cloud.retail.v2.DeleteServingConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteServingConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteServingConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.DeleteServingConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequestOrBuilder.java new file mode 100644 index 000000000000..4cd7b1793a23 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/DeleteServingConfigRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface DeleteServingConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.DeleteServingConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the ServingConfig to delete. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the ServingConfig to delete. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java index 086a83527430..4c116b64b412 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSource.java @@ -23,7 +23,6 @@ * *
  * Google Cloud Storage location for input content.
- * format.
  * 
* * Protobuf type {@code google.cloud.retail.v2.GcsSource} @@ -237,9 +236,11 @@ public com.google.protobuf.ByteString getInputUrisBytes(int index) { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -275,9 +276,11 @@ public java.lang.String getDataSchema() { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -475,7 +478,6 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * *
    * Google Cloud Storage location for input content.
-   * format.
    * 
* * Protobuf type {@code google.cloud.retail.v2.GcsSource} @@ -896,9 +898,11 @@ public Builder addInputUrisBytes(com.google.protobuf.ByteString value) { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -933,9 +937,11 @@ public java.lang.String getDataSchema() { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -970,9 +976,11 @@ public com.google.protobuf.ByteString getDataSchemaBytes() { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -1006,9 +1014,11 @@ public Builder setDataSchema(java.lang.String value) { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -1038,9 +1048,11 @@ public Builder clearDataSchema() { * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java index c1dba85a8bea..2204ee94e9d7 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GcsSourceOrBuilder.java @@ -119,9 +119,11 @@ public interface GcsSourceOrBuilder * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; @@ -146,9 +148,11 @@ public interface GcsSourceOrBuilder * * `user_event_ga360`: Using * https://support.google.com/analytics/answer/3437719. * Supported values for control imports: - * * 'control' (default): One JSON [Control][] per line. + * * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + * per line. * Supported values for catalog attribute imports: - * * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + * * `catalog_attribute` (default): One CSV + * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. *
* * string data_schema = 2; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequest.java new file mode 100644 index 000000000000..8d5e77f05b71 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequest.java @@ -0,0 +1,664 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetAttributesConfigRequest} + */ +public final class GetAttributesConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GetAttributesConfigRequest) + GetAttributesConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetAttributesConfigRequest.newBuilder() to construct. + private GetAttributesConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetAttributesConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetAttributesConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetAttributesConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetAttributesConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetAttributesConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetAttributesConfigRequest.class, + com.google.cloud.retail.v2.GetAttributesConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GetAttributesConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GetAttributesConfigRequest other = + (com.google.cloud.retail.v2.GetAttributesConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.GetAttributesConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetAttributesConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GetAttributesConfigRequest) + com.google.cloud.retail.v2.GetAttributesConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetAttributesConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetAttributesConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetAttributesConfigRequest.class, + com.google.cloud.retail.v2.GetAttributesConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GetAttributesConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetAttributesConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetAttributesConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GetAttributesConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetAttributesConfigRequest build() { + com.google.cloud.retail.v2.GetAttributesConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetAttributesConfigRequest buildPartial() { + com.google.cloud.retail.v2.GetAttributesConfigRequest result = + new com.google.cloud.retail.v2.GetAttributesConfigRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GetAttributesConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.GetAttributesConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GetAttributesConfigRequest other) { + if (other == com.google.cloud.retail.v2.GetAttributesConfigRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GetAttributesConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.GetAttributesConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GetAttributesConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GetAttributesConfigRequest) + private static final com.google.cloud.retail.v2.GetAttributesConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GetAttributesConfigRequest(); + } + + public static com.google.cloud.retail.v2.GetAttributesConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetAttributesConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetAttributesConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetAttributesConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequestOrBuilder.java new file mode 100644 index 000000000000..87db72115504 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetAttributesConfigRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface GetAttributesConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GetAttributesConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequest.java new file mode 100644 index 000000000000..f8bea6fc5263 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequest.java @@ -0,0 +1,664 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetCompletionConfigRequest} + */ +public final class GetCompletionConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GetCompletionConfigRequest) + GetCompletionConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetCompletionConfigRequest.newBuilder() to construct. + private GetCompletionConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetCompletionConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetCompletionConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetCompletionConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetCompletionConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetCompletionConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetCompletionConfigRequest.class, + com.google.cloud.retail.v2.GetCompletionConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Full CompletionConfig resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full CompletionConfig resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GetCompletionConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GetCompletionConfigRequest other = + (com.google.cloud.retail.v2.GetCompletionConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.GetCompletionConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetCompletionConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GetCompletionConfigRequest) + com.google.cloud.retail.v2.GetCompletionConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetCompletionConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetCompletionConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetCompletionConfigRequest.class, + com.google.cloud.retail.v2.GetCompletionConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GetCompletionConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_GetCompletionConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetCompletionConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GetCompletionConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetCompletionConfigRequest build() { + com.google.cloud.retail.v2.GetCompletionConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetCompletionConfigRequest buildPartial() { + com.google.cloud.retail.v2.GetCompletionConfigRequest result = + new com.google.cloud.retail.v2.GetCompletionConfigRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GetCompletionConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.GetCompletionConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GetCompletionConfigRequest other) { + if (other == com.google.cloud.retail.v2.GetCompletionConfigRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GetCompletionConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.GetCompletionConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Full CompletionConfig resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full CompletionConfig resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full CompletionConfig resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full CompletionConfig resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full CompletionConfig resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GetCompletionConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GetCompletionConfigRequest) + private static final com.google.cloud.retail.v2.GetCompletionConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GetCompletionConfigRequest(); + } + + public static com.google.cloud.retail.v2.GetCompletionConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetCompletionConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetCompletionConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetCompletionConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequestOrBuilder.java new file mode 100644 index 000000000000..55f2df10fd4b --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetCompletionConfigRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface GetCompletionConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GetCompletionConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full CompletionConfig resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Full CompletionConfig resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequest.java new file mode 100644 index 000000000000..253829c85a48 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequest.java @@ -0,0 +1,657 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for GetControl method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetControlRequest} + */ +public final class GetControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GetControlRequest) + GetControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetControlRequest.newBuilder() to construct. + private GetControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetControlRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_GetControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_GetControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetControlRequest.class, + com.google.cloud.retail.v2.GetControlRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the Control to get. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the Control to get. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GetControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GetControlRequest other = + (com.google.cloud.retail.v2.GetControlRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.GetControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for GetControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GetControlRequest) + com.google.cloud.retail.v2.GetControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_GetControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_GetControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetControlRequest.class, + com.google.cloud.retail.v2.GetControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GetControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_GetControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GetControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetControlRequest build() { + com.google.cloud.retail.v2.GetControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetControlRequest buildPartial() { + com.google.cloud.retail.v2.GetControlRequest result = + new com.google.cloud.retail.v2.GetControlRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GetControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.GetControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GetControlRequest other) { + if (other == com.google.cloud.retail.v2.GetControlRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GetControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.GetControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the Control to get. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Control to get. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the Control to get. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Control to get. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the Control to get. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GetControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GetControlRequest) + private static final com.google.cloud.retail.v2.GetControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GetControlRequest(); + } + + public static com.google.cloud.retail.v2.GetControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequestOrBuilder.java new file mode 100644 index 000000000000..b6ba0f070dee --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetControlRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface GetControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GetControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the Control to get. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the Control to get. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequest.java new file mode 100644 index 000000000000..49a02a9c90da --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequest.java @@ -0,0 +1,659 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for GetServingConfig method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetServingConfigRequest} + */ +public final class GetServingConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.GetServingConfigRequest) + GetServingConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetServingConfigRequest.newBuilder() to construct. + private GetServingConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetServingConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetServingConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetServingConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_GetServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_GetServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetServingConfigRequest.class, + com.google.cloud.retail.v2.GetServingConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the ServingConfig to get. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the ServingConfig to get. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.GetServingConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.GetServingConfigRequest other = + (com.google.cloud.retail.v2.GetServingConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.GetServingConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for GetServingConfig method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.GetServingConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.GetServingConfigRequest) + com.google.cloud.retail.v2.GetServingConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_GetServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_GetServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.GetServingConfigRequest.class, + com.google.cloud.retail.v2.GetServingConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.GetServingConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_GetServingConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetServingConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.GetServingConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetServingConfigRequest build() { + com.google.cloud.retail.v2.GetServingConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetServingConfigRequest buildPartial() { + com.google.cloud.retail.v2.GetServingConfigRequest result = + new com.google.cloud.retail.v2.GetServingConfigRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.GetServingConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.GetServingConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.GetServingConfigRequest other) { + if (other == com.google.cloud.retail.v2.GetServingConfigRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.GetServingConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.GetServingConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the ServingConfig to get. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to get. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to get. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to get. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the ServingConfig to get. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.GetServingConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.GetServingConfigRequest) + private static final com.google.cloud.retail.v2.GetServingConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.GetServingConfigRequest(); + } + + public static com.google.cloud.retail.v2.GetServingConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetServingConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetServingConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.GetServingConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequestOrBuilder.java new file mode 100644 index 000000000000..c1661e411e81 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/GetServingConfigRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface GetServingConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.GetServingConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the ServingConfig to get. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the ServingConfig to get. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequest.java index a1ad36f4fc21..4ee9d179dda1 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequest.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequest.java @@ -254,8 +254,8 @@ public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder getInputCon * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -281,8 +281,8 @@ public java.lang.String getNotificationPubsubTopic() { * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -998,8 +998,8 @@ public com.google.cloud.retail.v2.CompletionDataInputConfigOrBuilder getInputCon * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1024,8 +1024,8 @@ public java.lang.String getNotificationPubsubTopic() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1050,8 +1050,8 @@ public com.google.protobuf.ByteString getNotificationPubsubTopicBytes() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1075,8 +1075,8 @@ public Builder setNotificationPubsubTopic(java.lang.String value) { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1096,8 +1096,8 @@ public Builder clearNotificationPubsubTopic() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequestOrBuilder.java index 833c25cbc152..e5b132c48799 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequestOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportCompletionDataRequestOrBuilder.java @@ -100,8 +100,8 @@ public interface ImportCompletionDataRequestOrBuilder * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -116,8 +116,8 @@ public interface ImportCompletionDataRequestOrBuilder * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfig.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfig.java index 4b9e64317771..4ea059f63cc7 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfig.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfig.java @@ -161,7 +161,7 @@ public DestinationCase getDestinationCase() { * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
@@ -178,7 +178,7 @@ public boolean hasGcsPrefix() { * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
@@ -208,7 +208,7 @@ public java.lang.String getGcsPrefix() { * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
@@ -594,7 +594,7 @@ public Builder clearDestination() { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
@@ -612,7 +612,7 @@ public boolean hasGcsPrefix() { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
@@ -643,7 +643,7 @@ public java.lang.String getGcsPrefix() { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
@@ -674,7 +674,7 @@ public com.google.protobuf.ByteString getGcsPrefixBytes() { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
@@ -698,7 +698,7 @@ public Builder setGcsPrefix(java.lang.String value) { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
@@ -720,7 +720,7 @@ public Builder clearGcsPrefix() { * *
      * Google Cloud Storage prefix for import errors. This must be an empty,
-     * existing Cloud Storage directory. Import errors will be written to
+     * existing Cloud Storage directory. Import errors are written to
      * sharded files in this directory, one per line, as a JSON-encoded
      * `google.rpc.Status` message.
      * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java index 8f9d21dca7d1..294406df9a25 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportErrorsConfigOrBuilder.java @@ -28,7 +28,7 @@ public interface ImportErrorsConfigOrBuilder * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
@@ -43,7 +43,7 @@ public interface ImportErrorsConfigOrBuilder * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
@@ -58,7 +58,7 @@ public interface ImportErrorsConfigOrBuilder * *
    * Google Cloud Storage prefix for import errors. This must be an empty,
-   * existing Cloud Storage directory. Import errors will be written to
+   * existing Cloud Storage directory. Import errors are written to
    * sharded files in this directory, one per line, as a JSON-encoded
    * `google.rpc.Status` message.
    * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java index 73bbb33e81aa..f80a9d47f5b7 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadata.java @@ -22,7 +22,7 @@ * * *
- * Metadata related to the progress of the Import operation. This will be
+ * Metadata related to the progress of the Import operation. This is
  * returned by the google.longrunning.Operation.metadata field.
  * 
* @@ -305,7 +305,7 @@ public long getFailureCount() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The requestId. */ @java.lang.Override @@ -331,7 +331,7 @@ public java.lang.String getRequestId() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The bytes for requestId. */ @java.lang.Override @@ -355,8 +355,8 @@ public com.google.protobuf.ByteString getRequestIdBytes() { * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -382,8 +382,8 @@ public java.lang.String getNotificationPubsubTopic() { * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -623,7 +623,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * *
-   * Metadata related to the progress of the Import operation. This will be
+   * Metadata related to the progress of the Import operation. This is
    * returned by the google.longrunning.Operation.metadata field.
    * 
* @@ -1314,7 +1314,7 @@ public Builder clearFailureCount() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The requestId. */ @java.lang.Deprecated @@ -1339,7 +1339,7 @@ public java.lang.String getRequestId() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The bytes for requestId. */ @java.lang.Deprecated @@ -1364,7 +1364,7 @@ public com.google.protobuf.ByteString getRequestIdBytes() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @param value The requestId to set. * @return This builder for chaining. */ @@ -1388,7 +1388,7 @@ public Builder setRequestId(java.lang.String value) { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return This builder for chaining. */ @java.lang.Deprecated @@ -1408,7 +1408,7 @@ public Builder clearRequestId() { * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @param value The bytes for requestId to set. * @return This builder for chaining. */ @@ -1430,8 +1430,8 @@ public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1456,8 +1456,8 @@ public java.lang.String getNotificationPubsubTopic() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1482,8 +1482,8 @@ public com.google.protobuf.ByteString getNotificationPubsubTopicBytes() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1507,8 +1507,8 @@ public Builder setNotificationPubsubTopic(java.lang.String value) { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
@@ -1528,8 +1528,8 @@ public Builder clearNotificationPubsubTopic() { * *
      * Pub/Sub topic for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
      * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java index 4df957c98a31..ab0810fd9c35 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportMetadataOrBuilder.java @@ -132,7 +132,7 @@ public interface ImportMetadataOrBuilder * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The requestId. */ @java.lang.Deprecated @@ -147,7 +147,7 @@ public interface ImportMetadataOrBuilder * string request_id = 5 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportMetadata.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=345 + * google/cloud/retail/v2/import_config.proto;l=330 * @return The bytes for requestId. */ @java.lang.Deprecated @@ -158,8 +158,8 @@ public interface ImportMetadataOrBuilder * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
@@ -174,8 +174,8 @@ public interface ImportMetadataOrBuilder * *
    * Pub/Sub topic for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
    * 
diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java index ef5d911a31f5..a1d3d54c350e 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequest.java @@ -221,13 +221,6 @@ public enum ReconciliationMode implements com.google.protobuf.ProtocolMessageEnu *
      * Calculates diff and replaces the entire product dataset. Existing
      * products may be deleted if they are not present in the source location.
-     * Can only be set while using
-     * [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. And the BigQuery
-     * dataset must be created in the data location "us (multiple regions in
-     * United States)", otherwise a PERMISSION_DENIED error is thrown.
-     * Add the IAM permission "BigQuery Data Viewer" for
-     * cloud-retail-customer-data-access@system.gserviceaccount.com before
-     * using this feature otherwise an error is thrown.
      * 
* * FULL = 2; @@ -262,13 +255,6 @@ public enum ReconciliationMode implements com.google.protobuf.ProtocolMessageEnu *
      * Calculates diff and replaces the entire product dataset. Existing
      * products may be deleted if they are not present in the source location.
-     * Can only be set while using
-     * [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. And the BigQuery
-     * dataset must be created in the data location "us (multiple regions in
-     * United States)", otherwise a PERMISSION_DENIED error is thrown.
-     * Add the IAM permission "BigQuery Data Viewer" for
-     * cloud-retail-customer-data-access@system.gserviceaccount.com before
-     * using this feature otherwise an error is thrown.
      * 
* * FULL = 2; @@ -432,7 +418,7 @@ public com.google.protobuf.ByteString getParentBytes() { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The requestId. */ @java.lang.Override @@ -458,7 +444,7 @@ public java.lang.String getRequestId() { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The bytes for requestId. */ @java.lang.Override @@ -583,8 +569,8 @@ public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrB * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -599,8 +585,8 @@ public boolean hasUpdateMask() { * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -615,8 +601,8 @@ public com.google.protobuf.FieldMask getUpdateMask() { * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -679,19 +665,15 @@ public int getReconciliationModeValue() { * *
    * Full Pub/Sub topic name for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
    * to be within the same project as
    * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-   * Make sure that both
-   * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-   * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-   * have the `pubsub.topics.publish` IAM permission on the topic.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Make sure that `service-<project
+   * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+   * `pubsub.topics.publish` IAM permission on the topic.
    * 
* * string notification_pubsub_topic = 7; @@ -715,19 +697,15 @@ public java.lang.String getNotificationPubsubTopic() { * *
    * Full Pub/Sub topic name for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
    * to be within the same project as
    * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-   * Make sure that both
-   * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-   * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-   * have the `pubsub.topics.publish` IAM permission on the topic.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Make sure that `service-<project
+   * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+   * `pubsub.topics.publish` IAM permission on the topic.
    * 
* * string notification_pubsub_topic = 7; @@ -1343,7 +1321,7 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The requestId. */ @java.lang.Deprecated @@ -1368,7 +1346,7 @@ public java.lang.String getRequestId() { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The bytes for requestId. */ @java.lang.Deprecated @@ -1393,7 +1371,7 @@ public com.google.protobuf.ByteString getRequestIdBytes() { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @param value The requestId to set. * @return This builder for chaining. */ @@ -1417,7 +1395,7 @@ public Builder setRequestId(java.lang.String value) { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return This builder for chaining. */ @java.lang.Deprecated @@ -1437,7 +1415,7 @@ public Builder clearRequestId() { * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @param value The bytes for requestId to set. * @return This builder for chaining. */ @@ -1853,8 +1831,8 @@ public com.google.cloud.retail.v2.ImportErrorsConfigOrBuilder getErrorsConfigOrB * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1868,8 +1846,8 @@ public boolean hasUpdateMask() { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1889,8 +1867,8 @@ public com.google.protobuf.FieldMask getUpdateMask() { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1912,8 +1890,8 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1932,8 +1910,8 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForVal * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1957,8 +1935,8 @@ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1978,8 +1956,8 @@ public Builder clearUpdateMask() { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -1993,8 +1971,8 @@ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -2012,8 +1990,8 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { * * *
-     * Indicates which fields in the provided imported 'products' to update. If
-     * not set, will by default update all fields.
+     * Indicates which fields in the provided imported `products` to update. If
+     * not set, all fields are updated.
      * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -2157,19 +2135,15 @@ public Builder clearReconciliationMode() { * *
      * Full Pub/Sub topic name for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
      * to be within the same project as
      * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-     * Make sure that both
-     * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-     * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-     * have the `pubsub.topics.publish` IAM permission on the topic.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Make sure that `service-<project
+     * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+     * `pubsub.topics.publish` IAM permission on the topic.
      * 
* * string notification_pubsub_topic = 7; @@ -2192,19 +2166,15 @@ public java.lang.String getNotificationPubsubTopic() { * *
      * Full Pub/Sub topic name for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
      * to be within the same project as
      * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-     * Make sure that both
-     * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-     * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-     * have the `pubsub.topics.publish` IAM permission on the topic.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Make sure that `service-<project
+     * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+     * `pubsub.topics.publish` IAM permission on the topic.
      * 
* * string notification_pubsub_topic = 7; @@ -2227,19 +2197,15 @@ public com.google.protobuf.ByteString getNotificationPubsubTopicBytes() { * *
      * Full Pub/Sub topic name for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
      * to be within the same project as
      * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-     * Make sure that both
-     * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-     * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-     * have the `pubsub.topics.publish` IAM permission on the topic.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Make sure that `service-<project
+     * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+     * `pubsub.topics.publish` IAM permission on the topic.
      * 
* * string notification_pubsub_topic = 7; @@ -2261,19 +2227,15 @@ public Builder setNotificationPubsubTopic(java.lang.String value) { * *
      * Full Pub/Sub topic name for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
      * to be within the same project as
      * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-     * Make sure that both
-     * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-     * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-     * have the `pubsub.topics.publish` IAM permission on the topic.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Make sure that `service-<project
+     * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+     * `pubsub.topics.publish` IAM permission on the topic.
      * 
* * string notification_pubsub_topic = 7; @@ -2291,19 +2253,15 @@ public Builder clearNotificationPubsubTopic() { * *
      * Full Pub/Sub topic name for receiving notification. If this field is set,
-     * when the import is finished, a notification will be sent to
-     * specified Pub/Sub topic. The message data will be JSON string of a
+     * when the import is finished, a notification is sent to
+     * specified Pub/Sub topic. The message data is JSON string of a
      * [Operation][google.longrunning.Operation].
      * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
      * to be within the same project as
      * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-     * Make sure that both
-     * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-     * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-     * have the `pubsub.topics.publish` IAM permission on the topic.
-     * Only supported when
-     * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-     * is set to `FULL`.
+     * Make sure that `service-<project
+     * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+     * `pubsub.topics.publish` IAM permission on the topic.
      * 
* * string notification_pubsub_topic = 7; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java index af9099343034..07dd5fb8af58 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ImportProductsRequestOrBuilder.java @@ -68,7 +68,7 @@ public interface ImportProductsRequestOrBuilder * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The requestId. */ @java.lang.Deprecated @@ -83,7 +83,7 @@ public interface ImportProductsRequestOrBuilder * string request_id = 6 [deprecated = true]; * * @deprecated google.cloud.retail.v2.ImportProductsRequest.request_id is deprecated. See - * google/cloud/retail/v2/import_config.proto;l=199 + * google/cloud/retail/v2/import_config.proto;l=189 * @return The bytes for requestId. */ @java.lang.Deprecated @@ -169,8 +169,8 @@ public interface ImportProductsRequestOrBuilder * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -182,8 +182,8 @@ public interface ImportProductsRequestOrBuilder * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -195,8 +195,8 @@ public interface ImportProductsRequestOrBuilder * * *
-   * Indicates which fields in the provided imported 'products' to update. If
-   * not set, will by default update all fields.
+   * Indicates which fields in the provided imported `products` to update. If
+   * not set, all fields are updated.
    * 
* * .google.protobuf.FieldMask update_mask = 4; @@ -239,19 +239,15 @@ public interface ImportProductsRequestOrBuilder * *
    * Full Pub/Sub topic name for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
    * to be within the same project as
    * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-   * Make sure that both
-   * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-   * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-   * have the `pubsub.topics.publish` IAM permission on the topic.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Make sure that `service-<project
+   * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+   * `pubsub.topics.publish` IAM permission on the topic.
    * 
* * string notification_pubsub_topic = 7; @@ -264,19 +260,15 @@ public interface ImportProductsRequestOrBuilder * *
    * Full Pub/Sub topic name for receiving notification. If this field is set,
-   * when the import is finished, a notification will be sent to
-   * specified Pub/Sub topic. The message data will be JSON string of a
+   * when the import is finished, a notification is sent to
+   * specified Pub/Sub topic. The message data is JSON string of a
    * [Operation][google.longrunning.Operation].
    * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
    * to be within the same project as
    * [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
-   * Make sure that both
-   * `cloud-retail-customer-data-access@system.gserviceaccount.com` and
-   * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
-   * have the `pubsub.topics.publish` IAM permission on the topic.
-   * Only supported when
-   * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
-   * is set to `FULL`.
+   * Make sure that `service-<project
+   * number>@gcp-sa-retail.iam.gserviceaccount.com` has the
+   * `pubsub.topics.publish` IAM permission on the topic.
    * 
* * string notification_pubsub_topic = 7; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequest.java new file mode 100644 index 000000000000..c58e83709ce6 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequest.java @@ -0,0 +1,1144 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for ListControls method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListControlsRequest} + */ +public final class ListControlsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListControlsRequest) + ListControlsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListControlsRequest.newBuilder() to construct. + private ListControlsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListControlsRequest() { + parent_ = ""; + pageToken_ = ""; + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListControlsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListControlsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListControlsRequest.class, + com.google.cloud.retail.v2.ListControlsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. Maximum number of results to return. If unspecified, defaults
+   * to 50. Max allowed value is 1000.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. A page token, received from a previous `ListControls` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A page token, received from a previous `ListControls` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 4; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Optional. A filter to apply on the list results. Supported features:
+   * * List all the products under the parent branch if
+   * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+   * * List controls that are used in a single ServingConfig:
+   *     'serving_config = "boosted_home_page_cvr"'
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A filter to apply on the list results. Supported features:
+   * * List all the products under the parent branch if
+   * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+   * * List controls that are used in a single ServingConfig:
+   *     'serving_config = "boosted_home_page_cvr"'
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, filter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListControlsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListControlsRequest other = + (com.google.cloud.retail.v2.ListControlsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ListControlsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for ListControls method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListControlsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListControlsRequest) + com.google.cloud.retail.v2.ListControlsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListControlsRequest.class, + com.google.cloud.retail.v2.ListControlsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListControlsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListControlsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsRequest build() { + com.google.cloud.retail.v2.ListControlsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsRequest buildPartial() { + com.google.cloud.retail.v2.ListControlsRequest result = + new com.google.cloud.retail.v2.ListControlsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListControlsRequest) { + return mergeFrom((com.google.cloud.retail.v2.ListControlsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListControlsRequest other) { + if (other == com.google.cloud.retail.v2.ListControlsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListControlsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ListControlsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 50. Max allowed value is 1000.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 50. Max allowed value is 1000.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 50. Max allowed value is 1000.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. A page token, received from a previous `ListControls` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListControls` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListControls` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListControls` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListControls` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Optional. A filter to apply on the list results. Supported features:
+     * * List all the products under the parent branch if
+     * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+     * * List controls that are used in a single ServingConfig:
+     *     'serving_config = "boosted_home_page_cvr"'
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A filter to apply on the list results. Supported features:
+     * * List all the products under the parent branch if
+     * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+     * * List controls that are used in a single ServingConfig:
+     *     'serving_config = "boosted_home_page_cvr"'
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A filter to apply on the list results. Supported features:
+     * * List all the products under the parent branch if
+     * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+     * * List controls that are used in a single ServingConfig:
+     *     'serving_config = "boosted_home_page_cvr"'
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A filter to apply on the list results. Supported features:
+     * * List all the products under the parent branch if
+     * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+     * * List controls that are used in a single ServingConfig:
+     *     'serving_config = "boosted_home_page_cvr"'
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A filter to apply on the list results. Supported features:
+     * * List all the products under the parent branch if
+     * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+     * * List controls that are used in a single ServingConfig:
+     *     'serving_config = "boosted_home_page_cvr"'
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListControlsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListControlsRequest) + private static final com.google.cloud.retail.v2.ListControlsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListControlsRequest(); + } + + public static com.google.cloud.retail.v2.ListControlsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListControlsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListControlsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequestOrBuilder.java new file mode 100644 index 000000000000..d237e4cfec1d --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsRequestOrBuilder.java @@ -0,0 +1,130 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface ListControlsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListControlsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. Maximum number of results to return. If unspecified, defaults
+   * to 50. Max allowed value is 1000.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. A page token, received from a previous `ListControls` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. A page token, received from a previous `ListControls` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Optional. A filter to apply on the list results. Supported features:
+   * * List all the products under the parent branch if
+   * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+   * * List controls that are used in a single ServingConfig:
+   *     'serving_config = "boosted_home_page_cvr"'
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Optional. A filter to apply on the list results. Supported features:
+   * * List all the products under the parent branch if
+   * [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
+   * * List controls that are used in a single ServingConfig:
+   *     'serving_config = "boosted_home_page_cvr"'
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponse.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponse.java new file mode 100644 index 000000000000..39a107a4e7ab --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponse.java @@ -0,0 +1,1128 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response for ListControls method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListControlsResponse} + */ +public final class ListControlsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListControlsResponse) + ListControlsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListControlsResponse.newBuilder() to construct. + private ListControlsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListControlsResponse() { + controls_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListControlsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListControlsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + controls_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + controls_.add( + input.readMessage( + com.google.cloud.retail.v2.Control.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + controls_ = java.util.Collections.unmodifiableList(controls_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListControlsResponse.class, + com.google.cloud.retail.v2.ListControlsResponse.Builder.class); + } + + public static final int CONTROLS_FIELD_NUMBER = 1; + private java.util.List controls_; + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + @java.lang.Override + public java.util.List getControlsList() { + return controls_; + } + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + @java.lang.Override + public java.util.List + getControlsOrBuilderList() { + return controls_; + } + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + @java.lang.Override + public int getControlsCount() { + return controls_.size(); + } + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Control getControls(int index) { + return controls_.get(index); + } + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ControlOrBuilder getControlsOrBuilder(int index) { + return controls_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < controls_.size(); i++) { + output.writeMessage(1, controls_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < controls_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, controls_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListControlsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListControlsResponse other = + (com.google.cloud.retail.v2.ListControlsResponse) obj; + + if (!getControlsList().equals(other.getControlsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getControlsCount() > 0) { + hash = (37 * hash) + CONTROLS_FIELD_NUMBER; + hash = (53 * hash) + getControlsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListControlsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ListControlsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for ListControls method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListControlsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListControlsResponse) + com.google.cloud.retail.v2.ListControlsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListControlsResponse.class, + com.google.cloud.retail.v2.ListControlsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListControlsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getControlsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (controlsBuilder_ == null) { + controls_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + controlsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_ListControlsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListControlsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsResponse build() { + com.google.cloud.retail.v2.ListControlsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsResponse buildPartial() { + com.google.cloud.retail.v2.ListControlsResponse result = + new com.google.cloud.retail.v2.ListControlsResponse(this); + int from_bitField0_ = bitField0_; + if (controlsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + controls_ = java.util.Collections.unmodifiableList(controls_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.controls_ = controls_; + } else { + result.controls_ = controlsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListControlsResponse) { + return mergeFrom((com.google.cloud.retail.v2.ListControlsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListControlsResponse other) { + if (other == com.google.cloud.retail.v2.ListControlsResponse.getDefaultInstance()) + return this; + if (controlsBuilder_ == null) { + if (!other.controls_.isEmpty()) { + if (controls_.isEmpty()) { + controls_ = other.controls_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureControlsIsMutable(); + controls_.addAll(other.controls_); + } + onChanged(); + } + } else { + if (!other.controls_.isEmpty()) { + if (controlsBuilder_.isEmpty()) { + controlsBuilder_.dispose(); + controlsBuilder_ = null; + controls_ = other.controls_; + bitField0_ = (bitField0_ & ~0x00000001); + controlsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getControlsFieldBuilder() + : null; + } else { + controlsBuilder_.addAllMessages(other.controls_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListControlsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ListControlsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List controls_ = + java.util.Collections.emptyList(); + + private void ensureControlsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + controls_ = new java.util.ArrayList(controls_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + controlsBuilder_; + + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public java.util.List getControlsList() { + if (controlsBuilder_ == null) { + return java.util.Collections.unmodifiableList(controls_); + } else { + return controlsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public int getControlsCount() { + if (controlsBuilder_ == null) { + return controls_.size(); + } else { + return controlsBuilder_.getCount(); + } + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public com.google.cloud.retail.v2.Control getControls(int index) { + if (controlsBuilder_ == null) { + return controls_.get(index); + } else { + return controlsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder setControls(int index, com.google.cloud.retail.v2.Control value) { + if (controlsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureControlsIsMutable(); + controls_.set(index, value); + onChanged(); + } else { + controlsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder setControls( + int index, com.google.cloud.retail.v2.Control.Builder builderForValue) { + if (controlsBuilder_ == null) { + ensureControlsIsMutable(); + controls_.set(index, builderForValue.build()); + onChanged(); + } else { + controlsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder addControls(com.google.cloud.retail.v2.Control value) { + if (controlsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureControlsIsMutable(); + controls_.add(value); + onChanged(); + } else { + controlsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder addControls(int index, com.google.cloud.retail.v2.Control value) { + if (controlsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureControlsIsMutable(); + controls_.add(index, value); + onChanged(); + } else { + controlsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder addControls(com.google.cloud.retail.v2.Control.Builder builderForValue) { + if (controlsBuilder_ == null) { + ensureControlsIsMutable(); + controls_.add(builderForValue.build()); + onChanged(); + } else { + controlsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder addControls( + int index, com.google.cloud.retail.v2.Control.Builder builderForValue) { + if (controlsBuilder_ == null) { + ensureControlsIsMutable(); + controls_.add(index, builderForValue.build()); + onChanged(); + } else { + controlsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder addAllControls( + java.lang.Iterable values) { + if (controlsBuilder_ == null) { + ensureControlsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, controls_); + onChanged(); + } else { + controlsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder clearControls() { + if (controlsBuilder_ == null) { + controls_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + controlsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public Builder removeControls(int index) { + if (controlsBuilder_ == null) { + ensureControlsIsMutable(); + controls_.remove(index); + onChanged(); + } else { + controlsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public com.google.cloud.retail.v2.Control.Builder getControlsBuilder(int index) { + return getControlsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public com.google.cloud.retail.v2.ControlOrBuilder getControlsOrBuilder(int index) { + if (controlsBuilder_ == null) { + return controls_.get(index); + } else { + return controlsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public java.util.List + getControlsOrBuilderList() { + if (controlsBuilder_ != null) { + return controlsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(controls_); + } + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public com.google.cloud.retail.v2.Control.Builder addControlsBuilder() { + return getControlsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.Control.getDefaultInstance()); + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public com.google.cloud.retail.v2.Control.Builder addControlsBuilder(int index) { + return getControlsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.Control.getDefaultInstance()); + } + /** + * + * + *
+     * All the Controls for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + public java.util.List getControlsBuilderList() { + return getControlsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + getControlsFieldBuilder() { + if (controlsBuilder_ == null) { + controlsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder>( + controls_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + controls_ = null; + } + return controlsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListControlsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListControlsResponse) + private static final com.google.cloud.retail.v2.ListControlsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListControlsResponse(); + } + + public static com.google.cloud.retail.v2.ListControlsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListControlsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListControlsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListControlsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponseOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponseOrBuilder.java new file mode 100644 index 000000000000..4fed6fc891f4 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListControlsResponseOrBuilder.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface ListControlsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListControlsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + java.util.List getControlsList(); + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + com.google.cloud.retail.v2.Control getControls(int index); + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + int getControlsCount(); + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + java.util.List getControlsOrBuilderList(); + /** + * + * + *
+   * All the Controls for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.Control controls = 1; + */ + com.google.cloud.retail.v2.ControlOrBuilder getControlsOrBuilder(int index); + + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequest.java new file mode 100644 index 000000000000..18534031a63b --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequest.java @@ -0,0 +1,943 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for ListServingConfigs method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListServingConfigsRequest} + */ +public final class ListServingConfigsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListServingConfigsRequest) + ListServingConfigsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListServingConfigsRequest.newBuilder() to construct. + private ListServingConfigsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListServingConfigsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListServingConfigsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListServingConfigsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListServingConfigsRequest.class, + com.google.cloud.retail.v2.ListServingConfigsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. Maximum number of results to return. If unspecified, defaults
+   * to 100. If a value greater than 100 is provided, at most 100 results are
+   * returned.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. A page token, received from a previous `ListServingConfigs` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A page token, received from a previous `ListServingConfigs` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListServingConfigsRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListServingConfigsRequest other = + (com.google.cloud.retail.v2.ListServingConfigsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ListServingConfigsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for ListServingConfigs method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListServingConfigsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListServingConfigsRequest) + com.google.cloud.retail.v2.ListServingConfigsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListServingConfigsRequest.class, + com.google.cloud.retail.v2.ListServingConfigsRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListServingConfigsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListServingConfigsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsRequest build() { + com.google.cloud.retail.v2.ListServingConfigsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsRequest buildPartial() { + com.google.cloud.retail.v2.ListServingConfigsRequest result = + new com.google.cloud.retail.v2.ListServingConfigsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListServingConfigsRequest) { + return mergeFrom((com.google.cloud.retail.v2.ListServingConfigsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListServingConfigsRequest other) { + if (other == com.google.cloud.retail.v2.ListServingConfigsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListServingConfigsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ListServingConfigsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The catalog resource name. Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 100. If a value greater than 100 is provided, at most 100 results are
+     * returned.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 100. If a value greater than 100 is provided, at most 100 results are
+     * returned.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Maximum number of results to return. If unspecified, defaults
+     * to 100. If a value greater than 100 is provided, at most 100 results are
+     * returned.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. A page token, received from a previous `ListServingConfigs` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListServingConfigs` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListServingConfigs` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListServingConfigs` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A page token, received from a previous `ListServingConfigs` call.
+     * Provide this to retrieve the subsequent page.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListServingConfigsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListServingConfigsRequest) + private static final com.google.cloud.retail.v2.ListServingConfigsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListServingConfigsRequest(); + } + + public static com.google.cloud.retail.v2.ListServingConfigsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListServingConfigsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListServingConfigsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequestOrBuilder.java new file mode 100644 index 000000000000..5465fa3b0af6 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsRequestOrBuilder.java @@ -0,0 +1,98 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface ListServingConfigsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListServingConfigsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The catalog resource name. Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. Maximum number of results to return. If unspecified, defaults
+   * to 100. If a value greater than 100 is provided, at most 100 results are
+   * returned.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. A page token, received from a previous `ListServingConfigs` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. A page token, received from a previous `ListServingConfigs` call.
+   * Provide this to retrieve the subsequent page.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponse.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponse.java new file mode 100644 index 000000000000..468e29667573 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponse.java @@ -0,0 +1,1137 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Response for ListServingConfigs method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListServingConfigsResponse} + */ +public final class ListServingConfigsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ListServingConfigsResponse) + ListServingConfigsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListServingConfigsResponse.newBuilder() to construct. + private ListServingConfigsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListServingConfigsResponse() { + servingConfigs_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListServingConfigsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListServingConfigsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + servingConfigs_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + servingConfigs_.add( + input.readMessage( + com.google.cloud.retail.v2.ServingConfig.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + servingConfigs_ = java.util.Collections.unmodifiableList(servingConfigs_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListServingConfigsResponse.class, + com.google.cloud.retail.v2.ListServingConfigsResponse.Builder.class); + } + + public static final int SERVING_CONFIGS_FIELD_NUMBER = 1; + private java.util.List servingConfigs_; + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + @java.lang.Override + public java.util.List getServingConfigsList() { + return servingConfigs_; + } + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + @java.lang.Override + public java.util.List + getServingConfigsOrBuilderList() { + return servingConfigs_; + } + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + @java.lang.Override + public int getServingConfigsCount() { + return servingConfigs_.size(); + } + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig getServingConfigs(int index) { + return servingConfigs_.get(index); + } + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigsOrBuilder(int index) { + return servingConfigs_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < servingConfigs_.size(); i++) { + output.writeMessage(1, servingConfigs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < servingConfigs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, servingConfigs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ListServingConfigsResponse)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ListServingConfigsResponse other = + (com.google.cloud.retail.v2.ListServingConfigsResponse) obj; + + if (!getServingConfigsList().equals(other.getServingConfigsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getServingConfigsCount() > 0) { + hash = (37 * hash) + SERVING_CONFIGS_FIELD_NUMBER; + hash = (53 * hash) + getServingConfigsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.ListServingConfigsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for ListServingConfigs method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ListServingConfigsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ListServingConfigsResponse) + com.google.cloud.retail.v2.ListServingConfigsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ListServingConfigsResponse.class, + com.google.cloud.retail.v2.ListServingConfigsResponse.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ListServingConfigsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getServingConfigsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (servingConfigsBuilder_ == null) { + servingConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + servingConfigsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_ListServingConfigsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsResponse getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ListServingConfigsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsResponse build() { + com.google.cloud.retail.v2.ListServingConfigsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsResponse buildPartial() { + com.google.cloud.retail.v2.ListServingConfigsResponse result = + new com.google.cloud.retail.v2.ListServingConfigsResponse(this); + int from_bitField0_ = bitField0_; + if (servingConfigsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + servingConfigs_ = java.util.Collections.unmodifiableList(servingConfigs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.servingConfigs_ = servingConfigs_; + } else { + result.servingConfigs_ = servingConfigsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ListServingConfigsResponse) { + return mergeFrom((com.google.cloud.retail.v2.ListServingConfigsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ListServingConfigsResponse other) { + if (other == com.google.cloud.retail.v2.ListServingConfigsResponse.getDefaultInstance()) + return this; + if (servingConfigsBuilder_ == null) { + if (!other.servingConfigs_.isEmpty()) { + if (servingConfigs_.isEmpty()) { + servingConfigs_ = other.servingConfigs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureServingConfigsIsMutable(); + servingConfigs_.addAll(other.servingConfigs_); + } + onChanged(); + } + } else { + if (!other.servingConfigs_.isEmpty()) { + if (servingConfigsBuilder_.isEmpty()) { + servingConfigsBuilder_.dispose(); + servingConfigsBuilder_ = null; + servingConfigs_ = other.servingConfigs_; + bitField0_ = (bitField0_ & ~0x00000001); + servingConfigsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getServingConfigsFieldBuilder() + : null; + } else { + servingConfigsBuilder_.addAllMessages(other.servingConfigs_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ListServingConfigsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ListServingConfigsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List servingConfigs_ = + java.util.Collections.emptyList(); + + private void ensureServingConfigsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + servingConfigs_ = + new java.util.ArrayList(servingConfigs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + servingConfigsBuilder_; + + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public java.util.List getServingConfigsList() { + if (servingConfigsBuilder_ == null) { + return java.util.Collections.unmodifiableList(servingConfigs_); + } else { + return servingConfigsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public int getServingConfigsCount() { + if (servingConfigsBuilder_ == null) { + return servingConfigs_.size(); + } else { + return servingConfigsBuilder_.getCount(); + } + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public com.google.cloud.retail.v2.ServingConfig getServingConfigs(int index) { + if (servingConfigsBuilder_ == null) { + return servingConfigs_.get(index); + } else { + return servingConfigsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder setServingConfigs(int index, com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServingConfigsIsMutable(); + servingConfigs_.set(index, value); + onChanged(); + } else { + servingConfigsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder setServingConfigs( + int index, com.google.cloud.retail.v2.ServingConfig.Builder builderForValue) { + if (servingConfigsBuilder_ == null) { + ensureServingConfigsIsMutable(); + servingConfigs_.set(index, builderForValue.build()); + onChanged(); + } else { + servingConfigsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder addServingConfigs(com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServingConfigsIsMutable(); + servingConfigs_.add(value); + onChanged(); + } else { + servingConfigsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder addServingConfigs(int index, com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServingConfigsIsMutable(); + servingConfigs_.add(index, value); + onChanged(); + } else { + servingConfigsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder addServingConfigs( + com.google.cloud.retail.v2.ServingConfig.Builder builderForValue) { + if (servingConfigsBuilder_ == null) { + ensureServingConfigsIsMutable(); + servingConfigs_.add(builderForValue.build()); + onChanged(); + } else { + servingConfigsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder addServingConfigs( + int index, com.google.cloud.retail.v2.ServingConfig.Builder builderForValue) { + if (servingConfigsBuilder_ == null) { + ensureServingConfigsIsMutable(); + servingConfigs_.add(index, builderForValue.build()); + onChanged(); + } else { + servingConfigsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder addAllServingConfigs( + java.lang.Iterable values) { + if (servingConfigsBuilder_ == null) { + ensureServingConfigsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, servingConfigs_); + onChanged(); + } else { + servingConfigsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder clearServingConfigs() { + if (servingConfigsBuilder_ == null) { + servingConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + servingConfigsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public Builder removeServingConfigs(int index) { + if (servingConfigsBuilder_ == null) { + ensureServingConfigsIsMutable(); + servingConfigs_.remove(index); + onChanged(); + } else { + servingConfigsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public com.google.cloud.retail.v2.ServingConfig.Builder getServingConfigsBuilder(int index) { + return getServingConfigsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigsOrBuilder(int index) { + if (servingConfigsBuilder_ == null) { + return servingConfigs_.get(index); + } else { + return servingConfigsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public java.util.List + getServingConfigsOrBuilderList() { + if (servingConfigsBuilder_ != null) { + return servingConfigsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(servingConfigs_); + } + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public com.google.cloud.retail.v2.ServingConfig.Builder addServingConfigsBuilder() { + return getServingConfigsFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.ServingConfig.getDefaultInstance()); + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public com.google.cloud.retail.v2.ServingConfig.Builder addServingConfigsBuilder(int index) { + return getServingConfigsFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.ServingConfig.getDefaultInstance()); + } + /** + * + * + *
+     * All the ServingConfigs for a given catalog.
+     * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + public java.util.List + getServingConfigsBuilderList() { + return getServingConfigsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + getServingConfigsFieldBuilder() { + if (servingConfigsBuilder_ == null) { + servingConfigsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder>( + servingConfigs_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + servingConfigs_ = null; + } + return servingConfigsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Pagination token, if not returned indicates the last page.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ListServingConfigsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ListServingConfigsResponse) + private static final com.google.cloud.retail.v2.ListServingConfigsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ListServingConfigsResponse(); + } + + public static com.google.cloud.retail.v2.ListServingConfigsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListServingConfigsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListServingConfigsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ListServingConfigsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponseOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponseOrBuilder.java new file mode 100644 index 000000000000..0f3b8f0a61ee --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ListServingConfigsResponseOrBuilder.java @@ -0,0 +1,102 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface ListServingConfigsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ListServingConfigsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + java.util.List getServingConfigsList(); + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + com.google.cloud.retail.v2.ServingConfig getServingConfigs(int index); + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + int getServingConfigsCount(); + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + java.util.List + getServingConfigsOrBuilderList(); + /** + * + * + *
+   * All the ServingConfigs for a given catalog.
+   * 
+ * + * repeated .google.cloud.retail.v2.ServingConfig serving_configs = 1; + */ + com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigsOrBuilder(int index); + + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Pagination token, if not returned indicates the last page.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java index 813cd44d213a..db08a999d434 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Product.java @@ -61,6 +61,7 @@ private Product() { conditions_ = com.google.protobuf.LazyStringArrayList.EMPTY; promotions_ = java.util.Collections.emptyList(); variants_ = java.util.Collections.emptyList(); + localInventories_ = java.util.Collections.emptyList(); } @java.lang.Override @@ -457,6 +458,18 @@ private Product( com.google.cloud.retail.v2.Promotion.parser(), extensionRegistry)); break; } + case 282: + { + if (!((mutable_bitField0_ & 0x00002000) != 0)) { + localInventories_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00002000; + } + localInventories_.add( + input.readMessage( + com.google.cloud.retail.v2.LocalInventory.parser(), extensionRegistry)); + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -509,6 +522,9 @@ private Product( if (((mutable_bitField0_ & 0x00000800) != 0)) { promotions_ = java.util.Collections.unmodifiableList(promotions_); } + if (((mutable_bitField0_ & 0x00002000) != 0)) { + localInventories_ = java.util.Collections.unmodifiableList(localInventories_); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -1443,7 +1459,7 @@ public com.google.protobuf.ByteString getPrimaryProductIdBytes() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -1466,7 +1482,7 @@ public com.google.protobuf.ProtocolStringList getCollectionMemberIdsList() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -1489,7 +1505,7 @@ public int getCollectionMemberIdsCount() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -1513,7 +1529,7 @@ public java.lang.String getCollectionMemberIds(int index) { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -3761,6 +3777,96 @@ public com.google.cloud.retail.v2.ProductOrBuilder getVariantsOrBuilder(int inde return variants_.get(index); } + public static final int LOCAL_INVENTORIES_FIELD_NUMBER = 35; + private java.util.List localInventories_; + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List getLocalInventoriesList() { + return localInventories_; + } + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getLocalInventoriesOrBuilderList() { + return localInventories_; + } + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getLocalInventoriesCount() { + return localInventories_.size(); + } + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.LocalInventory getLocalInventories(int index) { + return localInventories_.get(index); + } + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.LocalInventoryOrBuilder getLocalInventoriesOrBuilder( + int index) { + return localInventories_.get(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -3874,6 +3980,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < promotions_.size(); i++) { output.writeMessage(34, promotions_.get(i)); } + for (int i = 0; i < localInventories_.size(); i++) { + output.writeMessage(35, localInventories_.get(i)); + } unknownFields.writeTo(output); } @@ -4035,6 +4144,10 @@ public int getSerializedSize() { for (int i = 0; i < promotions_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(34, promotions_.get(i)); } + for (int i = 0; i < localInventories_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(35, localInventories_.get(i)); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -4105,6 +4218,7 @@ public boolean equals(final java.lang.Object obj) { if (!getRetrievableFields().equals(other.getRetrievableFields())) return false; } if (!getVariantsList().equals(other.getVariantsList())) return false; + if (!getLocalInventoriesList().equals(other.getLocalInventoriesList())) return false; if (!getExpirationCase().equals(other.getExpirationCase())) return false; switch (expirationCase_) { case 16: @@ -4231,6 +4345,10 @@ public int hashCode() { hash = (37 * hash) + VARIANTS_FIELD_NUMBER; hash = (53 * hash) + getVariantsList().hashCode(); } + if (getLocalInventoriesCount() > 0) { + hash = (37 * hash) + LOCAL_INVENTORIES_FIELD_NUMBER; + hash = (53 * hash) + getLocalInventoriesList().hashCode(); + } switch (expirationCase_) { case 16: hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; @@ -4407,6 +4525,7 @@ private void maybeForceBuilderInitialization() { getImagesFieldBuilder(); getPromotionsFieldBuilder(); getVariantsFieldBuilder(); + getLocalInventoriesFieldBuilder(); } } @@ -4522,6 +4641,12 @@ public Builder clear() { } else { variantsBuilder_.clear(); } + if (localInventoriesBuilder_ == null) { + localInventories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00002000); + } else { + localInventoriesBuilder_.clear(); + } expirationCase_ = 0; expiration_ = null; return this; @@ -4693,6 +4818,15 @@ public com.google.cloud.retail.v2.Product buildPartial() { } else { result.variants_ = variantsBuilder_.build(); } + if (localInventoriesBuilder_ == null) { + if (((bitField0_ & 0x00002000) != 0)) { + localInventories_ = java.util.Collections.unmodifiableList(localInventories_); + bitField0_ = (bitField0_ & ~0x00002000); + } + result.localInventories_ = localInventories_; + } else { + result.localInventories_ = localInventoriesBuilder_.build(); + } result.expirationCase_ = expirationCase_; onBuilt(); return result; @@ -4994,6 +5128,33 @@ public Builder mergeFrom(com.google.cloud.retail.v2.Product other) { } } } + if (localInventoriesBuilder_ == null) { + if (!other.localInventories_.isEmpty()) { + if (localInventories_.isEmpty()) { + localInventories_ = other.localInventories_; + bitField0_ = (bitField0_ & ~0x00002000); + } else { + ensureLocalInventoriesIsMutable(); + localInventories_.addAll(other.localInventories_); + } + onChanged(); + } + } else { + if (!other.localInventories_.isEmpty()) { + if (localInventoriesBuilder_.isEmpty()) { + localInventoriesBuilder_.dispose(); + localInventoriesBuilder_ = null; + localInventories_ = other.localInventories_; + bitField0_ = (bitField0_ & ~0x00002000); + localInventoriesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getLocalInventoriesFieldBuilder() + : null; + } else { + localInventoriesBuilder_.addAllMessages(other.localInventories_); + } + } + } switch (other.getExpirationCase()) { case EXPIRE_TIME: { @@ -6287,7 +6448,7 @@ private void ensureCollectionMemberIdsIsMutable() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6310,7 +6471,7 @@ public com.google.protobuf.ProtocolStringList getCollectionMemberIdsList() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6333,7 +6494,7 @@ public int getCollectionMemberIdsCount() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6357,7 +6518,7 @@ public java.lang.String getCollectionMemberIds(int index) { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6381,7 +6542,7 @@ public com.google.protobuf.ByteString getCollectionMemberIdsBytes(int index) { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6412,7 +6573,7 @@ public Builder setCollectionMemberIds(int index, java.lang.String value) { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6442,7 +6603,7 @@ public Builder addCollectionMemberIds(java.lang.String value) { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6469,7 +6630,7 @@ public Builder addAllCollectionMemberIds(java.lang.Iterable va * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -6495,7 +6656,7 @@ public Builder clearCollectionMemberIds() { * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -13321,6 +13482,433 @@ public java.util.List getVariantsBui return variantsBuilder_; } + private java.util.List localInventories_ = + java.util.Collections.emptyList(); + + private void ensureLocalInventoriesIsMutable() { + if (!((bitField0_ & 0x00002000) != 0)) { + localInventories_ = + new java.util.ArrayList(localInventories_); + bitField0_ |= 0x00002000; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.LocalInventory, + com.google.cloud.retail.v2.LocalInventory.Builder, + com.google.cloud.retail.v2.LocalInventoryOrBuilder> + localInventoriesBuilder_; + + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getLocalInventoriesList() { + if (localInventoriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(localInventories_); + } else { + return localInventoriesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getLocalInventoriesCount() { + if (localInventoriesBuilder_ == null) { + return localInventories_.size(); + } else { + return localInventoriesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.LocalInventory getLocalInventories(int index) { + if (localInventoriesBuilder_ == null) { + return localInventories_.get(index); + } else { + return localInventoriesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLocalInventories(int index, com.google.cloud.retail.v2.LocalInventory value) { + if (localInventoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalInventoriesIsMutable(); + localInventories_.set(index, value); + onChanged(); + } else { + localInventoriesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLocalInventories( + int index, com.google.cloud.retail.v2.LocalInventory.Builder builderForValue) { + if (localInventoriesBuilder_ == null) { + ensureLocalInventoriesIsMutable(); + localInventories_.set(index, builderForValue.build()); + onChanged(); + } else { + localInventoriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addLocalInventories(com.google.cloud.retail.v2.LocalInventory value) { + if (localInventoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalInventoriesIsMutable(); + localInventories_.add(value); + onChanged(); + } else { + localInventoriesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addLocalInventories(int index, com.google.cloud.retail.v2.LocalInventory value) { + if (localInventoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalInventoriesIsMutable(); + localInventories_.add(index, value); + onChanged(); + } else { + localInventoriesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addLocalInventories( + com.google.cloud.retail.v2.LocalInventory.Builder builderForValue) { + if (localInventoriesBuilder_ == null) { + ensureLocalInventoriesIsMutable(); + localInventories_.add(builderForValue.build()); + onChanged(); + } else { + localInventoriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addLocalInventories( + int index, com.google.cloud.retail.v2.LocalInventory.Builder builderForValue) { + if (localInventoriesBuilder_ == null) { + ensureLocalInventoriesIsMutable(); + localInventories_.add(index, builderForValue.build()); + onChanged(); + } else { + localInventoriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllLocalInventories( + java.lang.Iterable values) { + if (localInventoriesBuilder_ == null) { + ensureLocalInventoriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, localInventories_); + onChanged(); + } else { + localInventoriesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLocalInventories() { + if (localInventoriesBuilder_ == null) { + localInventories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00002000); + onChanged(); + } else { + localInventoriesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeLocalInventories(int index) { + if (localInventoriesBuilder_ == null) { + ensureLocalInventoriesIsMutable(); + localInventories_.remove(index); + onChanged(); + } else { + localInventoriesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.LocalInventory.Builder getLocalInventoriesBuilder(int index) { + return getLocalInventoriesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.LocalInventoryOrBuilder getLocalInventoriesOrBuilder( + int index) { + if (localInventoriesBuilder_ == null) { + return localInventories_.get(index); + } else { + return localInventoriesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getLocalInventoriesOrBuilderList() { + if (localInventoriesBuilder_ != null) { + return localInventoriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(localInventories_); + } + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.LocalInventory.Builder addLocalInventoriesBuilder() { + return getLocalInventoriesFieldBuilder() + .addBuilder(com.google.cloud.retail.v2.LocalInventory.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.retail.v2.LocalInventory.Builder addLocalInventoriesBuilder(int index) { + return getLocalInventoriesFieldBuilder() + .addBuilder(index, com.google.cloud.retail.v2.LocalInventory.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. A list of local inventories specific to different places.
+     * This is only available for users who have Retail Search enabled, and it can
+     * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getLocalInventoriesBuilderList() { + return getLocalInventoriesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.LocalInventory, + com.google.cloud.retail.v2.LocalInventory.Builder, + com.google.cloud.retail.v2.LocalInventoryOrBuilder> + getLocalInventoriesFieldBuilder() { + if (localInventoriesBuilder_ == null) { + localInventoriesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.retail.v2.LocalInventory, + com.google.cloud.retail.v2.LocalInventory.Builder, + com.google.cloud.retail.v2.LocalInventoryOrBuilder>( + localInventories_, + ((bitField0_ & 0x00002000) != 0), + getParentForChildren(), + isClean()); + localInventories_ = null; + } + return localInventoriesBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java index 665f578ece15..259795fc97b4 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductOrBuilder.java @@ -341,7 +341,7 @@ public interface ProductOrBuilder * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -362,7 +362,7 @@ public interface ProductOrBuilder * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -383,7 +383,7 @@ public interface ProductOrBuilder * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -405,7 +405,7 @@ public interface ProductOrBuilder * Non-existent product ids are allowed. * The [type][google.cloud.retail.v2.Product.type] of the members must be * either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + * [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an * INVALID_ARGUMENT error is thrown. Should not set it for other types. A * maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is * return. @@ -2255,5 +2255,77 @@ com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault( */ com.google.cloud.retail.v2.ProductOrBuilder getVariantsOrBuilder(int index); + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getLocalInventoriesList(); + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.retail.v2.LocalInventory getLocalInventories(int index); + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getLocalInventoriesCount(); + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List + getLocalInventoriesOrBuilderList(); + /** + * + * + *
+   * Output only. A list of local inventories specific to different places.
+   * This is only available for users who have Retail Search enabled, and it can
+   * be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.LocalInventory local_inventories = 35 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.retail.v2.LocalInventoryOrBuilder getLocalInventoriesOrBuilder(int index); + public com.google.cloud.retail.v2.Product.ExpirationCase getExpirationCase(); } diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java index cf7db6482f73..e084911b5821 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ProductProto.java @@ -52,7 +52,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\036google/protobuf/duration.proto\032 google/" + "protobuf/field_mask.proto\032\037google/protob" + "uf/timestamp.proto\032\036google/protobuf/wrap" - + "pers.proto\"\217\r\n\007Product\0221\n\013expire_time\030\020 " + + "pers.proto\"\327\r\n\007Product\0221\n\013expire_time\030\020 " + "\001(\0132\032.google.protobuf.TimestampH\000\022-\n\003ttl" + "\030\021 \001(\0132\031.google.protobuf.DurationB\003\340A\004H\000" + "\022\021\n\004name\030\001 \001(\tB\003\340A\005\022\017\n\002id\030\002 \001(\tB\003\340A\005\0227\n\004" @@ -83,26 +83,27 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "h_time\030! \001(\0132\032.google.protobuf.Timestamp" + "\0226\n\022retrievable_fields\030\036 \001(\0132\032.google.pr" + "otobuf.FieldMask\0226\n\010variants\030\037 \003(\0132\037.goo" - + "gle.cloud.retail.v2.ProductB\003\340A\003\032Z\n\017Attr" - + "ibutesEntry\022\013\n\003key\030\001 \001(\t\0226\n\005value\030\002 \001(\0132" - + "\'.google.cloud.retail.v2.CustomAttribute" - + ":\0028\001\"F\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\013\n\007PR" - + "IMARY\020\001\022\013\n\007VARIANT\020\002\022\016\n\nCOLLECTION\020\003\"i\n\014" - + "Availability\022\034\n\030AVAILABILITY_UNSPECIFIED" - + "\020\000\022\014\n\010IN_STOCK\020\001\022\020\n\014OUT_OF_STOCK\020\002\022\014\n\010PR" - + "EORDER\020\003\022\r\n\tBACKORDER\020\004:\204\001\352A\200\001\n\035retail.g" - + "oogleapis.com/Product\022_projects/{project" - + "}/locations/{location}/catalogs/{catalog" - + "}/branches/{branch}/products/{product}B\014" - + "\n\nexpirationB\260\002\n\032com.google.cloud.retail" - + ".v2B\014ProductProtoP\001Z + * Request for + * [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute] + * method. + *
+ * + * Protobuf type {@code google.cloud.retail.v2.RemoveCatalogAttributeRequest} + */ +public final class RemoveCatalogAttributeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.RemoveCatalogAttributeRequest) + RemoveCatalogAttributeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RemoveCatalogAttributeRequest.newBuilder() to construct. + private RemoveCatalogAttributeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RemoveCatalogAttributeRequest() { + attributesConfig_ = ""; + key_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RemoveCatalogAttributeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RemoveCatalogAttributeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + attributesConfig_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_RemoveCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_RemoveCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.class, + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.Builder.class); + } + + public static final int ATTRIBUTES_CONFIG_FIELD_NUMBER = 1; + private volatile java.lang.Object attributesConfig_; + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + @java.lang.Override + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KEY_FIELD_NUMBER = 2; + private volatile java.lang.Object key_; + /** + * + * + *
+   * Required. The attribute name key of the
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+   * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The attribute name key of the
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+   * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attributesConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, key_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, attributesConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, key_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.RemoveCatalogAttributeRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest other = + (com.google.cloud.retail.v2.RemoveCatalogAttributeRequest) obj; + + if (!getAttributesConfig().equals(other.getAttributesConfig())) return false; + if (!getKey().equals(other.getKey())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ATTRIBUTES_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAttributesConfig().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RemoveCatalogAttributeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.RemoveCatalogAttributeRequest) + com.google.cloud.retail.v2.RemoveCatalogAttributeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_RemoveCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_RemoveCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.class, + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + attributesConfig_ = ""; + + key_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_RemoveCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveCatalogAttributeRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveCatalogAttributeRequest build() { + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveCatalogAttributeRequest buildPartial() { + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest result = + new com.google.cloud.retail.v2.RemoveCatalogAttributeRequest(this); + result.attributesConfig_ = attributesConfig_; + result.key_ = key_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.RemoveCatalogAttributeRequest) { + return mergeFrom((com.google.cloud.retail.v2.RemoveCatalogAttributeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.RemoveCatalogAttributeRequest other) { + if (other == com.google.cloud.retail.v2.RemoveCatalogAttributeRequest.getDefaultInstance()) + return this; + if (!other.getAttributesConfig().isEmpty()) { + attributesConfig_ = other.attributesConfig_; + onChanged(); + } + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.RemoveCatalogAttributeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.RemoveCatalogAttributeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object attributesConfig_ = ""; + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attributesConfig_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearAttributesConfig() { + + attributesConfig_ = getDefaultInstance().getAttributesConfig(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attributesConfig_ = value; + onChanged(); + return this; + } + + private java.lang.Object key_ = ""; + /** + * + * + *
+     * Required. The attribute name key of the
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+     * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The attribute name key of the
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+     * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The attribute name key of the
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+     * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The attribute name key of the
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+     * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The attribute name key of the
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+     * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.RemoveCatalogAttributeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.RemoveCatalogAttributeRequest) + private static final com.google.cloud.retail.v2.RemoveCatalogAttributeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.RemoveCatalogAttributeRequest(); + } + + public static com.google.cloud.retail.v2.RemoveCatalogAttributeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RemoveCatalogAttributeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RemoveCatalogAttributeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveCatalogAttributeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveCatalogAttributeRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveCatalogAttributeRequestOrBuilder.java new file mode 100644 index 000000000000..3f8cbd17112e --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveCatalogAttributeRequestOrBuilder.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface RemoveCatalogAttributeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.RemoveCatalogAttributeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + java.lang.String getAttributesConfig(); + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + com.google.protobuf.ByteString getAttributesConfigBytes(); + + /** + * + * + *
+   * Required. The attribute name key of the
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+   * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + java.lang.String getKey(); + /** + * + * + *
+   * Required. The attribute name key of the
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
+   * 
+ * + * string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for key. + */ + com.google.protobuf.ByteString getKeyBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequest.java new file mode 100644 index 000000000000..1ca0cd0cef84 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequest.java @@ -0,0 +1,844 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for RemoveControl method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RemoveControlRequest} + */ +public final class RemoveControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.RemoveControlRequest) + RemoveControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RemoveControlRequest.newBuilder() to construct. + private RemoveControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RemoveControlRequest() { + servingConfig_ = ""; + controlId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RemoveControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RemoveControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + servingConfig_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + controlId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_RemoveControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_RemoveControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RemoveControlRequest.class, + com.google.cloud.retail.v2.RemoveControlRequest.Builder.class); + } + + public static final int SERVING_CONFIG_FIELD_NUMBER = 1; + private volatile java.lang.Object servingConfig_; + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + @java.lang.Override + public java.lang.String getServingConfig() { + java.lang.Object ref = servingConfig_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfig_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServingConfigBytes() { + java.lang.Object ref = servingConfig_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTROL_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object controlId_; + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + @java.lang.Override + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfig_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, servingConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, controlId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(servingConfig_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, servingConfig_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(controlId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, controlId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.RemoveControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.RemoveControlRequest other = + (com.google.cloud.retail.v2.RemoveControlRequest) obj; + + if (!getServingConfig().equals(other.getServingConfig())) return false; + if (!getControlId().equals(other.getControlId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getServingConfig().hashCode(); + hash = (37 * hash) + CONTROL_ID_FIELD_NUMBER; + hash = (53 * hash) + getControlId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.RemoveControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for RemoveControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.RemoveControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.RemoveControlRequest) + com.google.cloud.retail.v2.RemoveControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_RemoveControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_RemoveControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.RemoveControlRequest.class, + com.google.cloud.retail.v2.RemoveControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.RemoveControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + servingConfig_ = ""; + + controlId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_RemoveControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.RemoveControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveControlRequest build() { + com.google.cloud.retail.v2.RemoveControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveControlRequest buildPartial() { + com.google.cloud.retail.v2.RemoveControlRequest result = + new com.google.cloud.retail.v2.RemoveControlRequest(this); + result.servingConfig_ = servingConfig_; + result.controlId_ = controlId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.RemoveControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.RemoveControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.RemoveControlRequest other) { + if (other == com.google.cloud.retail.v2.RemoveControlRequest.getDefaultInstance()) + return this; + if (!other.getServingConfig().isEmpty()) { + servingConfig_ = other.servingConfig_; + onChanged(); + } + if (!other.getControlId().isEmpty()) { + controlId_ = other.controlId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.RemoveControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.RemoveControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object servingConfig_ = ""; + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + public java.lang.String getServingConfig() { + java.lang.Object ref = servingConfig_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + servingConfig_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + public com.google.protobuf.ByteString getServingConfigBytes() { + java.lang.Object ref = servingConfig_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + servingConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The servingConfig to set. + * @return This builder for chaining. + */ + public Builder setServingConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + servingConfig_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearServingConfig() { + + servingConfig_ = getDefaultInstance().getServingConfig(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The source ServingConfig resource name . Format:
+     * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+     * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for servingConfig to set. + * @return This builder for chaining. + */ + public Builder setServingConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + servingConfig_ = value; + onChanged(); + return this; + } + + private java.lang.Object controlId_ = ""; + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + public java.lang.String getControlId() { + java.lang.Object ref = controlId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + controlId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + public com.google.protobuf.ByteString getControlIdBytes() { + java.lang.Object ref = controlId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + controlId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The controlId to set. + * @return This builder for chaining. + */ + public Builder setControlId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + controlId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearControlId() { + + controlId_ = getDefaultInstance().getControlId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The id of the control to apply. Assumed to be in the same catalog
+     * as the serving config.
+     * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for controlId to set. + * @return This builder for chaining. + */ + public Builder setControlIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + controlId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.RemoveControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.RemoveControlRequest) + private static final com.google.cloud.retail.v2.RemoveControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.RemoveControlRequest(); + } + + public static com.google.cloud.retail.v2.RemoveControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RemoveControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RemoveControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.RemoveControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequestOrBuilder.java new file mode 100644 index 000000000000..03b719e802d0 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RemoveControlRequestOrBuilder.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface RemoveControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.RemoveControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The servingConfig. + */ + java.lang.String getServingConfig(); + /** + * + * + *
+   * Required. The source ServingConfig resource name . Format:
+   * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}
+   * 
+ * + * + * string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for servingConfig. + */ + com.google.protobuf.ByteString getServingConfigBytes(); + + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The controlId. + */ + java.lang.String getControlId(); + /** + * + * + *
+   * Required. The id of the control to apply. Assumed to be in the same catalog
+   * as the serving config.
+   * 
+ * + * string control_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for controlId. + */ + com.google.protobuf.ByteString getControlIdBytes(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequest.java new file mode 100644 index 000000000000..b6bd59265757 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequest.java @@ -0,0 +1,1299 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ReplaceCatalogAttributeRequest} + */ +public final class ReplaceCatalogAttributeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ReplaceCatalogAttributeRequest) + ReplaceCatalogAttributeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplaceCatalogAttributeRequest.newBuilder() to construct. + private ReplaceCatalogAttributeRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplaceCatalogAttributeRequest() { + attributesConfig_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplaceCatalogAttributeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ReplaceCatalogAttributeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + attributesConfig_ = s; + break; + } + case 18: + { + com.google.cloud.retail.v2.CatalogAttribute.Builder subBuilder = null; + if (catalogAttribute_ != null) { + subBuilder = catalogAttribute_.toBuilder(); + } + catalogAttribute_ = + input.readMessage( + com.google.cloud.retail.v2.CatalogAttribute.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(catalogAttribute_); + catalogAttribute_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ReplaceCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ReplaceCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.class, + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.Builder.class); + } + + public static final int ATTRIBUTES_CONFIG_FIELD_NUMBER = 1; + private volatile java.lang.Object attributesConfig_; + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + @java.lang.Override + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATALOG_ATTRIBUTE_FIELD_NUMBER = 2; + private com.google.cloud.retail.v2.CatalogAttribute catalogAttribute_; + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + @java.lang.Override + public boolean hasCatalogAttribute() { + return catalogAttribute_ != null; + } + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute() { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder() { + return getCatalogAttribute(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 3; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attributesConfig_); + } + if (catalogAttribute_ != null) { + output.writeMessage(2, getCatalogAttribute()); + } + if (updateMask_ != null) { + output.writeMessage(3, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributesConfig_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, attributesConfig_); + } + if (catalogAttribute_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCatalogAttribute()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest other = + (com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) obj; + + if (!getAttributesConfig().equals(other.getAttributesConfig())) return false; + if (hasCatalogAttribute() != other.hasCatalogAttribute()) return false; + if (hasCatalogAttribute()) { + if (!getCatalogAttribute().equals(other.getCatalogAttribute())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ATTRIBUTES_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAttributesConfig().hashCode(); + if (hasCatalogAttribute()) { + hash = (37 * hash) + CATALOG_ATTRIBUTE_FIELD_NUMBER; + hash = (53 * hash) + getCatalogAttribute().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ReplaceCatalogAttributeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ReplaceCatalogAttributeRequest) + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ReplaceCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ReplaceCatalogAttributeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.class, + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + attributesConfig_ = ""; + + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = null; + } else { + catalogAttribute_ = null; + catalogAttributeBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_ReplaceCatalogAttributeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest build() { + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest buildPartial() { + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest result = + new com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest(this); + result.attributesConfig_ = attributesConfig_; + if (catalogAttributeBuilder_ == null) { + result.catalogAttribute_ = catalogAttribute_; + } else { + result.catalogAttribute_ = catalogAttributeBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) { + return mergeFrom((com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest other) { + if (other == com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest.getDefaultInstance()) + return this; + if (!other.getAttributesConfig().isEmpty()) { + attributesConfig_ = other.attributesConfig_; + onChanged(); + } + if (other.hasCatalogAttribute()) { + mergeCatalogAttribute(other.getCatalogAttribute()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object attributesConfig_ = ""; + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + public java.lang.String getAttributesConfig() { + java.lang.Object ref = attributesConfig_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attributesConfig_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + public com.google.protobuf.ByteString getAttributesConfigBytes() { + java.lang.Object ref = attributesConfig_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attributesConfig_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attributesConfig_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearAttributesConfig() { + + attributesConfig_ = getDefaultInstance().getAttributesConfig(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Full AttributesConfig resource name. Format:
+     * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+     * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for attributesConfig to set. + * @return This builder for chaining. + */ + public Builder setAttributesConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attributesConfig_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.CatalogAttribute catalogAttribute_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder> + catalogAttributeBuilder_; + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + public boolean hasCatalogAttribute() { + return catalogAttributeBuilder_ != null || catalogAttribute_ != null; + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + public com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute() { + if (catalogAttributeBuilder_ == null) { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } else { + return catalogAttributeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalogAttribute(com.google.cloud.retail.v2.CatalogAttribute value) { + if (catalogAttributeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + catalogAttribute_ = value; + onChanged(); + } else { + catalogAttributeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCatalogAttribute( + com.google.cloud.retail.v2.CatalogAttribute.Builder builderForValue) { + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = builderForValue.build(); + onChanged(); + } else { + catalogAttributeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCatalogAttribute(com.google.cloud.retail.v2.CatalogAttribute value) { + if (catalogAttributeBuilder_ == null) { + if (catalogAttribute_ != null) { + catalogAttribute_ = + com.google.cloud.retail.v2.CatalogAttribute.newBuilder(catalogAttribute_) + .mergeFrom(value) + .buildPartial(); + } else { + catalogAttribute_ = value; + } + onChanged(); + } else { + catalogAttributeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCatalogAttribute() { + if (catalogAttributeBuilder_ == null) { + catalogAttribute_ = null; + onChanged(); + } else { + catalogAttribute_ = null; + catalogAttributeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CatalogAttribute.Builder getCatalogAttributeBuilder() { + + onChanged(); + return getCatalogAttributeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder() { + if (catalogAttributeBuilder_ != null) { + return catalogAttributeBuilder_.getMessageOrBuilder(); + } else { + return catalogAttribute_ == null + ? com.google.cloud.retail.v2.CatalogAttribute.getDefaultInstance() + : catalogAttribute_; + } + } + /** + * + * + *
+     * Required. The updated
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+     * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder> + getCatalogAttributeFieldBuilder() { + if (catalogAttributeBuilder_ == null) { + catalogAttributeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CatalogAttribute, + com.google.cloud.retail.v2.CatalogAttribute.Builder, + com.google.cloud.retail.v2.CatalogAttributeOrBuilder>( + getCatalogAttribute(), getParentForChildren(), isClean()); + catalogAttribute_ = null; + } + return catalogAttributeBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+     * following are NOT supported:
+     * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ReplaceCatalogAttributeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ReplaceCatalogAttributeRequest) + private static final com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest(); + } + + public static com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplaceCatalogAttributeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReplaceCatalogAttributeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequestOrBuilder.java new file mode 100644 index 000000000000..b59a91a4e9cc --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ReplaceCatalogAttributeRequestOrBuilder.java @@ -0,0 +1,147 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface ReplaceCatalogAttributeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ReplaceCatalogAttributeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The attributesConfig. + */ + java.lang.String getAttributesConfig(); + /** + * + * + *
+   * Required. Full AttributesConfig resource name. Format:
+   * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
+   * 
+ * + * + * string attributes_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for attributesConfig. + */ + com.google.protobuf.ByteString getAttributesConfigBytes(); + + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the catalogAttribute field is set. + */ + boolean hasCatalogAttribute(); + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The catalogAttribute. + */ + com.google.cloud.retail.v2.CatalogAttribute getCatalogAttribute(); + /** + * + * + *
+   * Required. The updated
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
+   * 
+ * + * + * .google.cloud.retail.v2.CatalogAttribute catalog_attribute = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.CatalogAttributeOrBuilder getCatalogAttributeOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
+   * following are NOT supported:
+   * * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Rule.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Rule.java new file mode 100644 index 000000000000..9a1fa3c54e0f --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/Rule.java @@ -0,0 +1,11564 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * A rule is a condition-action pair
+ * * A condition defines when a rule is to be triggered.
+ * * An action specifies what occurs on that trigger.
+ * Currently rules only work for [controls][google.cloud.retail.v2.Control] with
+ * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule} + */ +public final class Rule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule) + RuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use Rule.newBuilder() to construct. + private Rule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Rule() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Rule(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Rule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.Condition.Builder subBuilder = null; + if (condition_ != null) { + subBuilder = condition_.toBuilder(); + } + condition_ = + input.readMessage( + com.google.cloud.retail.v2.Condition.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(condition_); + condition_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.cloud.retail.v2.Rule.BoostAction.Builder subBuilder = null; + if (actionCase_ == 2) { + subBuilder = ((com.google.cloud.retail.v2.Rule.BoostAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.BoostAction.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule.BoostAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 2; + break; + } + case 26: + { + com.google.cloud.retail.v2.Rule.RedirectAction.Builder subBuilder = null; + if (actionCase_ == 3) { + subBuilder = ((com.google.cloud.retail.v2.Rule.RedirectAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.RedirectAction.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule.RedirectAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 3; + break; + } + case 50: + { + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder subBuilder = null; + if (actionCase_ == 6) { + subBuilder = + ((com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 6; + break; + } + case 58: + { + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder subBuilder = null; + if (actionCase_ == 7) { + subBuilder = + ((com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 7; + break; + } + case 66: + { + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder subBuilder = null; + if (actionCase_ == 8) { + subBuilder = + ((com.google.cloud.retail.v2.Rule.ReplacementAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.ReplacementAction.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule.ReplacementAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 8; + break; + } + case 74: + { + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder subBuilder = null; + if (actionCase_ == 9) { + subBuilder = ((com.google.cloud.retail.v2.Rule.IgnoreAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.IgnoreAction.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule.IgnoreAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 9; + break; + } + case 82: + { + com.google.cloud.retail.v2.Rule.FilterAction.Builder subBuilder = null; + if (actionCase_ == 10) { + subBuilder = ((com.google.cloud.retail.v2.Rule.FilterAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.FilterAction.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.retail.v2.Rule.FilterAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 10; + break; + } + case 90: + { + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder subBuilder = null; + if (actionCase_ == 11) { + subBuilder = + ((com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_).toBuilder(); + } + action_ = + input.readMessage( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_); + action_ = subBuilder.buildPartial(); + } + actionCase_ = 11; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.class, com.google.cloud.retail.v2.Rule.Builder.class); + } + + public interface BoostActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.BoostAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Strength of the condition boost, which must be in [-1, 1]. Negative
+     * boost means demotion. Default is 0.0.
+     * Setting to 1.0 gives the item a big promotion. However, it does not
+     * necessarily mean that the boosted item will be the top result at all
+     * times, nor that other items will be excluded. Results could still be
+     * shown even when none of them matches the condition. And results that
+     * are significantly more relevant to the search query can still trump
+     * your heavily favored but irrelevant items.
+     * Setting to -1.0 gives the item a big demotion. However, results that
+     * are deeply relevant might still be shown. The item will have an
+     * upstream battle to get a fairly high ranking, but it is not blocked out
+     * completely.
+     * Setting to 0.0 means no boost applied. The boosting condition is
+     * ignored.
+     * 
+ * + * float boost = 1; + * + * @return The boost. + */ + float getBoost(); + + /** + * + * + *
+     * The filter can have a max size of 5000 characters.
+     * An expression which specifies which products to apply an action to.
+     * The syntax and supported fields are the same as a filter expression. See
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+     * detail syntax and limitations.
+     * Examples:
+     * * To boost products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string products_filter = 2; + * + * @return The productsFilter. + */ + java.lang.String getProductsFilter(); + /** + * + * + *
+     * The filter can have a max size of 5000 characters.
+     * An expression which specifies which products to apply an action to.
+     * The syntax and supported fields are the same as a filter expression. See
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+     * detail syntax and limitations.
+     * Examples:
+     * * To boost products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string products_filter = 2; + * + * @return The bytes for productsFilter. + */ + com.google.protobuf.ByteString getProductsFilterBytes(); + } + /** + * + * + *
+   * A boost action to apply to results matching condition specified above.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.BoostAction} + */ + public static final class BoostAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.BoostAction) + BoostActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use BoostAction.newBuilder() to construct. + private BoostAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BoostAction() { + productsFilter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BoostAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BoostAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 13: + { + boost_ = input.readFloat(); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + productsFilter_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_BoostAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_BoostAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.BoostAction.class, + com.google.cloud.retail.v2.Rule.BoostAction.Builder.class); + } + + public static final int BOOST_FIELD_NUMBER = 1; + private float boost_; + /** + * + * + *
+     * Strength of the condition boost, which must be in [-1, 1]. Negative
+     * boost means demotion. Default is 0.0.
+     * Setting to 1.0 gives the item a big promotion. However, it does not
+     * necessarily mean that the boosted item will be the top result at all
+     * times, nor that other items will be excluded. Results could still be
+     * shown even when none of them matches the condition. And results that
+     * are significantly more relevant to the search query can still trump
+     * your heavily favored but irrelevant items.
+     * Setting to -1.0 gives the item a big demotion. However, results that
+     * are deeply relevant might still be shown. The item will have an
+     * upstream battle to get a fairly high ranking, but it is not blocked out
+     * completely.
+     * Setting to 0.0 means no boost applied. The boosting condition is
+     * ignored.
+     * 
+ * + * float boost = 1; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + + public static final int PRODUCTS_FILTER_FIELD_NUMBER = 2; + private volatile java.lang.Object productsFilter_; + /** + * + * + *
+     * The filter can have a max size of 5000 characters.
+     * An expression which specifies which products to apply an action to.
+     * The syntax and supported fields are the same as a filter expression. See
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+     * detail syntax and limitations.
+     * Examples:
+     * * To boost products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string products_filter = 2; + * + * @return The productsFilter. + */ + @java.lang.Override + public java.lang.String getProductsFilter() { + java.lang.Object ref = productsFilter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + productsFilter_ = s; + return s; + } + } + /** + * + * + *
+     * The filter can have a max size of 5000 characters.
+     * An expression which specifies which products to apply an action to.
+     * The syntax and supported fields are the same as a filter expression. See
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+     * detail syntax and limitations.
+     * Examples:
+     * * To boost products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string products_filter = 2; + * + * @return The bytes for productsFilter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getProductsFilterBytes() { + java.lang.Object ref = productsFilter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + productsFilter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + output.writeFloat(1, boost_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(productsFilter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, productsFilter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(1, boost_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(productsFilter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, productsFilter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.BoostAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.BoostAction other = + (com.google.cloud.retail.v2.Rule.BoostAction) obj; + + if (java.lang.Float.floatToIntBits(getBoost()) + != java.lang.Float.floatToIntBits(other.getBoost())) return false; + if (!getProductsFilter().equals(other.getProductsFilter())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + BOOST_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getBoost()); + hash = (37 * hash) + PRODUCTS_FILTER_FIELD_NUMBER; + hash = (53 * hash) + getProductsFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule.BoostAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * A boost action to apply to results matching condition specified above.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.BoostAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.BoostAction) + com.google.cloud.retail.v2.Rule.BoostActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_BoostAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_BoostAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.BoostAction.class, + com.google.cloud.retail.v2.Rule.BoostAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.BoostAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + boost_ = 0F; + + productsFilter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_BoostAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction build() { + com.google.cloud.retail.v2.Rule.BoostAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction buildPartial() { + com.google.cloud.retail.v2.Rule.BoostAction result = + new com.google.cloud.retail.v2.Rule.BoostAction(this); + result.boost_ = boost_; + result.productsFilter_ = productsFilter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.BoostAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.BoostAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.BoostAction other) { + if (other == com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance()) return this; + if (other.getBoost() != 0F) { + setBoost(other.getBoost()); + } + if (!other.getProductsFilter().isEmpty()) { + productsFilter_ = other.productsFilter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.BoostAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Rule.BoostAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private float boost_; + /** + * + * + *
+       * Strength of the condition boost, which must be in [-1, 1]. Negative
+       * boost means demotion. Default is 0.0.
+       * Setting to 1.0 gives the item a big promotion. However, it does not
+       * necessarily mean that the boosted item will be the top result at all
+       * times, nor that other items will be excluded. Results could still be
+       * shown even when none of them matches the condition. And results that
+       * are significantly more relevant to the search query can still trump
+       * your heavily favored but irrelevant items.
+       * Setting to -1.0 gives the item a big demotion. However, results that
+       * are deeply relevant might still be shown. The item will have an
+       * upstream battle to get a fairly high ranking, but it is not blocked out
+       * completely.
+       * Setting to 0.0 means no boost applied. The boosting condition is
+       * ignored.
+       * 
+ * + * float boost = 1; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + /** + * + * + *
+       * Strength of the condition boost, which must be in [-1, 1]. Negative
+       * boost means demotion. Default is 0.0.
+       * Setting to 1.0 gives the item a big promotion. However, it does not
+       * necessarily mean that the boosted item will be the top result at all
+       * times, nor that other items will be excluded. Results could still be
+       * shown even when none of them matches the condition. And results that
+       * are significantly more relevant to the search query can still trump
+       * your heavily favored but irrelevant items.
+       * Setting to -1.0 gives the item a big demotion. However, results that
+       * are deeply relevant might still be shown. The item will have an
+       * upstream battle to get a fairly high ranking, but it is not blocked out
+       * completely.
+       * Setting to 0.0 means no boost applied. The boosting condition is
+       * ignored.
+       * 
+ * + * float boost = 1; + * + * @param value The boost to set. + * @return This builder for chaining. + */ + public Builder setBoost(float value) { + + boost_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Strength of the condition boost, which must be in [-1, 1]. Negative
+       * boost means demotion. Default is 0.0.
+       * Setting to 1.0 gives the item a big promotion. However, it does not
+       * necessarily mean that the boosted item will be the top result at all
+       * times, nor that other items will be excluded. Results could still be
+       * shown even when none of them matches the condition. And results that
+       * are significantly more relevant to the search query can still trump
+       * your heavily favored but irrelevant items.
+       * Setting to -1.0 gives the item a big demotion. However, results that
+       * are deeply relevant might still be shown. The item will have an
+       * upstream battle to get a fairly high ranking, but it is not blocked out
+       * completely.
+       * Setting to 0.0 means no boost applied. The boosting condition is
+       * ignored.
+       * 
+ * + * float boost = 1; + * + * @return This builder for chaining. + */ + public Builder clearBoost() { + + boost_ = 0F; + onChanged(); + return this; + } + + private java.lang.Object productsFilter_ = ""; + /** + * + * + *
+       * The filter can have a max size of 5000 characters.
+       * An expression which specifies which products to apply an action to.
+       * The syntax and supported fields are the same as a filter expression. See
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+       * detail syntax and limitations.
+       * Examples:
+       * * To boost products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string products_filter = 2; + * + * @return The productsFilter. + */ + public java.lang.String getProductsFilter() { + java.lang.Object ref = productsFilter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + productsFilter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The filter can have a max size of 5000 characters.
+       * An expression which specifies which products to apply an action to.
+       * The syntax and supported fields are the same as a filter expression. See
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+       * detail syntax and limitations.
+       * Examples:
+       * * To boost products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string products_filter = 2; + * + * @return The bytes for productsFilter. + */ + public com.google.protobuf.ByteString getProductsFilterBytes() { + java.lang.Object ref = productsFilter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + productsFilter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The filter can have a max size of 5000 characters.
+       * An expression which specifies which products to apply an action to.
+       * The syntax and supported fields are the same as a filter expression. See
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+       * detail syntax and limitations.
+       * Examples:
+       * * To boost products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string products_filter = 2; + * + * @param value The productsFilter to set. + * @return This builder for chaining. + */ + public Builder setProductsFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + productsFilter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The filter can have a max size of 5000 characters.
+       * An expression which specifies which products to apply an action to.
+       * The syntax and supported fields are the same as a filter expression. See
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+       * detail syntax and limitations.
+       * Examples:
+       * * To boost products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string products_filter = 2; + * + * @return This builder for chaining. + */ + public Builder clearProductsFilter() { + + productsFilter_ = getDefaultInstance().getProductsFilter(); + onChanged(); + return this; + } + /** + * + * + *
+       * The filter can have a max size of 5000 characters.
+       * An expression which specifies which products to apply an action to.
+       * The syntax and supported fields are the same as a filter expression. See
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
+       * detail syntax and limitations.
+       * Examples:
+       * * To boost products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string products_filter = 2; + * + * @param value The bytes for productsFilter to set. + * @return This builder for chaining. + */ + public Builder setProductsFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + productsFilter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.BoostAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.BoostAction) + private static final com.google.cloud.retail.v2.Rule.BoostAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.BoostAction(); + } + + public static com.google.cloud.retail.v2.Rule.BoostAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BoostAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BoostAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface FilterActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.FilterAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * A filter to apply on the matching condition results. Supported features:
+     * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+     * * Filter syntax is identical to
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+     * more
+     *   details at the Retail Search
+     *   [user guide](/retail/search/docs/filter-and-order#filter).
+     * * To filter products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string filter = 1; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+     * A filter to apply on the matching condition results. Supported features:
+     * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+     * * Filter syntax is identical to
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+     * more
+     *   details at the Retail Search
+     *   [user guide](/retail/search/docs/filter-and-order#filter).
+     * * To filter products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string filter = 1; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + } + /** + * + * + *
+   * * Rule Condition:
+   *   - No
+   *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
+   *   provided is a global match.
+   *   - 1 or more
+   *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
+   *   provided are combined with OR operator.
+   * * Action Input: The request query and filter that are applied to the
+   * retrieved products, in addition to any filters already provided with the
+   * SearchRequest. The AND operator is used to combine the query's existing
+   * filters with the filter rule(s). NOTE: May result in 0 results when
+   * filters conflict.
+   * * Action Result: Filters the returned objects to be ONLY those that passed
+   * the filter.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.FilterAction} + */ + public static final class FilterAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.FilterAction) + FilterActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use FilterAction.newBuilder() to construct. + private FilterAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private FilterAction() { + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new FilterAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private FilterAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_FilterAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_FilterAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.FilterAction.class, + com.google.cloud.retail.v2.Rule.FilterAction.Builder.class); + } + + public static final int FILTER_FIELD_NUMBER = 1; + private volatile java.lang.Object filter_; + /** + * + * + *
+     * A filter to apply on the matching condition results. Supported features:
+     * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+     * * Filter syntax is identical to
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+     * more
+     *   details at the Retail Search
+     *   [user guide](/retail/search/docs/filter-and-order#filter).
+     * * To filter products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string filter = 1; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+     * A filter to apply on the matching condition results. Supported features:
+     * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+     * * Filter syntax is identical to
+     * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+     * more
+     *   details at the Retail Search
+     *   [user guide](/retail/search/docs/filter-and-order#filter).
+     * * To filter products with product ID "product_1" or "product_2", and
+     * color
+     *   "Red" or "Blue":<br>
+     *   *(id: ANY("product_1", "product_2"))<br>*
+     *   *AND<br>*
+     *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+     * 
+ * + * string filter = 1; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, filter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.FilterAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.FilterAction other = + (com.google.cloud.retail.v2.Rule.FilterAction) obj; + + if (!getFilter().equals(other.getFilter())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule.FilterAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * * Rule Condition:
+     *   - No
+     *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
+     *   provided is a global match.
+     *   - 1 or more
+     *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
+     *   provided are combined with OR operator.
+     * * Action Input: The request query and filter that are applied to the
+     * retrieved products, in addition to any filters already provided with the
+     * SearchRequest. The AND operator is used to combine the query's existing
+     * filters with the filter rule(s). NOTE: May result in 0 results when
+     * filters conflict.
+     * * Action Result: Filters the returned objects to be ONLY those that passed
+     * the filter.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.FilterAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.FilterAction) + com.google.cloud.retail.v2.Rule.FilterActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_FilterAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_FilterAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.FilterAction.class, + com.google.cloud.retail.v2.Rule.FilterAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.FilterAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_FilterAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction build() { + com.google.cloud.retail.v2.Rule.FilterAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction buildPartial() { + com.google.cloud.retail.v2.Rule.FilterAction result = + new com.google.cloud.retail.v2.Rule.FilterAction(this); + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.FilterAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.FilterAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.FilterAction other) { + if (other == com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance()) return this; + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.FilterAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Rule.FilterAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+       * A filter to apply on the matching condition results. Supported features:
+       * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+       * * Filter syntax is identical to
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+       * more
+       *   details at the Retail Search
+       *   [user guide](/retail/search/docs/filter-and-order#filter).
+       * * To filter products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string filter = 1; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * A filter to apply on the matching condition results. Supported features:
+       * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+       * * Filter syntax is identical to
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+       * more
+       *   details at the Retail Search
+       *   [user guide](/retail/search/docs/filter-and-order#filter).
+       * * To filter products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string filter = 1; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * A filter to apply on the matching condition results. Supported features:
+       * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+       * * Filter syntax is identical to
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+       * more
+       *   details at the Retail Search
+       *   [user guide](/retail/search/docs/filter-and-order#filter).
+       * * To filter products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string filter = 1; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * A filter to apply on the matching condition results. Supported features:
+       * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+       * * Filter syntax is identical to
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+       * more
+       *   details at the Retail Search
+       *   [user guide](/retail/search/docs/filter-and-order#filter).
+       * * To filter products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string filter = 1; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+       * A filter to apply on the matching condition results. Supported features:
+       * * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
+       * * Filter syntax is identical to
+       * [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
+       * more
+       *   details at the Retail Search
+       *   [user guide](/retail/search/docs/filter-and-order#filter).
+       * * To filter products with product ID "product_1" or "product_2", and
+       * color
+       *   "Red" or "Blue":<br>
+       *   *(id: ANY("product_1", "product_2"))<br>*
+       *   *AND<br>*
+       *   *(colorFamilies: ANY("Red", "Blue"))<br>*
+       * 
+ * + * string filter = 1; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.FilterAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.FilterAction) + private static final com.google.cloud.retail.v2.Rule.FilterAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.FilterAction(); + } + + public static com.google.cloud.retail.v2.Rule.FilterAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FilterAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new FilterAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface RedirectActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.RedirectAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * URL must have length equal or less than 2000 characters.
+     * 
+ * + * string redirect_uri = 1; + * + * @return The redirectUri. + */ + java.lang.String getRedirectUri(); + /** + * + * + *
+     * URL must have length equal or less than 2000 characters.
+     * 
+ * + * string redirect_uri = 1; + * + * @return The bytes for redirectUri. + */ + com.google.protobuf.ByteString getRedirectUriBytes(); + } + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * * Rule Condition:
+   *   - Must specify
+   *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
+   * * Action Input: Request Query
+   * * Action Result: Redirects shopper to provided uri.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.RedirectAction} + */ + public static final class RedirectAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.RedirectAction) + RedirectActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use RedirectAction.newBuilder() to construct. + private RedirectAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RedirectAction() { + redirectUri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RedirectAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RedirectAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + redirectUri_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_RedirectAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_RedirectAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.RedirectAction.class, + com.google.cloud.retail.v2.Rule.RedirectAction.Builder.class); + } + + public static final int REDIRECT_URI_FIELD_NUMBER = 1; + private volatile java.lang.Object redirectUri_; + /** + * + * + *
+     * URL must have length equal or less than 2000 characters.
+     * 
+ * + * string redirect_uri = 1; + * + * @return The redirectUri. + */ + @java.lang.Override + public java.lang.String getRedirectUri() { + java.lang.Object ref = redirectUri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + redirectUri_ = s; + return s; + } + } + /** + * + * + *
+     * URL must have length equal or less than 2000 characters.
+     * 
+ * + * string redirect_uri = 1; + * + * @return The bytes for redirectUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRedirectUriBytes() { + java.lang.Object ref = redirectUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + redirectUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(redirectUri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, redirectUri_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(redirectUri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, redirectUri_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.RedirectAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.RedirectAction other = + (com.google.cloud.retail.v2.Rule.RedirectAction) obj; + + if (!getRedirectUri().equals(other.getRedirectUri())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REDIRECT_URI_FIELD_NUMBER; + hash = (53 * hash) + getRedirectUri().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule.RedirectAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * * Rule Condition:
+     *   - Must specify
+     *   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
+     * * Action Input: Request Query
+     * * Action Result: Redirects shopper to provided uri.
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.RedirectAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.RedirectAction) + com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_RedirectAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_RedirectAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.RedirectAction.class, + com.google.cloud.retail.v2.Rule.RedirectAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.RedirectAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + redirectUri_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_RedirectAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction build() { + com.google.cloud.retail.v2.Rule.RedirectAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction buildPartial() { + com.google.cloud.retail.v2.Rule.RedirectAction result = + new com.google.cloud.retail.v2.Rule.RedirectAction(this); + result.redirectUri_ = redirectUri_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.RedirectAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.RedirectAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.RedirectAction other) { + if (other == com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance()) + return this; + if (!other.getRedirectUri().isEmpty()) { + redirectUri_ = other.redirectUri_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.RedirectAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Rule.RedirectAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object redirectUri_ = ""; + /** + * + * + *
+       * URL must have length equal or less than 2000 characters.
+       * 
+ * + * string redirect_uri = 1; + * + * @return The redirectUri. + */ + public java.lang.String getRedirectUri() { + java.lang.Object ref = redirectUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + redirectUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * URL must have length equal or less than 2000 characters.
+       * 
+ * + * string redirect_uri = 1; + * + * @return The bytes for redirectUri. + */ + public com.google.protobuf.ByteString getRedirectUriBytes() { + java.lang.Object ref = redirectUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + redirectUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * URL must have length equal or less than 2000 characters.
+       * 
+ * + * string redirect_uri = 1; + * + * @param value The redirectUri to set. + * @return This builder for chaining. + */ + public Builder setRedirectUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + redirectUri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * URL must have length equal or less than 2000 characters.
+       * 
+ * + * string redirect_uri = 1; + * + * @return This builder for chaining. + */ + public Builder clearRedirectUri() { + + redirectUri_ = getDefaultInstance().getRedirectUri(); + onChanged(); + return this; + } + /** + * + * + *
+       * URL must have length equal or less than 2000 characters.
+       * 
+ * + * string redirect_uri = 1; + * + * @param value The bytes for redirectUri to set. + * @return This builder for chaining. + */ + public Builder setRedirectUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + redirectUri_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.RedirectAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.RedirectAction) + private static final com.google.cloud.retail.v2.Rule.RedirectAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.RedirectAction(); + } + + public static com.google.cloud.retail.v2.Rule.RedirectAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RedirectAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RedirectAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface TwowaySynonymsActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.TwowaySynonymsAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @return A list containing the synonyms. + */ + java.util.List getSynonymsList(); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @return The count of synonyms. + */ + int getSynonymsCount(); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + java.lang.String getSynonyms(int index); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + com.google.protobuf.ByteString getSynonymsBytes(int index); + } + /** + * + * + *
+   * Creates a set of terms that will be treated as synonyms of each other.
+   * Example: synonyms of "sneakers" and "shoes".
+   *  * "sneakers" will use a synonym of "shoes".
+   *  * "shoes" will use a synonym of "sneakers".
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.TwowaySynonymsAction} + */ + public static final class TwowaySynonymsAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.TwowaySynonymsAction) + TwowaySynonymsActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use TwowaySynonymsAction.newBuilder() to construct. + private TwowaySynonymsAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TwowaySynonymsAction() { + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new TwowaySynonymsAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TwowaySynonymsAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + synonyms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + synonyms_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + synonyms_ = synonyms_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_TwowaySynonymsAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_TwowaySynonymsAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.class, + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder.class); + } + + public static final int SYNONYMS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList synonyms_; + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @return A list containing the synonyms. + */ + public com.google.protobuf.ProtocolStringList getSynonymsList() { + return synonyms_; + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @return The count of synonyms. + */ + public int getSynonymsCount() { + return synonyms_.size(); + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + public java.lang.String getSynonyms(int index) { + return synonyms_.get(index); + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Can specify up to 100 synonyms.
+     * Must specify at least 2 synonyms.
+     * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + public com.google.protobuf.ByteString getSynonymsBytes(int index) { + return synonyms_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < synonyms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, synonyms_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < synonyms_.size(); i++) { + dataSize += computeStringSizeNoTag(synonyms_.getRaw(i)); + } + size += dataSize; + size += 1 * getSynonymsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.TwowaySynonymsAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction other = + (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) obj; + + if (!getSynonymsList().equals(other.getSynonymsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSynonymsCount() > 0) { + hash = (37 * hash) + SYNONYMS_FIELD_NUMBER; + hash = (53 * hash) + getSynonymsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Creates a set of terms that will be treated as synonyms of each other.
+     * Example: synonyms of "sneakers" and "shoes".
+     *  * "sneakers" will use a synonym of "shoes".
+     *  * "shoes" will use a synonym of "sneakers".
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.TwowaySynonymsAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.TwowaySynonymsAction) + com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_TwowaySynonymsAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_TwowaySynonymsAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.class, + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_TwowaySynonymsAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction build() { + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction buildPartial() { + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction result = + new com.google.cloud.retail.v2.Rule.TwowaySynonymsAction(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + synonyms_ = synonyms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.synonyms_ = synonyms_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.TwowaySynonymsAction other) { + if (other == com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance()) + return this; + if (!other.synonyms_.isEmpty()) { + if (synonyms_.isEmpty()) { + synonyms_ = other.synonyms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSynonymsIsMutable(); + synonyms_.addAll(other.synonyms_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList synonyms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureSynonymsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + synonyms_ = new com.google.protobuf.LazyStringArrayList(synonyms_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @return A list containing the synonyms. + */ + public com.google.protobuf.ProtocolStringList getSynonymsList() { + return synonyms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @return The count of synonyms. + */ + public int getSynonymsCount() { + return synonyms_.size(); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + public java.lang.String getSynonyms(int index) { + return synonyms_.get(index); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + public com.google.protobuf.ByteString getSynonymsBytes(int index) { + return synonyms_.getByteString(index); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param index The index to set the value at. + * @param value The synonyms to set. + * @return This builder for chaining. + */ + public Builder setSynonyms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSynonymsIsMutable(); + synonyms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param value The synonyms to add. + * @return This builder for chaining. + */ + public Builder addSynonyms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSynonymsIsMutable(); + synonyms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param values The synonyms to add. + * @return This builder for chaining. + */ + public Builder addAllSynonyms(java.lang.Iterable values) { + ensureSynonymsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, synonyms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @return This builder for chaining. + */ + public Builder clearSynonyms() { + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Can specify up to 100 synonyms.
+       * Must specify at least 2 synonyms.
+       * 
+ * + * repeated string synonyms = 1; + * + * @param value The bytes of the synonyms to add. + * @return This builder for chaining. + */ + public Builder addSynonymsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureSynonymsIsMutable(); + synonyms_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.TwowaySynonymsAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.TwowaySynonymsAction) + private static final com.google.cloud.retail.v2.Rule.TwowaySynonymsAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.TwowaySynonymsAction(); + } + + public static com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TwowaySynonymsAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TwowaySynonymsAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface OnewaySynonymsActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.OnewaySynonymsAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @return A list containing the queryTerms. + */ + java.util.List getQueryTermsList(); + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @return The count of queryTerms. + */ + int getQueryTermsCount(); + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + java.lang.String getQueryTerms(int index); + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + com.google.protobuf.ByteString getQueryTermsBytes(int index); + + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @return A list containing the synonyms. + */ + java.util.List getSynonymsList(); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @return The count of synonyms. + */ + int getSynonymsCount(); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + java.lang.String getSynonyms(int index); + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + com.google.protobuf.ByteString getSynonymsBytes(int index); + + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @return A list containing the onewayTerms. + */ + java.util.List getOnewayTermsList(); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @return The count of onewayTerms. + */ + int getOnewayTermsCount(); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the element to return. + * @return The onewayTerms at the given index. + */ + java.lang.String getOnewayTerms(int index); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the onewayTerms at the given index. + */ + com.google.protobuf.ByteString getOnewayTermsBytes(int index); + } + /** + * + * + *
+   * Maps a set of terms to a set of synonyms.
+   * Set of synonyms will be treated as synonyms of each query term only.
+   * `query_terms` will not be treated as synonyms of each other.
+   * Example: "sneakers" will use a synonym of "shoes".
+   * "shoes" will not use a synonym of "sneakers".
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.OnewaySynonymsAction} + */ + public static final class OnewaySynonymsAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.OnewaySynonymsAction) + OnewaySynonymsActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use OnewaySynonymsAction.newBuilder() to construct. + private OnewaySynonymsAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private OnewaySynonymsAction() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + onewayTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new OnewaySynonymsAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private OnewaySynonymsAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + onewayTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + onewayTerms_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + queryTerms_.add(s); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + synonyms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + synonyms_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) != 0)) { + onewayTerms_ = onewayTerms_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + synonyms_ = synonyms_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_OnewaySynonymsAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_OnewaySynonymsAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.class, + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder.class); + } + + public static final int QUERY_TERMS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList queryTerms_; + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_; + } + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will treat synonyms as their synonyms.
+     * Not themselves synonyms of the synonyms.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + + public static final int SYNONYMS_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList synonyms_; + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @return A list containing the synonyms. + */ + public com.google.protobuf.ProtocolStringList getSynonymsList() { + return synonyms_; + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @return The count of synonyms. + */ + public int getSynonymsCount() { + return synonyms_.size(); + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + public java.lang.String getSynonyms(int index) { + return synonyms_.get(index); + } + /** + * + * + *
+     * Defines a set of synonyms.
+     * Cannot contain duplicates.
+     * Can specify up to 100 synonyms.
+     * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + public com.google.protobuf.ByteString getSynonymsBytes(int index) { + return synonyms_.getByteString(index); + } + + public static final int ONEWAY_TERMS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList onewayTerms_; + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @return A list containing the onewayTerms. + */ + public com.google.protobuf.ProtocolStringList getOnewayTermsList() { + return onewayTerms_; + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @return The count of onewayTerms. + */ + public int getOnewayTermsCount() { + return onewayTerms_.size(); + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the element to return. + * @return The onewayTerms at the given index. + */ + public java.lang.String getOnewayTerms(int index) { + return onewayTerms_.get(index); + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the onewayTerms at the given index. + */ + public com.google.protobuf.ByteString getOnewayTermsBytes(int index) { + return onewayTerms_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < onewayTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, onewayTerms_.getRaw(i)); + } + for (int i = 0; i < queryTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, queryTerms_.getRaw(i)); + } + for (int i = 0; i < synonyms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, synonyms_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < onewayTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(onewayTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getOnewayTermsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < queryTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(queryTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getQueryTermsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < synonyms_.size(); i++) { + dataSize += computeStringSizeNoTag(synonyms_.getRaw(i)); + } + size += dataSize; + size += 1 * getSynonymsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.OnewaySynonymsAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction other = + (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) obj; + + if (!getQueryTermsList().equals(other.getQueryTermsList())) return false; + if (!getSynonymsList().equals(other.getSynonymsList())) return false; + if (!getOnewayTermsList().equals(other.getOnewayTermsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getQueryTermsCount() > 0) { + hash = (37 * hash) + QUERY_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getQueryTermsList().hashCode(); + } + if (getSynonymsCount() > 0) { + hash = (37 * hash) + SYNONYMS_FIELD_NUMBER; + hash = (53 * hash) + getSynonymsList().hashCode(); + } + if (getOnewayTermsCount() > 0) { + hash = (37 * hash) + ONEWAY_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getOnewayTermsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Maps a set of terms to a set of synonyms.
+     * Set of synonyms will be treated as synonyms of each query term only.
+     * `query_terms` will not be treated as synonyms of each other.
+     * Example: "sneakers" will use a synonym of "shoes".
+     * "shoes" will not use a synonym of "sneakers".
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.OnewaySynonymsAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.OnewaySynonymsAction) + com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_OnewaySynonymsAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_OnewaySynonymsAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.class, + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onewayTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_OnewaySynonymsAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction build() { + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction buildPartial() { + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction result = + new com.google.cloud.retail.v2.Rule.OnewaySynonymsAction(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.queryTerms_ = queryTerms_; + if (((bitField0_ & 0x00000002) != 0)) { + synonyms_ = synonyms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.synonyms_ = synonyms_; + if (((bitField0_ & 0x00000004) != 0)) { + onewayTerms_ = onewayTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.onewayTerms_ = onewayTerms_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.OnewaySynonymsAction other) { + if (other == com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance()) + return this; + if (!other.queryTerms_.isEmpty()) { + if (queryTerms_.isEmpty()) { + queryTerms_ = other.queryTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureQueryTermsIsMutable(); + queryTerms_.addAll(other.queryTerms_); + } + onChanged(); + } + if (!other.synonyms_.isEmpty()) { + if (synonyms_.isEmpty()) { + synonyms_ = other.synonyms_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureSynonymsIsMutable(); + synonyms_.addAll(other.synonyms_); + } + onChanged(); + } + if (!other.onewayTerms_.isEmpty()) { + if (onewayTerms_.isEmpty()) { + onewayTerms_ = other.onewayTerms_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureOnewayTermsIsMutable(); + onewayTerms_.addAll(other.onewayTerms_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList queryTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureQueryTermsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(queryTerms_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param index The index to set the value at. + * @param value The queryTerms to set. + * @return This builder for chaining. + */ + public Builder setQueryTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param value The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param values The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addAllQueryTerms(java.lang.Iterable values) { + ensureQueryTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, queryTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @return This builder for chaining. + */ + public Builder clearQueryTerms() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will treat synonyms as their synonyms.
+       * Not themselves synonyms of the synonyms.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 3; + * + * @param value The bytes of the queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList synonyms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureSynonymsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + synonyms_ = new com.google.protobuf.LazyStringArrayList(synonyms_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @return A list containing the synonyms. + */ + public com.google.protobuf.ProtocolStringList getSynonymsList() { + return synonyms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @return The count of synonyms. + */ + public int getSynonymsCount() { + return synonyms_.size(); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the element to return. + * @return The synonyms at the given index. + */ + public java.lang.String getSynonyms(int index) { + return synonyms_.get(index); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param index The index of the value to return. + * @return The bytes of the synonyms at the given index. + */ + public com.google.protobuf.ByteString getSynonymsBytes(int index) { + return synonyms_.getByteString(index); + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param index The index to set the value at. + * @param value The synonyms to set. + * @return This builder for chaining. + */ + public Builder setSynonyms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSynonymsIsMutable(); + synonyms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param value The synonyms to add. + * @return This builder for chaining. + */ + public Builder addSynonyms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSynonymsIsMutable(); + synonyms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param values The synonyms to add. + * @return This builder for chaining. + */ + public Builder addAllSynonyms(java.lang.Iterable values) { + ensureSynonymsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, synonyms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @return This builder for chaining. + */ + public Builder clearSynonyms() { + synonyms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * Defines a set of synonyms.
+       * Cannot contain duplicates.
+       * Can specify up to 100 synonyms.
+       * 
+ * + * repeated string synonyms = 4; + * + * @param value The bytes of the synonyms to add. + * @return This builder for chaining. + */ + public Builder addSynonymsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureSynonymsIsMutable(); + synonyms_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList onewayTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureOnewayTermsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + onewayTerms_ = new com.google.protobuf.LazyStringArrayList(onewayTerms_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @return A list containing the onewayTerms. + */ + public com.google.protobuf.ProtocolStringList getOnewayTermsList() { + return onewayTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @return The count of onewayTerms. + */ + public int getOnewayTermsCount() { + return onewayTerms_.size(); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the element to return. + * @return The onewayTerms at the given index. + */ + public java.lang.String getOnewayTerms(int index) { + return onewayTerms_.get(index); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the onewayTerms at the given index. + */ + public com.google.protobuf.ByteString getOnewayTermsBytes(int index) { + return onewayTerms_.getByteString(index); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param index The index to set the value at. + * @param value The onewayTerms to set. + * @return This builder for chaining. + */ + public Builder setOnewayTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureOnewayTermsIsMutable(); + onewayTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param value The onewayTerms to add. + * @return This builder for chaining. + */ + public Builder addOnewayTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureOnewayTermsIsMutable(); + onewayTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param values The onewayTerms to add. + * @return This builder for chaining. + */ + public Builder addAllOnewayTerms(java.lang.Iterable values) { + ensureOnewayTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, onewayTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @return This builder for chaining. + */ + public Builder clearOnewayTerms() { + onewayTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string oneway_terms = 2; + * + * @param value The bytes of the onewayTerms to add. + * @return This builder for chaining. + */ + public Builder addOnewayTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureOnewayTermsIsMutable(); + onewayTerms_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.OnewaySynonymsAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.OnewaySynonymsAction) + private static final com.google.cloud.retail.v2.Rule.OnewaySynonymsAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.OnewaySynonymsAction(); + } + + public static com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OnewaySynonymsAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OnewaySynonymsAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface DoNotAssociateActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.DoNotAssociateAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + java.util.List getQueryTermsList(); + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + int getQueryTermsCount(); + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + java.lang.String getQueryTerms(int index); + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + com.google.protobuf.ByteString getQueryTermsBytes(int index); + + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return A list containing the doNotAssociateTerms. + */ + java.util.List getDoNotAssociateTermsList(); + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return The count of doNotAssociateTerms. + */ + int getDoNotAssociateTermsCount(); + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the element to return. + * @return The doNotAssociateTerms at the given index. + */ + java.lang.String getDoNotAssociateTerms(int index); + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateTerms at the given index. + */ + com.google.protobuf.ByteString getDoNotAssociateTermsBytes(int index); + + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @return A list containing the terms. + */ + java.util.List getTermsList(); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @return The count of terms. + */ + int getTermsCount(); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @param index The index of the element to return. + * @return The terms at the given index. + */ + java.lang.String getTerms(int index); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the terms at the given index. + */ + com.google.protobuf.ByteString getTermsBytes(int index); + } + /** + * + * + *
+   * Prevents `query_term` from being associated with specified terms during
+   * search.
+   * Example: Don't associate "gShoe" and "cheap".
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.DoNotAssociateAction} + */ + public static final class DoNotAssociateAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.DoNotAssociateAction) + DoNotAssociateActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use DoNotAssociateAction.newBuilder() to construct. + private DoNotAssociateAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DoNotAssociateAction() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + doNotAssociateTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + terms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DoNotAssociateAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DoNotAssociateAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + terms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + terms_.add(s); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + queryTerms_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + doNotAssociateTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + doNotAssociateTerms_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) != 0)) { + terms_ = terms_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + doNotAssociateTerms_ = doNotAssociateTerms_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_DoNotAssociateAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_DoNotAssociateAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.class, + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder.class); + } + + public static final int QUERY_TERMS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList queryTerms_; + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_; + } + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will not consider do_not_associate_terms for search if in search query.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + + public static final int DO_NOT_ASSOCIATE_TERMS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList doNotAssociateTerms_; + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return A list containing the doNotAssociateTerms. + */ + public com.google.protobuf.ProtocolStringList getDoNotAssociateTermsList() { + return doNotAssociateTerms_; + } + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return The count of doNotAssociateTerms. + */ + public int getDoNotAssociateTermsCount() { + return doNotAssociateTerms_.size(); + } + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the element to return. + * @return The doNotAssociateTerms at the given index. + */ + public java.lang.String getDoNotAssociateTerms(int index) { + return doNotAssociateTerms_.get(index); + } + /** + * + * + *
+     * Cannot contain duplicates or the query term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateTerms at the given index. + */ + public com.google.protobuf.ByteString getDoNotAssociateTermsBytes(int index) { + return doNotAssociateTerms_.getByteString(index); + } + + public static final int TERMS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList terms_; + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @return A list containing the terms. + */ + public com.google.protobuf.ProtocolStringList getTermsList() { + return terms_; + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @return The count of terms. + */ + public int getTermsCount() { + return terms_.size(); + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @param index The index of the element to return. + * @return The terms at the given index. + */ + public java.lang.String getTerms(int index) { + return terms_.get(index); + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * repeated string terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the terms at the given index. + */ + public com.google.protobuf.ByteString getTermsBytes(int index) { + return terms_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < terms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, terms_.getRaw(i)); + } + for (int i = 0; i < queryTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, queryTerms_.getRaw(i)); + } + for (int i = 0; i < doNotAssociateTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 3, doNotAssociateTerms_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < terms_.size(); i++) { + dataSize += computeStringSizeNoTag(terms_.getRaw(i)); + } + size += dataSize; + size += 1 * getTermsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < queryTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(queryTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getQueryTermsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < doNotAssociateTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(doNotAssociateTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getDoNotAssociateTermsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.DoNotAssociateAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.DoNotAssociateAction other = + (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) obj; + + if (!getQueryTermsList().equals(other.getQueryTermsList())) return false; + if (!getDoNotAssociateTermsList().equals(other.getDoNotAssociateTermsList())) return false; + if (!getTermsList().equals(other.getTermsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getQueryTermsCount() > 0) { + hash = (37 * hash) + QUERY_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getQueryTermsList().hashCode(); + } + if (getDoNotAssociateTermsCount() > 0) { + hash = (37 * hash) + DO_NOT_ASSOCIATE_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getDoNotAssociateTermsList().hashCode(); + } + if (getTermsCount() > 0) { + hash = (37 * hash) + TERMS_FIELD_NUMBER; + hash = (53 * hash) + getTermsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Prevents `query_term` from being associated with specified terms during
+     * search.
+     * Example: Don't associate "gShoe" and "cheap".
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.DoNotAssociateAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.DoNotAssociateAction) + com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_DoNotAssociateAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_DoNotAssociateAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.class, + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.DoNotAssociateAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + doNotAssociateTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + terms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_DoNotAssociateAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction build() { + com.google.cloud.retail.v2.Rule.DoNotAssociateAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction buildPartial() { + com.google.cloud.retail.v2.Rule.DoNotAssociateAction result = + new com.google.cloud.retail.v2.Rule.DoNotAssociateAction(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.queryTerms_ = queryTerms_; + if (((bitField0_ & 0x00000002) != 0)) { + doNotAssociateTerms_ = doNotAssociateTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.doNotAssociateTerms_ = doNotAssociateTerms_; + if (((bitField0_ & 0x00000004) != 0)) { + terms_ = terms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.terms_ = terms_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.DoNotAssociateAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.DoNotAssociateAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.DoNotAssociateAction other) { + if (other == com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance()) + return this; + if (!other.queryTerms_.isEmpty()) { + if (queryTerms_.isEmpty()) { + queryTerms_ = other.queryTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureQueryTermsIsMutable(); + queryTerms_.addAll(other.queryTerms_); + } + onChanged(); + } + if (!other.doNotAssociateTerms_.isEmpty()) { + if (doNotAssociateTerms_.isEmpty()) { + doNotAssociateTerms_ = other.doNotAssociateTerms_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureDoNotAssociateTermsIsMutable(); + doNotAssociateTerms_.addAll(other.doNotAssociateTerms_); + } + onChanged(); + } + if (!other.terms_.isEmpty()) { + if (terms_.isEmpty()) { + terms_ = other.terms_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureTermsIsMutable(); + terms_.addAll(other.terms_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.DoNotAssociateAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList queryTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureQueryTermsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(queryTerms_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index to set the value at. + * @param value The queryTerms to set. + * @return This builder for chaining. + */ + public Builder setQueryTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param value The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param values The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addAllQueryTerms(java.lang.Iterable values) { + ensureQueryTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, queryTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return This builder for chaining. + */ + public Builder clearQueryTerms() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will not consider do_not_associate_terms for search if in search query.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param value The bytes of the queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList doNotAssociateTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureDoNotAssociateTermsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + doNotAssociateTerms_ = new com.google.protobuf.LazyStringArrayList(doNotAssociateTerms_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return A list containing the doNotAssociateTerms. + */ + public com.google.protobuf.ProtocolStringList getDoNotAssociateTermsList() { + return doNotAssociateTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return The count of doNotAssociateTerms. + */ + public int getDoNotAssociateTermsCount() { + return doNotAssociateTerms_.size(); + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the element to return. + * @return The doNotAssociateTerms at the given index. + */ + public java.lang.String getDoNotAssociateTerms(int index) { + return doNotAssociateTerms_.get(index); + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateTerms at the given index. + */ + public com.google.protobuf.ByteString getDoNotAssociateTermsBytes(int index) { + return doNotAssociateTerms_.getByteString(index); + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param index The index to set the value at. + * @param value The doNotAssociateTerms to set. + * @return This builder for chaining. + */ + public Builder setDoNotAssociateTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDoNotAssociateTermsIsMutable(); + doNotAssociateTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param value The doNotAssociateTerms to add. + * @return This builder for chaining. + */ + public Builder addDoNotAssociateTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDoNotAssociateTermsIsMutable(); + doNotAssociateTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param values The doNotAssociateTerms to add. + * @return This builder for chaining. + */ + public Builder addAllDoNotAssociateTerms(java.lang.Iterable values) { + ensureDoNotAssociateTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, doNotAssociateTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @return This builder for chaining. + */ + public Builder clearDoNotAssociateTerms() { + doNotAssociateTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * Cannot contain duplicates or the query term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string do_not_associate_terms = 3; + * + * @param value The bytes of the doNotAssociateTerms to add. + * @return This builder for chaining. + */ + public Builder addDoNotAssociateTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureDoNotAssociateTermsIsMutable(); + doNotAssociateTerms_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList terms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTermsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + terms_ = new com.google.protobuf.LazyStringArrayList(terms_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @return A list containing the terms. + */ + public com.google.protobuf.ProtocolStringList getTermsList() { + return terms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @return The count of terms. + */ + public int getTermsCount() { + return terms_.size(); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param index The index of the element to return. + * @return The terms at the given index. + */ + public java.lang.String getTerms(int index) { + return terms_.get(index); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the terms at the given index. + */ + public com.google.protobuf.ByteString getTermsBytes(int index) { + return terms_.getByteString(index); + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param index The index to set the value at. + * @param value The terms to set. + * @return This builder for chaining. + */ + public Builder setTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTermsIsMutable(); + terms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param value The terms to add. + * @return This builder for chaining. + */ + public Builder addTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTermsIsMutable(); + terms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param values The terms to add. + * @return This builder for chaining. + */ + public Builder addAllTerms(java.lang.Iterable values) { + ensureTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, terms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @return This builder for chaining. + */ + public Builder clearTerms() { + terms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * repeated string terms = 1; + * + * @param value The bytes of the terms to add. + * @return This builder for chaining. + */ + public Builder addTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTermsIsMutable(); + terms_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.DoNotAssociateAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.DoNotAssociateAction) + private static final com.google.cloud.retail.v2.Rule.DoNotAssociateAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.DoNotAssociateAction(); + } + + public static com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DoNotAssociateAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DoNotAssociateAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ReplacementActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.ReplacementAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + java.util.List getQueryTermsList(); + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + int getQueryTermsCount(); + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + java.lang.String getQueryTerms(int index); + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + com.google.protobuf.ByteString getQueryTermsBytes(int index); + + /** + * + * + *
+     * Term that will be used for replacement.
+     * 
+ * + * string replacement_term = 3; + * + * @return The replacementTerm. + */ + java.lang.String getReplacementTerm(); + /** + * + * + *
+     * Term that will be used for replacement.
+     * 
+ * + * string replacement_term = 3; + * + * @return The bytes for replacementTerm. + */ + com.google.protobuf.ByteString getReplacementTermBytes(); + + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * string term = 1; + * + * @return The term. + */ + java.lang.String getTerm(); + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * string term = 1; + * + * @return The bytes for term. + */ + com.google.protobuf.ByteString getTermBytes(); + } + /** + * + * + *
+   * Replaces a term in the query. Multiple replacement candidates can be
+   * specified. All `query_terms` will be replaced with the replacement term.
+   * Example: Replace "gShoe" with "google shoe".
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.ReplacementAction} + */ + public static final class ReplacementAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.ReplacementAction) + ReplacementActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplacementAction.newBuilder() to construct. + private ReplacementAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplacementAction() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + replacementTerm_ = ""; + term_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplacementAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ReplacementAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + term_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + queryTerms_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + replacementTerm_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_ReplacementAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_ReplacementAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.ReplacementAction.class, + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder.class); + } + + public static final int QUERY_TERMS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList queryTerms_; + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_; + } + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+     * Terms from the search query.
+     * Will be replaced by replacement term.
+     * Can specify up to 100 terms.
+     * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + + public static final int REPLACEMENT_TERM_FIELD_NUMBER = 3; + private volatile java.lang.Object replacementTerm_; + /** + * + * + *
+     * Term that will be used for replacement.
+     * 
+ * + * string replacement_term = 3; + * + * @return The replacementTerm. + */ + @java.lang.Override + public java.lang.String getReplacementTerm() { + java.lang.Object ref = replacementTerm_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + replacementTerm_ = s; + return s; + } + } + /** + * + * + *
+     * Term that will be used for replacement.
+     * 
+ * + * string replacement_term = 3; + * + * @return The bytes for replacementTerm. + */ + @java.lang.Override + public com.google.protobuf.ByteString getReplacementTermBytes() { + java.lang.Object ref = replacementTerm_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + replacementTerm_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TERM_FIELD_NUMBER = 1; + private volatile java.lang.Object term_; + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * string term = 1; + * + * @return The term. + */ + @java.lang.Override + public java.lang.String getTerm() { + java.lang.Object ref = term_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + term_ = s; + return s; + } + } + /** + * + * + *
+     * Will be [deprecated = true] post migration;
+     * 
+ * + * string term = 1; + * + * @return The bytes for term. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTermBytes() { + java.lang.Object ref = term_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + term_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(term_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, term_); + } + for (int i = 0; i < queryTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, queryTerms_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(replacementTerm_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, replacementTerm_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(term_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, term_); + } + { + int dataSize = 0; + for (int i = 0; i < queryTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(queryTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getQueryTermsList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(replacementTerm_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, replacementTerm_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.ReplacementAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.ReplacementAction other = + (com.google.cloud.retail.v2.Rule.ReplacementAction) obj; + + if (!getQueryTermsList().equals(other.getQueryTermsList())) return false; + if (!getReplacementTerm().equals(other.getReplacementTerm())) return false; + if (!getTerm().equals(other.getTerm())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getQueryTermsCount() > 0) { + hash = (37 * hash) + QUERY_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getQueryTermsList().hashCode(); + } + hash = (37 * hash) + REPLACEMENT_TERM_FIELD_NUMBER; + hash = (53 * hash) + getReplacementTerm().hashCode(); + hash = (37 * hash) + TERM_FIELD_NUMBER; + hash = (53 * hash) + getTerm().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule.ReplacementAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Replaces a term in the query. Multiple replacement candidates can be
+     * specified. All `query_terms` will be replaced with the replacement term.
+     * Example: Replace "gShoe" with "google shoe".
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.ReplacementAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.ReplacementAction) + com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_ReplacementAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_ReplacementAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.ReplacementAction.class, + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.ReplacementAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + replacementTerm_ = ""; + + term_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_ReplacementAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction build() { + com.google.cloud.retail.v2.Rule.ReplacementAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction buildPartial() { + com.google.cloud.retail.v2.Rule.ReplacementAction result = + new com.google.cloud.retail.v2.Rule.ReplacementAction(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = queryTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.queryTerms_ = queryTerms_; + result.replacementTerm_ = replacementTerm_; + result.term_ = term_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.ReplacementAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.ReplacementAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.ReplacementAction other) { + if (other == com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance()) + return this; + if (!other.queryTerms_.isEmpty()) { + if (queryTerms_.isEmpty()) { + queryTerms_ = other.queryTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureQueryTermsIsMutable(); + queryTerms_.addAll(other.queryTerms_); + } + onChanged(); + } + if (!other.getReplacementTerm().isEmpty()) { + replacementTerm_ = other.replacementTerm_; + onChanged(); + } + if (!other.getTerm().isEmpty()) { + term_ = other.term_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.ReplacementAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.Rule.ReplacementAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList queryTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureQueryTermsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + queryTerms_ = new com.google.protobuf.LazyStringArrayList(queryTerms_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return A list containing the queryTerms. + */ + public com.google.protobuf.ProtocolStringList getQueryTermsList() { + return queryTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return The count of queryTerms. + */ + public int getQueryTermsCount() { + return queryTerms_.size(); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the element to return. + * @return The queryTerms at the given index. + */ + public java.lang.String getQueryTerms(int index) { + return queryTerms_.get(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index of the value to return. + * @return The bytes of the queryTerms at the given index. + */ + public com.google.protobuf.ByteString getQueryTermsBytes(int index) { + return queryTerms_.getByteString(index); + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param index The index to set the value at. + * @param value The queryTerms to set. + * @return This builder for chaining. + */ + public Builder setQueryTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param value The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param values The queryTerms to add. + * @return This builder for chaining. + */ + public Builder addAllQueryTerms(java.lang.Iterable values) { + ensureQueryTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, queryTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @return This builder for chaining. + */ + public Builder clearQueryTerms() { + queryTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms from the search query.
+       * Will be replaced by replacement term.
+       * Can specify up to 100 terms.
+       * 
+ * + * repeated string query_terms = 2; + * + * @param value The bytes of the queryTerms to add. + * @return This builder for chaining. + */ + public Builder addQueryTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureQueryTermsIsMutable(); + queryTerms_.add(value); + onChanged(); + return this; + } + + private java.lang.Object replacementTerm_ = ""; + /** + * + * + *
+       * Term that will be used for replacement.
+       * 
+ * + * string replacement_term = 3; + * + * @return The replacementTerm. + */ + public java.lang.String getReplacementTerm() { + java.lang.Object ref = replacementTerm_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + replacementTerm_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Term that will be used for replacement.
+       * 
+ * + * string replacement_term = 3; + * + * @return The bytes for replacementTerm. + */ + public com.google.protobuf.ByteString getReplacementTermBytes() { + java.lang.Object ref = replacementTerm_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + replacementTerm_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Term that will be used for replacement.
+       * 
+ * + * string replacement_term = 3; + * + * @param value The replacementTerm to set. + * @return This builder for chaining. + */ + public Builder setReplacementTerm(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + replacementTerm_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Term that will be used for replacement.
+       * 
+ * + * string replacement_term = 3; + * + * @return This builder for chaining. + */ + public Builder clearReplacementTerm() { + + replacementTerm_ = getDefaultInstance().getReplacementTerm(); + onChanged(); + return this; + } + /** + * + * + *
+       * Term that will be used for replacement.
+       * 
+ * + * string replacement_term = 3; + * + * @param value The bytes for replacementTerm to set. + * @return This builder for chaining. + */ + public Builder setReplacementTermBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + replacementTerm_ = value; + onChanged(); + return this; + } + + private java.lang.Object term_ = ""; + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * string term = 1; + * + * @return The term. + */ + public java.lang.String getTerm() { + java.lang.Object ref = term_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + term_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * string term = 1; + * + * @return The bytes for term. + */ + public com.google.protobuf.ByteString getTermBytes() { + java.lang.Object ref = term_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + term_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * string term = 1; + * + * @param value The term to set. + * @return This builder for chaining. + */ + public Builder setTerm(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + term_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * string term = 1; + * + * @return This builder for chaining. + */ + public Builder clearTerm() { + + term_ = getDefaultInstance().getTerm(); + onChanged(); + return this; + } + /** + * + * + *
+       * Will be [deprecated = true] post migration;
+       * 
+ * + * string term = 1; + * + * @param value The bytes for term to set. + * @return This builder for chaining. + */ + public Builder setTermBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + term_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.ReplacementAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.ReplacementAction) + private static final com.google.cloud.retail.v2.Rule.ReplacementAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.ReplacementAction(); + } + + public static com.google.cloud.retail.v2.Rule.ReplacementAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplacementAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReplacementAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface IgnoreActionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule.IgnoreAction) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @return A list containing the ignoreTerms. + */ + java.util.List getIgnoreTermsList(); + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @return The count of ignoreTerms. + */ + int getIgnoreTermsCount(); + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the element to return. + * @return The ignoreTerms at the given index. + */ + java.lang.String getIgnoreTerms(int index); + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreTerms at the given index. + */ + com.google.protobuf.ByteString getIgnoreTermsBytes(int index); + } + /** + * + * + *
+   * Prevents a term in the query from being used in search.
+   * Example: Don't search for "shoddy".
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.IgnoreAction} + */ + public static final class IgnoreAction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.Rule.IgnoreAction) + IgnoreActionOrBuilder { + private static final long serialVersionUID = 0L; + // Use IgnoreAction.newBuilder() to construct. + private IgnoreAction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private IgnoreAction() { + ignoreTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new IgnoreAction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private IgnoreAction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + ignoreTerms_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + ignoreTerms_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + ignoreTerms_ = ignoreTerms_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_IgnoreAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_IgnoreAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.IgnoreAction.class, + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder.class); + } + + public static final int IGNORE_TERMS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList ignoreTerms_; + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @return A list containing the ignoreTerms. + */ + public com.google.protobuf.ProtocolStringList getIgnoreTermsList() { + return ignoreTerms_; + } + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @return The count of ignoreTerms. + */ + public int getIgnoreTermsCount() { + return ignoreTerms_.size(); + } + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the element to return. + * @return The ignoreTerms at the given index. + */ + public java.lang.String getIgnoreTerms(int index) { + return ignoreTerms_.get(index); + } + /** + * + * + *
+     * Terms to ignore in the search query.
+     * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreTerms at the given index. + */ + public com.google.protobuf.ByteString getIgnoreTermsBytes(int index) { + return ignoreTerms_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < ignoreTerms_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ignoreTerms_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < ignoreTerms_.size(); i++) { + dataSize += computeStringSizeNoTag(ignoreTerms_.getRaw(i)); + } + size += dataSize; + size += 1 * getIgnoreTermsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule.IgnoreAction)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule.IgnoreAction other = + (com.google.cloud.retail.v2.Rule.IgnoreAction) obj; + + if (!getIgnoreTermsList().equals(other.getIgnoreTermsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getIgnoreTermsCount() > 0) { + hash = (37 * hash) + IGNORE_TERMS_FIELD_NUMBER; + hash = (53 * hash) + getIgnoreTermsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule.IgnoreAction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Prevents a term in the query from being used in search.
+     * Example: Don't search for "shoddy".
+     * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule.IgnoreAction} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule.IgnoreAction) + com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_IgnoreAction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_IgnoreAction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.IgnoreAction.class, + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.IgnoreAction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + ignoreTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_IgnoreAction_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction build() { + com.google.cloud.retail.v2.Rule.IgnoreAction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction buildPartial() { + com.google.cloud.retail.v2.Rule.IgnoreAction result = + new com.google.cloud.retail.v2.Rule.IgnoreAction(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + ignoreTerms_ = ignoreTerms_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.ignoreTerms_ = ignoreTerms_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule.IgnoreAction) { + return mergeFrom((com.google.cloud.retail.v2.Rule.IgnoreAction) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule.IgnoreAction other) { + if (other == com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance()) return this; + if (!other.ignoreTerms_.isEmpty()) { + if (ignoreTerms_.isEmpty()) { + ignoreTerms_ = other.ignoreTerms_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureIgnoreTermsIsMutable(); + ignoreTerms_.addAll(other.ignoreTerms_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule.IgnoreAction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Rule.IgnoreAction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList ignoreTerms_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureIgnoreTermsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + ignoreTerms_ = new com.google.protobuf.LazyStringArrayList(ignoreTerms_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @return A list containing the ignoreTerms. + */ + public com.google.protobuf.ProtocolStringList getIgnoreTermsList() { + return ignoreTerms_.getUnmodifiableView(); + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @return The count of ignoreTerms. + */ + public int getIgnoreTermsCount() { + return ignoreTerms_.size(); + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the element to return. + * @return The ignoreTerms at the given index. + */ + public java.lang.String getIgnoreTerms(int index) { + return ignoreTerms_.get(index); + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreTerms at the given index. + */ + public com.google.protobuf.ByteString getIgnoreTermsBytes(int index) { + return ignoreTerms_.getByteString(index); + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param index The index to set the value at. + * @param value The ignoreTerms to set. + * @return This builder for chaining. + */ + public Builder setIgnoreTerms(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureIgnoreTermsIsMutable(); + ignoreTerms_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param value The ignoreTerms to add. + * @return This builder for chaining. + */ + public Builder addIgnoreTerms(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureIgnoreTermsIsMutable(); + ignoreTerms_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param values The ignoreTerms to add. + * @return This builder for chaining. + */ + public Builder addAllIgnoreTerms(java.lang.Iterable values) { + ensureIgnoreTermsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ignoreTerms_); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @return This builder for chaining. + */ + public Builder clearIgnoreTerms() { + ignoreTerms_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Terms to ignore in the search query.
+       * 
+ * + * repeated string ignore_terms = 1; + * + * @param value The bytes of the ignoreTerms to add. + * @return This builder for chaining. + */ + public Builder addIgnoreTermsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureIgnoreTermsIsMutable(); + ignoreTerms_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule.IgnoreAction) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule.IgnoreAction) + private static final com.google.cloud.retail.v2.Rule.IgnoreAction DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule.IgnoreAction(); + } + + public static com.google.cloud.retail.v2.Rule.IgnoreAction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IgnoreAction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IgnoreAction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int actionCase_ = 0; + private java.lang.Object action_; + + public enum ActionCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + BOOST_ACTION(2), + REDIRECT_ACTION(3), + ONEWAY_SYNONYMS_ACTION(6), + DO_NOT_ASSOCIATE_ACTION(7), + REPLACEMENT_ACTION(8), + IGNORE_ACTION(9), + FILTER_ACTION(10), + TWOWAY_SYNONYMS_ACTION(11), + ACTION_NOT_SET(0); + private final int value; + + private ActionCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ActionCase valueOf(int value) { + return forNumber(value); + } + + public static ActionCase forNumber(int value) { + switch (value) { + case 2: + return BOOST_ACTION; + case 3: + return REDIRECT_ACTION; + case 6: + return ONEWAY_SYNONYMS_ACTION; + case 7: + return DO_NOT_ASSOCIATE_ACTION; + case 8: + return REPLACEMENT_ACTION; + case 9: + return IGNORE_ACTION; + case 10: + return FILTER_ACTION; + case 11: + return TWOWAY_SYNONYMS_ACTION; + case 0: + return ACTION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ActionCase getActionCase() { + return ActionCase.forNumber(actionCase_); + } + + public static final int BOOST_ACTION_FIELD_NUMBER = 2; + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return Whether the boostAction field is set. + */ + @java.lang.Override + public boolean hasBoostAction() { + return actionCase_ == 2; + } + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return The boostAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction getBoostAction() { + if (actionCase_ == 2) { + return (com.google.cloud.retail.v2.Rule.BoostAction) action_; + } + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostActionOrBuilder getBoostActionOrBuilder() { + if (actionCase_ == 2) { + return (com.google.cloud.retail.v2.Rule.BoostAction) action_; + } + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + + public static final int REDIRECT_ACTION_FIELD_NUMBER = 3; + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return Whether the redirectAction field is set. + */ + @java.lang.Override + public boolean hasRedirectAction() { + return actionCase_ == 3; + } + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return The redirectAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction getRedirectAction() { + if (actionCase_ == 3) { + return (com.google.cloud.retail.v2.Rule.RedirectAction) action_; + } + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder getRedirectActionOrBuilder() { + if (actionCase_ == 3) { + return (com.google.cloud.retail.v2.Rule.RedirectAction) action_; + } + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + + public static final int ONEWAY_SYNONYMS_ACTION_FIELD_NUMBER = 6; + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return Whether the onewaySynonymsAction field is set. + */ + @java.lang.Override + public boolean hasOnewaySynonymsAction() { + return actionCase_ == 6; + } + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return The onewaySynonymsAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getOnewaySynonymsAction() { + if (actionCase_ == 6) { + return (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder + getOnewaySynonymsActionOrBuilder() { + if (actionCase_ == 6) { + return (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + + public static final int DO_NOT_ASSOCIATE_ACTION_FIELD_NUMBER = 7; + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return Whether the doNotAssociateAction field is set. + */ + @java.lang.Override + public boolean hasDoNotAssociateAction() { + return actionCase_ == 7; + } + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return The doNotAssociateAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDoNotAssociateAction() { + if (actionCase_ == 7) { + return (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_; + } + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder + getDoNotAssociateActionOrBuilder() { + if (actionCase_ == 7) { + return (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_; + } + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + + public static final int REPLACEMENT_ACTION_FIELD_NUMBER = 8; + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return Whether the replacementAction field is set. + */ + @java.lang.Override + public boolean hasReplacementAction() { + return actionCase_ == 8; + } + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return The replacementAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction getReplacementAction() { + if (actionCase_ == 8) { + return (com.google.cloud.retail.v2.Rule.ReplacementAction) action_; + } + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder + getReplacementActionOrBuilder() { + if (actionCase_ == 8) { + return (com.google.cloud.retail.v2.Rule.ReplacementAction) action_; + } + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + + public static final int IGNORE_ACTION_FIELD_NUMBER = 9; + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return Whether the ignoreAction field is set. + */ + @java.lang.Override + public boolean hasIgnoreAction() { + return actionCase_ == 9; + } + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return The ignoreAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction getIgnoreAction() { + if (actionCase_ == 9) { + return (com.google.cloud.retail.v2.Rule.IgnoreAction) action_; + } + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder getIgnoreActionOrBuilder() { + if (actionCase_ == 9) { + return (com.google.cloud.retail.v2.Rule.IgnoreAction) action_; + } + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + + public static final int FILTER_ACTION_FIELD_NUMBER = 10; + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return Whether the filterAction field is set. + */ + @java.lang.Override + public boolean hasFilterAction() { + return actionCase_ == 10; + } + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return The filterAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction getFilterAction() { + if (actionCase_ == 10) { + return (com.google.cloud.retail.v2.Rule.FilterAction) action_; + } + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterActionOrBuilder getFilterActionOrBuilder() { + if (actionCase_ == 10) { + return (com.google.cloud.retail.v2.Rule.FilterAction) action_; + } + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + + public static final int TWOWAY_SYNONYMS_ACTION_FIELD_NUMBER = 11; + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return Whether the twowaySynonymsAction field is set. + */ + @java.lang.Override + public boolean hasTwowaySynonymsAction() { + return actionCase_ == 11; + } + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return The twowaySynonymsAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getTwowaySynonymsAction() { + if (actionCase_ == 11) { + return (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder + getTwowaySynonymsActionOrBuilder() { + if (actionCase_ == 11) { + return (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + + public static final int CONDITION_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.Condition condition_; + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the condition field is set. + */ + @java.lang.Override + public boolean hasCondition() { + return condition_ != null; + } + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The condition. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Condition getCondition() { + return condition_ == null + ? com.google.cloud.retail.v2.Condition.getDefaultInstance() + : condition_; + } + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ConditionOrBuilder getConditionOrBuilder() { + return getCondition(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (condition_ != null) { + output.writeMessage(1, getCondition()); + } + if (actionCase_ == 2) { + output.writeMessage(2, (com.google.cloud.retail.v2.Rule.BoostAction) action_); + } + if (actionCase_ == 3) { + output.writeMessage(3, (com.google.cloud.retail.v2.Rule.RedirectAction) action_); + } + if (actionCase_ == 6) { + output.writeMessage(6, (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_); + } + if (actionCase_ == 7) { + output.writeMessage(7, (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_); + } + if (actionCase_ == 8) { + output.writeMessage(8, (com.google.cloud.retail.v2.Rule.ReplacementAction) action_); + } + if (actionCase_ == 9) { + output.writeMessage(9, (com.google.cloud.retail.v2.Rule.IgnoreAction) action_); + } + if (actionCase_ == 10) { + output.writeMessage(10, (com.google.cloud.retail.v2.Rule.FilterAction) action_); + } + if (actionCase_ == 11) { + output.writeMessage(11, (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (condition_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCondition()); + } + if (actionCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.retail.v2.Rule.BoostAction) action_); + } + if (actionCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.retail.v2.Rule.RedirectAction) action_); + } + if (actionCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_); + } + if (actionCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_); + } + if (actionCase_ == 8) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, (com.google.cloud.retail.v2.Rule.ReplacementAction) action_); + } + if (actionCase_ == 9) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 9, (com.google.cloud.retail.v2.Rule.IgnoreAction) action_); + } + if (actionCase_ == 10) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 10, (com.google.cloud.retail.v2.Rule.FilterAction) action_); + } + if (actionCase_ == 11) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 11, (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.Rule)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.Rule other = (com.google.cloud.retail.v2.Rule) obj; + + if (hasCondition() != other.hasCondition()) return false; + if (hasCondition()) { + if (!getCondition().equals(other.getCondition())) return false; + } + if (!getActionCase().equals(other.getActionCase())) return false; + switch (actionCase_) { + case 2: + if (!getBoostAction().equals(other.getBoostAction())) return false; + break; + case 3: + if (!getRedirectAction().equals(other.getRedirectAction())) return false; + break; + case 6: + if (!getOnewaySynonymsAction().equals(other.getOnewaySynonymsAction())) return false; + break; + case 7: + if (!getDoNotAssociateAction().equals(other.getDoNotAssociateAction())) return false; + break; + case 8: + if (!getReplacementAction().equals(other.getReplacementAction())) return false; + break; + case 9: + if (!getIgnoreAction().equals(other.getIgnoreAction())) return false; + break; + case 10: + if (!getFilterAction().equals(other.getFilterAction())) return false; + break; + case 11: + if (!getTwowaySynonymsAction().equals(other.getTwowaySynonymsAction())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCondition()) { + hash = (37 * hash) + CONDITION_FIELD_NUMBER; + hash = (53 * hash) + getCondition().hashCode(); + } + switch (actionCase_) { + case 2: + hash = (37 * hash) + BOOST_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getBoostAction().hashCode(); + break; + case 3: + hash = (37 * hash) + REDIRECT_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getRedirectAction().hashCode(); + break; + case 6: + hash = (37 * hash) + ONEWAY_SYNONYMS_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getOnewaySynonymsAction().hashCode(); + break; + case 7: + hash = (37 * hash) + DO_NOT_ASSOCIATE_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getDoNotAssociateAction().hashCode(); + break; + case 8: + hash = (37 * hash) + REPLACEMENT_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getReplacementAction().hashCode(); + break; + case 9: + hash = (37 * hash) + IGNORE_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getIgnoreAction().hashCode(); + break; + case 10: + hash = (37 * hash) + FILTER_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getFilterAction().hashCode(); + break; + case 11: + hash = (37 * hash) + TWOWAY_SYNONYMS_ACTION_FIELD_NUMBER; + hash = (53 * hash) + getTwowaySynonymsAction().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.Rule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.Rule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.Rule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A rule is a condition-action pair
+   * * A condition defines when a rule is to be triggered.
+   * * An action specifies what occurs on that trigger.
+   * Currently rules only work for [controls][google.cloud.retail.v2.Control] with
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.Rule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.Rule) + com.google.cloud.retail.v2.RuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.Rule.class, com.google.cloud.retail.v2.Rule.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.Rule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (conditionBuilder_ == null) { + condition_ = null; + } else { + condition_ = null; + conditionBuilder_ = null; + } + actionCase_ = 0; + action_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CommonProto + .internal_static_google_cloud_retail_v2_Rule_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule getDefaultInstanceForType() { + return com.google.cloud.retail.v2.Rule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule build() { + com.google.cloud.retail.v2.Rule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule buildPartial() { + com.google.cloud.retail.v2.Rule result = new com.google.cloud.retail.v2.Rule(this); + if (actionCase_ == 2) { + if (boostActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = boostActionBuilder_.build(); + } + } + if (actionCase_ == 3) { + if (redirectActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = redirectActionBuilder_.build(); + } + } + if (actionCase_ == 6) { + if (onewaySynonymsActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = onewaySynonymsActionBuilder_.build(); + } + } + if (actionCase_ == 7) { + if (doNotAssociateActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = doNotAssociateActionBuilder_.build(); + } + } + if (actionCase_ == 8) { + if (replacementActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = replacementActionBuilder_.build(); + } + } + if (actionCase_ == 9) { + if (ignoreActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = ignoreActionBuilder_.build(); + } + } + if (actionCase_ == 10) { + if (filterActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = filterActionBuilder_.build(); + } + } + if (actionCase_ == 11) { + if (twowaySynonymsActionBuilder_ == null) { + result.action_ = action_; + } else { + result.action_ = twowaySynonymsActionBuilder_.build(); + } + } + if (conditionBuilder_ == null) { + result.condition_ = condition_; + } else { + result.condition_ = conditionBuilder_.build(); + } + result.actionCase_ = actionCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.Rule) { + return mergeFrom((com.google.cloud.retail.v2.Rule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.Rule other) { + if (other == com.google.cloud.retail.v2.Rule.getDefaultInstance()) return this; + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + switch (other.getActionCase()) { + case BOOST_ACTION: + { + mergeBoostAction(other.getBoostAction()); + break; + } + case REDIRECT_ACTION: + { + mergeRedirectAction(other.getRedirectAction()); + break; + } + case ONEWAY_SYNONYMS_ACTION: + { + mergeOnewaySynonymsAction(other.getOnewaySynonymsAction()); + break; + } + case DO_NOT_ASSOCIATE_ACTION: + { + mergeDoNotAssociateAction(other.getDoNotAssociateAction()); + break; + } + case REPLACEMENT_ACTION: + { + mergeReplacementAction(other.getReplacementAction()); + break; + } + case IGNORE_ACTION: + { + mergeIgnoreAction(other.getIgnoreAction()); + break; + } + case FILTER_ACTION: + { + mergeFilterAction(other.getFilterAction()); + break; + } + case TWOWAY_SYNONYMS_ACTION: + { + mergeTwowaySynonymsAction(other.getTwowaySynonymsAction()); + break; + } + case ACTION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.Rule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.Rule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int actionCase_ = 0; + private java.lang.Object action_; + + public ActionCase getActionCase() { + return ActionCase.forNumber(actionCase_); + } + + public Builder clearAction() { + actionCase_ = 0; + action_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.BoostAction, + com.google.cloud.retail.v2.Rule.BoostAction.Builder, + com.google.cloud.retail.v2.Rule.BoostActionOrBuilder> + boostActionBuilder_; + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return Whether the boostAction field is set. + */ + @java.lang.Override + public boolean hasBoostAction() { + return actionCase_ == 2; + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return The boostAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostAction getBoostAction() { + if (boostActionBuilder_ == null) { + if (actionCase_ == 2) { + return (com.google.cloud.retail.v2.Rule.BoostAction) action_; + } + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } else { + if (actionCase_ == 2) { + return boostActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + public Builder setBoostAction(com.google.cloud.retail.v2.Rule.BoostAction value) { + if (boostActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + boostActionBuilder_.setMessage(value); + } + actionCase_ = 2; + return this; + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + public Builder setBoostAction( + com.google.cloud.retail.v2.Rule.BoostAction.Builder builderForValue) { + if (boostActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + boostActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 2; + return this; + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + public Builder mergeBoostAction(com.google.cloud.retail.v2.Rule.BoostAction value) { + if (boostActionBuilder_ == null) { + if (actionCase_ == 2 + && action_ != com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.BoostAction.newBuilder( + (com.google.cloud.retail.v2.Rule.BoostAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 2) { + boostActionBuilder_.mergeFrom(value); + } else { + boostActionBuilder_.setMessage(value); + } + } + actionCase_ = 2; + return this; + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + public Builder clearBoostAction() { + if (boostActionBuilder_ == null) { + if (actionCase_ == 2) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 2) { + actionCase_ = 0; + action_ = null; + } + boostActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + public com.google.cloud.retail.v2.Rule.BoostAction.Builder getBoostActionBuilder() { + return getBoostActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.BoostActionOrBuilder getBoostActionOrBuilder() { + if ((actionCase_ == 2) && (boostActionBuilder_ != null)) { + return boostActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 2) { + return (com.google.cloud.retail.v2.Rule.BoostAction) action_; + } + return com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * A boost action.
+     * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.BoostAction, + com.google.cloud.retail.v2.Rule.BoostAction.Builder, + com.google.cloud.retail.v2.Rule.BoostActionOrBuilder> + getBoostActionFieldBuilder() { + if (boostActionBuilder_ == null) { + if (!(actionCase_ == 2)) { + action_ = com.google.cloud.retail.v2.Rule.BoostAction.getDefaultInstance(); + } + boostActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.BoostAction, + com.google.cloud.retail.v2.Rule.BoostAction.Builder, + com.google.cloud.retail.v2.Rule.BoostActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.BoostAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 2; + onChanged(); + ; + return boostActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.RedirectAction, + com.google.cloud.retail.v2.Rule.RedirectAction.Builder, + com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder> + redirectActionBuilder_; + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return Whether the redirectAction field is set. + */ + @java.lang.Override + public boolean hasRedirectAction() { + return actionCase_ == 3; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return The redirectAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectAction getRedirectAction() { + if (redirectActionBuilder_ == null) { + if (actionCase_ == 3) { + return (com.google.cloud.retail.v2.Rule.RedirectAction) action_; + } + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } else { + if (actionCase_ == 3) { + return redirectActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + public Builder setRedirectAction(com.google.cloud.retail.v2.Rule.RedirectAction value) { + if (redirectActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + redirectActionBuilder_.setMessage(value); + } + actionCase_ = 3; + return this; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + public Builder setRedirectAction( + com.google.cloud.retail.v2.Rule.RedirectAction.Builder builderForValue) { + if (redirectActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + redirectActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 3; + return this; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + public Builder mergeRedirectAction(com.google.cloud.retail.v2.Rule.RedirectAction value) { + if (redirectActionBuilder_ == null) { + if (actionCase_ == 3 + && action_ != com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.RedirectAction.newBuilder( + (com.google.cloud.retail.v2.Rule.RedirectAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 3) { + redirectActionBuilder_.mergeFrom(value); + } else { + redirectActionBuilder_.setMessage(value); + } + } + actionCase_ = 3; + return this; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + public Builder clearRedirectAction() { + if (redirectActionBuilder_ == null) { + if (actionCase_ == 3) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 3) { + actionCase_ = 0; + action_ = null; + } + redirectActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + public com.google.cloud.retail.v2.Rule.RedirectAction.Builder getRedirectActionBuilder() { + return getRedirectActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder getRedirectActionOrBuilder() { + if ((actionCase_ == 3) && (redirectActionBuilder_ != null)) { + return redirectActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 3) { + return (com.google.cloud.retail.v2.Rule.RedirectAction) action_; + } + return com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Redirects a shopper to a specific page.
+     * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.RedirectAction, + com.google.cloud.retail.v2.Rule.RedirectAction.Builder, + com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder> + getRedirectActionFieldBuilder() { + if (redirectActionBuilder_ == null) { + if (!(actionCase_ == 3)) { + action_ = com.google.cloud.retail.v2.Rule.RedirectAction.getDefaultInstance(); + } + redirectActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.RedirectAction, + com.google.cloud.retail.v2.Rule.RedirectAction.Builder, + com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.RedirectAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 3; + onChanged(); + ; + return redirectActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction, + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder> + onewaySynonymsActionBuilder_; + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return Whether the onewaySynonymsAction field is set. + */ + @java.lang.Override + public boolean hasOnewaySynonymsAction() { + return actionCase_ == 6; + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return The onewaySynonymsAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getOnewaySynonymsAction() { + if (onewaySynonymsActionBuilder_ == null) { + if (actionCase_ == 6) { + return (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } else { + if (actionCase_ == 6) { + return onewaySynonymsActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + public Builder setOnewaySynonymsAction( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction value) { + if (onewaySynonymsActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + onewaySynonymsActionBuilder_.setMessage(value); + } + actionCase_ = 6; + return this; + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + public Builder setOnewaySynonymsAction( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder builderForValue) { + if (onewaySynonymsActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + onewaySynonymsActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 6; + return this; + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + public Builder mergeOnewaySynonymsAction( + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction value) { + if (onewaySynonymsActionBuilder_ == null) { + if (actionCase_ == 6 + && action_ + != com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.newBuilder( + (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 6) { + onewaySynonymsActionBuilder_.mergeFrom(value); + } else { + onewaySynonymsActionBuilder_.setMessage(value); + } + } + actionCase_ = 6; + return this; + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + public Builder clearOnewaySynonymsAction() { + if (onewaySynonymsActionBuilder_ == null) { + if (actionCase_ == 6) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 6) { + actionCase_ = 0; + action_ = null; + } + onewaySynonymsActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + public com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder + getOnewaySynonymsActionBuilder() { + return getOnewaySynonymsActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder + getOnewaySynonymsActionOrBuilder() { + if ((actionCase_ == 6) && (onewaySynonymsActionBuilder_ != null)) { + return onewaySynonymsActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 6) { + return (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Treats specific term as a synonym with a group of terms.
+     * Group of terms will not be treated as synonyms with the specific term.
+     * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction, + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder> + getOnewaySynonymsActionFieldBuilder() { + if (onewaySynonymsActionBuilder_ == null) { + if (!(actionCase_ == 6)) { + action_ = com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.getDefaultInstance(); + } + onewaySynonymsActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction, + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.OnewaySynonymsAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 6; + onChanged(); + ; + return onewaySynonymsActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.DoNotAssociateAction, + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder, + com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder> + doNotAssociateActionBuilder_; + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return Whether the doNotAssociateAction field is set. + */ + @java.lang.Override + public boolean hasDoNotAssociateAction() { + return actionCase_ == 7; + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return The doNotAssociateAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDoNotAssociateAction() { + if (doNotAssociateActionBuilder_ == null) { + if (actionCase_ == 7) { + return (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_; + } + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } else { + if (actionCase_ == 7) { + return doNotAssociateActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + public Builder setDoNotAssociateAction( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction value) { + if (doNotAssociateActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + doNotAssociateActionBuilder_.setMessage(value); + } + actionCase_ = 7; + return this; + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + public Builder setDoNotAssociateAction( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder builderForValue) { + if (doNotAssociateActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + doNotAssociateActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 7; + return this; + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + public Builder mergeDoNotAssociateAction( + com.google.cloud.retail.v2.Rule.DoNotAssociateAction value) { + if (doNotAssociateActionBuilder_ == null) { + if (actionCase_ == 7 + && action_ + != com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.newBuilder( + (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 7) { + doNotAssociateActionBuilder_.mergeFrom(value); + } else { + doNotAssociateActionBuilder_.setMessage(value); + } + } + actionCase_ = 7; + return this; + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + public Builder clearDoNotAssociateAction() { + if (doNotAssociateActionBuilder_ == null) { + if (actionCase_ == 7) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 7) { + actionCase_ = 0; + action_ = null; + } + doNotAssociateActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + public com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder + getDoNotAssociateActionBuilder() { + return getDoNotAssociateActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder + getDoNotAssociateActionOrBuilder() { + if ((actionCase_ == 7) && (doNotAssociateActionBuilder_ != null)) { + return doNotAssociateActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 7) { + return (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_; + } + return com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Prevents term from being associated with other terms.
+     * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.DoNotAssociateAction, + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder, + com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder> + getDoNotAssociateActionFieldBuilder() { + if (doNotAssociateActionBuilder_ == null) { + if (!(actionCase_ == 7)) { + action_ = com.google.cloud.retail.v2.Rule.DoNotAssociateAction.getDefaultInstance(); + } + doNotAssociateActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.DoNotAssociateAction, + com.google.cloud.retail.v2.Rule.DoNotAssociateAction.Builder, + com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.DoNotAssociateAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 7; + onChanged(); + ; + return doNotAssociateActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.ReplacementAction, + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder, + com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder> + replacementActionBuilder_; + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return Whether the replacementAction field is set. + */ + @java.lang.Override + public boolean hasReplacementAction() { + return actionCase_ == 8; + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return The replacementAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementAction getReplacementAction() { + if (replacementActionBuilder_ == null) { + if (actionCase_ == 8) { + return (com.google.cloud.retail.v2.Rule.ReplacementAction) action_; + } + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } else { + if (actionCase_ == 8) { + return replacementActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + public Builder setReplacementAction(com.google.cloud.retail.v2.Rule.ReplacementAction value) { + if (replacementActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + replacementActionBuilder_.setMessage(value); + } + actionCase_ = 8; + return this; + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + public Builder setReplacementAction( + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder builderForValue) { + if (replacementActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + replacementActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 8; + return this; + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + public Builder mergeReplacementAction(com.google.cloud.retail.v2.Rule.ReplacementAction value) { + if (replacementActionBuilder_ == null) { + if (actionCase_ == 8 + && action_ != com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.ReplacementAction.newBuilder( + (com.google.cloud.retail.v2.Rule.ReplacementAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 8) { + replacementActionBuilder_.mergeFrom(value); + } else { + replacementActionBuilder_.setMessage(value); + } + } + actionCase_ = 8; + return this; + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + public Builder clearReplacementAction() { + if (replacementActionBuilder_ == null) { + if (actionCase_ == 8) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 8) { + actionCase_ = 0; + action_ = null; + } + replacementActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + public com.google.cloud.retail.v2.Rule.ReplacementAction.Builder getReplacementActionBuilder() { + return getReplacementActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder + getReplacementActionOrBuilder() { + if ((actionCase_ == 8) && (replacementActionBuilder_ != null)) { + return replacementActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 8) { + return (com.google.cloud.retail.v2.Rule.ReplacementAction) action_; + } + return com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Replaces specific terms in the query.
+     * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.ReplacementAction, + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder, + com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder> + getReplacementActionFieldBuilder() { + if (replacementActionBuilder_ == null) { + if (!(actionCase_ == 8)) { + action_ = com.google.cloud.retail.v2.Rule.ReplacementAction.getDefaultInstance(); + } + replacementActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.ReplacementAction, + com.google.cloud.retail.v2.Rule.ReplacementAction.Builder, + com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.ReplacementAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 8; + onChanged(); + ; + return replacementActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.IgnoreAction, + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder, + com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder> + ignoreActionBuilder_; + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return Whether the ignoreAction field is set. + */ + @java.lang.Override + public boolean hasIgnoreAction() { + return actionCase_ == 9; + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return The ignoreAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreAction getIgnoreAction() { + if (ignoreActionBuilder_ == null) { + if (actionCase_ == 9) { + return (com.google.cloud.retail.v2.Rule.IgnoreAction) action_; + } + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } else { + if (actionCase_ == 9) { + return ignoreActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + public Builder setIgnoreAction(com.google.cloud.retail.v2.Rule.IgnoreAction value) { + if (ignoreActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + ignoreActionBuilder_.setMessage(value); + } + actionCase_ = 9; + return this; + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + public Builder setIgnoreAction( + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder builderForValue) { + if (ignoreActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + ignoreActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 9; + return this; + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + public Builder mergeIgnoreAction(com.google.cloud.retail.v2.Rule.IgnoreAction value) { + if (ignoreActionBuilder_ == null) { + if (actionCase_ == 9 + && action_ != com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.IgnoreAction.newBuilder( + (com.google.cloud.retail.v2.Rule.IgnoreAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 9) { + ignoreActionBuilder_.mergeFrom(value); + } else { + ignoreActionBuilder_.setMessage(value); + } + } + actionCase_ = 9; + return this; + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + public Builder clearIgnoreAction() { + if (ignoreActionBuilder_ == null) { + if (actionCase_ == 9) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 9) { + actionCase_ = 0; + action_ = null; + } + ignoreActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + public com.google.cloud.retail.v2.Rule.IgnoreAction.Builder getIgnoreActionBuilder() { + return getIgnoreActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder getIgnoreActionOrBuilder() { + if ((actionCase_ == 9) && (ignoreActionBuilder_ != null)) { + return ignoreActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 9) { + return (com.google.cloud.retail.v2.Rule.IgnoreAction) action_; + } + return com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Ignores specific terms from query during search.
+     * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.IgnoreAction, + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder, + com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder> + getIgnoreActionFieldBuilder() { + if (ignoreActionBuilder_ == null) { + if (!(actionCase_ == 9)) { + action_ = com.google.cloud.retail.v2.Rule.IgnoreAction.getDefaultInstance(); + } + ignoreActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.IgnoreAction, + com.google.cloud.retail.v2.Rule.IgnoreAction.Builder, + com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.IgnoreAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 9; + onChanged(); + ; + return ignoreActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.FilterAction, + com.google.cloud.retail.v2.Rule.FilterAction.Builder, + com.google.cloud.retail.v2.Rule.FilterActionOrBuilder> + filterActionBuilder_; + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return Whether the filterAction field is set. + */ + @java.lang.Override + public boolean hasFilterAction() { + return actionCase_ == 10; + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return The filterAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterAction getFilterAction() { + if (filterActionBuilder_ == null) { + if (actionCase_ == 10) { + return (com.google.cloud.retail.v2.Rule.FilterAction) action_; + } + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } else { + if (actionCase_ == 10) { + return filterActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + public Builder setFilterAction(com.google.cloud.retail.v2.Rule.FilterAction value) { + if (filterActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + filterActionBuilder_.setMessage(value); + } + actionCase_ = 10; + return this; + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + public Builder setFilterAction( + com.google.cloud.retail.v2.Rule.FilterAction.Builder builderForValue) { + if (filterActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + filterActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 10; + return this; + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + public Builder mergeFilterAction(com.google.cloud.retail.v2.Rule.FilterAction value) { + if (filterActionBuilder_ == null) { + if (actionCase_ == 10 + && action_ != com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.FilterAction.newBuilder( + (com.google.cloud.retail.v2.Rule.FilterAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 10) { + filterActionBuilder_.mergeFrom(value); + } else { + filterActionBuilder_.setMessage(value); + } + } + actionCase_ = 10; + return this; + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + public Builder clearFilterAction() { + if (filterActionBuilder_ == null) { + if (actionCase_ == 10) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 10) { + actionCase_ = 0; + action_ = null; + } + filterActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + public com.google.cloud.retail.v2.Rule.FilterAction.Builder getFilterActionBuilder() { + return getFilterActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.FilterActionOrBuilder getFilterActionOrBuilder() { + if ((actionCase_ == 10) && (filterActionBuilder_ != null)) { + return filterActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 10) { + return (com.google.cloud.retail.v2.Rule.FilterAction) action_; + } + return com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Filters results.
+     * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.FilterAction, + com.google.cloud.retail.v2.Rule.FilterAction.Builder, + com.google.cloud.retail.v2.Rule.FilterActionOrBuilder> + getFilterActionFieldBuilder() { + if (filterActionBuilder_ == null) { + if (!(actionCase_ == 10)) { + action_ = com.google.cloud.retail.v2.Rule.FilterAction.getDefaultInstance(); + } + filterActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.FilterAction, + com.google.cloud.retail.v2.Rule.FilterAction.Builder, + com.google.cloud.retail.v2.Rule.FilterActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.FilterAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 10; + onChanged(); + ; + return filterActionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction, + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder> + twowaySynonymsActionBuilder_; + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return Whether the twowaySynonymsAction field is set. + */ + @java.lang.Override + public boolean hasTwowaySynonymsAction() { + return actionCase_ == 11; + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return The twowaySynonymsAction. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getTwowaySynonymsAction() { + if (twowaySynonymsActionBuilder_ == null) { + if (actionCase_ == 11) { + return (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } else { + if (actionCase_ == 11) { + return twowaySynonymsActionBuilder_.getMessage(); + } + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + public Builder setTwowaySynonymsAction( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction value) { + if (twowaySynonymsActionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + action_ = value; + onChanged(); + } else { + twowaySynonymsActionBuilder_.setMessage(value); + } + actionCase_ = 11; + return this; + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + public Builder setTwowaySynonymsAction( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder builderForValue) { + if (twowaySynonymsActionBuilder_ == null) { + action_ = builderForValue.build(); + onChanged(); + } else { + twowaySynonymsActionBuilder_.setMessage(builderForValue.build()); + } + actionCase_ = 11; + return this; + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + public Builder mergeTwowaySynonymsAction( + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction value) { + if (twowaySynonymsActionBuilder_ == null) { + if (actionCase_ == 11 + && action_ + != com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance()) { + action_ = + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.newBuilder( + (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_) + .mergeFrom(value) + .buildPartial(); + } else { + action_ = value; + } + onChanged(); + } else { + if (actionCase_ == 11) { + twowaySynonymsActionBuilder_.mergeFrom(value); + } else { + twowaySynonymsActionBuilder_.setMessage(value); + } + } + actionCase_ = 11; + return this; + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + public Builder clearTwowaySynonymsAction() { + if (twowaySynonymsActionBuilder_ == null) { + if (actionCase_ == 11) { + actionCase_ = 0; + action_ = null; + onChanged(); + } + } else { + if (actionCase_ == 11) { + actionCase_ = 0; + action_ = null; + } + twowaySynonymsActionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + public com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder + getTwowaySynonymsActionBuilder() { + return getTwowaySynonymsActionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + @java.lang.Override + public com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder + getTwowaySynonymsActionOrBuilder() { + if ((actionCase_ == 11) && (twowaySynonymsActionBuilder_ != null)) { + return twowaySynonymsActionBuilder_.getMessageOrBuilder(); + } else { + if (actionCase_ == 11) { + return (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_; + } + return com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + } + /** + * + * + *
+     * Treats a set of terms as synonyms of one another.
+     * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction, + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder> + getTwowaySynonymsActionFieldBuilder() { + if (twowaySynonymsActionBuilder_ == null) { + if (!(actionCase_ == 11)) { + action_ = com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.getDefaultInstance(); + } + twowaySynonymsActionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction, + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction.Builder, + com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder>( + (com.google.cloud.retail.v2.Rule.TwowaySynonymsAction) action_, + getParentForChildren(), + isClean()); + action_ = null; + } + actionCase_ = 11; + onChanged(); + ; + return twowaySynonymsActionBuilder_; + } + + private com.google.cloud.retail.v2.Condition condition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Condition, + com.google.cloud.retail.v2.Condition.Builder, + com.google.cloud.retail.v2.ConditionOrBuilder> + conditionBuilder_; + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the condition field is set. + */ + public boolean hasCondition() { + return conditionBuilder_ != null || condition_ != null; + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The condition. + */ + public com.google.cloud.retail.v2.Condition getCondition() { + if (conditionBuilder_ == null) { + return condition_ == null + ? com.google.cloud.retail.v2.Condition.getDefaultInstance() + : condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCondition(com.google.cloud.retail.v2.Condition value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + onChanged(); + } else { + conditionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCondition(com.google.cloud.retail.v2.Condition.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + onChanged(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCondition(com.google.cloud.retail.v2.Condition value) { + if (conditionBuilder_ == null) { + if (condition_ != null) { + condition_ = + com.google.cloud.retail.v2.Condition.newBuilder(condition_) + .mergeFrom(value) + .buildPartial(); + } else { + condition_ = value; + } + onChanged(); + } else { + conditionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCondition() { + if (conditionBuilder_ == null) { + condition_ = null; + onChanged(); + } else { + condition_ = null; + conditionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Condition.Builder getConditionBuilder() { + + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ConditionOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_ == null + ? com.google.cloud.retail.v2.Condition.getDefaultInstance() + : condition_; + } + } + /** + * + * + *
+     * Required. The condition that triggers the rule.
+     * If the condition is empty, the rule will always apply.
+     * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Condition, + com.google.cloud.retail.v2.Condition.Builder, + com.google.cloud.retail.v2.ConditionOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Condition, + com.google.cloud.retail.v2.Condition.Builder, + com.google.cloud.retail.v2.ConditionOrBuilder>( + getCondition(), getParentForChildren(), isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.Rule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.Rule) + private static final com.google.cloud.retail.v2.Rule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.Rule(); + } + + public static com.google.cloud.retail.v2.Rule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Rule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Rule(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.Rule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RuleOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RuleOrBuilder.java new file mode 100644 index 000000000000..d3e69bab33a1 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/RuleOrBuilder.java @@ -0,0 +1,354 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/common.proto + +package com.google.cloud.retail.v2; + +public interface RuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.Rule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return Whether the boostAction field is set. + */ + boolean hasBoostAction(); + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + * + * @return The boostAction. + */ + com.google.cloud.retail.v2.Rule.BoostAction getBoostAction(); + /** + * + * + *
+   * A boost action.
+   * 
+ * + * .google.cloud.retail.v2.Rule.BoostAction boost_action = 2; + */ + com.google.cloud.retail.v2.Rule.BoostActionOrBuilder getBoostActionOrBuilder(); + + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return Whether the redirectAction field is set. + */ + boolean hasRedirectAction(); + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + * + * @return The redirectAction. + */ + com.google.cloud.retail.v2.Rule.RedirectAction getRedirectAction(); + /** + * + * + *
+   * Redirects a shopper to a specific page.
+   * 
+ * + * .google.cloud.retail.v2.Rule.RedirectAction redirect_action = 3; + */ + com.google.cloud.retail.v2.Rule.RedirectActionOrBuilder getRedirectActionOrBuilder(); + + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return Whether the onewaySynonymsAction field is set. + */ + boolean hasOnewaySynonymsAction(); + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + * + * @return The onewaySynonymsAction. + */ + com.google.cloud.retail.v2.Rule.OnewaySynonymsAction getOnewaySynonymsAction(); + /** + * + * + *
+   * Treats specific term as a synonym with a group of terms.
+   * Group of terms will not be treated as synonyms with the specific term.
+   * 
+ * + * .google.cloud.retail.v2.Rule.OnewaySynonymsAction oneway_synonyms_action = 6; + */ + com.google.cloud.retail.v2.Rule.OnewaySynonymsActionOrBuilder getOnewaySynonymsActionOrBuilder(); + + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return Whether the doNotAssociateAction field is set. + */ + boolean hasDoNotAssociateAction(); + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + * + * @return The doNotAssociateAction. + */ + com.google.cloud.retail.v2.Rule.DoNotAssociateAction getDoNotAssociateAction(); + /** + * + * + *
+   * Prevents term from being associated with other terms.
+   * 
+ * + * .google.cloud.retail.v2.Rule.DoNotAssociateAction do_not_associate_action = 7; + */ + com.google.cloud.retail.v2.Rule.DoNotAssociateActionOrBuilder getDoNotAssociateActionOrBuilder(); + + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return Whether the replacementAction field is set. + */ + boolean hasReplacementAction(); + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + * + * @return The replacementAction. + */ + com.google.cloud.retail.v2.Rule.ReplacementAction getReplacementAction(); + /** + * + * + *
+   * Replaces specific terms in the query.
+   * 
+ * + * .google.cloud.retail.v2.Rule.ReplacementAction replacement_action = 8; + */ + com.google.cloud.retail.v2.Rule.ReplacementActionOrBuilder getReplacementActionOrBuilder(); + + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return Whether the ignoreAction field is set. + */ + boolean hasIgnoreAction(); + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + * + * @return The ignoreAction. + */ + com.google.cloud.retail.v2.Rule.IgnoreAction getIgnoreAction(); + /** + * + * + *
+   * Ignores specific terms from query during search.
+   * 
+ * + * .google.cloud.retail.v2.Rule.IgnoreAction ignore_action = 9; + */ + com.google.cloud.retail.v2.Rule.IgnoreActionOrBuilder getIgnoreActionOrBuilder(); + + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return Whether the filterAction field is set. + */ + boolean hasFilterAction(); + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + * + * @return The filterAction. + */ + com.google.cloud.retail.v2.Rule.FilterAction getFilterAction(); + /** + * + * + *
+   * Filters results.
+   * 
+ * + * .google.cloud.retail.v2.Rule.FilterAction filter_action = 10; + */ + com.google.cloud.retail.v2.Rule.FilterActionOrBuilder getFilterActionOrBuilder(); + + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return Whether the twowaySynonymsAction field is set. + */ + boolean hasTwowaySynonymsAction(); + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + * + * @return The twowaySynonymsAction. + */ + com.google.cloud.retail.v2.Rule.TwowaySynonymsAction getTwowaySynonymsAction(); + /** + * + * + *
+   * Treats a set of terms as synonyms of one another.
+   * 
+ * + * .google.cloud.retail.v2.Rule.TwowaySynonymsAction twoway_synonyms_action = 11; + */ + com.google.cloud.retail.v2.Rule.TwowaySynonymsActionOrBuilder getTwowaySynonymsActionOrBuilder(); + + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the condition field is set. + */ + boolean hasCondition(); + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The condition. + */ + com.google.cloud.retail.v2.Condition getCondition(); + /** + * + * + *
+   * Required. The condition that triggers the rule.
+   * If the condition is empty, the rule will always apply.
+   * 
+ * + * + * .google.cloud.retail.v2.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ConditionOrBuilder getConditionOrBuilder(); + + public com.google.cloud.retail.v2.Rule.ActionCase getActionCase(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequest.java index 62baac333b36..91558b483c98 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequest.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequest.java @@ -10489,7 +10489,8 @@ public enum Mode implements com.google.protobuf.ProtocolMessageEnum { * * *
-       * Let CRS decide whether to use personalization.
+       * Let CRS decide whether to use personalization based on quality of user
+       * event data.
        * 
* * AUTO = 1; @@ -10523,7 +10524,8 @@ public enum Mode implements com.google.protobuf.ProtocolMessageEnum { * * *
-       * Let CRS decide whether to use personalization.
+       * Let CRS decide whether to use personalization based on quality of user
+       * event data.
        * 
* * AUTO = 1; @@ -12648,7 +12650,7 @@ public com.google.cloud.retail.v2.SearchRequest.FacetSpecOrBuilder getFacetSpecs * * * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return Whether the dynamicFacetSpec field is set. */ @java.lang.Override @@ -12671,7 +12673,7 @@ public boolean hasDynamicFacetSpec() { * * * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return The dynamicFacetSpec. */ @java.lang.Override @@ -12710,7 +12712,9 @@ public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec getDynamicFacet *
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -12731,7 +12735,9 @@ public boolean hasBoostSpec() {
    * 
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -12754,7 +12760,9 @@ public com.google.cloud.retail.v2.SearchRequest.BoostSpec getBoostSpec() {
    * 
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -13291,6 +13299,14 @@ public com.google.cloud.retail.v2.SearchRequest.SearchMode getSearchMode() {
    *
    * 
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -13307,6 +13323,14 @@ public boolean hasPersonalizationSpec() { * *
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -13325,6 +13349,14 @@ public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec getPersonali * *
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -16169,7 +16201,7 @@ public com.google.cloud.retail.v2.SearchRequest.FacetSpec.Builder addFacetSpecsB * * * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return Whether the dynamicFacetSpec field is set. */ @java.lang.Deprecated @@ -16191,7 +16223,7 @@ public boolean hasDynamicFacetSpec() { *
* * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return The dynamicFacetSpec. */ @java.lang.Deprecated @@ -16408,7 +16440,9 @@ public Builder clearDynamicFacetSpec() { *
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16428,7 +16462,9 @@ public boolean hasBoostSpec() {
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16454,7 +16490,9 @@ public com.google.cloud.retail.v2.SearchRequest.BoostSpec getBoostSpec() {
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16482,7 +16520,9 @@ public Builder setBoostSpec(com.google.cloud.retail.v2.SearchRequest.BoostSpec v
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16508,7 +16548,9 @@ public Builder setBoostSpec(
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16540,7 +16582,9 @@ public Builder mergeBoostSpec(com.google.cloud.retail.v2.SearchRequest.BoostSpec
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16566,7 +16610,9 @@ public Builder clearBoostSpec() {
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16586,7 +16632,9 @@ public com.google.cloud.retail.v2.SearchRequest.BoostSpec.Builder getBoostSpecBu
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -16610,7 +16658,9 @@ public com.google.cloud.retail.v2.SearchRequest.BoostSpecOrBuilder getBoostSpecO
      * 
      * Boost specification to boost certain products. See more details at this
      * [user guide](https://cloud.google.com/retail/docs/boosting).
-     * Notice that if both [ServingConfig.boost_control_ids][] and
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
      * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
      * are set, the boost conditions from both places are evaluated. If a search
      * request matches multiple boost conditions, the final boost score is equal
@@ -17965,6 +18015,14 @@ public Builder clearSearchMode() {
      *
      * 
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -17980,6 +18038,14 @@ public boolean hasPersonalizationSpec() { * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18001,6 +18067,14 @@ public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec getPersonali * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18025,6 +18099,14 @@ public Builder setPersonalizationSpec( * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18046,6 +18128,14 @@ public Builder setPersonalizationSpec( * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18075,6 +18165,14 @@ public Builder mergePersonalizationSpec( * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18096,6 +18194,14 @@ public Builder clearPersonalizationSpec() { * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18112,6 +18218,14 @@ public Builder clearPersonalizationSpec() { * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -18132,6 +18246,14 @@ public Builder clearPersonalizationSpec() { * *
      * The specification for personalization.
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
      * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequestOrBuilder.java index 0153a2d8ae30..2ec7c8c50faa 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequestOrBuilder.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchRequestOrBuilder.java @@ -459,7 +459,7 @@ public interface SearchRequestOrBuilder * * * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return Whether the dynamicFacetSpec field is set. */ @java.lang.Deprecated @@ -479,7 +479,7 @@ public interface SearchRequestOrBuilder *
* * @deprecated google.cloud.retail.v2.SearchRequest.dynamic_facet_spec is deprecated. See - * google/cloud/retail/v2/search_service.proto;l=575 + * google/cloud/retail/v2/search_service.proto;l=576 * @return The dynamicFacetSpec. */ @java.lang.Deprecated @@ -507,7 +507,9 @@ public interface SearchRequestOrBuilder *
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -525,7 +527,9 @@ public interface SearchRequestOrBuilder
    * 
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -543,7 +547,9 @@ public interface SearchRequestOrBuilder
    * 
    * Boost specification to boost certain products. See more details at this
    * [user guide](https://cloud.google.com/retail/docs/boosting).
-   * Notice that if both [ServingConfig.boost_control_ids][] and
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
    * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
    * are set, the boost conditions from both places are evaluated. If a search
    * request matches multiple boost conditions, the final boost score is equal
@@ -1029,6 +1035,14 @@ public interface SearchRequestOrBuilder
    *
    * 
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -1042,6 +1056,14 @@ public interface SearchRequestOrBuilder * *
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; @@ -1055,6 +1077,14 @@ public interface SearchRequestOrBuilder * *
    * The specification for personalization.
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
    * 
* * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 32; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchResponse.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchResponse.java index 8d2108ce041f..6dc61cd67fd5 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchResponse.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchResponse.java @@ -642,6 +642,93 @@ com.google.protobuf.Value getVariantRollupValuesOrDefault( * map<string, .google.protobuf.Value> variant_rollup_values = 5; */ com.google.protobuf.Value getVariantRollupValuesOrThrow(java.lang.String key); + + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @return A list containing the personalLabels. + */ + java.util.List getPersonalLabelsList(); + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @return The count of personalLabels. + */ + int getPersonalLabelsCount(); + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the element to return. + * @return The personalLabels at the given index. + */ + java.lang.String getPersonalLabels(int index); + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the value to return. + * @return The bytes of the personalLabels at the given index. + */ + com.google.protobuf.ByteString getPersonalLabelsBytes(int index); } /** * @@ -664,6 +751,7 @@ private SearchResult(com.google.protobuf.GeneratedMessageV3.Builder builder) private SearchResult() { id_ = ""; + personalLabels_ = com.google.protobuf.LazyStringArrayList.EMPTY; } @java.lang.Override @@ -760,6 +848,16 @@ private SearchResult( .put(variantRollupValues__.getKey(), variantRollupValues__.getValue()); break; } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + personalLabels_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + personalLabels_.add(s); + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -776,6 +874,9 @@ private SearchResult( } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { + if (((mutable_bitField0_ & 0x00000004) != 0)) { + personalLabels_ = personalLabels_.getUnmodifiableView(); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -1317,6 +1418,103 @@ public com.google.protobuf.Value getVariantRollupValuesOrThrow(java.lang.String return map.get(key); } + public static final int PERSONAL_LABELS_FIELD_NUMBER = 7; + private com.google.protobuf.LazyStringList personalLabels_; + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @return A list containing the personalLabels. + */ + public com.google.protobuf.ProtocolStringList getPersonalLabelsList() { + return personalLabels_; + } + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @return The count of personalLabels. + */ + public int getPersonalLabelsCount() { + return personalLabels_.size(); + } + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the element to return. + * @return The personalLabels at the given index. + */ + public java.lang.String getPersonalLabels(int index) { + return personalLabels_.get(index); + } + /** + * + * + *
+     * Specifies previous events related to this product for this user based on
+     * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+     * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+     * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+     * This is set only when
+     * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+     * is
+     * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+     * Possible values:
+     * * `purchased`: Indicates that this product has been purchased before.
+     * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the value to return. + * @return The bytes of the personalLabels at the given index. + */ + public com.google.protobuf.ByteString getPersonalLabelsBytes(int index) { + return personalLabels_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -1350,6 +1548,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io internalGetVariantRollupValues(), VariantRollupValuesDefaultEntryHolder.defaultEntry, 5); + for (int i = 0; i < personalLabels_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, personalLabels_.getRaw(i)); + } unknownFields.writeTo(output); } @@ -1391,6 +1592,14 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, variantRollupValues__); } + { + int dataSize = 0; + for (int i = 0; i < personalLabels_.size(); i++) { + dataSize += computeStringSizeNoTag(personalLabels_.getRaw(i)); + } + size += dataSize; + size += 1 * getPersonalLabelsList().size(); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1417,6 +1626,7 @@ public boolean equals(final java.lang.Object obj) { return false; if (!internalGetVariantRollupValues().equals(other.internalGetVariantRollupValues())) return false; + if (!getPersonalLabelsList().equals(other.getPersonalLabelsList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1444,6 +1654,10 @@ public int hashCode() { hash = (37 * hash) + VARIANT_ROLLUP_VALUES_FIELD_NUMBER; hash = (53 * hash) + internalGetVariantRollupValues().hashCode(); } + if (getPersonalLabelsCount() > 0) { + hash = (37 * hash) + PERSONAL_LABELS_FIELD_NUMBER; + hash = (53 * hash) + getPersonalLabelsList().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1628,6 +1842,8 @@ public Builder clear() { internalGetMutableMatchingVariantFields().clear(); internalGetMutableVariantRollupValues().clear(); + personalLabels_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -1667,6 +1883,11 @@ public com.google.cloud.retail.v2.SearchResponse.SearchResult buildPartial() { result.matchingVariantFields_.makeImmutable(); result.variantRollupValues_ = internalGetVariantRollupValues(); result.variantRollupValues_.makeImmutable(); + if (((bitField0_ & 0x00000004) != 0)) { + personalLabels_ = personalLabels_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.personalLabels_ = personalLabels_; onBuilt(); return result; } @@ -1732,6 +1953,16 @@ public Builder mergeFrom(com.google.cloud.retail.v2.SearchResponse.SearchResult internalGetMutableMatchingVariantFields() .mergeFrom(other.internalGetMatchingVariantFields()); internalGetMutableVariantRollupValues().mergeFrom(other.internalGetVariantRollupValues()); + if (!other.personalLabels_.isEmpty()) { + if (personalLabels_.isEmpty()) { + personalLabels_ = other.personalLabels_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensurePersonalLabelsIsMutable(); + personalLabels_.addAll(other.personalLabels_); + } + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -2807,6 +3038,255 @@ public Builder putAllVariantRollupValues( return this; } + private com.google.protobuf.LazyStringList personalLabels_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensurePersonalLabelsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + personalLabels_ = new com.google.protobuf.LazyStringArrayList(personalLabels_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @return A list containing the personalLabels. + */ + public com.google.protobuf.ProtocolStringList getPersonalLabelsList() { + return personalLabels_.getUnmodifiableView(); + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @return The count of personalLabels. + */ + public int getPersonalLabelsCount() { + return personalLabels_.size(); + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the element to return. + * @return The personalLabels at the given index. + */ + public java.lang.String getPersonalLabels(int index) { + return personalLabels_.get(index); + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index of the value to return. + * @return The bytes of the personalLabels at the given index. + */ + public com.google.protobuf.ByteString getPersonalLabelsBytes(int index) { + return personalLabels_.getByteString(index); + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param index The index to set the value at. + * @param value The personalLabels to set. + * @return This builder for chaining. + */ + public Builder setPersonalLabels(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePersonalLabelsIsMutable(); + personalLabels_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param value The personalLabels to add. + * @return This builder for chaining. + */ + public Builder addPersonalLabels(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePersonalLabelsIsMutable(); + personalLabels_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param values The personalLabels to add. + * @return This builder for chaining. + */ + public Builder addAllPersonalLabels(java.lang.Iterable values) { + ensurePersonalLabelsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, personalLabels_); + onChanged(); + return this; + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @return This builder for chaining. + */ + public Builder clearPersonalLabels() { + personalLabels_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+       * Specifies previous events related to this product for this user based on
+       * [UserEvent][google.cloud.retail.v2.UserEvent] with same
+       * [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
+       * or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
+       * This is set only when
+       * [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
+       * is
+       * [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
+       * Possible values:
+       * * `purchased`: Indicates that this product has been purchased before.
+       * 
+ * + * repeated string personal_labels = 7; + * + * @param value The bytes of the personalLabels to add. + * @return This builder for chaining. + */ + public Builder addPersonalLabelsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensurePersonalLabelsIsMutable(); + personalLabels_.add(value); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchServiceProto.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchServiceProto.java index 3666429385ff..a826bb19c53d 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchServiceProto.java +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/SearchServiceProto.java @@ -174,7 +174,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\t:\0028\001\"[\n\nSearchMode\022\033\n\027SEARCH_MODE_UNSPE" + "CIFIED\020\000\022\027\n\023PRODUCT_SEARCH_ONLY\020\001\022\027\n\023FAC" + "ETED_SEARCH_ONLY\020\002B\030\n\026_spell_correction_" - + "spec\"\300\n\n\016SearchResponse\022D\n\007results\030\001 \003(\013" + + "spec\"\331\n\n\016SearchResponse\022D\n\007results\030\001 \003(\013" + "23.google.cloud.retail.v2.SearchResponse" + ".SearchResult\022<\n\006facets\030\002 \003(\0132,.google.c" + "loud.retail.v2.SearchResponse.Facet\022\022\n\nt" @@ -186,7 +186,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\001(\t\022\030\n\020applied_controls\030\014 \003(\t\022i\n\035invalid" + "_condition_boost_specs\030\016 \003(\0132B.google.cl" + "oud.retail.v2.SearchRequest.BoostSpec.Co" - + "nditionBoostSpec\032\370\003\n\014SearchResult\022\n\n\002id\030" + + "nditionBoostSpec\032\221\004\n\014SearchResult\022\n\n\002id\030" + "\001 \001(\t\0220\n\007product\030\002 \001(\0132\037.google.cloud.re" + "tail.v2.Product\022\036\n\026matching_variant_coun" + "t\030\003 \001(\005\022o\n\027matching_variant_fields\030\004 \003(\013" @@ -194,34 +194,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".SearchResult.MatchingVariantFieldsEntry" + "\022k\n\025variant_rollup_values\030\005 \003(\0132L.google" + ".cloud.retail.v2.SearchResponse.SearchRe" - + "sult.VariantRollupValuesEntry\032X\n\032Matchin" - + "gVariantFieldsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005valu" - + "e\030\002 \001(\0132\032.google.protobuf.FieldMask:\0028\001\032" - + "R\n\030VariantRollupValuesEntry\022\013\n\003key\030\001 \001(\t" - + "\022%\n\005value\030\002 \001(\0132\026.google.protobuf.Value:" - + "\0028\001\032\216\002\n\005Facet\022\013\n\003key\030\001 \001(\t\022G\n\006values\030\002 \003" - + "(\01327.google.cloud.retail.v2.SearchRespon" - + "se.Facet.FacetValue\022\025\n\rdynamic_facet\030\003 \001" - + "(\010\032\227\001\n\nFacetValue\022\017\n\005value\030\001 \001(\tH\000\0224\n\010in" - + "terval\030\002 \001(\0132 .google.cloud.retail.v2.In" - + "tervalH\000\022\r\n\005count\030\003 \001(\003\022\021\n\tmin_value\030\005 \001" - + "(\001\022\021\n\tmax_value\030\006 \001(\001B\r\n\013facet_value\032I\n\022" - + "QueryExpansionInfo\022\026\n\016expanded_query\030\001 \001" - + "(\010\022\033\n\023pinned_result_count\030\002 \001(\0032\330\002\n\rSear" - + "chService\022\373\001\n\006Search\022%.google.cloud.reta" - + "il.v2.SearchRequest\032&.google.cloud.retai" - + "l.v2.SearchResponse\"\241\001\202\323\344\223\002\232\001\"E/v2/{plac" - + "ement=projects/*/locations/*/catalogs/*/" - + "placements/*}:search:\001*ZN\"I/v2/{placemen" - + "t=projects/*/locations/*/catalogs/*/serv" - + "ingConfigs/*}:search:\001*\032I\312A\025retail.googl" - + "eapis.com\322A.https://www.googleapis.com/a" - + "uth/cloud-platformB\307\001\n\032com.google.cloud." - + "retail.v2B\022SearchServiceProtoP\001Z + * The use case of Cloud Retail Search. + *
+ * + * Protobuf enum {@code google.cloud.retail.v2.SearchSolutionUseCase} + */ +public enum SearchSolutionUseCase implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * The value when it's unspecified. In this case, server behavior defaults to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + */ + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED(0), + /** + * + * + *
+   * Search use case. Expects the traffic has a non-empty
+   * [query][google.cloud.retail.v2.SearchRequest.query].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + */ + SEARCH_SOLUTION_USE_CASE_SEARCH(1), + /** + * + * + *
+   * Browse use case. Expects the traffic has an empty
+   * [query][google.cloud.retail.v2.SearchRequest.query].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_BROWSE = 2; + */ + SEARCH_SOLUTION_USE_CASE_BROWSE(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * The value when it's unspecified. In this case, server behavior defaults to
+   * [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + */ + public static final int SEARCH_SOLUTION_USE_CASE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * Search use case. Expects the traffic has a non-empty
+   * [query][google.cloud.retail.v2.SearchRequest.query].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + */ + public static final int SEARCH_SOLUTION_USE_CASE_SEARCH_VALUE = 1; + /** + * + * + *
+   * Browse use case. Expects the traffic has an empty
+   * [query][google.cloud.retail.v2.SearchRequest.query].
+   * 
+ * + * SEARCH_SOLUTION_USE_CASE_BROWSE = 2; + */ + public static final int SEARCH_SOLUTION_USE_CASE_BROWSE_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SearchSolutionUseCase valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static SearchSolutionUseCase forNumber(int value) { + switch (value) { + case 0: + return SEARCH_SOLUTION_USE_CASE_UNSPECIFIED; + case 1: + return SEARCH_SOLUTION_USE_CASE_SEARCH; + case 2: + return SEARCH_SOLUTION_USE_CASE_BROWSE; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SearchSolutionUseCase findValueByNumber(int number) { + return SearchSolutionUseCase.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto.getDescriptor().getEnumTypes().get(2); + } + + private static final SearchSolutionUseCase[] VALUES = values(); + + public static SearchSolutionUseCase valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private SearchSolutionUseCase(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.SearchSolutionUseCase) +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfig.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfig.java new file mode 100644 index 000000000000..8b052b6c3441 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfig.java @@ -0,0 +1,6410 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Configures metadata that is used to generate serving time results (e.g.
+ * search results or recommendation predictions).
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ServingConfig} + */ +public final class ServingConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.ServingConfig) + ServingConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ServingConfig.newBuilder() to construct. + private ServingConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ServingConfig() { + name_ = ""; + displayName_ = ""; + modelId_ = ""; + priceRerankingLevel_ = ""; + facetControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + boostControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + filterControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + redirectControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + twowaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + onewaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + doNotAssociateControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + replacementControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + ignoreControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + diversityLevel_ = ""; + enableCategoryFilterLevel_ = ""; + solutionTypes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ServingConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ServingConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + modelId_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + priceRerankingLevel_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + facetControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + facetControlIds_.add(s); + break; + } + case 50: + { + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder subBuilder = null; + if (dynamicFacetSpec_ != null) { + subBuilder = dynamicFacetSpec_.toBuilder(); + } + dynamicFacetSpec_ = + input.readMessage( + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(dynamicFacetSpec_); + dynamicFacetSpec_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + boostControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + boostControlIds_.add(s); + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + diversityLevel_ = s; + break; + } + case 74: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + filterControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + filterControlIds_.add(s); + break; + } + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + redirectControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + redirectControlIds_.add(s); + break; + } + case 98: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000020) != 0)) { + onewaySynonymsControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000020; + } + onewaySynonymsControlIds_.add(s); + break; + } + case 106: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000040) != 0)) { + doNotAssociateControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000040; + } + doNotAssociateControlIds_.add(s); + break; + } + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000080) != 0)) { + replacementControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000080; + } + replacementControlIds_.add(s); + break; + } + case 122: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000100) != 0)) { + ignoreControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000100; + } + ignoreControlIds_.add(s); + break; + } + case 130: + { + java.lang.String s = input.readStringRequireUtf8(); + + enableCategoryFilterLevel_ = s; + break; + } + case 146: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + twowaySynonymsControlIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000010; + } + twowaySynonymsControlIds_.add(s); + break; + } + case 152: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000200) != 0)) { + solutionTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000200; + } + solutionTypes_.add(rawValue); + break; + } + case 154: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000200) != 0)) { + solutionTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000200; + } + solutionTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + case 170: + { + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder subBuilder = + null; + if (personalizationSpec_ != null) { + subBuilder = personalizationSpec_.toBuilder(); + } + personalizationSpec_ = + input.readMessage( + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(personalizationSpec_); + personalizationSpec_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + facetControlIds_ = facetControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + boostControlIds_ = boostControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + filterControlIds_ = filterControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + redirectControlIds_ = redirectControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000020) != 0)) { + onewaySynonymsControlIds_ = onewaySynonymsControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000040) != 0)) { + doNotAssociateControlIds_ = doNotAssociateControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000080) != 0)) { + replacementControlIds_ = replacementControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000100) != 0)) { + ignoreControlIds_ = ignoreControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000010) != 0)) { + twowaySynonymsControlIds_ = twowaySynonymsControlIds_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000200) != 0)) { + solutionTypes_ = java.util.Collections.unmodifiableList(solutionTypes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigProto + .internal_static_google_cloud_retail_v2_ServingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigProto + .internal_static_google_cloud_retail_v2_ServingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ServingConfig.class, + com.google.cloud.retail.v2.ServingConfig.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/servingConfig/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/servingConfig/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * Required. The human readable serving config display name. Used in Retail
+   * UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The human readable serving config display name. Used in Retail
+   * UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object modelId_; + /** + * + * + *
+   * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+   * to use at serving time. Currently only RecommendationModels are supported:
+   * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+   * Can be changed but only to a compatible model (e.g.
+   * others-you-may-like CTR to others-you-may-like CVR).
+   * Required when
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string model_id = 3; + * + * @return The modelId. + */ + @java.lang.Override + public java.lang.String getModelId() { + java.lang.Object ref = modelId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + modelId_ = s; + return s; + } + } + /** + * + * + *
+   * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+   * to use at serving time. Currently only RecommendationModels are supported:
+   * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+   * Can be changed but only to a compatible model (e.g.
+   * others-you-may-like CTR to others-you-may-like CVR).
+   * Required when
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string model_id = 3; + * + * @return The bytes for modelId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getModelIdBytes() { + java.lang.Object ref = modelId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + modelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRICE_RERANKING_LEVEL_FIELD_NUMBER = 4; + private volatile java.lang.Object priceRerankingLevel_; + /** + * + * + *
+   * How much price ranking we want in serving results.
+   * Price reranking causes product items with a similar
+   * recommendation probability to be ordered by price, with the
+   * highest-priced items first. This setting could result in a decrease in
+   * click-through and conversion rates.
+   *  Allowed values are:
+   * * 'no-price-reranking'
+   * * 'low-price-raranking'
+   * * 'medium-price-reranking'
+   * * 'high-price-reranking'
+   * If not specified, we choose default based on model type. Default value:
+   * 'no-price-reranking'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string price_reranking_level = 4; + * + * @return The priceRerankingLevel. + */ + @java.lang.Override + public java.lang.String getPriceRerankingLevel() { + java.lang.Object ref = priceRerankingLevel_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + priceRerankingLevel_ = s; + return s; + } + } + /** + * + * + *
+   * How much price ranking we want in serving results.
+   * Price reranking causes product items with a similar
+   * recommendation probability to be ordered by price, with the
+   * highest-priced items first. This setting could result in a decrease in
+   * click-through and conversion rates.
+   *  Allowed values are:
+   * * 'no-price-reranking'
+   * * 'low-price-raranking'
+   * * 'medium-price-reranking'
+   * * 'high-price-reranking'
+   * If not specified, we choose default based on model type. Default value:
+   * 'no-price-reranking'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string price_reranking_level = 4; + * + * @return The bytes for priceRerankingLevel. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPriceRerankingLevelBytes() { + java.lang.Object ref = priceRerankingLevel_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + priceRerankingLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FACET_CONTROL_IDS_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList facetControlIds_; + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @return A list containing the facetControlIds. + */ + public com.google.protobuf.ProtocolStringList getFacetControlIdsList() { + return facetControlIds_; + } + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @return The count of facetControlIds. + */ + public int getFacetControlIdsCount() { + return facetControlIds_.size(); + } + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the element to return. + * @return The facetControlIds at the given index. + */ + public java.lang.String getFacetControlIds(int index) { + return facetControlIds_.get(index); + } + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the value to return. + * @return The bytes of the facetControlIds at the given index. + */ + public com.google.protobuf.ByteString getFacetControlIdsBytes(int index) { + return facetControlIds_.getByteString(index); + } + + public static final int DYNAMIC_FACET_SPEC_FIELD_NUMBER = 6; + private com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamicFacetSpec_; + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return Whether the dynamicFacetSpec field is set. + */ + @java.lang.Override + public boolean hasDynamicFacetSpec() { + return dynamicFacetSpec_ != null; + } + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return The dynamicFacetSpec. + */ + @java.lang.Override + public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec getDynamicFacetSpec() { + return dynamicFacetSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.getDefaultInstance() + : dynamicFacetSpec_; + } + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + @java.lang.Override + public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder + getDynamicFacetSpecOrBuilder() { + return getDynamicFacetSpec(); + } + + public static final int BOOST_CONTROL_IDS_FIELD_NUMBER = 7; + private com.google.protobuf.LazyStringList boostControlIds_; + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @return A list containing the boostControlIds. + */ + public com.google.protobuf.ProtocolStringList getBoostControlIdsList() { + return boostControlIds_; + } + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @return The count of boostControlIds. + */ + public int getBoostControlIdsCount() { + return boostControlIds_.size(); + } + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the element to return. + * @return The boostControlIds at the given index. + */ + public java.lang.String getBoostControlIds(int index) { + return boostControlIds_.get(index); + } + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the value to return. + * @return The bytes of the boostControlIds at the given index. + */ + public com.google.protobuf.ByteString getBoostControlIdsBytes(int index) { + return boostControlIds_.getByteString(index); + } + + public static final int FILTER_CONTROL_IDS_FIELD_NUMBER = 9; + private com.google.protobuf.LazyStringList filterControlIds_; + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @return A list containing the filterControlIds. + */ + public com.google.protobuf.ProtocolStringList getFilterControlIdsList() { + return filterControlIds_; + } + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @return The count of filterControlIds. + */ + public int getFilterControlIdsCount() { + return filterControlIds_.size(); + } + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the element to return. + * @return The filterControlIds at the given index. + */ + public java.lang.String getFilterControlIds(int index) { + return filterControlIds_.get(index); + } + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the value to return. + * @return The bytes of the filterControlIds at the given index. + */ + public com.google.protobuf.ByteString getFilterControlIdsBytes(int index) { + return filterControlIds_.getByteString(index); + } + + public static final int REDIRECT_CONTROL_IDS_FIELD_NUMBER = 10; + private com.google.protobuf.LazyStringList redirectControlIds_; + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return A list containing the redirectControlIds. + */ + public com.google.protobuf.ProtocolStringList getRedirectControlIdsList() { + return redirectControlIds_; + } + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return The count of redirectControlIds. + */ + public int getRedirectControlIdsCount() { + return redirectControlIds_.size(); + } + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the element to return. + * @return The redirectControlIds at the given index. + */ + public java.lang.String getRedirectControlIds(int index) { + return redirectControlIds_.get(index); + } + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the value to return. + * @return The bytes of the redirectControlIds at the given index. + */ + public com.google.protobuf.ByteString getRedirectControlIdsBytes(int index) { + return redirectControlIds_.getByteString(index); + } + + public static final int TWOWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER = 18; + private com.google.protobuf.LazyStringList twowaySynonymsControlIds_; + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return A list containing the twowaySynonymsControlIds. + */ + public com.google.protobuf.ProtocolStringList getTwowaySynonymsControlIdsList() { + return twowaySynonymsControlIds_; + } + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return The count of twowaySynonymsControlIds. + */ + public int getTwowaySynonymsControlIdsCount() { + return twowaySynonymsControlIds_.size(); + } + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the element to return. + * @return The twowaySynonymsControlIds at the given index. + */ + public java.lang.String getTwowaySynonymsControlIds(int index) { + return twowaySynonymsControlIds_.get(index); + } + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the value to return. + * @return The bytes of the twowaySynonymsControlIds at the given index. + */ + public com.google.protobuf.ByteString getTwowaySynonymsControlIdsBytes(int index) { + return twowaySynonymsControlIds_.getByteString(index); + } + + public static final int ONEWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER = 12; + private com.google.protobuf.LazyStringList onewaySynonymsControlIds_; + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return A list containing the onewaySynonymsControlIds. + */ + public com.google.protobuf.ProtocolStringList getOnewaySynonymsControlIdsList() { + return onewaySynonymsControlIds_; + } + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return The count of onewaySynonymsControlIds. + */ + public int getOnewaySynonymsControlIdsCount() { + return onewaySynonymsControlIds_.size(); + } + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the element to return. + * @return The onewaySynonymsControlIds at the given index. + */ + public java.lang.String getOnewaySynonymsControlIds(int index) { + return onewaySynonymsControlIds_.get(index); + } + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the value to return. + * @return The bytes of the onewaySynonymsControlIds at the given index. + */ + public com.google.protobuf.ByteString getOnewaySynonymsControlIdsBytes(int index) { + return onewaySynonymsControlIds_.getByteString(index); + } + + public static final int DO_NOT_ASSOCIATE_CONTROL_IDS_FIELD_NUMBER = 13; + private com.google.protobuf.LazyStringList doNotAssociateControlIds_; + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return A list containing the doNotAssociateControlIds. + */ + public com.google.protobuf.ProtocolStringList getDoNotAssociateControlIdsList() { + return doNotAssociateControlIds_; + } + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return The count of doNotAssociateControlIds. + */ + public int getDoNotAssociateControlIdsCount() { + return doNotAssociateControlIds_.size(); + } + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the element to return. + * @return The doNotAssociateControlIds at the given index. + */ + public java.lang.String getDoNotAssociateControlIds(int index) { + return doNotAssociateControlIds_.get(index); + } + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateControlIds at the given index. + */ + public com.google.protobuf.ByteString getDoNotAssociateControlIdsBytes(int index) { + return doNotAssociateControlIds_.getByteString(index); + } + + public static final int REPLACEMENT_CONTROL_IDS_FIELD_NUMBER = 14; + private com.google.protobuf.LazyStringList replacementControlIds_; + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return A list containing the replacementControlIds. + */ + public com.google.protobuf.ProtocolStringList getReplacementControlIdsList() { + return replacementControlIds_; + } + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return The count of replacementControlIds. + */ + public int getReplacementControlIdsCount() { + return replacementControlIds_.size(); + } + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the element to return. + * @return The replacementControlIds at the given index. + */ + public java.lang.String getReplacementControlIds(int index) { + return replacementControlIds_.get(index); + } + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the value to return. + * @return The bytes of the replacementControlIds at the given index. + */ + public com.google.protobuf.ByteString getReplacementControlIdsBytes(int index) { + return replacementControlIds_.getByteString(index); + } + + public static final int IGNORE_CONTROL_IDS_FIELD_NUMBER = 15; + private com.google.protobuf.LazyStringList ignoreControlIds_; + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return A list containing the ignoreControlIds. + */ + public com.google.protobuf.ProtocolStringList getIgnoreControlIdsList() { + return ignoreControlIds_; + } + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return The count of ignoreControlIds. + */ + public int getIgnoreControlIdsCount() { + return ignoreControlIds_.size(); + } + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the element to return. + * @return The ignoreControlIds at the given index. + */ + public java.lang.String getIgnoreControlIds(int index) { + return ignoreControlIds_.get(index); + } + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreControlIds at the given index. + */ + public com.google.protobuf.ByteString getIgnoreControlIdsBytes(int index) { + return ignoreControlIds_.getByteString(index); + } + + public static final int DIVERSITY_LEVEL_FIELD_NUMBER = 8; + private volatile java.lang.Object diversityLevel_; + /** + * + * + *
+   * How much diversity to use in recommendation model results e.g.
+   * 'medium-diversity' or 'high-diversity'. Currently supported values:
+   * * 'no-diversity'
+   * * 'low-diversity'
+   * * 'medium-diversity'
+   * * 'high-diversity'
+   * * 'auto-diversity'
+   * If not specified, we choose default based on recommendation model
+   * type. Default value: 'no-diversity'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string diversity_level = 8; + * + * @return The diversityLevel. + */ + @java.lang.Override + public java.lang.String getDiversityLevel() { + java.lang.Object ref = diversityLevel_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + diversityLevel_ = s; + return s; + } + } + /** + * + * + *
+   * How much diversity to use in recommendation model results e.g.
+   * 'medium-diversity' or 'high-diversity'. Currently supported values:
+   * * 'no-diversity'
+   * * 'low-diversity'
+   * * 'medium-diversity'
+   * * 'high-diversity'
+   * * 'auto-diversity'
+   * If not specified, we choose default based on recommendation model
+   * type. Default value: 'no-diversity'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string diversity_level = 8; + * + * @return The bytes for diversityLevel. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDiversityLevelBytes() { + java.lang.Object ref = diversityLevel_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + diversityLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ENABLE_CATEGORY_FILTER_LEVEL_FIELD_NUMBER = 16; + private volatile java.lang.Object enableCategoryFilterLevel_; + /** + * + * + *
+   * Whether to add additional category filters on the 'similar-items' model.
+   * If not specified, we enable it by default.
+   *  Allowed values are:
+   * * 'no-category-match': No additional filtering of original results from
+   *   the model and the customer's filters.
+   * * 'relaxed-category-match': Only keep results with categories that match
+   *   at least one item categories in the PredictRequests's context item.
+   *   * If customer also sends filters in the PredictRequest, then the results
+   *   will satisfy both conditions (user given and category match).
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string enable_category_filter_level = 16; + * + * @return The enableCategoryFilterLevel. + */ + @java.lang.Override + public java.lang.String getEnableCategoryFilterLevel() { + java.lang.Object ref = enableCategoryFilterLevel_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + enableCategoryFilterLevel_ = s; + return s; + } + } + /** + * + * + *
+   * Whether to add additional category filters on the 'similar-items' model.
+   * If not specified, we enable it by default.
+   *  Allowed values are:
+   * * 'no-category-match': No additional filtering of original results from
+   *   the model and the customer's filters.
+   * * 'relaxed-category-match': Only keep results with categories that match
+   *   at least one item categories in the PredictRequests's context item.
+   *   * If customer also sends filters in the PredictRequest, then the results
+   *   will satisfy both conditions (user given and category match).
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string enable_category_filter_level = 16; + * + * @return The bytes for enableCategoryFilterLevel. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEnableCategoryFilterLevelBytes() { + java.lang.Object ref = enableCategoryFilterLevel_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + enableCategoryFilterLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PERSONALIZATION_SPEC_FIELD_NUMBER = 21; + private com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalizationSpec_; + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return Whether the personalizationSpec field is set. + */ + @java.lang.Override + public boolean hasPersonalizationSpec() { + return personalizationSpec_ != null; + } + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return The personalizationSpec. + */ + @java.lang.Override + public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec getPersonalizationSpec() { + return personalizationSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.getDefaultInstance() + : personalizationSpec_; + } + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder + getPersonalizationSpecOrBuilder() { + return getPersonalizationSpec(); + } + + public static final int SOLUTION_TYPES_FIELD_NUMBER = 19; + private java.util.List solutionTypes_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType> + solutionTypes_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>() { + public com.google.cloud.retail.v2.SolutionType convert(java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.cloud.retail.v2.SolutionType result = + com.google.cloud.retail.v2.SolutionType.valueOf(from); + return result == null ? com.google.cloud.retail.v2.SolutionType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + @java.lang.Override + public java.util.List getSolutionTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>( + solutionTypes_, solutionTypes_converter_); + } + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + @java.lang.Override + public int getSolutionTypesCount() { + return solutionTypes_.size(); + } + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + @java.lang.Override + public com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index) { + return solutionTypes_converter_.convert(solutionTypes_.get(index)); + } + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + @java.lang.Override + public java.util.List getSolutionTypesValueList() { + return solutionTypes_; + } + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + @java.lang.Override + public int getSolutionTypesValue(int index) { + return solutionTypes_.get(index); + } + + private int solutionTypesMemoizedSerializedSize; + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, modelId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(priceRerankingLevel_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, priceRerankingLevel_); + } + for (int i = 0; i < facetControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, facetControlIds_.getRaw(i)); + } + if (dynamicFacetSpec_ != null) { + output.writeMessage(6, getDynamicFacetSpec()); + } + for (int i = 0; i < boostControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, boostControlIds_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(diversityLevel_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, diversityLevel_); + } + for (int i = 0; i < filterControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 9, filterControlIds_.getRaw(i)); + } + for (int i = 0; i < redirectControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, redirectControlIds_.getRaw(i)); + } + for (int i = 0; i < onewaySynonymsControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 12, onewaySynonymsControlIds_.getRaw(i)); + } + for (int i = 0; i < doNotAssociateControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 13, doNotAssociateControlIds_.getRaw(i)); + } + for (int i = 0; i < replacementControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 14, replacementControlIds_.getRaw(i)); + } + for (int i = 0; i < ignoreControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 15, ignoreControlIds_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(enableCategoryFilterLevel_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 16, enableCategoryFilterLevel_); + } + for (int i = 0; i < twowaySynonymsControlIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 18, twowaySynonymsControlIds_.getRaw(i)); + } + if (getSolutionTypesList().size() > 0) { + output.writeUInt32NoTag(154); + output.writeUInt32NoTag(solutionTypesMemoizedSerializedSize); + } + for (int i = 0; i < solutionTypes_.size(); i++) { + output.writeEnumNoTag(solutionTypes_.get(i)); + } + if (personalizationSpec_ != null) { + output.writeMessage(21, getPersonalizationSpec()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, modelId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(priceRerankingLevel_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, priceRerankingLevel_); + } + { + int dataSize = 0; + for (int i = 0; i < facetControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(facetControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getFacetControlIdsList().size(); + } + if (dynamicFacetSpec_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getDynamicFacetSpec()); + } + { + int dataSize = 0; + for (int i = 0; i < boostControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(boostControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getBoostControlIdsList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(diversityLevel_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, diversityLevel_); + } + { + int dataSize = 0; + for (int i = 0; i < filterControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(filterControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getFilterControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < redirectControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(redirectControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getRedirectControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < onewaySynonymsControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(onewaySynonymsControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getOnewaySynonymsControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < doNotAssociateControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(doNotAssociateControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getDoNotAssociateControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < replacementControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(replacementControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getReplacementControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < ignoreControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(ignoreControlIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getIgnoreControlIdsList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(enableCategoryFilterLevel_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize(16, enableCategoryFilterLevel_); + } + { + int dataSize = 0; + for (int i = 0; i < twowaySynonymsControlIds_.size(); i++) { + dataSize += computeStringSizeNoTag(twowaySynonymsControlIds_.getRaw(i)); + } + size += dataSize; + size += 2 * getTwowaySynonymsControlIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < solutionTypes_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(solutionTypes_.get(i)); + } + size += dataSize; + if (!getSolutionTypesList().isEmpty()) { + size += 2; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + solutionTypesMemoizedSerializedSize = dataSize; + } + if (personalizationSpec_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(21, getPersonalizationSpec()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.ServingConfig)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.ServingConfig other = (com.google.cloud.retail.v2.ServingConfig) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getModelId().equals(other.getModelId())) return false; + if (!getPriceRerankingLevel().equals(other.getPriceRerankingLevel())) return false; + if (!getFacetControlIdsList().equals(other.getFacetControlIdsList())) return false; + if (hasDynamicFacetSpec() != other.hasDynamicFacetSpec()) return false; + if (hasDynamicFacetSpec()) { + if (!getDynamicFacetSpec().equals(other.getDynamicFacetSpec())) return false; + } + if (!getBoostControlIdsList().equals(other.getBoostControlIdsList())) return false; + if (!getFilterControlIdsList().equals(other.getFilterControlIdsList())) return false; + if (!getRedirectControlIdsList().equals(other.getRedirectControlIdsList())) return false; + if (!getTwowaySynonymsControlIdsList().equals(other.getTwowaySynonymsControlIdsList())) + return false; + if (!getOnewaySynonymsControlIdsList().equals(other.getOnewaySynonymsControlIdsList())) + return false; + if (!getDoNotAssociateControlIdsList().equals(other.getDoNotAssociateControlIdsList())) + return false; + if (!getReplacementControlIdsList().equals(other.getReplacementControlIdsList())) return false; + if (!getIgnoreControlIdsList().equals(other.getIgnoreControlIdsList())) return false; + if (!getDiversityLevel().equals(other.getDiversityLevel())) return false; + if (!getEnableCategoryFilterLevel().equals(other.getEnableCategoryFilterLevel())) return false; + if (hasPersonalizationSpec() != other.hasPersonalizationSpec()) return false; + if (hasPersonalizationSpec()) { + if (!getPersonalizationSpec().equals(other.getPersonalizationSpec())) return false; + } + if (!solutionTypes_.equals(other.solutionTypes_)) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + MODEL_ID_FIELD_NUMBER; + hash = (53 * hash) + getModelId().hashCode(); + hash = (37 * hash) + PRICE_RERANKING_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + getPriceRerankingLevel().hashCode(); + if (getFacetControlIdsCount() > 0) { + hash = (37 * hash) + FACET_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getFacetControlIdsList().hashCode(); + } + if (hasDynamicFacetSpec()) { + hash = (37 * hash) + DYNAMIC_FACET_SPEC_FIELD_NUMBER; + hash = (53 * hash) + getDynamicFacetSpec().hashCode(); + } + if (getBoostControlIdsCount() > 0) { + hash = (37 * hash) + BOOST_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getBoostControlIdsList().hashCode(); + } + if (getFilterControlIdsCount() > 0) { + hash = (37 * hash) + FILTER_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getFilterControlIdsList().hashCode(); + } + if (getRedirectControlIdsCount() > 0) { + hash = (37 * hash) + REDIRECT_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getRedirectControlIdsList().hashCode(); + } + if (getTwowaySynonymsControlIdsCount() > 0) { + hash = (37 * hash) + TWOWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getTwowaySynonymsControlIdsList().hashCode(); + } + if (getOnewaySynonymsControlIdsCount() > 0) { + hash = (37 * hash) + ONEWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getOnewaySynonymsControlIdsList().hashCode(); + } + if (getDoNotAssociateControlIdsCount() > 0) { + hash = (37 * hash) + DO_NOT_ASSOCIATE_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getDoNotAssociateControlIdsList().hashCode(); + } + if (getReplacementControlIdsCount() > 0) { + hash = (37 * hash) + REPLACEMENT_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getReplacementControlIdsList().hashCode(); + } + if (getIgnoreControlIdsCount() > 0) { + hash = (37 * hash) + IGNORE_CONTROL_IDS_FIELD_NUMBER; + hash = (53 * hash) + getIgnoreControlIdsList().hashCode(); + } + hash = (37 * hash) + DIVERSITY_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + getDiversityLevel().hashCode(); + hash = (37 * hash) + ENABLE_CATEGORY_FILTER_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + getEnableCategoryFilterLevel().hashCode(); + if (hasPersonalizationSpec()) { + hash = (37 * hash) + PERSONALIZATION_SPEC_FIELD_NUMBER; + hash = (53 * hash) + getPersonalizationSpec().hashCode(); + } + if (getSolutionTypesCount() > 0) { + hash = (37 * hash) + SOLUTION_TYPES_FIELD_NUMBER; + hash = (53 * hash) + solutionTypes_.hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ServingConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ServingConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.ServingConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.ServingConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configures metadata that is used to generate serving time results (e.g.
+   * search results or recommendation predictions).
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.ServingConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.ServingConfig) + com.google.cloud.retail.v2.ServingConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigProto + .internal_static_google_cloud_retail_v2_ServingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigProto + .internal_static_google_cloud_retail_v2_ServingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.ServingConfig.class, + com.google.cloud.retail.v2.ServingConfig.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.ServingConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + displayName_ = ""; + + modelId_ = ""; + + priceRerankingLevel_ = ""; + + facetControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + if (dynamicFacetSpecBuilder_ == null) { + dynamicFacetSpec_ = null; + } else { + dynamicFacetSpec_ = null; + dynamicFacetSpecBuilder_ = null; + } + boostControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + filterControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + redirectControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + twowaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + onewaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + doNotAssociateControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + replacementControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000080); + ignoreControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000100); + diversityLevel_ = ""; + + enableCategoryFilterLevel_ = ""; + + if (personalizationSpecBuilder_ == null) { + personalizationSpec_ = null; + } else { + personalizationSpec_ = null; + personalizationSpecBuilder_ = null; + } + solutionTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000200); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigProto + .internal_static_google_cloud_retail_v2_ServingConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig getDefaultInstanceForType() { + return com.google.cloud.retail.v2.ServingConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig build() { + com.google.cloud.retail.v2.ServingConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig buildPartial() { + com.google.cloud.retail.v2.ServingConfig result = + new com.google.cloud.retail.v2.ServingConfig(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.displayName_ = displayName_; + result.modelId_ = modelId_; + result.priceRerankingLevel_ = priceRerankingLevel_; + if (((bitField0_ & 0x00000001) != 0)) { + facetControlIds_ = facetControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.facetControlIds_ = facetControlIds_; + if (dynamicFacetSpecBuilder_ == null) { + result.dynamicFacetSpec_ = dynamicFacetSpec_; + } else { + result.dynamicFacetSpec_ = dynamicFacetSpecBuilder_.build(); + } + if (((bitField0_ & 0x00000002) != 0)) { + boostControlIds_ = boostControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.boostControlIds_ = boostControlIds_; + if (((bitField0_ & 0x00000004) != 0)) { + filterControlIds_ = filterControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.filterControlIds_ = filterControlIds_; + if (((bitField0_ & 0x00000008) != 0)) { + redirectControlIds_ = redirectControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.redirectControlIds_ = redirectControlIds_; + if (((bitField0_ & 0x00000010) != 0)) { + twowaySynonymsControlIds_ = twowaySynonymsControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.twowaySynonymsControlIds_ = twowaySynonymsControlIds_; + if (((bitField0_ & 0x00000020) != 0)) { + onewaySynonymsControlIds_ = onewaySynonymsControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.onewaySynonymsControlIds_ = onewaySynonymsControlIds_; + if (((bitField0_ & 0x00000040) != 0)) { + doNotAssociateControlIds_ = doNotAssociateControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.doNotAssociateControlIds_ = doNotAssociateControlIds_; + if (((bitField0_ & 0x00000080) != 0)) { + replacementControlIds_ = replacementControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.replacementControlIds_ = replacementControlIds_; + if (((bitField0_ & 0x00000100) != 0)) { + ignoreControlIds_ = ignoreControlIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000100); + } + result.ignoreControlIds_ = ignoreControlIds_; + result.diversityLevel_ = diversityLevel_; + result.enableCategoryFilterLevel_ = enableCategoryFilterLevel_; + if (personalizationSpecBuilder_ == null) { + result.personalizationSpec_ = personalizationSpec_; + } else { + result.personalizationSpec_ = personalizationSpecBuilder_.build(); + } + if (((bitField0_ & 0x00000200) != 0)) { + solutionTypes_ = java.util.Collections.unmodifiableList(solutionTypes_); + bitField0_ = (bitField0_ & ~0x00000200); + } + result.solutionTypes_ = solutionTypes_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.ServingConfig) { + return mergeFrom((com.google.cloud.retail.v2.ServingConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.ServingConfig other) { + if (other == com.google.cloud.retail.v2.ServingConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getModelId().isEmpty()) { + modelId_ = other.modelId_; + onChanged(); + } + if (!other.getPriceRerankingLevel().isEmpty()) { + priceRerankingLevel_ = other.priceRerankingLevel_; + onChanged(); + } + if (!other.facetControlIds_.isEmpty()) { + if (facetControlIds_.isEmpty()) { + facetControlIds_ = other.facetControlIds_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureFacetControlIdsIsMutable(); + facetControlIds_.addAll(other.facetControlIds_); + } + onChanged(); + } + if (other.hasDynamicFacetSpec()) { + mergeDynamicFacetSpec(other.getDynamicFacetSpec()); + } + if (!other.boostControlIds_.isEmpty()) { + if (boostControlIds_.isEmpty()) { + boostControlIds_ = other.boostControlIds_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureBoostControlIdsIsMutable(); + boostControlIds_.addAll(other.boostControlIds_); + } + onChanged(); + } + if (!other.filterControlIds_.isEmpty()) { + if (filterControlIds_.isEmpty()) { + filterControlIds_ = other.filterControlIds_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureFilterControlIdsIsMutable(); + filterControlIds_.addAll(other.filterControlIds_); + } + onChanged(); + } + if (!other.redirectControlIds_.isEmpty()) { + if (redirectControlIds_.isEmpty()) { + redirectControlIds_ = other.redirectControlIds_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureRedirectControlIdsIsMutable(); + redirectControlIds_.addAll(other.redirectControlIds_); + } + onChanged(); + } + if (!other.twowaySynonymsControlIds_.isEmpty()) { + if (twowaySynonymsControlIds_.isEmpty()) { + twowaySynonymsControlIds_ = other.twowaySynonymsControlIds_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureTwowaySynonymsControlIdsIsMutable(); + twowaySynonymsControlIds_.addAll(other.twowaySynonymsControlIds_); + } + onChanged(); + } + if (!other.onewaySynonymsControlIds_.isEmpty()) { + if (onewaySynonymsControlIds_.isEmpty()) { + onewaySynonymsControlIds_ = other.onewaySynonymsControlIds_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureOnewaySynonymsControlIdsIsMutable(); + onewaySynonymsControlIds_.addAll(other.onewaySynonymsControlIds_); + } + onChanged(); + } + if (!other.doNotAssociateControlIds_.isEmpty()) { + if (doNotAssociateControlIds_.isEmpty()) { + doNotAssociateControlIds_ = other.doNotAssociateControlIds_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureDoNotAssociateControlIdsIsMutable(); + doNotAssociateControlIds_.addAll(other.doNotAssociateControlIds_); + } + onChanged(); + } + if (!other.replacementControlIds_.isEmpty()) { + if (replacementControlIds_.isEmpty()) { + replacementControlIds_ = other.replacementControlIds_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureReplacementControlIdsIsMutable(); + replacementControlIds_.addAll(other.replacementControlIds_); + } + onChanged(); + } + if (!other.ignoreControlIds_.isEmpty()) { + if (ignoreControlIds_.isEmpty()) { + ignoreControlIds_ = other.ignoreControlIds_; + bitField0_ = (bitField0_ & ~0x00000100); + } else { + ensureIgnoreControlIdsIsMutable(); + ignoreControlIds_.addAll(other.ignoreControlIds_); + } + onChanged(); + } + if (!other.getDiversityLevel().isEmpty()) { + diversityLevel_ = other.diversityLevel_; + onChanged(); + } + if (!other.getEnableCategoryFilterLevel().isEmpty()) { + enableCategoryFilterLevel_ = other.enableCategoryFilterLevel_; + onChanged(); + } + if (other.hasPersonalizationSpec()) { + mergePersonalizationSpec(other.getPersonalizationSpec()); + } + if (!other.solutionTypes_.isEmpty()) { + if (solutionTypes_.isEmpty()) { + solutionTypes_ = other.solutionTypes_; + bitField0_ = (bitField0_ & ~0x00000200); + } else { + ensureSolutionTypesIsMutable(); + solutionTypes_.addAll(other.solutionTypes_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.ServingConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.ServingConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/servingConfig/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/servingConfig/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/servingConfig/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/servingConfig/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Fully qualified name
+     * `projects/*/locations/global/catalogs/*/servingConfig/*`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Required. The human readable serving config display name. Used in Retail
+     * UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The human readable serving config display name. Used in Retail
+     * UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The human readable serving config display name. Used in Retail
+     * UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The human readable serving config display name. Used in Retail
+     * UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The human readable serving config display name. Used in Retail
+     * UI.
+     * This field must be a UTF-8 encoded string with a length limit of 128
+     * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+     * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object modelId_ = ""; + /** + * + * + *
+     * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+     * to use at serving time. Currently only RecommendationModels are supported:
+     * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+     * Can be changed but only to a compatible model (e.g.
+     * others-you-may-like CTR to others-you-may-like CVR).
+     * Required when
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string model_id = 3; + * + * @return The modelId. + */ + public java.lang.String getModelId() { + java.lang.Object ref = modelId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + modelId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+     * to use at serving time. Currently only RecommendationModels are supported:
+     * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+     * Can be changed but only to a compatible model (e.g.
+     * others-you-may-like CTR to others-you-may-like CVR).
+     * Required when
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string model_id = 3; + * + * @return The bytes for modelId. + */ + public com.google.protobuf.ByteString getModelIdBytes() { + java.lang.Object ref = modelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + modelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+     * to use at serving time. Currently only RecommendationModels are supported:
+     * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+     * Can be changed but only to a compatible model (e.g.
+     * others-you-may-like CTR to others-you-may-like CVR).
+     * Required when
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string model_id = 3; + * + * @param value The modelId to set. + * @return This builder for chaining. + */ + public Builder setModelId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + modelId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+     * to use at serving time. Currently only RecommendationModels are supported:
+     * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+     * Can be changed but only to a compatible model (e.g.
+     * others-you-may-like CTR to others-you-may-like CVR).
+     * Required when
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string model_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearModelId() { + + modelId_ = getDefaultInstance().getModelId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+     * to use at serving time. Currently only RecommendationModels are supported:
+     * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+     * Can be changed but only to a compatible model (e.g.
+     * others-you-may-like CTR to others-you-may-like CVR).
+     * Required when
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string model_id = 3; + * + * @param value The bytes for modelId to set. + * @return This builder for chaining. + */ + public Builder setModelIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + modelId_ = value; + onChanged(); + return this; + } + + private java.lang.Object priceRerankingLevel_ = ""; + /** + * + * + *
+     * How much price ranking we want in serving results.
+     * Price reranking causes product items with a similar
+     * recommendation probability to be ordered by price, with the
+     * highest-priced items first. This setting could result in a decrease in
+     * click-through and conversion rates.
+     *  Allowed values are:
+     * * 'no-price-reranking'
+     * * 'low-price-raranking'
+     * * 'medium-price-reranking'
+     * * 'high-price-reranking'
+     * If not specified, we choose default based on model type. Default value:
+     * 'no-price-reranking'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string price_reranking_level = 4; + * + * @return The priceRerankingLevel. + */ + public java.lang.String getPriceRerankingLevel() { + java.lang.Object ref = priceRerankingLevel_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + priceRerankingLevel_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * How much price ranking we want in serving results.
+     * Price reranking causes product items with a similar
+     * recommendation probability to be ordered by price, with the
+     * highest-priced items first. This setting could result in a decrease in
+     * click-through and conversion rates.
+     *  Allowed values are:
+     * * 'no-price-reranking'
+     * * 'low-price-raranking'
+     * * 'medium-price-reranking'
+     * * 'high-price-reranking'
+     * If not specified, we choose default based on model type. Default value:
+     * 'no-price-reranking'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string price_reranking_level = 4; + * + * @return The bytes for priceRerankingLevel. + */ + public com.google.protobuf.ByteString getPriceRerankingLevelBytes() { + java.lang.Object ref = priceRerankingLevel_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + priceRerankingLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * How much price ranking we want in serving results.
+     * Price reranking causes product items with a similar
+     * recommendation probability to be ordered by price, with the
+     * highest-priced items first. This setting could result in a decrease in
+     * click-through and conversion rates.
+     *  Allowed values are:
+     * * 'no-price-reranking'
+     * * 'low-price-raranking'
+     * * 'medium-price-reranking'
+     * * 'high-price-reranking'
+     * If not specified, we choose default based on model type. Default value:
+     * 'no-price-reranking'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string price_reranking_level = 4; + * + * @param value The priceRerankingLevel to set. + * @return This builder for chaining. + */ + public Builder setPriceRerankingLevel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + priceRerankingLevel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * How much price ranking we want in serving results.
+     * Price reranking causes product items with a similar
+     * recommendation probability to be ordered by price, with the
+     * highest-priced items first. This setting could result in a decrease in
+     * click-through and conversion rates.
+     *  Allowed values are:
+     * * 'no-price-reranking'
+     * * 'low-price-raranking'
+     * * 'medium-price-reranking'
+     * * 'high-price-reranking'
+     * If not specified, we choose default based on model type. Default value:
+     * 'no-price-reranking'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string price_reranking_level = 4; + * + * @return This builder for chaining. + */ + public Builder clearPriceRerankingLevel() { + + priceRerankingLevel_ = getDefaultInstance().getPriceRerankingLevel(); + onChanged(); + return this; + } + /** + * + * + *
+     * How much price ranking we want in serving results.
+     * Price reranking causes product items with a similar
+     * recommendation probability to be ordered by price, with the
+     * highest-priced items first. This setting could result in a decrease in
+     * click-through and conversion rates.
+     *  Allowed values are:
+     * * 'no-price-reranking'
+     * * 'low-price-raranking'
+     * * 'medium-price-reranking'
+     * * 'high-price-reranking'
+     * If not specified, we choose default based on model type. Default value:
+     * 'no-price-reranking'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string price_reranking_level = 4; + * + * @param value The bytes for priceRerankingLevel to set. + * @return This builder for chaining. + */ + public Builder setPriceRerankingLevelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + priceRerankingLevel_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList facetControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureFacetControlIdsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + facetControlIds_ = new com.google.protobuf.LazyStringArrayList(facetControlIds_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @return A list containing the facetControlIds. + */ + public com.google.protobuf.ProtocolStringList getFacetControlIdsList() { + return facetControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @return The count of facetControlIds. + */ + public int getFacetControlIdsCount() { + return facetControlIds_.size(); + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the element to return. + * @return The facetControlIds at the given index. + */ + public java.lang.String getFacetControlIds(int index) { + return facetControlIds_.get(index); + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the value to return. + * @return The bytes of the facetControlIds at the given index. + */ + public com.google.protobuf.ByteString getFacetControlIdsBytes(int index) { + return facetControlIds_.getByteString(index); + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index to set the value at. + * @param value The facetControlIds to set. + * @return This builder for chaining. + */ + public Builder setFacetControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFacetControlIdsIsMutable(); + facetControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param value The facetControlIds to add. + * @return This builder for chaining. + */ + public Builder addFacetControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFacetControlIdsIsMutable(); + facetControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param values The facetControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllFacetControlIds(java.lang.Iterable values) { + ensureFacetControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, facetControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @return This builder for chaining. + */ + public Builder clearFacetControlIds() { + facetControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Facet specifications for faceted search. If empty, no facets are returned.
+     * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+     * resources with only the Facet control set. These controls are assumed to be
+     * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+     * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+     * is returned.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string facet_control_ids = 5; + * + * @param value The bytes of the facetControlIds to add. + * @return This builder for chaining. + */ + public Builder addFacetControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureFacetControlIdsIsMutable(); + facetControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamicFacetSpec_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder> + dynamicFacetSpecBuilder_; + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return Whether the dynamicFacetSpec field is set. + */ + public boolean hasDynamicFacetSpec() { + return dynamicFacetSpecBuilder_ != null || dynamicFacetSpec_ != null; + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return The dynamicFacetSpec. + */ + public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec getDynamicFacetSpec() { + if (dynamicFacetSpecBuilder_ == null) { + return dynamicFacetSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.getDefaultInstance() + : dynamicFacetSpec_; + } else { + return dynamicFacetSpecBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public Builder setDynamicFacetSpec( + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec value) { + if (dynamicFacetSpecBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + dynamicFacetSpec_ = value; + onChanged(); + } else { + dynamicFacetSpecBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public Builder setDynamicFacetSpec( + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder builderForValue) { + if (dynamicFacetSpecBuilder_ == null) { + dynamicFacetSpec_ = builderForValue.build(); + onChanged(); + } else { + dynamicFacetSpecBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public Builder mergeDynamicFacetSpec( + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec value) { + if (dynamicFacetSpecBuilder_ == null) { + if (dynamicFacetSpec_ != null) { + dynamicFacetSpec_ = + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.newBuilder( + dynamicFacetSpec_) + .mergeFrom(value) + .buildPartial(); + } else { + dynamicFacetSpec_ = value; + } + onChanged(); + } else { + dynamicFacetSpecBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public Builder clearDynamicFacetSpec() { + if (dynamicFacetSpecBuilder_ == null) { + dynamicFacetSpec_ = null; + onChanged(); + } else { + dynamicFacetSpec_ = null; + dynamicFacetSpecBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder + getDynamicFacetSpecBuilder() { + + onChanged(); + return getDynamicFacetSpecFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + public com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder + getDynamicFacetSpecOrBuilder() { + if (dynamicFacetSpecBuilder_ != null) { + return dynamicFacetSpecBuilder_.getMessageOrBuilder(); + } else { + return dynamicFacetSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.getDefaultInstance() + : dynamicFacetSpec_; + } + } + /** + * + * + *
+     * The specification for dynamically generated facets. Notice that only
+     * textual facets can be dynamically generated.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder> + getDynamicFacetSpecFieldBuilder() { + if (dynamicFacetSpecBuilder_ == null) { + dynamicFacetSpecBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder>( + getDynamicFacetSpec(), getParentForChildren(), isClean()); + dynamicFacetSpec_ = null; + } + return dynamicFacetSpecBuilder_; + } + + private com.google.protobuf.LazyStringList boostControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureBoostControlIdsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + boostControlIds_ = new com.google.protobuf.LazyStringArrayList(boostControlIds_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @return A list containing the boostControlIds. + */ + public com.google.protobuf.ProtocolStringList getBoostControlIdsList() { + return boostControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @return The count of boostControlIds. + */ + public int getBoostControlIdsCount() { + return boostControlIds_.size(); + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the element to return. + * @return The boostControlIds at the given index. + */ + public java.lang.String getBoostControlIds(int index) { + return boostControlIds_.get(index); + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the value to return. + * @return The bytes of the boostControlIds at the given index. + */ + public com.google.protobuf.ByteString getBoostControlIdsBytes(int index) { + return boostControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index to set the value at. + * @param value The boostControlIds to set. + * @return This builder for chaining. + */ + public Builder setBoostControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBoostControlIdsIsMutable(); + boostControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param value The boostControlIds to add. + * @return This builder for chaining. + */ + public Builder addBoostControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBoostControlIdsIsMutable(); + boostControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param values The boostControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllBoostControlIds(java.lang.Iterable values) { + ensureBoostControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, boostControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @return This builder for chaining. + */ + public Builder clearBoostControlIds() { + boostControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition boost specifications. If a product matches multiple conditions
+     * in the specifications, boost scores from these specifications are all
+     * applied and combined in a non-linear way. Maximum number of
+     * specifications is 100.
+     * Notice that if both
+     * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+     * and
+     * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+     * are set, the boost conditions from both places are evaluated. If a search
+     * request matches multiple boost conditions, the final boost score is equal
+     * to the sum of the boost scores from all matched boost conditions.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string boost_control_ids = 7; + * + * @param value The bytes of the boostControlIds to add. + * @return This builder for chaining. + */ + public Builder addBoostControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureBoostControlIdsIsMutable(); + boostControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList filterControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureFilterControlIdsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + filterControlIds_ = new com.google.protobuf.LazyStringArrayList(filterControlIds_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @return A list containing the filterControlIds. + */ + public com.google.protobuf.ProtocolStringList getFilterControlIdsList() { + return filterControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @return The count of filterControlIds. + */ + public int getFilterControlIdsCount() { + return filterControlIds_.size(); + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the element to return. + * @return The filterControlIds at the given index. + */ + public java.lang.String getFilterControlIds(int index) { + return filterControlIds_.get(index); + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the value to return. + * @return The bytes of the filterControlIds at the given index. + */ + public com.google.protobuf.ByteString getFilterControlIdsBytes(int index) { + return filterControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index to set the value at. + * @param value The filterControlIds to set. + * @return This builder for chaining. + */ + public Builder setFilterControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilterControlIdsIsMutable(); + filterControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param value The filterControlIds to add. + * @return This builder for chaining. + */ + public Builder addFilterControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilterControlIdsIsMutable(); + filterControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param values The filterControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllFilterControlIds(java.lang.Iterable values) { + ensureFilterControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, filterControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @return This builder for chaining. + */ + public Builder clearFilterControlIds() { + filterControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition filter specifications. If a product matches multiple conditions
+     * in the specifications, filters from these specifications are all
+     * applied and combined via the AND operator. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string filter_control_ids = 9; + * + * @param value The bytes of the filterControlIds to add. + * @return This builder for chaining. + */ + public Builder addFilterControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureFilterControlIdsIsMutable(); + filterControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList redirectControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureRedirectControlIdsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + redirectControlIds_ = new com.google.protobuf.LazyStringArrayList(redirectControlIds_); + bitField0_ |= 0x00000008; + } + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return A list containing the redirectControlIds. + */ + public com.google.protobuf.ProtocolStringList getRedirectControlIdsList() { + return redirectControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return The count of redirectControlIds. + */ + public int getRedirectControlIdsCount() { + return redirectControlIds_.size(); + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the element to return. + * @return The redirectControlIds at the given index. + */ + public java.lang.String getRedirectControlIds(int index) { + return redirectControlIds_.get(index); + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the value to return. + * @return The bytes of the redirectControlIds at the given index. + */ + public com.google.protobuf.ByteString getRedirectControlIdsBytes(int index) { + return redirectControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index to set the value at. + * @param value The redirectControlIds to set. + * @return This builder for chaining. + */ + public Builder setRedirectControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRedirectControlIdsIsMutable(); + redirectControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param value The redirectControlIds to add. + * @return This builder for chaining. + */ + public Builder addRedirectControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRedirectControlIdsIsMutable(); + redirectControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param values The redirectControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllRedirectControlIds(java.lang.Iterable values) { + ensureRedirectControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, redirectControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return This builder for chaining. + */ + public Builder clearRedirectControlIds() { + redirectControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition redirect specifications. Only the first triggered redirect action
+     * is applied, even if multiple apply. Maximum number of specifications is
+     * 1000.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param value The bytes of the redirectControlIds to add. + * @return This builder for chaining. + */ + public Builder addRedirectControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureRedirectControlIdsIsMutable(); + redirectControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList twowaySynonymsControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTwowaySynonymsControlIdsIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + twowaySynonymsControlIds_ = + new com.google.protobuf.LazyStringArrayList(twowaySynonymsControlIds_); + bitField0_ |= 0x00000010; + } + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return A list containing the twowaySynonymsControlIds. + */ + public com.google.protobuf.ProtocolStringList getTwowaySynonymsControlIdsList() { + return twowaySynonymsControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return The count of twowaySynonymsControlIds. + */ + public int getTwowaySynonymsControlIdsCount() { + return twowaySynonymsControlIds_.size(); + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the element to return. + * @return The twowaySynonymsControlIds at the given index. + */ + public java.lang.String getTwowaySynonymsControlIds(int index) { + return twowaySynonymsControlIds_.get(index); + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the value to return. + * @return The bytes of the twowaySynonymsControlIds at the given index. + */ + public com.google.protobuf.ByteString getTwowaySynonymsControlIdsBytes(int index) { + return twowaySynonymsControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index to set the value at. + * @param value The twowaySynonymsControlIds to set. + * @return This builder for chaining. + */ + public Builder setTwowaySynonymsControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTwowaySynonymsControlIdsIsMutable(); + twowaySynonymsControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param value The twowaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addTwowaySynonymsControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTwowaySynonymsControlIdsIsMutable(); + twowaySynonymsControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param values The twowaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllTwowaySynonymsControlIds(java.lang.Iterable values) { + ensureTwowaySynonymsControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, twowaySynonymsControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return This builder for chaining. + */ + public Builder clearTwowaySynonymsControlIds() { + twowaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition synonyms specifications. If multiple syonyms conditions match,
+     * all matching synonyms control in the list will execute. Order of controls
+     * in the list will not matter. Maximum number of specifications is
+     * 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param value The bytes of the twowaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addTwowaySynonymsControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTwowaySynonymsControlIdsIsMutable(); + twowaySynonymsControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList onewaySynonymsControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureOnewaySynonymsControlIdsIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + onewaySynonymsControlIds_ = + new com.google.protobuf.LazyStringArrayList(onewaySynonymsControlIds_); + bitField0_ |= 0x00000020; + } + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return A list containing the onewaySynonymsControlIds. + */ + public com.google.protobuf.ProtocolStringList getOnewaySynonymsControlIdsList() { + return onewaySynonymsControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return The count of onewaySynonymsControlIds. + */ + public int getOnewaySynonymsControlIdsCount() { + return onewaySynonymsControlIds_.size(); + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the element to return. + * @return The onewaySynonymsControlIds at the given index. + */ + public java.lang.String getOnewaySynonymsControlIds(int index) { + return onewaySynonymsControlIds_.get(index); + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the value to return. + * @return The bytes of the onewaySynonymsControlIds at the given index. + */ + public com.google.protobuf.ByteString getOnewaySynonymsControlIdsBytes(int index) { + return onewaySynonymsControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index to set the value at. + * @param value The onewaySynonymsControlIds to set. + * @return This builder for chaining. + */ + public Builder setOnewaySynonymsControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureOnewaySynonymsControlIdsIsMutable(); + onewaySynonymsControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param value The onewaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addOnewaySynonymsControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureOnewaySynonymsControlIdsIsMutable(); + onewaySynonymsControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param values The onewaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllOnewaySynonymsControlIds(java.lang.Iterable values) { + ensureOnewaySynonymsControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, onewaySynonymsControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return This builder for chaining. + */ + public Builder clearOnewaySynonymsControlIds() { + onewaySynonymsControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition oneway synonyms specifications. If multiple oneway synonyms
+     * conditions match, all matching oneway synonyms controls in the list will
+     * execute. Order of controls in the list will not matter. Maximum number of
+     * specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param value The bytes of the onewaySynonymsControlIds to add. + * @return This builder for chaining. + */ + public Builder addOnewaySynonymsControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureOnewaySynonymsControlIdsIsMutable(); + onewaySynonymsControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList doNotAssociateControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureDoNotAssociateControlIdsIsMutable() { + if (!((bitField0_ & 0x00000040) != 0)) { + doNotAssociateControlIds_ = + new com.google.protobuf.LazyStringArrayList(doNotAssociateControlIds_); + bitField0_ |= 0x00000040; + } + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return A list containing the doNotAssociateControlIds. + */ + public com.google.protobuf.ProtocolStringList getDoNotAssociateControlIdsList() { + return doNotAssociateControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return The count of doNotAssociateControlIds. + */ + public int getDoNotAssociateControlIdsCount() { + return doNotAssociateControlIds_.size(); + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the element to return. + * @return The doNotAssociateControlIds at the given index. + */ + public java.lang.String getDoNotAssociateControlIds(int index) { + return doNotAssociateControlIds_.get(index); + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateControlIds at the given index. + */ + public com.google.protobuf.ByteString getDoNotAssociateControlIdsBytes(int index) { + return doNotAssociateControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index to set the value at. + * @param value The doNotAssociateControlIds to set. + * @return This builder for chaining. + */ + public Builder setDoNotAssociateControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDoNotAssociateControlIdsIsMutable(); + doNotAssociateControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param value The doNotAssociateControlIds to add. + * @return This builder for chaining. + */ + public Builder addDoNotAssociateControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDoNotAssociateControlIdsIsMutable(); + doNotAssociateControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param values The doNotAssociateControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllDoNotAssociateControlIds(java.lang.Iterable values) { + ensureDoNotAssociateControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, doNotAssociateControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return This builder for chaining. + */ + public Builder clearDoNotAssociateControlIds() { + doNotAssociateControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition do not associate specifications. If multiple do not associate
+     * conditions match, all matching do not associate controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param value The bytes of the doNotAssociateControlIds to add. + * @return This builder for chaining. + */ + public Builder addDoNotAssociateControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureDoNotAssociateControlIdsIsMutable(); + doNotAssociateControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList replacementControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureReplacementControlIdsIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + replacementControlIds_ = + new com.google.protobuf.LazyStringArrayList(replacementControlIds_); + bitField0_ |= 0x00000080; + } + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return A list containing the replacementControlIds. + */ + public com.google.protobuf.ProtocolStringList getReplacementControlIdsList() { + return replacementControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return The count of replacementControlIds. + */ + public int getReplacementControlIdsCount() { + return replacementControlIds_.size(); + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the element to return. + * @return The replacementControlIds at the given index. + */ + public java.lang.String getReplacementControlIds(int index) { + return replacementControlIds_.get(index); + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the value to return. + * @return The bytes of the replacementControlIds at the given index. + */ + public com.google.protobuf.ByteString getReplacementControlIdsBytes(int index) { + return replacementControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index to set the value at. + * @param value The replacementControlIds to set. + * @return This builder for chaining. + */ + public Builder setReplacementControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplacementControlIdsIsMutable(); + replacementControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param value The replacementControlIds to add. + * @return This builder for chaining. + */ + public Builder addReplacementControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplacementControlIdsIsMutable(); + replacementControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param values The replacementControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllReplacementControlIds(java.lang.Iterable values) { + ensureReplacementControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, replacementControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return This builder for chaining. + */ + public Builder clearReplacementControlIds() { + replacementControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition replacement specifications.
+     * - Applied according to the order in the list.
+     * - A previously replaced term can not be re-replaced.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param value The bytes of the replacementControlIds to add. + * @return This builder for chaining. + */ + public Builder addReplacementControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureReplacementControlIdsIsMutable(); + replacementControlIds_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList ignoreControlIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureIgnoreControlIdsIsMutable() { + if (!((bitField0_ & 0x00000100) != 0)) { + ignoreControlIds_ = new com.google.protobuf.LazyStringArrayList(ignoreControlIds_); + bitField0_ |= 0x00000100; + } + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return A list containing the ignoreControlIds. + */ + public com.google.protobuf.ProtocolStringList getIgnoreControlIdsList() { + return ignoreControlIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return The count of ignoreControlIds. + */ + public int getIgnoreControlIdsCount() { + return ignoreControlIds_.size(); + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the element to return. + * @return The ignoreControlIds at the given index. + */ + public java.lang.String getIgnoreControlIds(int index) { + return ignoreControlIds_.get(index); + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreControlIds at the given index. + */ + public com.google.protobuf.ByteString getIgnoreControlIdsBytes(int index) { + return ignoreControlIds_.getByteString(index); + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index to set the value at. + * @param value The ignoreControlIds to set. + * @return This builder for chaining. + */ + public Builder setIgnoreControlIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureIgnoreControlIdsIsMutable(); + ignoreControlIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param value The ignoreControlIds to add. + * @return This builder for chaining. + */ + public Builder addIgnoreControlIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureIgnoreControlIdsIsMutable(); + ignoreControlIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param values The ignoreControlIds to add. + * @return This builder for chaining. + */ + public Builder addAllIgnoreControlIds(java.lang.Iterable values) { + ensureIgnoreControlIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ignoreControlIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return This builder for chaining. + */ + public Builder clearIgnoreControlIds() { + ignoreControlIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + /** + * + * + *
+     * Condition ignore specifications. If multiple ignore
+     * conditions match, all matching ignore controls in the list will
+     * execute.
+     * - Order does not matter.
+     * - Maximum number of specifications is 100.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param value The bytes of the ignoreControlIds to add. + * @return This builder for chaining. + */ + public Builder addIgnoreControlIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureIgnoreControlIdsIsMutable(); + ignoreControlIds_.add(value); + onChanged(); + return this; + } + + private java.lang.Object diversityLevel_ = ""; + /** + * + * + *
+     * How much diversity to use in recommendation model results e.g.
+     * 'medium-diversity' or 'high-diversity'. Currently supported values:
+     * * 'no-diversity'
+     * * 'low-diversity'
+     * * 'medium-diversity'
+     * * 'high-diversity'
+     * * 'auto-diversity'
+     * If not specified, we choose default based on recommendation model
+     * type. Default value: 'no-diversity'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string diversity_level = 8; + * + * @return The diversityLevel. + */ + public java.lang.String getDiversityLevel() { + java.lang.Object ref = diversityLevel_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + diversityLevel_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * How much diversity to use in recommendation model results e.g.
+     * 'medium-diversity' or 'high-diversity'. Currently supported values:
+     * * 'no-diversity'
+     * * 'low-diversity'
+     * * 'medium-diversity'
+     * * 'high-diversity'
+     * * 'auto-diversity'
+     * If not specified, we choose default based on recommendation model
+     * type. Default value: 'no-diversity'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string diversity_level = 8; + * + * @return The bytes for diversityLevel. + */ + public com.google.protobuf.ByteString getDiversityLevelBytes() { + java.lang.Object ref = diversityLevel_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + diversityLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * How much diversity to use in recommendation model results e.g.
+     * 'medium-diversity' or 'high-diversity'. Currently supported values:
+     * * 'no-diversity'
+     * * 'low-diversity'
+     * * 'medium-diversity'
+     * * 'high-diversity'
+     * * 'auto-diversity'
+     * If not specified, we choose default based on recommendation model
+     * type. Default value: 'no-diversity'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string diversity_level = 8; + * + * @param value The diversityLevel to set. + * @return This builder for chaining. + */ + public Builder setDiversityLevel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + diversityLevel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * How much diversity to use in recommendation model results e.g.
+     * 'medium-diversity' or 'high-diversity'. Currently supported values:
+     * * 'no-diversity'
+     * * 'low-diversity'
+     * * 'medium-diversity'
+     * * 'high-diversity'
+     * * 'auto-diversity'
+     * If not specified, we choose default based on recommendation model
+     * type. Default value: 'no-diversity'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string diversity_level = 8; + * + * @return This builder for chaining. + */ + public Builder clearDiversityLevel() { + + diversityLevel_ = getDefaultInstance().getDiversityLevel(); + onChanged(); + return this; + } + /** + * + * + *
+     * How much diversity to use in recommendation model results e.g.
+     * 'medium-diversity' or 'high-diversity'. Currently supported values:
+     * * 'no-diversity'
+     * * 'low-diversity'
+     * * 'medium-diversity'
+     * * 'high-diversity'
+     * * 'auto-diversity'
+     * If not specified, we choose default based on recommendation model
+     * type. Default value: 'no-diversity'.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string diversity_level = 8; + * + * @param value The bytes for diversityLevel to set. + * @return This builder for chaining. + */ + public Builder setDiversityLevelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + diversityLevel_ = value; + onChanged(); + return this; + } + + private java.lang.Object enableCategoryFilterLevel_ = ""; + /** + * + * + *
+     * Whether to add additional category filters on the 'similar-items' model.
+     * If not specified, we enable it by default.
+     *  Allowed values are:
+     * * 'no-category-match': No additional filtering of original results from
+     *   the model and the customer's filters.
+     * * 'relaxed-category-match': Only keep results with categories that match
+     *   at least one item categories in the PredictRequests's context item.
+     *   * If customer also sends filters in the PredictRequest, then the results
+     *   will satisfy both conditions (user given and category match).
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string enable_category_filter_level = 16; + * + * @return The enableCategoryFilterLevel. + */ + public java.lang.String getEnableCategoryFilterLevel() { + java.lang.Object ref = enableCategoryFilterLevel_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + enableCategoryFilterLevel_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Whether to add additional category filters on the 'similar-items' model.
+     * If not specified, we enable it by default.
+     *  Allowed values are:
+     * * 'no-category-match': No additional filtering of original results from
+     *   the model and the customer's filters.
+     * * 'relaxed-category-match': Only keep results with categories that match
+     *   at least one item categories in the PredictRequests's context item.
+     *   * If customer also sends filters in the PredictRequest, then the results
+     *   will satisfy both conditions (user given and category match).
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string enable_category_filter_level = 16; + * + * @return The bytes for enableCategoryFilterLevel. + */ + public com.google.protobuf.ByteString getEnableCategoryFilterLevelBytes() { + java.lang.Object ref = enableCategoryFilterLevel_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + enableCategoryFilterLevel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Whether to add additional category filters on the 'similar-items' model.
+     * If not specified, we enable it by default.
+     *  Allowed values are:
+     * * 'no-category-match': No additional filtering of original results from
+     *   the model and the customer's filters.
+     * * 'relaxed-category-match': Only keep results with categories that match
+     *   at least one item categories in the PredictRequests's context item.
+     *   * If customer also sends filters in the PredictRequest, then the results
+     *   will satisfy both conditions (user given and category match).
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string enable_category_filter_level = 16; + * + * @param value The enableCategoryFilterLevel to set. + * @return This builder for chaining. + */ + public Builder setEnableCategoryFilterLevel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + enableCategoryFilterLevel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether to add additional category filters on the 'similar-items' model.
+     * If not specified, we enable it by default.
+     *  Allowed values are:
+     * * 'no-category-match': No additional filtering of original results from
+     *   the model and the customer's filters.
+     * * 'relaxed-category-match': Only keep results with categories that match
+     *   at least one item categories in the PredictRequests's context item.
+     *   * If customer also sends filters in the PredictRequest, then the results
+     *   will satisfy both conditions (user given and category match).
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string enable_category_filter_level = 16; + * + * @return This builder for chaining. + */ + public Builder clearEnableCategoryFilterLevel() { + + enableCategoryFilterLevel_ = getDefaultInstance().getEnableCategoryFilterLevel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Whether to add additional category filters on the 'similar-items' model.
+     * If not specified, we enable it by default.
+     *  Allowed values are:
+     * * 'no-category-match': No additional filtering of original results from
+     *   the model and the customer's filters.
+     * * 'relaxed-category-match': Only keep results with categories that match
+     *   at least one item categories in the PredictRequests's context item.
+     *   * If customer also sends filters in the PredictRequest, then the results
+     *   will satisfy both conditions (user given and category match).
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+     * 
+ * + * string enable_category_filter_level = 16; + * + * @param value The bytes for enableCategoryFilterLevel to set. + * @return This builder for chaining. + */ + public Builder setEnableCategoryFilterLevelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + enableCategoryFilterLevel_ = value; + onChanged(); + return this; + } + + private com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalizationSpec_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder> + personalizationSpecBuilder_; + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return Whether the personalizationSpec field is set. + */ + public boolean hasPersonalizationSpec() { + return personalizationSpecBuilder_ != null || personalizationSpec_ != null; + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return The personalizationSpec. + */ + public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec getPersonalizationSpec() { + if (personalizationSpecBuilder_ == null) { + return personalizationSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.getDefaultInstance() + : personalizationSpec_; + } else { + return personalizationSpecBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public Builder setPersonalizationSpec( + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec value) { + if (personalizationSpecBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + personalizationSpec_ = value; + onChanged(); + } else { + personalizationSpecBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public Builder setPersonalizationSpec( + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder builderForValue) { + if (personalizationSpecBuilder_ == null) { + personalizationSpec_ = builderForValue.build(); + onChanged(); + } else { + personalizationSpecBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public Builder mergePersonalizationSpec( + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec value) { + if (personalizationSpecBuilder_ == null) { + if (personalizationSpec_ != null) { + personalizationSpec_ = + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.newBuilder( + personalizationSpec_) + .mergeFrom(value) + .buildPartial(); + } else { + personalizationSpec_ = value; + } + onChanged(); + } else { + personalizationSpecBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public Builder clearPersonalizationSpec() { + if (personalizationSpecBuilder_ == null) { + personalizationSpec_ = null; + onChanged(); + } else { + personalizationSpec_ = null; + personalizationSpecBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder + getPersonalizationSpecBuilder() { + + onChanged(); + return getPersonalizationSpecFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + public com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder + getPersonalizationSpecOrBuilder() { + if (personalizationSpecBuilder_ != null) { + return personalizationSpecBuilder_.getMessageOrBuilder(); + } else { + return personalizationSpec_ == null + ? com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.getDefaultInstance() + : personalizationSpec_; + } + } + /** + * + * + *
+     * The specification for personalization spec.
+     * Can only be set if
+     * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+     * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+     * Notice that if both
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+     * and
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * are set.
+     * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+     * will override
+     * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+     * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder> + getPersonalizationSpecFieldBuilder() { + if (personalizationSpecBuilder_ == null) { + personalizationSpecBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Builder, + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder>( + getPersonalizationSpec(), getParentForChildren(), isClean()); + personalizationSpec_ = null; + } + return personalizationSpecBuilder_; + } + + private java.util.List solutionTypes_ = java.util.Collections.emptyList(); + + private void ensureSolutionTypesIsMutable() { + if (!((bitField0_ & 0x00000200) != 0)) { + solutionTypes_ = new java.util.ArrayList(solutionTypes_); + bitField0_ |= 0x00000200; + } + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + public java.util.List getSolutionTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.retail.v2.SolutionType>( + solutionTypes_, solutionTypes_converter_); + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + public int getSolutionTypesCount() { + return solutionTypes_.size(); + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + public com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index) { + return solutionTypes_converter_.convert(solutionTypes_.get(index)); + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index to set the value at. + * @param value The solutionTypes to set. + * @return This builder for chaining. + */ + public Builder setSolutionTypes(int index, com.google.cloud.retail.v2.SolutionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSolutionTypesIsMutable(); + solutionTypes_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addSolutionTypes(com.google.cloud.retail.v2.SolutionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSolutionTypesIsMutable(); + solutionTypes_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param values The solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addAllSolutionTypes( + java.lang.Iterable values) { + ensureSolutionTypesIsMutable(); + for (com.google.cloud.retail.v2.SolutionType value : values) { + solutionTypes_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return This builder for chaining. + */ + public Builder clearSolutionTypes() { + solutionTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000200); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + public java.util.List getSolutionTypesValueList() { + return java.util.Collections.unmodifiableList(solutionTypes_); + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + public int getSolutionTypesValue(int index) { + return solutionTypes_.get(index); + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for solutionTypes to set. + * @return This builder for chaining. + */ + public Builder setSolutionTypesValue(int index, int value) { + ensureSolutionTypesIsMutable(); + solutionTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param value The enum numeric value on the wire for solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addSolutionTypesValue(int value) { + ensureSolutionTypesIsMutable(); + solutionTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Immutable. Specifies the solution types that a serving config can
+     * be associated with. Currently we support setting only one type of solution.
+     * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param values The enum numeric values on the wire for solutionTypes to add. + * @return This builder for chaining. + */ + public Builder addAllSolutionTypesValue(java.lang.Iterable values) { + ensureSolutionTypesIsMutable(); + for (int value : values) { + solutionTypes_.add(value); + } + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.ServingConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.ServingConfig) + private static final com.google.cloud.retail.v2.ServingConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.ServingConfig(); + } + + public static com.google.cloud.retail.v2.ServingConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ServingConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ServingConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigName.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigName.java new file mode 100644 index 000000000000..d470e8473b6a --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigName.java @@ -0,0 +1,269 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ServingConfigName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CATALOG_SERVING_CONFIG = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String catalog; + private final String servingConfig; + + @Deprecated + protected ServingConfigName() { + project = null; + location = null; + catalog = null; + servingConfig = null; + } + + private ServingConfigName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + catalog = Preconditions.checkNotNull(builder.getCatalog()); + servingConfig = Preconditions.checkNotNull(builder.getServingConfig()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getServingConfig() { + return servingConfig; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ServingConfigName of( + String project, String location, String catalog, String servingConfig) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setServingConfig(servingConfig) + .build(); + } + + public static String format( + String project, String location, String catalog, String servingConfig) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCatalog(catalog) + .setServingConfig(servingConfig) + .build() + .toString(); + } + + public static ServingConfigName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CATALOG_SERVING_CONFIG.validatedMatch( + formattedString, "ServingConfigName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("catalog"), + matchMap.get("serving_config")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ServingConfigName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CATALOG_SERVING_CONFIG.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (catalog != null) { + fieldMapBuilder.put("catalog", catalog); + } + if (servingConfig != null) { + fieldMapBuilder.put("serving_config", servingConfig); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CATALOG_SERVING_CONFIG.instantiate( + "project", + project, + "location", + location, + "catalog", + catalog, + "serving_config", + servingConfig); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ServingConfigName that = ((ServingConfigName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.catalog, that.catalog) + && Objects.equals(this.servingConfig, that.servingConfig); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(catalog); + h *= 1000003; + h ^= Objects.hashCode(servingConfig); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}. + */ + public static class Builder { + private String project; + private String location; + private String catalog; + private String servingConfig; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCatalog() { + return catalog; + } + + public String getServingConfig() { + return servingConfig; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCatalog(String catalog) { + this.catalog = catalog; + return this; + } + + public Builder setServingConfig(String servingConfig) { + this.servingConfig = servingConfig; + return this; + } + + private Builder(ServingConfigName servingConfigName) { + this.project = servingConfigName.project; + this.location = servingConfigName.location; + this.catalog = servingConfigName.catalog; + this.servingConfig = servingConfigName.servingConfig; + } + + public ServingConfigName build() { + return new ServingConfigName(this); + } + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigOrBuilder.java new file mode 100644 index 000000000000..b57f13f1abd9 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigOrBuilder.java @@ -0,0 +1,1185 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config.proto + +package com.google.cloud.retail.v2; + +public interface ServingConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.ServingConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/servingConfig/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. Fully qualified name
+   * `projects/*/locations/global/catalogs/*/servingConfig/*`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The human readable serving config display name. Used in Retail
+   * UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Required. The human readable serving config display name. Used in Retail
+   * UI.
+   * This field must be a UTF-8 encoded string with a length limit of 128
+   * characters. Otherwise, an INVALID_ARGUMENT error is returned.
+   * 
+ * + * string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+   * to use at serving time. Currently only RecommendationModels are supported:
+   * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+   * Can be changed but only to a compatible model (e.g.
+   * others-you-may-like CTR to others-you-may-like CVR).
+   * Required when
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string model_id = 3; + * + * @return The modelId. + */ + java.lang.String getModelId(); + /** + * + * + *
+   * The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
+   * to use at serving time. Currently only RecommendationModels are supported:
+   * https://cloud.google.com/retail/recommendations-ai/docs/create-models
+   * Can be changed but only to a compatible model (e.g.
+   * others-you-may-like CTR to others-you-may-like CVR).
+   * Required when
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string model_id = 3; + * + * @return The bytes for modelId. + */ + com.google.protobuf.ByteString getModelIdBytes(); + + /** + * + * + *
+   * How much price ranking we want in serving results.
+   * Price reranking causes product items with a similar
+   * recommendation probability to be ordered by price, with the
+   * highest-priced items first. This setting could result in a decrease in
+   * click-through and conversion rates.
+   *  Allowed values are:
+   * * 'no-price-reranking'
+   * * 'low-price-raranking'
+   * * 'medium-price-reranking'
+   * * 'high-price-reranking'
+   * If not specified, we choose default based on model type. Default value:
+   * 'no-price-reranking'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string price_reranking_level = 4; + * + * @return The priceRerankingLevel. + */ + java.lang.String getPriceRerankingLevel(); + /** + * + * + *
+   * How much price ranking we want in serving results.
+   * Price reranking causes product items with a similar
+   * recommendation probability to be ordered by price, with the
+   * highest-priced items first. This setting could result in a decrease in
+   * click-through and conversion rates.
+   *  Allowed values are:
+   * * 'no-price-reranking'
+   * * 'low-price-raranking'
+   * * 'medium-price-reranking'
+   * * 'high-price-reranking'
+   * If not specified, we choose default based on model type. Default value:
+   * 'no-price-reranking'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string price_reranking_level = 4; + * + * @return The bytes for priceRerankingLevel. + */ + com.google.protobuf.ByteString getPriceRerankingLevelBytes(); + + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @return A list containing the facetControlIds. + */ + java.util.List getFacetControlIdsList(); + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @return The count of facetControlIds. + */ + int getFacetControlIdsCount(); + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the element to return. + * @return The facetControlIds at the given index. + */ + java.lang.String getFacetControlIds(int index); + /** + * + * + *
+   * Facet specifications for faceted search. If empty, no facets are returned.
+   * The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
+   * resources with only the Facet control set. These controls are assumed to be
+   * in the same [Catalog][google.cloud.retail.v2.Catalog] as the
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig].
+   * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
+   * is returned.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string facet_control_ids = 5; + * + * @param index The index of the value to return. + * @return The bytes of the facetControlIds at the given index. + */ + com.google.protobuf.ByteString getFacetControlIdsBytes(int index); + + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return Whether the dynamicFacetSpec field is set. + */ + boolean hasDynamicFacetSpec(); + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + * + * @return The dynamicFacetSpec. + */ + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec getDynamicFacetSpec(); + /** + * + * + *
+   * The specification for dynamically generated facets. Notice that only
+   * textual facets can be dynamically generated.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + */ + com.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecOrBuilder getDynamicFacetSpecOrBuilder(); + + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @return A list containing the boostControlIds. + */ + java.util.List getBoostControlIdsList(); + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @return The count of boostControlIds. + */ + int getBoostControlIdsCount(); + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the element to return. + * @return The boostControlIds at the given index. + */ + java.lang.String getBoostControlIds(int index); + /** + * + * + *
+   * Condition boost specifications. If a product matches multiple conditions
+   * in the specifications, boost scores from these specifications are all
+   * applied and combined in a non-linear way. Maximum number of
+   * specifications is 100.
+   * Notice that if both
+   * [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
+   * and
+   * [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
+   * are set, the boost conditions from both places are evaluated. If a search
+   * request matches multiple boost conditions, the final boost score is equal
+   * to the sum of the boost scores from all matched boost conditions.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string boost_control_ids = 7; + * + * @param index The index of the value to return. + * @return The bytes of the boostControlIds at the given index. + */ + com.google.protobuf.ByteString getBoostControlIdsBytes(int index); + + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @return A list containing the filterControlIds. + */ + java.util.List getFilterControlIdsList(); + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @return The count of filterControlIds. + */ + int getFilterControlIdsCount(); + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the element to return. + * @return The filterControlIds at the given index. + */ + java.lang.String getFilterControlIds(int index); + /** + * + * + *
+   * Condition filter specifications. If a product matches multiple conditions
+   * in the specifications, filters from these specifications are all
+   * applied and combined via the AND operator. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string filter_control_ids = 9; + * + * @param index The index of the value to return. + * @return The bytes of the filterControlIds at the given index. + */ + com.google.protobuf.ByteString getFilterControlIdsBytes(int index); + + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return A list containing the redirectControlIds. + */ + java.util.List getRedirectControlIdsList(); + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @return The count of redirectControlIds. + */ + int getRedirectControlIdsCount(); + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the element to return. + * @return The redirectControlIds at the given index. + */ + java.lang.String getRedirectControlIds(int index); + /** + * + * + *
+   * Condition redirect specifications. Only the first triggered redirect action
+   * is applied, even if multiple apply. Maximum number of specifications is
+   * 1000.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string redirect_control_ids = 10; + * + * @param index The index of the value to return. + * @return The bytes of the redirectControlIds at the given index. + */ + com.google.protobuf.ByteString getRedirectControlIdsBytes(int index); + + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return A list containing the twowaySynonymsControlIds. + */ + java.util.List getTwowaySynonymsControlIdsList(); + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @return The count of twowaySynonymsControlIds. + */ + int getTwowaySynonymsControlIdsCount(); + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the element to return. + * @return The twowaySynonymsControlIds at the given index. + */ + java.lang.String getTwowaySynonymsControlIds(int index); + /** + * + * + *
+   * Condition synonyms specifications. If multiple syonyms conditions match,
+   * all matching synonyms control in the list will execute. Order of controls
+   * in the list will not matter. Maximum number of specifications is
+   * 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string twoway_synonyms_control_ids = 18; + * + * @param index The index of the value to return. + * @return The bytes of the twowaySynonymsControlIds at the given index. + */ + com.google.protobuf.ByteString getTwowaySynonymsControlIdsBytes(int index); + + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return A list containing the onewaySynonymsControlIds. + */ + java.util.List getOnewaySynonymsControlIdsList(); + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @return The count of onewaySynonymsControlIds. + */ + int getOnewaySynonymsControlIdsCount(); + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the element to return. + * @return The onewaySynonymsControlIds at the given index. + */ + java.lang.String getOnewaySynonymsControlIds(int index); + /** + * + * + *
+   * Condition oneway synonyms specifications. If multiple oneway synonyms
+   * conditions match, all matching oneway synonyms controls in the list will
+   * execute. Order of controls in the list will not matter. Maximum number of
+   * specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string oneway_synonyms_control_ids = 12; + * + * @param index The index of the value to return. + * @return The bytes of the onewaySynonymsControlIds at the given index. + */ + com.google.protobuf.ByteString getOnewaySynonymsControlIdsBytes(int index); + + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return A list containing the doNotAssociateControlIds. + */ + java.util.List getDoNotAssociateControlIdsList(); + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @return The count of doNotAssociateControlIds. + */ + int getDoNotAssociateControlIdsCount(); + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the element to return. + * @return The doNotAssociateControlIds at the given index. + */ + java.lang.String getDoNotAssociateControlIds(int index); + /** + * + * + *
+   * Condition do not associate specifications. If multiple do not associate
+   * conditions match, all matching do not associate controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string do_not_associate_control_ids = 13; + * + * @param index The index of the value to return. + * @return The bytes of the doNotAssociateControlIds at the given index. + */ + com.google.protobuf.ByteString getDoNotAssociateControlIdsBytes(int index); + + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return A list containing the replacementControlIds. + */ + java.util.List getReplacementControlIdsList(); + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @return The count of replacementControlIds. + */ + int getReplacementControlIdsCount(); + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the element to return. + * @return The replacementControlIds at the given index. + */ + java.lang.String getReplacementControlIds(int index); + /** + * + * + *
+   * Condition replacement specifications.
+   * - Applied according to the order in the list.
+   * - A previously replaced term can not be re-replaced.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string replacement_control_ids = 14; + * + * @param index The index of the value to return. + * @return The bytes of the replacementControlIds at the given index. + */ + com.google.protobuf.ByteString getReplacementControlIdsBytes(int index); + + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return A list containing the ignoreControlIds. + */ + java.util.List getIgnoreControlIdsList(); + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @return The count of ignoreControlIds. + */ + int getIgnoreControlIdsCount(); + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the element to return. + * @return The ignoreControlIds at the given index. + */ + java.lang.String getIgnoreControlIds(int index); + /** + * + * + *
+   * Condition ignore specifications. If multiple ignore
+   * conditions match, all matching ignore controls in the list will
+   * execute.
+   * - Order does not matter.
+   * - Maximum number of specifications is 100.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * 
+ * + * repeated string ignore_control_ids = 15; + * + * @param index The index of the value to return. + * @return The bytes of the ignoreControlIds at the given index. + */ + com.google.protobuf.ByteString getIgnoreControlIdsBytes(int index); + + /** + * + * + *
+   * How much diversity to use in recommendation model results e.g.
+   * 'medium-diversity' or 'high-diversity'. Currently supported values:
+   * * 'no-diversity'
+   * * 'low-diversity'
+   * * 'medium-diversity'
+   * * 'high-diversity'
+   * * 'auto-diversity'
+   * If not specified, we choose default based on recommendation model
+   * type. Default value: 'no-diversity'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string diversity_level = 8; + * + * @return The diversityLevel. + */ + java.lang.String getDiversityLevel(); + /** + * + * + *
+   * How much diversity to use in recommendation model results e.g.
+   * 'medium-diversity' or 'high-diversity'. Currently supported values:
+   * * 'no-diversity'
+   * * 'low-diversity'
+   * * 'medium-diversity'
+   * * 'high-diversity'
+   * * 'auto-diversity'
+   * If not specified, we choose default based on recommendation model
+   * type. Default value: 'no-diversity'.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string diversity_level = 8; + * + * @return The bytes for diversityLevel. + */ + com.google.protobuf.ByteString getDiversityLevelBytes(); + + /** + * + * + *
+   * Whether to add additional category filters on the 'similar-items' model.
+   * If not specified, we enable it by default.
+   *  Allowed values are:
+   * * 'no-category-match': No additional filtering of original results from
+   *   the model and the customer's filters.
+   * * 'relaxed-category-match': Only keep results with categories that match
+   *   at least one item categories in the PredictRequests's context item.
+   *   * If customer also sends filters in the PredictRequest, then the results
+   *   will satisfy both conditions (user given and category match).
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string enable_category_filter_level = 16; + * + * @return The enableCategoryFilterLevel. + */ + java.lang.String getEnableCategoryFilterLevel(); + /** + * + * + *
+   * Whether to add additional category filters on the 'similar-items' model.
+   * If not specified, we enable it by default.
+   *  Allowed values are:
+   * * 'no-category-match': No additional filtering of original results from
+   *   the model and the customer's filters.
+   * * 'relaxed-category-match': Only keep results with categories that match
+   *   at least one item categories in the PredictRequests's context item.
+   *   * If customer also sends filters in the PredictRequest, then the results
+   *   will satisfy both conditions (user given and category match).
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
+   * 
+ * + * string enable_category_filter_level = 16; + * + * @return The bytes for enableCategoryFilterLevel. + */ + com.google.protobuf.ByteString getEnableCategoryFilterLevelBytes(); + + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return Whether the personalizationSpec field is set. + */ + boolean hasPersonalizationSpec(); + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + * + * @return The personalizationSpec. + */ + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpec getPersonalizationSpec(); + /** + * + * + *
+   * The specification for personalization spec.
+   * Can only be set if
+   * [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
+   * [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH].
+   * Notice that if both
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
+   * and
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * are set.
+   * [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
+   * will override
+   * [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
+   * 
+ * + * .google.cloud.retail.v2.SearchRequest.PersonalizationSpec personalization_spec = 21; + * + */ + com.google.cloud.retail.v2.SearchRequest.PersonalizationSpecOrBuilder + getPersonalizationSpecOrBuilder(); + + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the solutionTypes. + */ + java.util.List getSolutionTypesList(); + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return The count of solutionTypes. + */ + int getSolutionTypesCount(); + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the element to return. + * @return The solutionTypes at the given index. + */ + com.google.cloud.retail.v2.SolutionType getSolutionTypes(int index); + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @return A list containing the enum numeric values on the wire for solutionTypes. + */ + java.util.List getSolutionTypesValueList(); + /** + * + * + *
+   * Required. Immutable. Specifies the solution types that a serving config can
+   * be associated with. Currently we support setting only one type of solution.
+   * 
+ * + * + * repeated .google.cloud.retail.v2.SolutionType solution_types = 19 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of solutionTypes at the given index. + */ + int getSolutionTypesValue(int index); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigProto.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigProto.java new file mode 100644 index 000000000000..d9dac76e1fb0 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/ServingConfigProto.java @@ -0,0 +1,123 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config.proto + +package com.google.cloud.retail.v2; + +public final class ServingConfigProto { + private ServingConfigProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_retail_v2_ServingConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_retail_v2_ServingConfig_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n+google/cloud/retail/v2/serving_config." + + "proto\022\026google.cloud.retail.v2\032\037google/ap" + + "i/field_behavior.proto\032\031google/api/resou" + + "rce.proto\032#google/cloud/retail/v2/common" + + ".proto\032+google/cloud/retail/v2/search_se" + + "rvice.proto\"\305\006\n\rServingConfig\022\021\n\004name\030\001 " + + "\001(\tB\003\340A\005\022\031\n\014display_name\030\002 \001(\tB\003\340A\002\022\020\n\010m" + + "odel_id\030\003 \001(\t\022\035\n\025price_reranking_level\030\004" + + " \001(\t\022\031\n\021facet_control_ids\030\005 \003(\t\022R\n\022dynam" + + "ic_facet_spec\030\006 \001(\01326.google.cloud.retai" + + "l.v2.SearchRequest.DynamicFacetSpec\022\031\n\021b" + + "oost_control_ids\030\007 \003(\t\022\032\n\022filter_control" + + "_ids\030\t \003(\t\022\034\n\024redirect_control_ids\030\n \003(\t" + + "\022#\n\033twoway_synonyms_control_ids\030\022 \003(\t\022#\n" + + "\033oneway_synonyms_control_ids\030\014 \003(\t\022$\n\034do" + + "_not_associate_control_ids\030\r \003(\t\022\037\n\027repl" + + "acement_control_ids\030\016 \003(\t\022\032\n\022ignore_cont" + + "rol_ids\030\017 \003(\t\022\027\n\017diversity_level\030\010 \001(\t\022$" + + "\n\034enable_category_filter_level\030\020 \001(\t\022W\n\024" + + "personalization_spec\030\025 \001(\01329.google.clou" + + "d.retail.v2.SearchRequest.Personalizatio" + + "nSpec\022D\n\016solution_types\030\023 \003(\0162$.google.c" + + "loud.retail.v2.SolutionTypeB\006\340A\002\340A\005:\205\001\352A" + + "\201\001\n#retail.googleapis.com/ServingConfig\022" + + "Zprojects/{project}/locations/{location}" + + "/catalogs/{catalog}/servingConfigs/{serv" + + "ing_config}B\307\001\n\032com.google.cloud.retail." + + "v2B\022ServingConfigProtoP\001Z\n\017serving_configs\030\001 \003(\0132%" + + ".google.cloud.retail.v2.ServingConfig\022\027\n" + + "\017next_page_token\030\002 \001(\t\"q\n\021AddControlRequ" + + "est\022C\n\016serving_config\030\001 \001(\tB+\340A\002\372A%\n#ret" + + "ail.googleapis.com/ServingConfig\022\027\n\ncont" + + "rol_id\030\002 \001(\tB\003\340A\002\"t\n\024RemoveControlReques" + + "t\022C\n\016serving_config\030\001 \001(\tB+\340A\002\372A%\n#retai" + + "l.googleapis.com/ServingConfig\022\027\n\ncontro" + + "l_id\030\002 \001(\tB\003\340A\0022\262\014\n\024ServingConfigService" + + "\022\361\001\n\023CreateServingConfig\0222.google.cloud." + + "retail.v2.CreateServingConfigRequest\032%.g" + + "oogle.cloud.retail.v2.ServingConfig\"\177\202\323\344" + + "\223\002O\"=/v2/{parent=projects/*/locations/*/" + + "catalogs/*}/servingConfigs:\016serving_conf" + + "ig\332A\'parent,serving_config,serving_confi" + + "g_id\022\257\001\n\023DeleteServingConfig\0222.google.cl" + + "oud.retail.v2.DeleteServingConfigRequest" + + "\032\026.google.protobuf.Empty\"L\202\323\344\223\002?*=/v2/{n" + + "ame=projects/*/locations/*/catalogs/*/se" + + "rvingConfigs/*}\332A\004name\022\364\001\n\023UpdateServing" + + "Config\0222.google.cloud.retail.v2.UpdateSe" + + "rvingConfigRequest\032%.google.cloud.retail" + + ".v2.ServingConfig\"\201\001\202\323\344\223\002^2L/v2/{serving" + + "_config.name=projects/*/locations/*/cata" + + "logs/*/servingConfigs/*}:\016serving_config" + + "\332A\032serving_config,update_mask\022\270\001\n\020GetSer" + + "vingConfig\022/.google.cloud.retail.v2.GetS" + + "ervingConfigRequest\032%.google.cloud.retai" + + "l.v2.ServingConfig\"L\202\323\344\223\002?\022=/v2/{name=pr" + + "ojects/*/locations/*/catalogs/*/servingC" + + "onfigs/*}\332A\004name\022\313\001\n\022ListServingConfigs\022" + + "1.google.cloud.retail.v2.ListServingConf" + + "igsRequest\0322.google.cloud.retail.v2.List" + + "ServingConfigsResponse\"N\202\323\344\223\002?\022=/v2/{par" + + "ent=projects/*/locations/*/catalogs/*}/s" + + "ervingConfigs\332A\006parent\022\316\001\n\nAddControl\022)." + + "google.cloud.retail.v2.AddControlRequest" + + "\032%.google.cloud.retail.v2.ServingConfig\"" + + "n\202\323\344\223\002W\"R/v2/{serving_config=projects/*/" + + "locations/*/catalogs/*/servingConfigs/*}" + + ":addControl:\001*\332A\016serving_config\022\327\001\n\rRemo" + + "veControl\022,.google.cloud.retail.v2.Remov" + + "eControlRequest\032%.google.cloud.retail.v2" + + ".ServingConfig\"q\202\323\344\223\002Z\"U/v2/{serving_con" + + "fig=projects/*/locations/*/catalogs/*/se" + + "rvingConfigs/*}:removeControl:\001*\332A\016servi" + + "ng_config\032I\312A\025retail.googleapis.com\322A.ht" + + "tps://www.googleapis.com/auth/cloud-plat" + + "formB\316\001\n\032com.google.cloud.retail.v2B\031Ser" + + "vingConfigServiceProtoP\001Z + * The type of solution. + *
+ * + * Protobuf enum {@code google.cloud.retail.v2.SolutionType} + */ +public enum SolutionType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Default value.
+   * 
+ * + * SOLUTION_TYPE_UNSPECIFIED = 0; + */ + SOLUTION_TYPE_UNSPECIFIED(0), + /** + * + * + *
+   * Used for Recommendations AI.
+   * 
+ * + * SOLUTION_TYPE_RECOMMENDATION = 1; + */ + SOLUTION_TYPE_RECOMMENDATION(1), + /** + * + * + *
+   * Used for Retail Search.
+   * 
+ * + * SOLUTION_TYPE_SEARCH = 2; + */ + SOLUTION_TYPE_SEARCH(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Default value.
+   * 
+ * + * SOLUTION_TYPE_UNSPECIFIED = 0; + */ + public static final int SOLUTION_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * Used for Recommendations AI.
+   * 
+ * + * SOLUTION_TYPE_RECOMMENDATION = 1; + */ + public static final int SOLUTION_TYPE_RECOMMENDATION_VALUE = 1; + /** + * + * + *
+   * Used for Retail Search.
+   * 
+ * + * SOLUTION_TYPE_SEARCH = 2; + */ + public static final int SOLUTION_TYPE_SEARCH_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SolutionType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static SolutionType forNumber(int value) { + switch (value) { + case 0: + return SOLUTION_TYPE_UNSPECIFIED; + case 1: + return SOLUTION_TYPE_RECOMMENDATION; + case 2: + return SOLUTION_TYPE_SEARCH; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SolutionType findValueByNumber(int number) { + return SolutionType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.retail.v2.CommonProto.getDescriptor().getEnumTypes().get(1); + } + + private static final SolutionType[] VALUES = values(); + + public static SolutionType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private SolutionType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.retail.v2.SolutionType) +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequest.java new file mode 100644 index 000000000000..439e5a00e967 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequest.java @@ -0,0 +1,1097 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateAttributesConfigRequest} + */ +public final class UpdateAttributesConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateAttributesConfigRequest) + UpdateAttributesConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateAttributesConfigRequest.newBuilder() to construct. + private UpdateAttributesConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateAttributesConfigRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateAttributesConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateAttributesConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.AttributesConfig.Builder subBuilder = null; + if (attributesConfig_ != null) { + subBuilder = attributesConfig_.toBuilder(); + } + attributesConfig_ = + input.readMessage( + com.google.cloud.retail.v2.AttributesConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(attributesConfig_); + attributesConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateAttributesConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateAttributesConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest.class, + com.google.cloud.retail.v2.UpdateAttributesConfigRequest.Builder.class); + } + + public static final int ATTRIBUTES_CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.AttributesConfig attributesConfig_; + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the attributesConfig field is set. + */ + @java.lang.Override + public boolean hasAttributesConfig() { + return attributesConfig_ != null; + } + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The attributesConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfig getAttributesConfig() { + return attributesConfig_ == null + ? com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance() + : attributesConfig_; + } + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.AttributesConfigOrBuilder getAttributesConfigOrBuilder() { + return getAttributesConfig(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (attributesConfig_ != null) { + output.writeMessage(1, getAttributesConfig()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (attributesConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getAttributesConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateAttributesConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateAttributesConfigRequest other = + (com.google.cloud.retail.v2.UpdateAttributesConfigRequest) obj; + + if (hasAttributesConfig() != other.hasAttributesConfig()) return false; + if (hasAttributesConfig()) { + if (!getAttributesConfig().equals(other.getAttributesConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasAttributesConfig()) { + hash = (37 * hash) + ATTRIBUTES_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAttributesConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateAttributesConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateAttributesConfigRequest) + com.google.cloud.retail.v2.UpdateAttributesConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateAttributesConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateAttributesConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateAttributesConfigRequest.class, + com.google.cloud.retail.v2.UpdateAttributesConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateAttributesConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (attributesConfigBuilder_ == null) { + attributesConfig_ = null; + } else { + attributesConfig_ = null; + attributesConfigBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateAttributesConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateAttributesConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateAttributesConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateAttributesConfigRequest build() { + com.google.cloud.retail.v2.UpdateAttributesConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateAttributesConfigRequest buildPartial() { + com.google.cloud.retail.v2.UpdateAttributesConfigRequest result = + new com.google.cloud.retail.v2.UpdateAttributesConfigRequest(this); + if (attributesConfigBuilder_ == null) { + result.attributesConfig_ = attributesConfig_; + } else { + result.attributesConfig_ = attributesConfigBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateAttributesConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateAttributesConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateAttributesConfigRequest other) { + if (other == com.google.cloud.retail.v2.UpdateAttributesConfigRequest.getDefaultInstance()) + return this; + if (other.hasAttributesConfig()) { + mergeAttributesConfig(other.getAttributesConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateAttributesConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.UpdateAttributesConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.AttributesConfig attributesConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.AttributesConfig, + com.google.cloud.retail.v2.AttributesConfig.Builder, + com.google.cloud.retail.v2.AttributesConfigOrBuilder> + attributesConfigBuilder_; + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the attributesConfig field is set. + */ + public boolean hasAttributesConfig() { + return attributesConfigBuilder_ != null || attributesConfig_ != null; + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The attributesConfig. + */ + public com.google.cloud.retail.v2.AttributesConfig getAttributesConfig() { + if (attributesConfigBuilder_ == null) { + return attributesConfig_ == null + ? com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance() + : attributesConfig_; + } else { + return attributesConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAttributesConfig(com.google.cloud.retail.v2.AttributesConfig value) { + if (attributesConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + attributesConfig_ = value; + onChanged(); + } else { + attributesConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAttributesConfig( + com.google.cloud.retail.v2.AttributesConfig.Builder builderForValue) { + if (attributesConfigBuilder_ == null) { + attributesConfig_ = builderForValue.build(); + onChanged(); + } else { + attributesConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeAttributesConfig(com.google.cloud.retail.v2.AttributesConfig value) { + if (attributesConfigBuilder_ == null) { + if (attributesConfig_ != null) { + attributesConfig_ = + com.google.cloud.retail.v2.AttributesConfig.newBuilder(attributesConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + attributesConfig_ = value; + } + onChanged(); + } else { + attributesConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearAttributesConfig() { + if (attributesConfigBuilder_ == null) { + attributesConfig_ = null; + onChanged(); + } else { + attributesConfig_ = null; + attributesConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.AttributesConfig.Builder getAttributesConfigBuilder() { + + onChanged(); + return getAttributesConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.AttributesConfigOrBuilder getAttributesConfigOrBuilder() { + if (attributesConfigBuilder_ != null) { + return attributesConfigBuilder_.getMessageOrBuilder(); + } else { + return attributesConfig_ == null + ? com.google.cloud.retail.v2.AttributesConfig.getDefaultInstance() + : attributesConfig_; + } + } + /** + * + * + *
+     * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+     * to update.
+     * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.AttributesConfig, + com.google.cloud.retail.v2.AttributesConfig.Builder, + com.google.cloud.retail.v2.AttributesConfigOrBuilder> + getAttributesConfigFieldBuilder() { + if (attributesConfigBuilder_ == null) { + attributesConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.AttributesConfig, + com.google.cloud.retail.v2.AttributesConfig.Builder, + com.google.cloud.retail.v2.AttributesConfigOrBuilder>( + getAttributesConfig(), getParentForChildren(), isClean()); + attributesConfig_ = null; + } + return attributesConfigBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+     * following is the only supported field:
+     * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateAttributesConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateAttributesConfigRequest) + private static final com.google.cloud.retail.v2.UpdateAttributesConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateAttributesConfigRequest(); + } + + public static com.google.cloud.retail.v2.UpdateAttributesConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateAttributesConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateAttributesConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateAttributesConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequestOrBuilder.java new file mode 100644 index 000000000000..75effc89c018 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateAttributesConfigRequestOrBuilder.java @@ -0,0 +1,116 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateAttributesConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateAttributesConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the attributesConfig field is set. + */ + boolean hasAttributesConfig(); + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The attributesConfig. + */ + com.google.cloud.retail.v2.AttributesConfig getAttributesConfig(); + /** + * + * + *
+   * Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
+   * to update.
+   * 
+ * + * + * .google.cloud.retail.v2.AttributesConfig attributes_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.AttributesConfigOrBuilder getAttributesConfigOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
+   * following is the only supported field:
+   * * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequest.java new file mode 100644 index 000000000000..07ee636907c9 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequest.java @@ -0,0 +1,1193 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for
+ * [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateCompletionConfigRequest} + */ +public final class UpdateCompletionConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateCompletionConfigRequest) + UpdateCompletionConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateCompletionConfigRequest.newBuilder() to construct. + private UpdateCompletionConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateCompletionConfigRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateCompletionConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateCompletionConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.CompletionConfig.Builder subBuilder = null; + if (completionConfig_ != null) { + subBuilder = completionConfig_.toBuilder(); + } + completionConfig_ = + input.readMessage( + com.google.cloud.retail.v2.CompletionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(completionConfig_); + completionConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCompletionConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCompletionConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest.class, + com.google.cloud.retail.v2.UpdateCompletionConfigRequest.Builder.class); + } + + public static final int COMPLETION_CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.CompletionConfig completionConfig_; + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the completionConfig field is set. + */ + @java.lang.Override + public boolean hasCompletionConfig() { + return completionConfig_ != null; + } + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The completionConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfig getCompletionConfig() { + return completionConfig_ == null + ? com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance() + : completionConfig_; + } + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.CompletionConfigOrBuilder getCompletionConfigOrBuilder() { + return getCompletionConfig(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (completionConfig_ != null) { + output.writeMessage(1, getCompletionConfig()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (completionConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCompletionConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateCompletionConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateCompletionConfigRequest other = + (com.google.cloud.retail.v2.UpdateCompletionConfigRequest) obj; + + if (hasCompletionConfig() != other.hasCompletionConfig()) return false; + if (hasCompletionConfig()) { + if (!getCompletionConfig().equals(other.getCompletionConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCompletionConfig()) { + hash = (37 * hash) + COMPLETION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getCompletionConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for
+   * [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateCompletionConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateCompletionConfigRequest) + com.google.cloud.retail.v2.UpdateCompletionConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCompletionConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCompletionConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateCompletionConfigRequest.class, + com.google.cloud.retail.v2.UpdateCompletionConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateCompletionConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (completionConfigBuilder_ == null) { + completionConfig_ = null; + } else { + completionConfig_ = null; + completionConfigBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.CatalogServiceProto + .internal_static_google_cloud_retail_v2_UpdateCompletionConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCompletionConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateCompletionConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCompletionConfigRequest build() { + com.google.cloud.retail.v2.UpdateCompletionConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCompletionConfigRequest buildPartial() { + com.google.cloud.retail.v2.UpdateCompletionConfigRequest result = + new com.google.cloud.retail.v2.UpdateCompletionConfigRequest(this); + if (completionConfigBuilder_ == null) { + result.completionConfig_ = completionConfig_; + } else { + result.completionConfig_ = completionConfigBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateCompletionConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateCompletionConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateCompletionConfigRequest other) { + if (other == com.google.cloud.retail.v2.UpdateCompletionConfigRequest.getDefaultInstance()) + return this; + if (other.hasCompletionConfig()) { + mergeCompletionConfig(other.getCompletionConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateCompletionConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.UpdateCompletionConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.CompletionConfig completionConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionConfig, + com.google.cloud.retail.v2.CompletionConfig.Builder, + com.google.cloud.retail.v2.CompletionConfigOrBuilder> + completionConfigBuilder_; + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the completionConfig field is set. + */ + public boolean hasCompletionConfig() { + return completionConfigBuilder_ != null || completionConfig_ != null; + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The completionConfig. + */ + public com.google.cloud.retail.v2.CompletionConfig getCompletionConfig() { + if (completionConfigBuilder_ == null) { + return completionConfig_ == null + ? com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance() + : completionConfig_; + } else { + return completionConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCompletionConfig(com.google.cloud.retail.v2.CompletionConfig value) { + if (completionConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + completionConfig_ = value; + onChanged(); + } else { + completionConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCompletionConfig( + com.google.cloud.retail.v2.CompletionConfig.Builder builderForValue) { + if (completionConfigBuilder_ == null) { + completionConfig_ = builderForValue.build(); + onChanged(); + } else { + completionConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCompletionConfig(com.google.cloud.retail.v2.CompletionConfig value) { + if (completionConfigBuilder_ == null) { + if (completionConfig_ != null) { + completionConfig_ = + com.google.cloud.retail.v2.CompletionConfig.newBuilder(completionConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + completionConfig_ = value; + } + onChanged(); + } else { + completionConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCompletionConfig() { + if (completionConfigBuilder_ == null) { + completionConfig_ = null; + onChanged(); + } else { + completionConfig_ = null; + completionConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CompletionConfig.Builder getCompletionConfigBuilder() { + + onChanged(); + return getCompletionConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.CompletionConfigOrBuilder getCompletionConfigOrBuilder() { + if (completionConfigBuilder_ != null) { + return completionConfigBuilder_.getMessageOrBuilder(); + } else { + return completionConfig_ == null + ? com.google.cloud.retail.v2.CompletionConfig.getDefaultInstance() + : completionConfig_; + } + } + /** + * + * + *
+     * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+     * to update.
+     * If the caller does not have permission to update the
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+     * PERMISSION_DENIED error is returned.
+     * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+     * update does not exist, a NOT_FOUND error is returned.
+     * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionConfig, + com.google.cloud.retail.v2.CompletionConfig.Builder, + com.google.cloud.retail.v2.CompletionConfigOrBuilder> + getCompletionConfigFieldBuilder() { + if (completionConfigBuilder_ == null) { + completionConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.CompletionConfig, + com.google.cloud.retail.v2.CompletionConfig.Builder, + com.google.cloud.retail.v2.CompletionConfigOrBuilder>( + getCompletionConfig(), getParentForChildren(), isClean()); + completionConfig_ = null; + } + return completionConfigBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+     * following are the only supported fields:
+     * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+     * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+     * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+     * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateCompletionConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateCompletionConfigRequest) + private static final com.google.cloud.retail.v2.UpdateCompletionConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateCompletionConfigRequest(); + } + + public static com.google.cloud.retail.v2.UpdateCompletionConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateCompletionConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCompletionConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateCompletionConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequestOrBuilder.java new file mode 100644 index 000000000000..e6df9b363e76 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateCompletionConfigRequestOrBuilder.java @@ -0,0 +1,140 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/catalog_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateCompletionConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateCompletionConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the completionConfig field is set. + */ + boolean hasCompletionConfig(); + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The completionConfig. + */ + com.google.cloud.retail.v2.CompletionConfig getCompletionConfig(); + /** + * + * + *
+   * Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
+   * to update.
+   * If the caller does not have permission to update the
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
+   * PERMISSION_DENIED error is returned.
+   * If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
+   * update does not exist, a NOT_FOUND error is returned.
+   * 
+ * + * + * .google.cloud.retail.v2.CompletionConfig completion_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.CompletionConfigOrBuilder getCompletionConfigOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
+   * following are the only supported fields:
+   * * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
+   * * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
+   * * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
+   * * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequest.java new file mode 100644 index 000000000000..cecbfe8f3a21 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequest.java @@ -0,0 +1,1063 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for UpdateControl method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateControlRequest} + */ +public final class UpdateControlRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateControlRequest) + UpdateControlRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateControlRequest.newBuilder() to construct. + private UpdateControlRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateControlRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateControlRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateControlRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.Control.Builder subBuilder = null; + if (control_ != null) { + subBuilder = control_.toBuilder(); + } + control_ = + input.readMessage(com.google.cloud.retail.v2.Control.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(control_); + control_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_UpdateControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_UpdateControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateControlRequest.class, + com.google.cloud.retail.v2.UpdateControlRequest.Builder.class); + } + + public static final int CONTROL_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.Control control_; + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + @java.lang.Override + public boolean hasControl() { + return control_ != null; + } + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + @java.lang.Override + public com.google.cloud.retail.v2.Control getControl() { + return control_ == null ? com.google.cloud.retail.v2.Control.getDefaultInstance() : control_; + } + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder() { + return getControl(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (control_ != null) { + output.writeMessage(1, getControl()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (control_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getControl()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateControlRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateControlRequest other = + (com.google.cloud.retail.v2.UpdateControlRequest) obj; + + if (hasControl() != other.hasControl()) return false; + if (hasControl()) { + if (!getControl().equals(other.getControl())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasControl()) { + hash = (37 * hash) + CONTROL_FIELD_NUMBER; + hash = (53 * hash) + getControl().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.retail.v2.UpdateControlRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for UpdateControl method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateControlRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateControlRequest) + com.google.cloud.retail.v2.UpdateControlRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_UpdateControlRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_UpdateControlRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateControlRequest.class, + com.google.cloud.retail.v2.UpdateControlRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateControlRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (controlBuilder_ == null) { + control_ = null; + } else { + control_ = null; + controlBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ControlServiceProto + .internal_static_google_cloud_retail_v2_UpdateControlRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateControlRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateControlRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateControlRequest build() { + com.google.cloud.retail.v2.UpdateControlRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateControlRequest buildPartial() { + com.google.cloud.retail.v2.UpdateControlRequest result = + new com.google.cloud.retail.v2.UpdateControlRequest(this); + if (controlBuilder_ == null) { + result.control_ = control_; + } else { + result.control_ = controlBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateControlRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateControlRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateControlRequest other) { + if (other == com.google.cloud.retail.v2.UpdateControlRequest.getDefaultInstance()) + return this; + if (other.hasControl()) { + mergeControl(other.getControl()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateControlRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.retail.v2.UpdateControlRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.Control control_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + controlBuilder_; + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + public boolean hasControl() { + return controlBuilder_ != null || control_ != null; + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + public com.google.cloud.retail.v2.Control getControl() { + if (controlBuilder_ == null) { + return control_ == null + ? com.google.cloud.retail.v2.Control.getDefaultInstance() + : control_; + } else { + return controlBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setControl(com.google.cloud.retail.v2.Control value) { + if (controlBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + control_ = value; + onChanged(); + } else { + controlBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setControl(com.google.cloud.retail.v2.Control.Builder builderForValue) { + if (controlBuilder_ == null) { + control_ = builderForValue.build(); + onChanged(); + } else { + controlBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeControl(com.google.cloud.retail.v2.Control value) { + if (controlBuilder_ == null) { + if (control_ != null) { + control_ = + com.google.cloud.retail.v2.Control.newBuilder(control_) + .mergeFrom(value) + .buildPartial(); + } else { + control_ = value; + } + onChanged(); + } else { + controlBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearControl() { + if (controlBuilder_ == null) { + control_ = null; + onChanged(); + } else { + control_ = null; + controlBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.Control.Builder getControlBuilder() { + + onChanged(); + return getControlFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder() { + if (controlBuilder_ != null) { + return controlBuilder_.getMessageOrBuilder(); + } else { + return control_ == null + ? com.google.cloud.retail.v2.Control.getDefaultInstance() + : control_; + } + } + /** + * + * + *
+     * Required. The Control to update.
+     * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder> + getControlFieldBuilder() { + if (controlBuilder_ == null) { + controlBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.Control, + com.google.cloud.retail.v2.Control.Builder, + com.google.cloud.retail.v2.ControlOrBuilder>( + getControl(), getParentForChildren(), isClean()); + control_ = null; + } + return controlBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+     * supported:
+     * * [Control.name][google.cloud.retail.v2.Control.name]
+     * If not set or empty, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateControlRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateControlRequest) + private static final com.google.cloud.retail.v2.UpdateControlRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateControlRequest(); + } + + public static com.google.cloud.retail.v2.UpdateControlRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateControlRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateControlRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateControlRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequestOrBuilder.java new file mode 100644 index 000000000000..569d22751f08 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateControlRequestOrBuilder.java @@ -0,0 +1,110 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/control_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateControlRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateControlRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the control field is set. + */ + boolean hasControl(); + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The control. + */ + com.google.cloud.retail.v2.Control getControl(); + /** + * + * + *
+   * Required. The Control to update.
+   * 
+ * + * .google.cloud.retail.v2.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ControlOrBuilder getControlOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [Control][google.cloud.retail.v2.Control] to update. The following are NOT
+   * supported:
+   * * [Control.name][google.cloud.retail.v2.Control.name]
+   * If not set or empty, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequest.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequest.java new file mode 100644 index 000000000000..a7df8c582111 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequest.java @@ -0,0 +1,1081 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +/** + * + * + *
+ * Request for UpdateServingConfig method.
+ * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateServingConfigRequest} + */ +public final class UpdateServingConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UpdateServingConfigRequest) + UpdateServingConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateServingConfigRequest.newBuilder() to construct. + private UpdateServingConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateServingConfigRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateServingConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateServingConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.retail.v2.ServingConfig.Builder subBuilder = null; + if (servingConfig_ != null) { + subBuilder = servingConfig_.toBuilder(); + } + servingConfig_ = + input.readMessage( + com.google.cloud.retail.v2.ServingConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(servingConfig_); + servingConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_UpdateServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_UpdateServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateServingConfigRequest.class, + com.google.cloud.retail.v2.UpdateServingConfigRequest.Builder.class); + } + + public static final int SERVING_CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.retail.v2.ServingConfig servingConfig_; + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + @java.lang.Override + public boolean hasServingConfig() { + return servingConfig_ != null; + } + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfig getServingConfig() { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder() { + return getServingConfig(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (servingConfig_ != null) { + output.writeMessage(1, getServingConfig()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (servingConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getServingConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.retail.v2.UpdateServingConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.retail.v2.UpdateServingConfigRequest other = + (com.google.cloud.retail.v2.UpdateServingConfigRequest) obj; + + if (hasServingConfig() != other.hasServingConfig()) return false; + if (hasServingConfig()) { + if (!getServingConfig().equals(other.getServingConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasServingConfig()) { + hash = (37 * hash) + SERVING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getServingConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.retail.v2.UpdateServingConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for UpdateServingConfig method.
+   * 
+ * + * Protobuf type {@code google.cloud.retail.v2.UpdateServingConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UpdateServingConfigRequest) + com.google.cloud.retail.v2.UpdateServingConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_UpdateServingConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_UpdateServingConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.retail.v2.UpdateServingConfigRequest.class, + com.google.cloud.retail.v2.UpdateServingConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.retail.v2.UpdateServingConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (servingConfigBuilder_ == null) { + servingConfig_ = null; + } else { + servingConfig_ = null; + servingConfigBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.retail.v2.ServingConfigServiceProto + .internal_static_google_cloud_retail_v2_UpdateServingConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateServingConfigRequest getDefaultInstanceForType() { + return com.google.cloud.retail.v2.UpdateServingConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateServingConfigRequest build() { + com.google.cloud.retail.v2.UpdateServingConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateServingConfigRequest buildPartial() { + com.google.cloud.retail.v2.UpdateServingConfigRequest result = + new com.google.cloud.retail.v2.UpdateServingConfigRequest(this); + if (servingConfigBuilder_ == null) { + result.servingConfig_ = servingConfig_; + } else { + result.servingConfig_ = servingConfigBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.retail.v2.UpdateServingConfigRequest) { + return mergeFrom((com.google.cloud.retail.v2.UpdateServingConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.retail.v2.UpdateServingConfigRequest other) { + if (other == com.google.cloud.retail.v2.UpdateServingConfigRequest.getDefaultInstance()) + return this; + if (other.hasServingConfig()) { + mergeServingConfig(other.getServingConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.retail.v2.UpdateServingConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.retail.v2.UpdateServingConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.retail.v2.ServingConfig servingConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + servingConfigBuilder_; + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + public boolean hasServingConfig() { + return servingConfigBuilder_ != null || servingConfig_ != null; + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + public com.google.cloud.retail.v2.ServingConfig getServingConfig() { + if (servingConfigBuilder_ == null) { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } else { + return servingConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setServingConfig(com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + servingConfig_ = value; + onChanged(); + } else { + servingConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setServingConfig( + com.google.cloud.retail.v2.ServingConfig.Builder builderForValue) { + if (servingConfigBuilder_ == null) { + servingConfig_ = builderForValue.build(); + onChanged(); + } else { + servingConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeServingConfig(com.google.cloud.retail.v2.ServingConfig value) { + if (servingConfigBuilder_ == null) { + if (servingConfig_ != null) { + servingConfig_ = + com.google.cloud.retail.v2.ServingConfig.newBuilder(servingConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + servingConfig_ = value; + } + onChanged(); + } else { + servingConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearServingConfig() { + if (servingConfigBuilder_ == null) { + servingConfig_ = null; + onChanged(); + } else { + servingConfig_ = null; + servingConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ServingConfig.Builder getServingConfigBuilder() { + + onChanged(); + return getServingConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder() { + if (servingConfigBuilder_ != null) { + return servingConfigBuilder_.getMessageOrBuilder(); + } else { + return servingConfig_ == null + ? com.google.cloud.retail.v2.ServingConfig.getDefaultInstance() + : servingConfig_; + } + } + /** + * + * + *
+     * Required. The ServingConfig to update.
+     * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder> + getServingConfigFieldBuilder() { + if (servingConfigBuilder_ == null) { + servingConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.retail.v2.ServingConfig, + com.google.cloud.retail.v2.ServingConfig.Builder, + com.google.cloud.retail.v2.ServingConfigOrBuilder>( + getServingConfig(), getParentForChildren(), isClean()); + servingConfig_ = null; + } + return servingConfigBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Indicates which fields in the provided
+     * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+     * following are NOT supported:
+     * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+     * If not set, all supported fields are updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UpdateServingConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UpdateServingConfigRequest) + private static final com.google.cloud.retail.v2.UpdateServingConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UpdateServingConfigRequest(); + } + + public static com.google.cloud.retail.v2.UpdateServingConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateServingConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateServingConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.retail.v2.UpdateServingConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequestOrBuilder.java b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequestOrBuilder.java new file mode 100644 index 000000000000..56023240c4b3 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/java/com/google/cloud/retail/v2/UpdateServingConfigRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/retail/v2/serving_config_service.proto + +package com.google.cloud.retail.v2; + +public interface UpdateServingConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.UpdateServingConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the servingConfig field is set. + */ + boolean hasServingConfig(); + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The servingConfig. + */ + com.google.cloud.retail.v2.ServingConfig getServingConfig(); + /** + * + * + *
+   * Required. The ServingConfig to update.
+   * 
+ * + * + * .google.cloud.retail.v2.ServingConfig serving_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.retail.v2.ServingConfigOrBuilder getServingConfigOrBuilder(); + + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Indicates which fields in the provided
+   * [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
+   * following are NOT supported:
+   * * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
+   * If not set, all supported fields are updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto index 119afaf3697a..0e1b85f6af08 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog.proto @@ -18,6 +18,8 @@ package google.cloud.retail.v2; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; @@ -82,6 +84,244 @@ message ProductLevelConfig { string merchant_center_product_id_field = 2; } +// Catalog level attribute config for an attribute. For example, if customers +// want to enable/disable facet for a specific attribute. +message CatalogAttribute { + // The type of an attribute. + enum AttributeType { + // The type of the attribute is unknown. + // + // Used when type cannot be derived from attribute that is not + // [in_use][google.cloud.retail.v2.CatalogAttribute.in_use]. + UNKNOWN = 0; + + // Textual attribute. + TEXTUAL = 1; + + // Numerical attribute. + NUMERICAL = 2; + } + + // The status of the indexable option of a catalog attribute. + enum IndexableOption { + // Value used when unset. Defaults to + // [INDEXABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED]. + INDEXABLE_OPTION_UNSPECIFIED = 0; + + // Indexable option enabled for an attribute. + INDEXABLE_ENABLED = 1; + + // Indexable option disabled for an attribute. + INDEXABLE_DISABLED = 2; + } + + // The status of the dynamic facetable option of a catalog attribute. + enum DynamicFacetableOption { + // Value used when unset. Defaults to + // [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED]. + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + + // Dynamic facetable option enabled for an attribute. + DYNAMIC_FACETABLE_ENABLED = 1; + + // Dynamic facetable option disabled for an attribute. + DYNAMIC_FACETABLE_DISABLED = 2; + } + + // The status of the searchable option of a catalog attribute. + enum SearchableOption { + // Value used when unset. Defaults to + // [SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED]. + SEARCHABLE_OPTION_UNSPECIFIED = 0; + + // Searchable option enabled for an attribute. + SEARCHABLE_ENABLED = 1; + + // Searchable option disabled for an attribute. + SEARCHABLE_DISABLED = 2; + } + + // Required. Attribute name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // To be indexable, the attribute name can contain only alpha-numeric + // characters and underscores. For example, an attribute named + // `attributes.abc_xyz` can be indexed, but an attribute named + // `attributes.abc-xyz` cannot be indexed. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Indicates whether this attribute has been used by any + // products. `True` if at least one [Product][google.cloud.retail.v2.Product] + // is using this attribute in + // [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise, + // this field is `False`. + // + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be + // pre-loaded by using + // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute], + // [CatalogService.ImportCatalogAttributes][], or + // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig] + // APIs. This field is `False` for pre-loaded + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s. + // + // Only pre-loaded + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are + // neither in use by products nor predefined can be deleted. + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are + // either in use by products or are predefined cannot be deleted; however, + // their configuration properties will reset to default values upon removal + // request. + // + // After catalog changes, it takes about 10 minutes for this field to update. + bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this attribute. This is derived from the attribute + // in [Product.attributes][google.cloud.retail.v2.Product.attributes]. + AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values + // are indexed so that it can be filtered, faceted, or boosted in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + IndexableOption indexable_option = 5; + + // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic + // facet. Could only be DYNAMIC_FACETABLE_DISABLED if + // [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option] + // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. + DynamicFacetableOption dynamic_facetable_option = 6; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values + // are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + // + // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values + // will not be searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as + // there are no text values associated to numerical attributes. + SearchableOption searchable_option = 7; +} + +// Catalog level attribute config. +message AttributesConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/AttributesConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }; + + // Required. Immutable. The fully qualified resource name of the attribute + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Enable attribute(s) config at catalog level. + // For example, indexable, dynamic_facetable, or searchable for each + // attribute. + // + // The key is catalog attribute's name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // + // The maximum number of catalog attributes allowed in a request is 1000. + map catalog_attributes = 2; + + // Output only. The + // [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used + // for this catalog. + AttributeConfigLevel attribute_config_level = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Catalog level autocomplete config for customers to customize autocomplete +// feature's settings. +message CompletionConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/CompletionConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }; + + // Required. Immutable. Fully qualified name + // `projects/*/locations/*/catalogs/*/completionConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the matching order for autocomplete suggestions, e.g., a query + // consisting of 'sh' with 'out-of-order' specified would suggest "women's + // shoes", whereas a query of 'red s' with 'exact-prefix' specified would + // suggest "red shoes". Currently supported values: + // + // * 'out-of-order' + // * 'exact-prefix' + // + // Default value: 'exact-prefix'. + string matching_order = 2; + + // The maximum number of autocomplete suggestions returned per term. Default + // value is 20. If left unset or set to 0, then will fallback to default + // value. + // + // Value range is 1 to 20. + int32 max_suggestions = 3; + + // The minimum number of characters needed to be typed in order to get + // suggestions. Default value is 2. If left unset or set to 0, then will + // fallback to default value. + // + // Value range is 1 to 20. + int32 min_prefix_length = 4; + + // If set to true, the auto learning function is enabled. Auto learning uses + // user data to generate suggestions using ML techniques. Default value is + // false. Only after enabling auto learning can users use `cloud-retail` + // data in + // [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest]. + bool auto_learning = 11; + + // Output only. The source data for the latest import of the autocomplete + // suggestion phrases. + CompletionDataInputConfig suggestions_input_config = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest suggestion terms + // list import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_suggestions_import_operation = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The source data for the latest import of the autocomplete + // denylist phrases. + CompletionDataInputConfig denylist_input_config = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest denylist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_denylist_import_operation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The source data for the latest import of the autocomplete + // allowlist phrases. + CompletionDataInputConfig allowlist_input_config = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest allowlist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_allowlist_import_operation = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + // The catalog configuration. message Catalog { option (google.api.resource) = { diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto index ec7a23a8d665..4d667d1f9e34 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/catalog_service.proto @@ -110,6 +110,95 @@ service CatalogService { }; option (google.api.method_signature) = "catalog"; } + + // Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + rpc GetCompletionConfig(GetCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + patch: "/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" + body: "completion_config" + }; + option (google.api.method_signature) = "completion_config,update_mask"; + } + + // Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + rpc GetAttributesConfig(GetAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // The catalog attributes in the request will be updated in the catalog, or + // inserted if they do not exist. Existing catalog attributes not included in + // the request will remain unchanged. Attributes that are assigned to + // products, but do not exist at the catalog level, are always included in the + // response. The product attribute is assigned default values for missing + // catalog attribute fields, e.g., searchable and dynamic facetable options. + rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + patch: "/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" + body: "attributes_config" + }; + option (google.api.method_signature) = "attributes_config,update_mask"; + } + + // Adds the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add + // already exists, an ALREADY_EXISTS error is returned. + rpc AddCatalogAttribute(AddCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" + body: "*" + }; + } + + // Removes the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + // remove does not exist, a NOT_FOUND error is returned. + rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" + body: "*" + }; + } + + // Replaces the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the + // catalog attribute with the same + // [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + // replace does not exist, a NOT_FOUND error is returned. + rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" + body: "*" + }; + } } // Request for @@ -244,3 +333,144 @@ message GetDefaultBranchResponse { // field, when this branch was set as default. string note = 3; } + +// Request for +// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig] +// method. +message GetCompletionConfigRequest { + // Required. Full CompletionConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/CompletionConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig] +// method. +message UpdateCompletionConfigRequest { + // Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig] + // to update. + // + // If the caller does not have permission to update the + // [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a + // PERMISSION_DENIED error is returned. + // + // If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to + // update does not exist, a NOT_FOUND error is returned. + CompletionConfig completion_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The + // following are the only supported fields: + // + // * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order] + // * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions] + // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length] + // * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig] +// method. +message GetAttributesConfigRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig] +// method. +message UpdateAttributesConfigRequest { + // Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig] + // to update. + AttributesConfig attributes_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The + // following is the only supported field: + // + // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute] +// method. +message AddCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] + // to add. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute] +// method. +message RemoveCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The attribute name key of the + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove. + string key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute] +// method. +message ReplaceCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The updated + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The + // following are NOT supported: + // + // * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto index 57b054bca813..9864ee7d64f5 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/common.proto @@ -28,6 +28,283 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2"; option ruby_package = "Google::Cloud::Retail::V2"; +// At which level we offer configuration for attributes. +enum AttributeConfigLevel { + // Value used when unset. In this case, server behavior defaults to + // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + + // At this level, we honor the attribute configurations set in + // [Product.attributes][google.cloud.retail.v2.Product.attributes]. + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + + // At this level, we honor the attribute configurations set in + // [CatalogConfig.attribute_configs][]. + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; +} + +// The type of solution. +enum SolutionType { + // Default value. + SOLUTION_TYPE_UNSPECIFIED = 0; + + // Used for Recommendations AI. + SOLUTION_TYPE_RECOMMENDATION = 1; + + // Used for Retail Search. + SOLUTION_TYPE_SEARCH = 2; +} + +// The use case of Cloud Retail Search. +enum SearchSolutionUseCase { + // The value when it's unspecified. In this case, server behavior defaults to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]. + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + + // Search use case. Expects the traffic has a non-empty + // [query][google.cloud.retail.v2.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + + // Browse use case. Expects the traffic has an empty + // [query][google.cloud.retail.v2.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_BROWSE = 2; +} + +// Metadata that is used to define a condition that triggers an action. +// A valid condition must specify at least one of 'query_terms' or +// 'products_filter'. If multiple fields are specified, the condition is met if +// all the fields are satisfied e.g. if a set of query terms and product_filter +// are set, then only items matching the product_filter for requests with a +// query matching the query terms wil get boosted. +message Condition { + // Query terms that we want to match on. + message QueryTerm { + // The value of the term to match on. + // Value cannot be empty. + // Value can have at most 3 terms if specified as a partial match. Each + // space separated string is considered as one term. + // Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not + // allowed for partial match. + string value = 1; + + // Whether this is supposed to be a full or partial match. + bool full_match = 2; + } + + // Used for time-dependent conditions. + // Example: Want to have rule applied for week long sale. + message TimeRange { + // Start of time range. Range is inclusive. + google.protobuf.Timestamp start_time = 1; + + // End of time range. Range is inclusive. + google.protobuf.Timestamp end_time = 2; + } + + // A list (up to 10 entries) of terms to match the query on. If not + // specified, match all queries. + // If many query terms are specified, the condition + // is matched if any of the terms is a match (i.e. using the OR operator). + repeated QueryTerm query_terms = 1; + + // Range of time(s) specifying when Condition is active. + // Condition true if any time range matches. + repeated TimeRange active_time_range = 3; +} + +// A rule is a condition-action pair +// * A condition defines when a rule is to be triggered. +// * An action specifies what occurs on that trigger. +// Currently rules only work for [controls][google.cloud.retail.v2.Control] with +// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]. +message Rule { + // A boost action to apply to results matching condition specified above. + message BoostAction { + // Strength of the condition boost, which must be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 1; + + // The filter can have a max size of 5000 characters. + // An expression which specifies which products to apply an action to. + // The syntax and supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string products_filter = 2; + } + + // * Rule Condition: + // - No + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] + // provided is a global match. + // - 1 or more + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] + // provided are combined with OR operator. + // * Action Input: The request query and filter that are applied to the + // retrieved products, in addition to any filters already provided with the + // SearchRequest. The AND operator is used to combine the query's existing + // filters with the filter rule(s). NOTE: May result in 0 results when + // filters conflict. + // * Action Result: Filters the returned objects to be ONLY those that passed + // the filter. + message FilterAction { + // A filter to apply on the matching condition results. Supported features: + // + // * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set. + // * Filter syntax is identical to + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See + // more + // details at the Retail Search + // [user guide](/retail/search/docs/filter-and-order#filter). + // * To filter products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string filter = 1; + } + + // Redirects a shopper to a specific page. + // + // * Rule Condition: + // - Must specify + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]. + // * Action Input: Request Query + // * Action Result: Redirects shopper to provided uri. + message RedirectAction { + // URL must have length equal or less than 2000 characters. + string redirect_uri = 1; + } + + // Creates a set of terms that will be treated as synonyms of each other. + // Example: synonyms of "sneakers" and "shoes". + // * "sneakers" will use a synonym of "shoes". + // * "shoes" will use a synonym of "sneakers". + message TwowaySynonymsAction { + // Defines a set of synonyms. + // Can specify up to 100 synonyms. + // Must specify at least 2 synonyms. + repeated string synonyms = 1; + } + + // Maps a set of terms to a set of synonyms. + // Set of synonyms will be treated as synonyms of each query term only. + // `query_terms` will not be treated as synonyms of each other. + // Example: "sneakers" will use a synonym of "shoes". + // "shoes" will not use a synonym of "sneakers". + message OnewaySynonymsAction { + // Terms from the search query. + // Will treat synonyms as their synonyms. + // Not themselves synonyms of the synonyms. + // Can specify up to 100 terms. + repeated string query_terms = 3; + + // Defines a set of synonyms. + // Cannot contain duplicates. + // Can specify up to 100 synonyms. + repeated string synonyms = 4; + + // Will be [deprecated = true] post migration; + repeated string oneway_terms = 2; + } + + // Prevents `query_term` from being associated with specified terms during + // search. + // Example: Don't associate "gShoe" and "cheap". + message DoNotAssociateAction { + // Terms from the search query. + // Will not consider do_not_associate_terms for search if in search query. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Cannot contain duplicates or the query term. + // Can specify up to 100 terms. + repeated string do_not_associate_terms = 3; + + // Will be [deprecated = true] post migration; + repeated string terms = 1; + } + + // Replaces a term in the query. Multiple replacement candidates can be + // specified. All `query_terms` will be replaced with the replacement term. + // Example: Replace "gShoe" with "google shoe". + message ReplacementAction { + // Terms from the search query. + // Will be replaced by replacement term. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Term that will be used for replacement. + string replacement_term = 3; + + // Will be [deprecated = true] post migration; + string term = 1; + } + + // Prevents a term in the query from being used in search. + // Example: Don't search for "shoddy". + message IgnoreAction { + // Terms to ignore in the search query. + repeated string ignore_terms = 1; + } + + // An action must be provided. + oneof action { + // A boost action. + BoostAction boost_action = 2; + + // Redirects a shopper to a specific page. + RedirectAction redirect_action = 3; + + // Treats specific term as a synonym with a group of terms. + // Group of terms will not be treated as synonyms with the specific term. + OnewaySynonymsAction oneway_synonyms_action = 6; + + // Prevents term from being associated with other terms. + DoNotAssociateAction do_not_associate_action = 7; + + // Replaces specific terms in the query. + ReplacementAction replacement_action = 8; + + // Ignores specific terms from query during search. + IgnoreAction ignore_action = 9; + + // Filters results. + FilterAction filter_action = 10; + + // Treats a set of terms as synonyms of one another. + TwowaySynonymsAction twoway_synonyms_action = 11; + } + + // Required. The condition that triggers the rule. + // If the condition is empty, the rule will always apply. + Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; +} + // An intended audience of the [Product][google.cloud.retail.v2.Product] for // whom it's sold. message Audience { @@ -116,8 +393,8 @@ message CustomAttribute { repeated double numbers = 2; // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level // attribute configuration, see [Configuration // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). @@ -131,8 +408,8 @@ message CustomAttribute { optional bool searchable = 3 [deprecated = true]; // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level // attribute configuration, see [Configuration // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/completion_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/completion_service.proto index 14cb26d760f5..af0fac87e79c 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/completion_service.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/completion_service.proto @@ -142,7 +142,8 @@ message CompleteQueryRequest { string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback - // to the configured value [CompletionConfig.max_suggestions][]. + // to the configured value + // [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. // // The maximum allowed max suggestions is 20. If it is set higher, it will be // capped by 20. diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control.proto new file mode 100644 index 000000000000..5558e44dd8cc --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control.proto @@ -0,0 +1,93 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Configures dynamic metadata that can be linked to a +// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or +// recommendation results at serving time. +message Control { + option (google.api.resource) = { + type: "retail.googleapis.com/Control" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }; + + // The behavior/type of the control + // + // A behavior/type must be specified on creation. Type cannot be changed once + // specified (e.g. A Rule control will always be a Rule control.). An + // INVALID_ARGUMENT will be returned if either condition is violated. + oneof control { + // A rule control - a condition-action pair. + // Enacts a set action when the condition is triggered. + // For example: Boost "gShoe" when query full matches "Running Shoes". + Rule rule = 4; + } + + // Immutable. Fully qualified name + // `projects/*/locations/global/catalogs/*/controls/*` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable control display name. Used in Retail UI. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is thrown. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. List of [serving + // configuration][google.cloud.retail.v2.ServingConfig] ids that are + // associated with this control in the same + // [Catalog][google.cloud.retail.v2.Catalog]. + // + // Note the association is managed via the + // [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output + // only denormalized view. + repeated string associated_serving_config_ids = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The solution types that the control is used for. + // Currently we support setting only one type of solution at creation time. + // + // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. + // If no solution type is provided at creation time, will default to + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated SolutionType solution_types = 6 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the use case for the control. + // Affects what condition fields can be set. + // Only settable by search controls. + // Will default to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH] + // if not specified. Currently only allow one search_solution_use_case per + // control. + repeated SearchSolutionUseCase search_solution_use_case = 7; +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control_service.proto new file mode 100644 index 000000000000..24e8c1c44640 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/control_service.proto @@ -0,0 +1,185 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/control.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for modifying Control. +service ControlService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Control. + // + // If the [Control][google.cloud.retail.v2.Control] to create already exists, + // an ALREADY_EXISTS error is returned. + rpc CreateControl(CreateControlRequest) returns (Control) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls" + body: "control" + }; + option (google.api.method_signature) = "parent,control,control_id"; + } + + // Deletes a Control. + // + // If the [Control][google.cloud.retail.v2.Control] to delete does not exist, + // a NOT_FOUND error is returned. + rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a Control. + // + // [Control][google.cloud.retail.v2.Control] cannot be set to a different + // oneof field, if so an INVALID_ARGUMENT is returned. If the + // [Control][google.cloud.retail.v2.Control] to update does not exist, a + // NOT_FOUND error is returned. + rpc UpdateControl(UpdateControlRequest) returns (Control) { + option (google.api.http) = { + patch: "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}" + body: "control" + }; + option (google.api.method_signature) = "control,update_mask"; + } + + // Gets a Control. + rpc GetControl(GetControlRequest) returns (Control) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all Controls by their parent + // [Catalog][google.cloud.retail.v2.Catalog]. + rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for CreateControl method. +message CreateControlRequest { + // Required. Full resource name of parent catalog. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The Control to create. + Control control = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Control, which will become the final + // component of the Control's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string control_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateControl method. +message UpdateControlRequest { + // Required. The Control to update. + Control control = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Control][google.cloud.retail.v2.Control] to update. The following are NOT + // supported: + // + // * [Control.name][google.cloud.retail.v2.Control.name] + // + // If not set or empty, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteControl method. +message DeleteControlRequest { + // Required. The resource name of the Control to delete. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for GetControl method. +message GetControlRequest { + // Required. The resource name of the Control to get. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for ListControls method. +message ListControlsRequest { + // Required. The catalog resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListControls` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset. + // * List controls that are used in a single ServingConfig: + // 'serving_config = "boosted_home_page_cvr"' + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListControls method. +message ListControlsResponse { + // All the Controls for a given catalog. + repeated Control controls = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto index cadec1194050..23b063692066 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/import_config.proto @@ -35,7 +35,6 @@ option php_namespace = "Google\\Cloud\\Retail\\V2"; option ruby_package = "Google::Cloud::Retail::V2"; // Google Cloud Storage location for input content. -// format. message GcsSource { // Required. Google Cloud Storage URIs to input files. URI can be up to // 2000 characters long. URIs can match the full object path (for example, @@ -66,11 +65,13 @@ message GcsSource { // // Supported values for control imports: // - // * 'control' (default): One JSON [Control][] per line. + // * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + // per line. // // Supported values for catalog attribute imports: // - // * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + // * `catalog_attribute` (default): One CSV + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. string data_schema = 2; } @@ -81,9 +82,8 @@ message BigQuerySource { oneof partition { // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Only supported in + // [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. google.type.Date partition_date = 6; } @@ -122,8 +122,7 @@ message BigQuerySource { // * `user_event_ga360`: // The schema is available here: // https://support.google.com/analytics/answer/3437719. - // * `user_event_ga4`: This feature is in private preview. Please contact the - // support team for importing Google Analytics 4 events. + // * `user_event_ga4`: // The schema is available here: // https://support.google.com/analytics/answer/7029846. // @@ -154,7 +153,7 @@ message ImportErrorsConfig { // Required. Errors destination. oneof destination { // Google Cloud Storage prefix for import errors. This must be an empty, - // existing Cloud Storage directory. Import errors will be written to + // existing Cloud Storage directory. Import errors are written to // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; @@ -174,15 +173,6 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. - // - // Can only be set while using - // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. And the BigQuery - // dataset must be created in the data location "us (multiple regions in - // United States)", otherwise a PERMISSION_DENIED error is thrown. - // - // Add the IAM permission "BigQuery Data Viewer" for - // cloud-retail-customer-data-access@system.gserviceaccount.com before - // using this feature otherwise an error is thrown. FULL = 2; } @@ -205,8 +195,8 @@ message ImportProductsRequest { // The desired location of errors incurred during the Import. ImportErrorsConfig errors_config = 3; - // Indicates which fields in the provided imported 'products' to update. If - // not set, will by default update all fields. + // Indicates which fields in the provided imported `products` to update. If + // not set, all fields are updated. google.protobuf.FieldMask update_mask = 4; // The mode of reconciliation between existing products and the products to be @@ -215,21 +205,16 @@ message ImportProductsRequest { ReconciliationMode reconciliation_mode = 5; // Full Pub/Sub topic name for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has // to be within the same project as // [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent]. - // Make sure that both - // `cloud-retail-customer-data-access@system.gserviceaccount.com` and - // `service-@gcp-sa-retail.iam.gserviceaccount.com` - // have the `pubsub.topics.publish` IAM permission on the topic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + // `pubsub.topics.publish` IAM permission on the topic. string notification_pubsub_topic = 7; } @@ -265,8 +250,8 @@ message ImportCompletionDataRequest { [(google.api.field_behavior) = REQUIRED]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 3; @@ -326,7 +311,7 @@ message CompletionDataInputConfig { } } -// Metadata related to the progress of the Import operation. This will be +// Metadata related to the progress of the Import operation. This is // returned by the google.longrunning.Operation.metadata field. message ImportMetadata { // Operation create time. @@ -346,8 +331,8 @@ message ImportMetadata { string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 6; diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto index 43443295317c..fe5d212cf07d 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product.proto @@ -194,7 +194,7 @@ message Product { // Non-existent product ids are allowed. // The [type][google.cloud.retail.v2.Product.type] of the members must be // either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an // INVALID_ARGUMENT error is thrown. Should not set it for other types. A // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is // return. @@ -555,4 +555,11 @@ message Product { // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]. // Do not set this field in API requests. repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A list of local inventories specific to different places. + // + // This is only available for users who have Retail Search enabled, and it can + // be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs. + repeated LocalInventory local_inventories = 35 + [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto index e278d81e3315..5ca2cb326962 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/product_service.proto @@ -146,6 +146,13 @@ service ProductService { // and // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { @@ -173,6 +180,13 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) @@ -201,6 +215,13 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) @@ -236,6 +257,13 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc AddLocalInventories(AddLocalInventoriesRequest) @@ -269,6 +297,13 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/search_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/search_service.proto index 4e6662817004..32de76da6f32 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/search_service.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/search_service.proto @@ -394,7 +394,8 @@ message SearchRequest { // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; - // Let CRS decide whether to use personalization. + // Let CRS decide whether to use personalization based on quality of user + // event data. AUTO = 1; // Disable personalization. @@ -578,7 +579,9 @@ message SearchRequest { // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). // - // Notice that if both [ServingConfig.boost_control_ids][] and + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids] + // and // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] // are set, the boost conditions from both places are evaluated. If a search // request matches multiple boost conditions, the final boost score is equal @@ -681,6 +684,15 @@ message SearchRequest { SearchMode search_mode = 31; // The specification for personalization. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]. PersonalizationSpec personalization_spec = 32; // The labels applied to a resource must meet the following requirements: @@ -782,6 +794,21 @@ message SearchResponse { // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; + + // Specifies previous events related to this product for this user based on + // [UserEvent][google.cloud.retail.v2.UserEvent] with same + // [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id] + // or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id]. + // + // This is set only when + // [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode] + // is + // [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. + // + // Possible values: + // + // * `purchased`: Indicates that this product has been purchased before. + repeated string personal_labels = 7; } // A facet result. diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config.proto new file mode 100644 index 000000000000..45f317d63b87 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config.proto @@ -0,0 +1,248 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/search_service.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Configures metadata that is used to generate serving time results (e.g. +// search results or recommendation predictions). +message ServingConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/ServingConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }; + + // Immutable. Fully qualified name + // `projects/*/locations/global/catalogs/*/servingConfig/*` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable serving config display name. Used in Retail + // UI. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog] + // to use at serving time. Currently only RecommendationModels are supported: + // https://cloud.google.com/retail/recommendations-ai/docs/create-models + // Can be changed but only to a compatible model (e.g. + // others-you-may-like CTR to others-you-may-like CVR). + // + // Required when + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string model_id = 3; + + // How much price ranking we want in serving results. + // Price reranking causes product items with a similar + // recommendation probability to be ordered by price, with the + // highest-priced items first. This setting could result in a decrease in + // click-through and conversion rates. + // Allowed values are: + // + // * 'no-price-reranking' + // * 'low-price-raranking' + // * 'medium-price-reranking' + // * 'high-price-reranking' + // + // If not specified, we choose default based on model type. Default value: + // 'no-price-reranking'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string price_reranking_level = 4; + + // Facet specifications for faceted search. If empty, no facets are returned. + // The ids refer to the ids of [Control][google.cloud.retail.v2.Control] + // resources with only the Facet control set. These controls are assumed to be + // in the same [Catalog][google.cloud.retail.v2.Catalog] as the + // [ServingConfig][google.cloud.retail.v2.ServingConfig]. + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string facet_control_ids = 5; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + + // Condition boost specifications. If a product matches multiple conditions + // in the specifications, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 100. + // + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids] + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string boost_control_ids = 7; + + // Condition filter specifications. If a product matches multiple conditions + // in the specifications, filters from these specifications are all + // applied and combined via the AND operator. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string filter_control_ids = 9; + + // Condition redirect specifications. Only the first triggered redirect action + // is applied, even if multiple apply. Maximum number of specifications is + // 1000. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string redirect_control_ids = 10; + + // Condition synonyms specifications. If multiple syonyms conditions match, + // all matching synonyms control in the list will execute. Order of controls + // in the list will not matter. Maximum number of specifications is + // 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string twoway_synonyms_control_ids = 18; + + // Condition oneway synonyms specifications. If multiple oneway synonyms + // conditions match, all matching oneway synonyms controls in the list will + // execute. Order of controls in the list will not matter. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string oneway_synonyms_control_ids = 12; + + // Condition do not associate specifications. If multiple do not associate + // conditions match, all matching do not associate controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string do_not_associate_control_ids = 13; + + // Condition replacement specifications. + // - Applied according to the order in the list. + // - A previously replaced term can not be re-replaced. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string replacement_control_ids = 14; + + // Condition ignore specifications. If multiple ignore + // conditions match, all matching ignore controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string ignore_control_ids = 15; + + // How much diversity to use in recommendation model results e.g. + // 'medium-diversity' or 'high-diversity'. Currently supported values: + // + // * 'no-diversity' + // * 'low-diversity' + // * 'medium-diversity' + // * 'high-diversity' + // * 'auto-diversity' + // + // If not specified, we choose default based on recommendation model + // type. Default value: 'no-diversity'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string diversity_level = 8; + + // Whether to add additional category filters on the 'similar-items' model. + // If not specified, we enable it by default. + // Allowed values are: + // + // * 'no-category-match': No additional filtering of original results from + // the model and the customer's filters. + // * 'relaxed-category-match': Only keep results with categories that match + // at least one item categories in the PredictRequests's context item. + // * If customer also sends filters in the PredictRequest, then the results + // will satisfy both conditions (user given and category match). + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string enable_category_filter_level = 16; + + // The specification for personalization spec. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]. + SearchRequest.PersonalizationSpec personalization_spec = 21; + + // Required. Immutable. Specifies the solution types that a serving config can + // be associated with. Currently we support setting only one type of solution. + repeated SolutionType solution_types = 19 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config_service.proto new file mode 100644 index 000000000000..a4cabe26ba21 --- /dev/null +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/serving_config_service.proto @@ -0,0 +1,240 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/serving_config.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for modifying ServingConfig. +service ServingConfigService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a ServingConfig. + // + // A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are + // allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a + // FAILED_PRECONDITION error is returned. + rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + body: "serving_config" + }; + option (google.api.method_signature) = + "parent,serving_config,serving_config_id"; + } + + // Deletes a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc DeleteServingConfig(DeleteServingConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a ServingConfig. + rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + patch: "/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + body: "serving_config" + }; + option (google.api.method_signature) = "serving_config,update_mask"; + } + + // Gets a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all ServingConfigs linked to this catalog. + rpc ListServingConfigs(ListServingConfigsRequest) + returns (ListServingConfigsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Enables a Control on the specified ServingConfig. + // The control is added in the last position of the list of controls + // it belongs to (e.g. if it's a facet spec control it will be applied + // in the last position of servingConfig.facetSpecIds) + // Returns a ALREADY_EXISTS error if the control has already been applied. + // Returns a FAILED_PRECONDITION error if the addition could exceed maximum + // number of control allowed for that type of control. + rpc AddControl(AddControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } + + // Disables a Control on the specified ServingConfig. + // The control is removed from the ServingConfig. + // Returns a NOT_FOUND error if the Control is not enabled for the + // ServingConfig. + rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } +} + +// Request for CreateServingConfig method. +message CreateServingConfigRequest { + // Required. Full resource name of parent. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The ServingConfig to create. + ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the ServingConfig, which will become the final + // component of the ServingConfig's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateServingConfig method. +message UpdateServingConfigRequest { + // Required. The ServingConfig to update. + ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The + // following are NOT supported: + // + // * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteServingConfig method. +message DeleteServingConfigRequest { + // Required. The resource name of the ServingConfig to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for GetServingConfig method. +message GetServingConfigRequest { + // Required. The resource name of the ServingConfig to get. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for ListServingConfigs method. +message ListServingConfigsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 100. If a value greater than 100 is provided, at most 100 results are + // returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListServingConfigs` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListServingConfigs method. +message ListServingConfigsResponse { + // All the ServingConfigs for a given catalog. + repeated ServingConfig serving_configs = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request for AddControl method. +message AddControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config - if id is not found a NOT_FOUND error is returned. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for RemoveControl method. +message RemoveControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto index 1b0c190df167..9a917bc6c6c1 100644 --- a/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto +++ b/java-retail/proto-google-cloud-retail-v2/src/main/proto/google/cloud/retail/v2/user_event_service.proto @@ -79,9 +79,9 @@ service UserEventService { // synchronous. Events that already exist are skipped. // Use this method for backfilling historical user events. // - // Operation.response is of type ImportResponse. Note that it is + // `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. + // `Operation.metadata` is of type `ImportMetadata`. rpc ImportUserEvents(ImportUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/AsyncAddCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/AsyncAddCatalogAttribute.java new file mode 100644 index 000000000000..a0d0671261a1 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/AsyncAddCatalogAttribute.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_addcatalogattribute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogAttribute; +import com.google.cloud.retail.v2.CatalogServiceClient; + +public class AsyncAddCatalogAttribute { + + public static void main(String[] args) throws Exception { + asyncAddCatalogAttribute(); + } + + public static void asyncAddCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + ApiFuture future = + catalogServiceClient.addCatalogAttributeCallable().futureCall(request); + // Do something. + AttributesConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_addcatalogattribute_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/SyncAddCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/SyncAddCatalogAttribute.java new file mode 100644 index 000000000000..e44b16034ee2 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/addcatalogattribute/SyncAddCatalogAttribute.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_addcatalogattribute_sync] +import com.google.cloud.retail.v2.AddCatalogAttributeRequest; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogAttribute; +import com.google.cloud.retail.v2.CatalogServiceClient; + +public class SyncAddCatalogAttribute { + + public static void main(String[] args) throws Exception { + syncAddCatalogAttribute(); + } + + public static void syncAddCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + AddCatalogAttributeRequest request = + AddCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .build(); + AttributesConfig response = catalogServiceClient.addCatalogAttribute(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_addcatalogattribute_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/AsyncGetAttributesConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/AsyncGetAttributesConfig.java new file mode 100644 index 000000000000..4f8ca1588238 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/AsyncGetAttributesConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getattributesconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; + +public class AsyncGetAttributesConfig { + + public static void main(String[] args) throws Exception { + asyncGetAttributesConfig(); + } + + public static void asyncGetAttributesConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + GetAttributesConfigRequest request = + GetAttributesConfigRequest.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .build(); + ApiFuture future = + catalogServiceClient.getAttributesConfigCallable().futureCall(request); + // Do something. + AttributesConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getattributesconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfig.java new file mode 100644 index 000000000000..c2125413a201 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfig.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getattributesconfig_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.GetAttributesConfigRequest; + +public class SyncGetAttributesConfig { + + public static void main(String[] args) throws Exception { + syncGetAttributesConfig(); + } + + public static void syncGetAttributesConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + GetAttributesConfigRequest request = + GetAttributesConfigRequest.newBuilder() + .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .build(); + AttributesConfig response = catalogServiceClient.getAttributesConfig(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getattributesconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigAttributesconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigAttributesconfigname.java new file mode 100644 index 000000000000..b41e52d17145 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigAttributesconfigname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getattributesconfig_attributesconfigname_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; + +public class SyncGetAttributesConfigAttributesconfigname { + + public static void main(String[] args) throws Exception { + syncGetAttributesConfigAttributesconfigname(); + } + + public static void syncGetAttributesConfigAttributesconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + AttributesConfig response = catalogServiceClient.getAttributesConfig(name); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getattributesconfig_attributesconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigString.java new file mode 100644 index 000000000000..abba3aba5dfc --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getattributesconfig/SyncGetAttributesConfigString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getattributesconfig_string_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; + +public class SyncGetAttributesConfigString { + + public static void main(String[] args) throws Exception { + syncGetAttributesConfigString(); + } + + public static void syncGetAttributesConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + String name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + AttributesConfig response = catalogServiceClient.getAttributesConfig(name); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getattributesconfig_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/AsyncGetCompletionConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/AsyncGetCompletionConfig.java new file mode 100644 index 000000000000..a072ccd4672d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/AsyncGetCompletionConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getcompletionconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.CompletionConfigName; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; + +public class AsyncGetCompletionConfig { + + public static void main(String[] args) throws Exception { + asyncGetCompletionConfig(); + } + + public static void asyncGetCompletionConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + GetCompletionConfigRequest request = + GetCompletionConfigRequest.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .build(); + ApiFuture future = + catalogServiceClient.getCompletionConfigCallable().futureCall(request); + // Do something. + CompletionConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getcompletionconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfig.java new file mode 100644 index 000000000000..90823488875e --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfig.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getcompletionconfig_sync] +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.CompletionConfigName; +import com.google.cloud.retail.v2.GetCompletionConfigRequest; + +public class SyncGetCompletionConfig { + + public static void main(String[] args) throws Exception { + syncGetCompletionConfig(); + } + + public static void syncGetCompletionConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + GetCompletionConfigRequest request = + GetCompletionConfigRequest.newBuilder() + .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .build(); + CompletionConfig response = catalogServiceClient.getCompletionConfig(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getcompletionconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigCompletionconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigCompletionconfigname.java new file mode 100644 index 000000000000..f0220c101bf7 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigCompletionconfigname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getcompletionconfig_completionconfigname_sync] +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.CompletionConfigName; + +public class SyncGetCompletionConfigCompletionconfigname { + + public static void main(String[] args) throws Exception { + syncGetCompletionConfigCompletionconfigname(); + } + + public static void syncGetCompletionConfigCompletionconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + CompletionConfig response = catalogServiceClient.getCompletionConfig(name); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getcompletionconfig_completionconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigString.java new file mode 100644 index 000000000000..4a45365e2202 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/getcompletionconfig/SyncGetCompletionConfigString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_getcompletionconfig_string_sync] +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.CompletionConfigName; + +public class SyncGetCompletionConfigString { + + public static void main(String[] args) throws Exception { + syncGetCompletionConfigString(); + } + + public static void syncGetCompletionConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + String name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + CompletionConfig response = catalogServiceClient.getCompletionConfig(name); + } + } +} +// [END retail_v2_generated_catalogserviceclient_getcompletionconfig_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/AsyncRemoveCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/AsyncRemoveCatalogAttribute.java new file mode 100644 index 000000000000..5f9d6d74630f --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/AsyncRemoveCatalogAttribute.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_removecatalogattribute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; + +public class AsyncRemoveCatalogAttribute { + + public static void main(String[] args) throws Exception { + asyncRemoveCatalogAttribute(); + } + + public static void asyncRemoveCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + ApiFuture future = + catalogServiceClient.removeCatalogAttributeCallable().futureCall(request); + // Do something. + AttributesConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_removecatalogattribute_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/SyncRemoveCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/SyncRemoveCatalogAttribute.java new file mode 100644 index 000000000000..6016199a1ed8 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/removecatalogattribute/SyncRemoveCatalogAttribute.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_removecatalogattribute_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.RemoveCatalogAttributeRequest; + +public class SyncRemoveCatalogAttribute { + + public static void main(String[] args) throws Exception { + syncRemoveCatalogAttribute(); + } + + public static void syncRemoveCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + RemoveCatalogAttributeRequest request = + RemoveCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setKey("key106079") + .build(); + AttributesConfig response = catalogServiceClient.removeCatalogAttribute(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_removecatalogattribute_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/AsyncReplaceCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/AsyncReplaceCatalogAttribute.java new file mode 100644 index 000000000000..e9768bd450aa --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/AsyncReplaceCatalogAttribute.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_replacecatalogattribute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogAttribute; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncReplaceCatalogAttribute { + + public static void main(String[] args) throws Exception { + asyncReplaceCatalogAttribute(); + } + + public static void asyncReplaceCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + catalogServiceClient.replaceCatalogAttributeCallable().futureCall(request); + // Do something. + AttributesConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_replacecatalogattribute_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/SyncReplaceCatalogAttribute.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/SyncReplaceCatalogAttribute.java new file mode 100644 index 000000000000..d357a954d3b9 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/replacecatalogattribute/SyncReplaceCatalogAttribute.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_replacecatalogattribute_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.AttributesConfigName; +import com.google.cloud.retail.v2.CatalogAttribute; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.ReplaceCatalogAttributeRequest; +import com.google.protobuf.FieldMask; + +public class SyncReplaceCatalogAttribute { + + public static void main(String[] args) throws Exception { + syncReplaceCatalogAttribute(); + } + + public static void syncReplaceCatalogAttribute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + ReplaceCatalogAttributeRequest request = + ReplaceCatalogAttributeRequest.newBuilder() + .setAttributesConfig( + AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setCatalogAttribute(CatalogAttribute.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AttributesConfig response = catalogServiceClient.replaceCatalogAttribute(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_replacecatalogattribute_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/AsyncUpdateAttributesConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/AsyncUpdateAttributesConfig.java new file mode 100644 index 000000000000..f080c2ac8c9d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/AsyncUpdateAttributesConfig.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updateattributesconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAttributesConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateAttributesConfig(); + } + + public static void asyncUpdateAttributesConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + UpdateAttributesConfigRequest request = + UpdateAttributesConfigRequest.newBuilder() + .setAttributesConfig(AttributesConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + catalogServiceClient.updateAttributesConfigCallable().futureCall(request); + // Do something. + AttributesConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updateattributesconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfig.java new file mode 100644 index 000000000000..ab01b952a178 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updateattributesconfig_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.UpdateAttributesConfigRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAttributesConfig { + + public static void main(String[] args) throws Exception { + syncUpdateAttributesConfig(); + } + + public static void syncUpdateAttributesConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + UpdateAttributesConfigRequest request = + UpdateAttributesConfigRequest.newBuilder() + .setAttributesConfig(AttributesConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AttributesConfig response = catalogServiceClient.updateAttributesConfig(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updateattributesconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfigAttributesconfigFieldmask.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfigAttributesconfigFieldmask.java new file mode 100644 index 000000000000..32fc5af09173 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updateattributesconfig/SyncUpdateAttributesConfigAttributesconfigFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updateattributesconfig_attributesconfigfieldmask_sync] +import com.google.cloud.retail.v2.AttributesConfig; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAttributesConfigAttributesconfigFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateAttributesConfigAttributesconfigFieldmask(); + } + + public static void syncUpdateAttributesConfigAttributesconfigFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + AttributesConfig attributesConfig = AttributesConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + AttributesConfig response = + catalogServiceClient.updateAttributesConfig(attributesConfig, updateMask); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updateattributesconfig_attributesconfigfieldmask_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/AsyncUpdateCompletionConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/AsyncUpdateCompletionConfig.java new file mode 100644 index 000000000000..39e81d27ccaa --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/AsyncUpdateCompletionConfig.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updatecompletionconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCompletionConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateCompletionConfig(); + } + + public static void asyncUpdateCompletionConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + UpdateCompletionConfigRequest request = + UpdateCompletionConfigRequest.newBuilder() + .setCompletionConfig(CompletionConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + catalogServiceClient.updateCompletionConfigCallable().futureCall(request); + // Do something. + CompletionConfig response = future.get(); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updatecompletionconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfig.java new file mode 100644 index 000000000000..042159cc056e --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfig.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updatecompletionconfig_sync] +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.cloud.retail.v2.UpdateCompletionConfigRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCompletionConfig { + + public static void main(String[] args) throws Exception { + syncUpdateCompletionConfig(); + } + + public static void syncUpdateCompletionConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + UpdateCompletionConfigRequest request = + UpdateCompletionConfigRequest.newBuilder() + .setCompletionConfig(CompletionConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + CompletionConfig response = catalogServiceClient.updateCompletionConfig(request); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updatecompletionconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfigCompletionconfigFieldmask.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfigCompletionconfigFieldmask.java new file mode 100644 index 000000000000..2cfc094f7f7e --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/catalogserviceclient/updatecompletionconfig/SyncUpdateCompletionConfigCompletionconfigFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_catalogserviceclient_updatecompletionconfig_completionconfigfieldmask_sync] +import com.google.cloud.retail.v2.CatalogServiceClient; +import com.google.cloud.retail.v2.CompletionConfig; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCompletionConfigCompletionconfigFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCompletionConfigCompletionconfigFieldmask(); + } + + public static void syncUpdateCompletionConfigCompletionconfigFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { + CompletionConfig completionConfig = CompletionConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CompletionConfig response = + catalogServiceClient.updateCompletionConfig(completionConfig, updateMask); + } + } +} +// [END retail_v2_generated_catalogserviceclient_updatecompletionconfig_completionconfigfieldmask_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5dd5b46a5407 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ControlServiceSettings; +import com.google.cloud.retail.v2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ControlServiceSettings controlServiceSettings = + ControlServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings); + } +} +// [END retail_v2_generated_controlserviceclient_create_setcredentialsprovider_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider1.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..23d62100239f --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ControlServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ControlServiceSettings controlServiceSettings = + ControlServiceSettings.newBuilder() + .setTransportChannelProvider( + ControlServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings); + } +} +// [END retail_v2_generated_controlserviceclient_create_setcredentialsprovider1_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetEndpoint.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..a9402b504aa6 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_create_setendpoint_sync] +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ControlServiceSettings; +import com.google.cloud.retail.v2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ControlServiceSettings controlServiceSettings = + ControlServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings); + } +} +// [END retail_v2_generated_controlserviceclient_create_setendpoint_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/AsyncCreateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/AsyncCreateControl.java new file mode 100644 index 000000000000..2660c7c17067 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/AsyncCreateControl.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_createcontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.CreateControlRequest; + +public class AsyncCreateControl { + + public static void main(String[] args) throws Exception { + asyncCreateControl(); + } + + public static void asyncCreateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + CreateControlRequest request = + CreateControlRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setControl(Control.newBuilder().build()) + .setControlId("controlId-395080872") + .build(); + ApiFuture future = controlServiceClient.createControlCallable().futureCall(request); + // Do something. + Control response = future.get(); + } + } +} +// [END retail_v2_generated_controlserviceclient_createcontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControl.java new file mode 100644 index 000000000000..16e02425dae9 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControl.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_createcontrol_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.CreateControlRequest; + +public class SyncCreateControl { + + public static void main(String[] args) throws Exception { + syncCreateControl(); + } + + public static void syncCreateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + CreateControlRequest request = + CreateControlRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setControl(Control.newBuilder().build()) + .setControlId("controlId-395080872") + .build(); + Control response = controlServiceClient.createControl(request); + } + } +} +// [END retail_v2_generated_controlserviceclient_createcontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlCatalognameControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlCatalognameControlString.java new file mode 100644 index 000000000000..0e340fb3c42c --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlCatalognameControlString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_createcontrol_catalognamecontrolstring_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncCreateControlCatalognameControlString { + + public static void main(String[] args) throws Exception { + syncCreateControlCatalognameControlString(); + } + + public static void syncCreateControlCatalognameControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + Control response = controlServiceClient.createControl(parent, control, controlId); + } + } +} +// [END retail_v2_generated_controlserviceclient_createcontrol_catalognamecontrolstring_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlStringControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlStringControlString.java new file mode 100644 index 000000000000..759759c5df8d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/createcontrol/SyncCreateControlStringControlString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_createcontrol_stringcontrolstring_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncCreateControlStringControlString { + + public static void main(String[] args) throws Exception { + syncCreateControlStringControlString(); + } + + public static void syncCreateControlStringControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + Control control = Control.newBuilder().build(); + String controlId = "controlId-395080872"; + Control response = controlServiceClient.createControl(parent, control, controlId); + } + } +} +// [END retail_v2_generated_controlserviceclient_createcontrol_stringcontrolstring_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/AsyncDeleteControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/AsyncDeleteControl.java new file mode 100644 index 000000000000..b5c168c2680d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/AsyncDeleteControl.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_deletecontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteControl { + + public static void main(String[] args) throws Exception { + asyncDeleteControl(); + } + + public static void asyncDeleteControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + DeleteControlRequest request = + DeleteControlRequest.newBuilder() + .setName( + ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .build(); + ApiFuture future = controlServiceClient.deleteControlCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END retail_v2_generated_controlserviceclient_deletecontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControl.java new file mode 100644 index 000000000000..76e0c81e44e1 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControl.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_deletecontrol_sync] +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.DeleteControlRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteControl { + + public static void main(String[] args) throws Exception { + syncDeleteControl(); + } + + public static void syncDeleteControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + DeleteControlRequest request = + DeleteControlRequest.newBuilder() + .setName( + ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .build(); + controlServiceClient.deleteControl(request); + } + } +} +// [END retail_v2_generated_controlserviceclient_deletecontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlControlname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlControlname.java new file mode 100644 index 000000000000..2544e5cfc3d3 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlControlname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_deletecontrol_controlname_sync] +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteControlControlname { + + public static void main(String[] args) throws Exception { + syncDeleteControlControlname(); + } + + public static void syncDeleteControlControlname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + controlServiceClient.deleteControl(name); + } + } +} +// [END retail_v2_generated_controlserviceclient_deletecontrol_controlname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlString.java new file mode 100644 index 000000000000..bfef04c6f658 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/deletecontrol/SyncDeleteControlString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_deletecontrol_string_sync] +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteControlString { + + public static void main(String[] args) throws Exception { + syncDeleteControlString(); + } + + public static void syncDeleteControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + String name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString(); + controlServiceClient.deleteControl(name); + } + } +} +// [END retail_v2_generated_controlserviceclient_deletecontrol_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/AsyncGetControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/AsyncGetControl.java new file mode 100644 index 000000000000..f13afba44952 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/AsyncGetControl.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_getcontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.GetControlRequest; + +public class AsyncGetControl { + + public static void main(String[] args) throws Exception { + asyncGetControl(); + } + + public static void asyncGetControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + GetControlRequest request = + GetControlRequest.newBuilder() + .setName( + ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .build(); + ApiFuture future = controlServiceClient.getControlCallable().futureCall(request); + // Do something. + Control response = future.get(); + } + } +} +// [END retail_v2_generated_controlserviceclient_getcontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControl.java new file mode 100644 index 000000000000..2f0d214d10bf --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControl.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_getcontrol_sync] +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.GetControlRequest; + +public class SyncGetControl { + + public static void main(String[] args) throws Exception { + syncGetControl(); + } + + public static void syncGetControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + GetControlRequest request = + GetControlRequest.newBuilder() + .setName( + ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString()) + .build(); + Control response = controlServiceClient.getControl(request); + } + } +} +// [END retail_v2_generated_controlserviceclient_getcontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlControlname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlControlname.java new file mode 100644 index 000000000000..c61df3476a7a --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlControlname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_getcontrol_controlname_sync] +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncGetControlControlname { + + public static void main(String[] args) throws Exception { + syncGetControlControlname(); + } + + public static void syncGetControlControlname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + ControlName name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]"); + Control response = controlServiceClient.getControl(name); + } + } +} +// [END retail_v2_generated_controlserviceclient_getcontrol_controlname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlString.java new file mode 100644 index 000000000000..8082acb4518e --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/getcontrol/SyncGetControlString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_getcontrol_string_sync] +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlName; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncGetControlString { + + public static void main(String[] args) throws Exception { + syncGetControlString(); + } + + public static void syncGetControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + String name = ControlName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CONTROL]").toString(); + Control response = controlServiceClient.getControl(name); + } + } +} +// [END retail_v2_generated_controlserviceclient_getcontrol_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControls.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControls.java new file mode 100644 index 000000000000..bd317976718f --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControls.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_listcontrols_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ListControlsRequest; + +public class AsyncListControls { + + public static void main(String[] args) throws Exception { + asyncListControls(); + } + + public static void asyncListControls() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + ListControlsRequest request = + ListControlsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + controlServiceClient.listControlsPagedCallable().futureCall(request); + // Do something. + for (Control element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_controlserviceclient_listcontrols_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControlsPaged.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControlsPaged.java new file mode 100644 index 000000000000..c7c2d8fed9fd --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/AsyncListControlsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_listcontrols_paged_async] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ListControlsRequest; +import com.google.cloud.retail.v2.ListControlsResponse; +import com.google.common.base.Strings; + +public class AsyncListControlsPaged { + + public static void main(String[] args) throws Exception { + asyncListControlsPaged(); + } + + public static void asyncListControlsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + ListControlsRequest request = + ListControlsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListControlsResponse response = controlServiceClient.listControlsCallable().call(request); + for (Control element : response.getControlsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END retail_v2_generated_controlserviceclient_listcontrols_paged_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControls.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControls.java new file mode 100644 index 000000000000..47ef078d44ff --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControls.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_listcontrols_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ListControlsRequest; + +public class SyncListControls { + + public static void main(String[] args) throws Exception { + syncListControls(); + } + + public static void syncListControls() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + ListControlsRequest request = + ListControlsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Control element : controlServiceClient.listControls(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_controlserviceclient_listcontrols_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsCatalogname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsCatalogname.java new file mode 100644 index 000000000000..bd9b42de7f46 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsCatalogname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_listcontrols_catalogname_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncListControlsCatalogname { + + public static void main(String[] args) throws Exception { + syncListControlsCatalogname(); + } + + public static void syncListControlsCatalogname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + for (Control element : controlServiceClient.listControls(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_controlserviceclient_listcontrols_catalogname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsString.java new file mode 100644 index 000000000000..214744df9c3a --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/listcontrols/SyncListControlsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_listcontrols_string_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; + +public class SyncListControlsString { + + public static void main(String[] args) throws Exception { + syncListControlsString(); + } + + public static void syncListControlsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + for (Control element : controlServiceClient.listControls(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_controlserviceclient_listcontrols_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/AsyncUpdateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/AsyncUpdateControl.java new file mode 100644 index 000000000000..6d1f421b6e45 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/AsyncUpdateControl.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_updatecontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateControl { + + public static void main(String[] args) throws Exception { + asyncUpdateControl(); + } + + public static void asyncUpdateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + UpdateControlRequest request = + UpdateControlRequest.newBuilder() + .setControl(Control.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = controlServiceClient.updateControlCallable().futureCall(request); + // Do something. + Control response = future.get(); + } + } +} +// [END retail_v2_generated_controlserviceclient_updatecontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControl.java new file mode 100644 index 000000000000..cca54f2967f8 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControl.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_updatecontrol_sync] +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.UpdateControlRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateControl { + + public static void main(String[] args) throws Exception { + syncUpdateControl(); + } + + public static void syncUpdateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + UpdateControlRequest request = + UpdateControlRequest.newBuilder() + .setControl(Control.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Control response = controlServiceClient.updateControl(request); + } + } +} +// [END retail_v2_generated_controlserviceclient_updatecontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControlControlFieldmask.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControlControlFieldmask.java new file mode 100644 index 000000000000..d96e13f36693 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlserviceclient/updatecontrol/SyncUpdateControlControlFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlserviceclient_updatecontrol_controlfieldmask_sync] +import com.google.cloud.retail.v2.Control; +import com.google.cloud.retail.v2.ControlServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateControlControlFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateControlControlFieldmask(); + } + + public static void syncUpdateControlControlFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ControlServiceClient controlServiceClient = ControlServiceClient.create()) { + Control control = Control.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Control response = controlServiceClient.updateControl(control, updateMask); + } + } +} +// [END retail_v2_generated_controlserviceclient_updatecontrol_controlfieldmask_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlservicesettings/createcontrol/SyncCreateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlservicesettings/createcontrol/SyncCreateControl.java new file mode 100644 index 000000000000..6befa8f710e0 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/controlservicesettings/createcontrol/SyncCreateControl.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_controlservicesettings_createcontrol_sync] +import com.google.cloud.retail.v2.ControlServiceSettings; +import java.time.Duration; + +public class SyncCreateControl { + + public static void main(String[] args) throws Exception { + syncCreateControl(); + } + + public static void syncCreateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ControlServiceSettings.Builder controlServiceSettingsBuilder = + ControlServiceSettings.newBuilder(); + controlServiceSettingsBuilder + .createControlSettings() + .setRetrySettings( + controlServiceSettingsBuilder + .createControlSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ControlServiceSettings controlServiceSettings = controlServiceSettingsBuilder.build(); + } +} +// [END retail_v2_generated_controlservicesettings_createcontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/AsyncAddControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/AsyncAddControl.java new file mode 100644 index 000000000000..5b80fd72f6a1 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/AsyncAddControl.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_addcontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class AsyncAddControl { + + public static void main(String[] args) throws Exception { + asyncAddControl(); + } + + public static void asyncAddControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + AddControlRequest request = + AddControlRequest.newBuilder() + .setServingConfig( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setControlId("controlId-395080872") + .build(); + ApiFuture future = + servingConfigServiceClient.addControlCallable().futureCall(request); + // Do something. + ServingConfig response = future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_addcontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControl.java new file mode 100644 index 000000000000..3ee67587c37d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControl.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_addcontrol_sync] +import com.google.cloud.retail.v2.AddControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncAddControl { + + public static void main(String[] args) throws Exception { + syncAddControl(); + } + + public static void syncAddControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + AddControlRequest request = + AddControlRequest.newBuilder() + .setServingConfig( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setControlId("controlId-395080872") + .build(); + ServingConfig response = servingConfigServiceClient.addControl(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_addcontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlServingconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlServingconfigname.java new file mode 100644 index 000000000000..c6821e812306 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlServingconfigname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_addcontrol_servingconfigname_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncAddControlServingconfigname { + + public static void main(String[] args) throws Exception { + syncAddControlServingconfigname(); + } + + public static void syncAddControlServingconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + ServingConfig response = servingConfigServiceClient.addControl(servingConfig); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_addcontrol_servingconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlString.java new file mode 100644 index 000000000000..da64a87f9a72 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/addcontrol/SyncAddControlString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_addcontrol_string_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncAddControlString { + + public static void main(String[] args) throws Exception { + syncAddControlString(); + } + + public static void syncAddControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString(); + ServingConfig response = servingConfigServiceClient.addControl(servingConfig); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_addcontrol_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5498dec2b37b --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.ServingConfigServiceSettings; +import com.google.cloud.retail.v2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ServingConfigServiceSettings servingConfigServiceSettings = + ServingConfigServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create(servingConfigServiceSettings); + } +} +// [END retail_v2_generated_servingconfigserviceclient_create_setcredentialsprovider_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..155db7165a3d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.ServingConfigServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ServingConfigServiceSettings servingConfigServiceSettings = + ServingConfigServiceSettings.newBuilder() + .setTransportChannelProvider( + ServingConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create(servingConfigServiceSettings); + } +} +// [END retail_v2_generated_servingconfigserviceclient_create_setcredentialsprovider1_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetEndpoint.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..226d2c14cbb6 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_create_setendpoint_sync] +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.ServingConfigServiceSettings; +import com.google.cloud.retail.v2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ServingConfigServiceSettings servingConfigServiceSettings = + ServingConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create(servingConfigServiceSettings); + } +} +// [END retail_v2_generated_servingconfigserviceclient_create_setendpoint_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/AsyncCreateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/AsyncCreateServingConfig.java new file mode 100644 index 000000000000..95cec9bc5a55 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/AsyncCreateServingConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_createservingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class AsyncCreateServingConfig { + + public static void main(String[] args) throws Exception { + asyncCreateServingConfig(); + } + + public static void asyncCreateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + CreateServingConfigRequest request = + CreateServingConfigRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setServingConfig(ServingConfig.newBuilder().build()) + .setServingConfigId("servingConfigId-831052759") + .build(); + ApiFuture future = + servingConfigServiceClient.createServingConfigCallable().futureCall(request); + // Do something. + ServingConfig response = future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_createservingconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfig.java new file mode 100644 index 000000000000..287a3b6d3e93 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_createservingconfig_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.CreateServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncCreateServingConfig { + + public static void main(String[] args) throws Exception { + syncCreateServingConfig(); + } + + public static void syncCreateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + CreateServingConfigRequest request = + CreateServingConfigRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setServingConfig(ServingConfig.newBuilder().build()) + .setServingConfigId("servingConfigId-831052759") + .build(); + ServingConfig response = servingConfigServiceClient.createServingConfig(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_createservingconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigCatalognameServingconfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigCatalognameServingconfigString.java new file mode 100644 index 000000000000..8a098921d355 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigCatalognameServingconfigString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_createservingconfig_catalognameservingconfigstring_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncCreateServingConfigCatalognameServingconfigString { + + public static void main(String[] args) throws Exception { + syncCreateServingConfigCatalognameServingconfigString(); + } + + public static void syncCreateServingConfigCatalognameServingconfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + ServingConfig response = + servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_createservingconfig_catalognameservingconfigstring_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigStringServingconfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigStringServingconfigString.java new file mode 100644 index 000000000000..3c33c3e3ca25 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/createservingconfig/SyncCreateServingConfigStringServingconfigString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_createservingconfig_stringservingconfigstring_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncCreateServingConfigStringServingconfigString { + + public static void main(String[] args) throws Exception { + syncCreateServingConfigStringServingconfigString(); + } + + public static void syncCreateServingConfigStringServingconfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + String servingConfigId = "servingConfigId-831052759"; + ServingConfig response = + servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_createservingconfig_stringservingconfigstring_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/AsyncDeleteServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/AsyncDeleteServingConfig.java new file mode 100644 index 000000000000..9c991188cb45 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/AsyncDeleteServingConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_deleteservingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteServingConfig { + + public static void main(String[] args) throws Exception { + asyncDeleteServingConfig(); + } + + public static void asyncDeleteServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + DeleteServingConfigRequest request = + DeleteServingConfigRequest.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + servingConfigServiceClient.deleteServingConfigCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_deleteservingconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfig.java new file mode 100644 index 000000000000..ef4208463d64 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_deleteservingconfig_sync] +import com.google.cloud.retail.v2.DeleteServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteServingConfig { + + public static void main(String[] args) throws Exception { + syncDeleteServingConfig(); + } + + public static void syncDeleteServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + DeleteServingConfigRequest request = + DeleteServingConfigRequest.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .build(); + servingConfigServiceClient.deleteServingConfig(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_deleteservingconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigServingconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigServingconfigname.java new file mode 100644 index 000000000000..4be250879422 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigServingconfigname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_deleteservingconfig_servingconfigname_sync] +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteServingConfigServingconfigname { + + public static void main(String[] args) throws Exception { + syncDeleteServingConfigServingconfigname(); + } + + public static void syncDeleteServingConfigServingconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + servingConfigServiceClient.deleteServingConfig(name); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_deleteservingconfig_servingconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigString.java new file mode 100644 index 000000000000..3bea99681909 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/deleteservingconfig/SyncDeleteServingConfigString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_deleteservingconfig_string_sync] +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteServingConfigString { + + public static void main(String[] args) throws Exception { + syncDeleteServingConfigString(); + } + + public static void syncDeleteServingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString(); + servingConfigServiceClient.deleteServingConfig(name); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_deleteservingconfig_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/AsyncGetServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/AsyncGetServingConfig.java new file mode 100644 index 000000000000..3b26cc15ed3d --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/AsyncGetServingConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_getservingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class AsyncGetServingConfig { + + public static void main(String[] args) throws Exception { + asyncGetServingConfig(); + } + + public static void asyncGetServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + GetServingConfigRequest request = + GetServingConfigRequest.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + servingConfigServiceClient.getServingConfigCallable().futureCall(request); + // Do something. + ServingConfig response = future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_getservingconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfig.java new file mode 100644 index 000000000000..557db8ea8c41 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_getservingconfig_sync] +import com.google.cloud.retail.v2.GetServingConfigRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncGetServingConfig { + + public static void main(String[] args) throws Exception { + syncGetServingConfig(); + } + + public static void syncGetServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + GetServingConfigRequest request = + GetServingConfigRequest.newBuilder() + .setName( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .build(); + ServingConfig response = servingConfigServiceClient.getServingConfig(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_getservingconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigServingconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigServingconfigname.java new file mode 100644 index 000000000000..7bbd3b1c16f4 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigServingconfigname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_getservingconfig_servingconfigname_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncGetServingConfigServingconfigname { + + public static void main(String[] args) throws Exception { + syncGetServingConfigServingconfigname(); + } + + public static void syncGetServingConfigServingconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ServingConfigName name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + ServingConfig response = servingConfigServiceClient.getServingConfig(name); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_getservingconfig_servingconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigString.java new file mode 100644 index 000000000000..5a1bf38439ee --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/getservingconfig/SyncGetServingConfigString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_getservingconfig_string_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncGetServingConfigString { + + public static void main(String[] args) throws Exception { + syncGetServingConfigString(); + } + + public static void syncGetServingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String name = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString(); + ServingConfig response = servingConfigServiceClient.getServingConfig(name); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_getservingconfig_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigs.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigs.java new file mode 100644 index 000000000000..86ebdbf4657e --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigs.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_listservingconfigs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class AsyncListServingConfigs { + + public static void main(String[] args) throws Exception { + asyncListServingConfigs(); + } + + public static void asyncListServingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ListServingConfigsRequest request = + ListServingConfigsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + servingConfigServiceClient.listServingConfigsPagedCallable().futureCall(request); + // Do something. + for (ServingConfig element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_listservingconfigs_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigsPaged.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigsPaged.java new file mode 100644 index 000000000000..b163ef43c2b0 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/AsyncListServingConfigsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_listservingconfigs_paged_async] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ListServingConfigsResponse; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.common.base.Strings; + +public class AsyncListServingConfigsPaged { + + public static void main(String[] args) throws Exception { + asyncListServingConfigsPaged(); + } + + public static void asyncListServingConfigsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ListServingConfigsRequest request = + ListServingConfigsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListServingConfigsResponse response = + servingConfigServiceClient.listServingConfigsCallable().call(request); + for (ServingConfig element : response.getServingConfigsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_listservingconfigs_paged_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigs.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigs.java new file mode 100644 index 000000000000..c446e2b28695 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigs.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_listservingconfigs_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ListServingConfigsRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncListServingConfigs { + + public static void main(String[] args) throws Exception { + syncListServingConfigs(); + } + + public static void syncListServingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ListServingConfigsRequest request = + ListServingConfigsRequest.newBuilder() + .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (ServingConfig element : + servingConfigServiceClient.listServingConfigs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_listservingconfigs_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsCatalogname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsCatalogname.java new file mode 100644 index 000000000000..909ce7df1a6a --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsCatalogname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_listservingconfigs_catalogname_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncListServingConfigsCatalogname { + + public static void main(String[] args) throws Exception { + syncListServingConfigsCatalogname(); + } + + public static void syncListServingConfigsCatalogname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); + for (ServingConfig element : + servingConfigServiceClient.listServingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_listservingconfigs_catalogname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsString.java new file mode 100644 index 000000000000..255c9e10afb4 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/listservingconfigs/SyncListServingConfigsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_listservingconfigs_string_sync] +import com.google.cloud.retail.v2.CatalogName; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncListServingConfigsString { + + public static void main(String[] args) throws Exception { + syncListServingConfigsString(); + } + + public static void syncListServingConfigsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); + for (ServingConfig element : + servingConfigServiceClient.listServingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_listservingconfigs_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/AsyncRemoveControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/AsyncRemoveControl.java new file mode 100644 index 000000000000..efe4ca962a62 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/AsyncRemoveControl.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_removecontrol_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class AsyncRemoveControl { + + public static void main(String[] args) throws Exception { + asyncRemoveControl(); + } + + public static void asyncRemoveControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + RemoveControlRequest request = + RemoveControlRequest.newBuilder() + .setServingConfig( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setControlId("controlId-395080872") + .build(); + ApiFuture future = + servingConfigServiceClient.removeControlCallable().futureCall(request); + // Do something. + ServingConfig response = future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_removecontrol_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControl.java new file mode 100644 index 000000000000..c4e6824ab1ce --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControl.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_removecontrol_sync] +import com.google.cloud.retail.v2.RemoveControlRequest; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncRemoveControl { + + public static void main(String[] args) throws Exception { + syncRemoveControl(); + } + + public static void syncRemoveControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + RemoveControlRequest request = + RemoveControlRequest.newBuilder() + .setServingConfig( + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString()) + .setControlId("controlId-395080872") + .build(); + ServingConfig response = servingConfigServiceClient.removeControl(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_removecontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlServingconfigname.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlServingconfigname.java new file mode 100644 index 000000000000..3d43b6a5e4d7 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlServingconfigname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_removecontrol_servingconfigname_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncRemoveControlServingconfigname { + + public static void main(String[] args) throws Exception { + syncRemoveControlServingconfigname(); + } + + public static void syncRemoveControlServingconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ServingConfigName servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); + ServingConfig response = servingConfigServiceClient.removeControl(servingConfig); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_removecontrol_servingconfigname_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlString.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlString.java new file mode 100644 index 000000000000..bcf7e9f76a9c --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/removecontrol/SyncRemoveControlString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_removecontrol_string_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigName; +import com.google.cloud.retail.v2.ServingConfigServiceClient; + +public class SyncRemoveControlString { + + public static void main(String[] args) throws Exception { + syncRemoveControlString(); + } + + public static void syncRemoveControlString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + String servingConfig = + ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") + .toString(); + ServingConfig response = servingConfigServiceClient.removeControl(servingConfig); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_removecontrol_string_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/AsyncUpdateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/AsyncUpdateServingConfig.java new file mode 100644 index 000000000000..7f43db53d2be --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/AsyncUpdateServingConfig.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_updateservingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateServingConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateServingConfig(); + } + + public static void asyncUpdateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + UpdateServingConfigRequest request = + UpdateServingConfigRequest.newBuilder() + .setServingConfig(ServingConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + servingConfigServiceClient.updateServingConfigCallable().futureCall(request); + // Do something. + ServingConfig response = future.get(); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_updateservingconfig_async] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfig.java new file mode 100644 index 000000000000..22615e954f37 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_updateservingconfig_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.UpdateServingConfigRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateServingConfig { + + public static void main(String[] args) throws Exception { + syncUpdateServingConfig(); + } + + public static void syncUpdateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + UpdateServingConfigRequest request = + UpdateServingConfigRequest.newBuilder() + .setServingConfig(ServingConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ServingConfig response = servingConfigServiceClient.updateServingConfig(request); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_updateservingconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfigServingconfigFieldmask.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfigServingconfigFieldmask.java new file mode 100644 index 000000000000..6675b37a4f33 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigserviceclient/updateservingconfig/SyncUpdateServingConfigServingconfigFieldmask.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigserviceclient_updateservingconfig_servingconfigfieldmask_sync] +import com.google.cloud.retail.v2.ServingConfig; +import com.google.cloud.retail.v2.ServingConfigServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateServingConfigServingconfigFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateServingConfigServingconfigFieldmask(); + } + + public static void syncUpdateServingConfigServingconfigFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ServingConfigServiceClient servingConfigServiceClient = + ServingConfigServiceClient.create()) { + ServingConfig servingConfig = ServingConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + ServingConfig response = + servingConfigServiceClient.updateServingConfig(servingConfig, updateMask); + } + } +} +// [END retail_v2_generated_servingconfigserviceclient_updateservingconfig_servingconfigfieldmask_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigservicesettings/createservingconfig/SyncCreateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigservicesettings/createservingconfig/SyncCreateServingConfig.java new file mode 100644 index 000000000000..da56bfa77708 --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/servingconfigservicesettings/createservingconfig/SyncCreateServingConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.samples; + +// [START retail_v2_generated_servingconfigservicesettings_createservingconfig_sync] +import com.google.cloud.retail.v2.ServingConfigServiceSettings; +import java.time.Duration; + +public class SyncCreateServingConfig { + + public static void main(String[] args) throws Exception { + syncCreateServingConfig(); + } + + public static void syncCreateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ServingConfigServiceSettings.Builder servingConfigServiceSettingsBuilder = + ServingConfigServiceSettings.newBuilder(); + servingConfigServiceSettingsBuilder + .createServingConfigSettings() + .setRetrySettings( + servingConfigServiceSettingsBuilder + .createServingConfigSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ServingConfigServiceSettings servingConfigServiceSettings = + servingConfigServiceSettingsBuilder.build(); + } +} +// [END retail_v2_generated_servingconfigservicesettings_createservingconfig_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/controlservicestubsettings/createcontrol/SyncCreateControl.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/controlservicestubsettings/createcontrol/SyncCreateControl.java new file mode 100644 index 000000000000..090038be3dfd --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/controlservicestubsettings/createcontrol/SyncCreateControl.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub.samples; + +// [START retail_v2_generated_controlservicestubsettings_createcontrol_sync] +import com.google.cloud.retail.v2.stub.ControlServiceStubSettings; +import java.time.Duration; + +public class SyncCreateControl { + + public static void main(String[] args) throws Exception { + syncCreateControl(); + } + + public static void syncCreateControl() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ControlServiceStubSettings.Builder controlServiceSettingsBuilder = + ControlServiceStubSettings.newBuilder(); + controlServiceSettingsBuilder + .createControlSettings() + .setRetrySettings( + controlServiceSettingsBuilder + .createControlSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ControlServiceStubSettings controlServiceSettings = controlServiceSettingsBuilder.build(); + } +} +// [END retail_v2_generated_controlservicestubsettings_createcontrol_sync] diff --git a/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/servingconfigservicestubsettings/createservingconfig/SyncCreateServingConfig.java b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/servingconfigservicestubsettings/createservingconfig/SyncCreateServingConfig.java new file mode 100644 index 000000000000..b86c287a818b --- /dev/null +++ b/java-retail/samples/snippets/generated/com/google/cloud/retail/v2/stub/servingconfigservicestubsettings/createservingconfig/SyncCreateServingConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.retail.v2.stub.samples; + +// [START retail_v2_generated_servingconfigservicestubsettings_createservingconfig_sync] +import com.google.cloud.retail.v2.stub.ServingConfigServiceStubSettings; +import java.time.Duration; + +public class SyncCreateServingConfig { + + public static void main(String[] args) throws Exception { + syncCreateServingConfig(); + } + + public static void syncCreateServingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ServingConfigServiceStubSettings.Builder servingConfigServiceSettingsBuilder = + ServingConfigServiceStubSettings.newBuilder(); + servingConfigServiceSettingsBuilder + .createServingConfigSettings() + .setRetrySettings( + servingConfigServiceSettingsBuilder + .createServingConfigSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ServingConfigServiceStubSettings servingConfigServiceSettings = + servingConfigServiceSettingsBuilder.build(); + } +} +// [END retail_v2_generated_servingconfigservicestubsettings_createservingconfig_sync]