Class CatalogServiceClient
- java.lang.Object
-
- com.google.cloud.retail.v2alpha.CatalogServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class CatalogServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service for managing catalog configuration.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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { Catalog catalog = Catalog.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask); }
Note: close() needs to be called on the CatalogServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- 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.
- 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.
- 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 CatalogServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library CatalogServiceSettings catalogServiceSettings = CatalogServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library CatalogServiceSettings catalogServiceSettings = CatalogServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library CatalogServiceSettings catalogServiceSettings = CatalogServiceSettings.newHttpJsonBuilder().build(); CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CatalogServiceClient.ListCatalogsFixedSizeCollection
static class
CatalogServiceClient.ListCatalogsPage
static class
CatalogServiceClient.ListCatalogsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
CatalogServiceClient(CatalogServiceSettings settings)
Constructs an instance of CatalogServiceClient, using the given settings.protected
CatalogServiceClient(CatalogServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributesConfig
addCatalogAttribute(AddCatalogAttributeRequest request)
Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].com.google.api.gax.rpc.UnaryCallable<AddCatalogAttributeRequest,AttributesConfig>
addCatalogAttributeCallable()
Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].boolean
awaitTermination(long duration, TimeUnit unit)
BatchRemoveCatalogAttributesResponse
batchRemoveCatalogAttributes(BatchRemoveCatalogAttributesRequest request)
Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].com.google.api.gax.rpc.UnaryCallable<BatchRemoveCatalogAttributesRequest,BatchRemoveCatalogAttributesResponse>
batchRemoveCatalogAttributesCallable()
Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].void
close()
static CatalogServiceClient
create()
Constructs an instance of CatalogServiceClient with default settings.static CatalogServiceClient
create(CatalogServiceSettings settings)
Constructs an instance of CatalogServiceClient, using the given settings.static CatalogServiceClient
create(CatalogServiceStub stub)
Constructs an instance of CatalogServiceClient, using the given stub for making calls.AttributesConfig
getAttributesConfig(AttributesConfigName name)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].AttributesConfig
getAttributesConfig(GetAttributesConfigRequest request)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].AttributesConfig
getAttributesConfig(String name)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].com.google.api.gax.rpc.UnaryCallable<GetAttributesConfigRequest,AttributesConfig>
getAttributesConfigCallable()
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].CompletionConfig
getCompletionConfig(CompletionConfigName name)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].CompletionConfig
getCompletionConfig(GetCompletionConfigRequest request)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].CompletionConfig
getCompletionConfig(String name)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].com.google.api.gax.rpc.UnaryCallable<GetCompletionConfigRequest,CompletionConfig>
getCompletionConfigCallable()
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].GetDefaultBranchResponse
getDefaultBranch(CatalogName catalog)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.GetDefaultBranchResponse
getDefaultBranch(GetDefaultBranchRequest request)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.GetDefaultBranchResponse
getDefaultBranch(String catalog)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.com.google.api.gax.rpc.UnaryCallable<GetDefaultBranchRequest,GetDefaultBranchResponse>
getDefaultBranchCallable()
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.CatalogServiceSettings
getSettings()
CatalogServiceStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
CatalogServiceClient.ListCatalogsPagedResponse
listCatalogs(ListCatalogsRequest request)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.CatalogServiceClient.ListCatalogsPagedResponse
listCatalogs(LocationName parent)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.CatalogServiceClient.ListCatalogsPagedResponse
listCatalogs(String parent)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,ListCatalogsResponse>
listCatalogsCallable()
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,CatalogServiceClient.ListCatalogsPagedResponse>
listCatalogsPagedCallable()
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.AttributesConfig
removeCatalogAttribute(RemoveCatalogAttributeRequest request)
Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].com.google.api.gax.rpc.UnaryCallable<RemoveCatalogAttributeRequest,AttributesConfig>
removeCatalogAttributeCallable()
Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].AttributesConfig
replaceCatalogAttribute(ReplaceCatalogAttributeRequest request)
Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key].com.google.api.gax.rpc.UnaryCallable<ReplaceCatalogAttributeRequest,AttributesConfig>
replaceCatalogAttributeCallable()
Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key].void
setDefaultBranch(CatalogName catalog)
Set a specified branch id as default branch.void
setDefaultBranch(SetDefaultBranchRequest request)
Set a specified branch id as default branch.void
setDefaultBranch(String catalog)
Set a specified branch id as default branch.com.google.api.gax.rpc.UnaryCallable<SetDefaultBranchRequest,com.google.protobuf.Empty>
setDefaultBranchCallable()
Set a specified branch id as default branch.void
shutdown()
void
shutdownNow()
AttributesConfig
updateAttributesConfig(AttributesConfig attributesConfig, com.google.protobuf.FieldMask updateMask)
Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].AttributesConfig
updateAttributesConfig(UpdateAttributesConfigRequest request)
Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].com.google.api.gax.rpc.UnaryCallable<UpdateAttributesConfigRequest,AttributesConfig>
updateAttributesConfigCallable()
Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Catalog
updateCatalog(Catalog catalog, com.google.protobuf.FieldMask updateMask)
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.Catalog
updateCatalog(UpdateCatalogRequest request)
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.com.google.api.gax.rpc.UnaryCallable<UpdateCatalogRequest,Catalog>
updateCatalogCallable()
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.CompletionConfig
updateCompletionConfig(CompletionConfig completionConfig, com.google.protobuf.FieldMask updateMask)
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.CompletionConfig
updateCompletionConfig(UpdateCompletionConfigRequest request)
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.com.google.api.gax.rpc.UnaryCallable<UpdateCompletionConfigRequest,CompletionConfig>
updateCompletionConfigCallable()
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.
-
-
-
Constructor Detail
-
CatalogServiceClient
protected CatalogServiceClient(CatalogServiceSettings settings) throws IOException
Constructs an instance of CatalogServiceClient, 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.- Throws:
IOException
-
CatalogServiceClient
protected CatalogServiceClient(CatalogServiceStub stub)
-
-
Method Detail
-
create
public static final CatalogServiceClient create() throws IOException
Constructs an instance of CatalogServiceClient with default settings.- Throws:
IOException
-
create
public static final CatalogServiceClient create(CatalogServiceSettings settings) throws IOException
Constructs an instance of CatalogServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final CatalogServiceClient create(CatalogServiceStub stub)
Constructs an instance of CatalogServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CatalogServiceSettings).
-
getSettings
public final CatalogServiceSettings getSettings()
-
getStub
public CatalogServiceStub getStub()
-
listCatalogs
public final CatalogServiceClient.ListCatalogsPagedResponse listCatalogs(LocationName parent)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The account resource name with an associated location.If the caller does not have permission to list [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCatalogs
public final CatalogServiceClient.ListCatalogsPagedResponse listCatalogs(String parent)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Catalog element : catalogServiceClient.listCatalogs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The account resource name with an associated location.If the caller does not have permission to list [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCatalogs
public final CatalogServiceClient.ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request)
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Catalog element : catalogServiceClient.listCatalogs(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
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
-
listCatalogsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,CatalogServiceClient.ListCatalogsPagedResponse> listCatalogsPagedCallable()
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Catalog> future = catalogServiceClient.listCatalogsPagedCallable().futureCall(request); // Do something. for (Catalog element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listCatalogsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,ListCatalogsResponse> listCatalogsCallable()
Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListCatalogsResponse response = catalogServiceClient.listCatalogsCallable().call(request); for (Catalog element : response.getCatalogsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
updateCatalog
public final Catalog updateCatalog(Catalog catalog, com.google.protobuf.FieldMask updateMask)
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { Catalog catalog = Catalog.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Catalog response = catalogServiceClient.updateCatalog(catalog, updateMask); }
- Parameters:
catalog
- Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update.If the caller does not have permission to update the [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the [Catalog][google.cloud.retail.v2alpha.Catalog] to update does not exist, a NOT_FOUND error is returned.
updateMask
- Indicates which fields in the provided [Catalog][google.cloud.retail.v2alpha.Catalog] to update.If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateCatalog
public final Catalog updateCatalog(UpdateCatalogRequest request)
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateCatalogRequest request = UpdateCatalogRequest.newBuilder() .setCatalog(Catalog.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Catalog response = catalogServiceClient.updateCatalog(request); }
- Parameters:
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
-
updateCatalogCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateCatalogRequest,Catalog> updateCatalogCallable()
Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateCatalogRequest request = UpdateCatalogRequest.newBuilder() .setCatalog(Catalog.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Catalog> future = catalogServiceClient.updateCatalogCallable().futureCall(request); // Do something. Catalog response = future.get(); }
-
setDefaultBranch
public final void setDefaultBranch(CatalogName catalog)
Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using "default_branch" to the actual branch id set as default.For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`.
Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch.
CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.
More specifically:
- PredictionService will only return product IDs from branch {newBranch}.
- SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set).
- UserEventService will only join events with products from branch {newBranch}.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { CatalogName catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); catalogServiceClient.setDefaultBranch(catalog); }
- Parameters:
catalog
- Full resource name of the catalog, such as `projects/*/locations/global/catalogs/default_catalog`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setDefaultBranch
public final void setDefaultBranch(String catalog)
Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using "default_branch" to the actual branch id set as default.For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`.
Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch.
CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.
More specifically:
- PredictionService will only return product IDs from branch {newBranch}.
- SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set).
- UserEventService will only join events with products from branch {newBranch}.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { String catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); catalogServiceClient.setDefaultBranch(catalog); }
- Parameters:
catalog
- Full resource name of the catalog, such as `projects/*/locations/global/catalogs/default_catalog`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setDefaultBranch
public final void setDefaultBranch(SetDefaultBranchRequest request)
Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using "default_branch" to the actual branch id set as default.For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`.
Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch.
CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.
More specifically:
- PredictionService will only return product IDs from branch {newBranch}.
- SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set).
- UserEventService will only join events with products from branch {newBranch}.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { SetDefaultBranchRequest request = SetDefaultBranchRequest.newBuilder() .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setBranchId( BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) .setNote("note3387378") .setForce(true) .build(); catalogServiceClient.setDefaultBranch(request); }
- Parameters:
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
-
setDefaultBranchCallable
public final com.google.api.gax.rpc.UnaryCallable<SetDefaultBranchRequest,com.google.protobuf.Empty> setDefaultBranchCallable()
Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using "default_branch" to the actual branch id set as default.For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`.
Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch.
CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.
More specifically:
- PredictionService will only return product IDs from branch {newBranch}.
- SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set).
- UserEventService will only join events with products from branch {newBranch}.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { SetDefaultBranchRequest request = SetDefaultBranchRequest.newBuilder() .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setBranchId( BranchName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]").toString()) .setNote("note3387378") .setForce(true) .build(); ApiFuture<Empty> future = catalogServiceClient.setDefaultBranchCallable().futureCall(request); // Do something. future.get(); }
-
getDefaultBranch
public final GetDefaultBranchResponse getDefaultBranch(CatalogName catalog)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { CatalogName catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(catalog); }
- Parameters:
catalog
- The parent catalog resource name, such as `projects/*/locations/global/catalogs/default_catalog`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getDefaultBranch
public final GetDefaultBranchResponse getDefaultBranch(String catalog)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { String catalog = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(catalog); }
- Parameters:
catalog
- The parent catalog resource name, such as `projects/*/locations/global/catalogs/default_catalog`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getDefaultBranch
public final GetDefaultBranchResponse getDefaultBranch(GetDefaultBranchRequest request)
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetDefaultBranchRequest request = GetDefaultBranchRequest.newBuilder() .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); GetDefaultBranchResponse response = catalogServiceClient.getDefaultBranch(request); }
- Parameters:
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
-
getDefaultBranchCallable
public final com.google.api.gax.rpc.UnaryCallable<GetDefaultBranchRequest,GetDefaultBranchResponse> getDefaultBranchCallable()
Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetDefaultBranchRequest request = GetDefaultBranchRequest.newBuilder() .setCatalog(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); ApiFuture<GetDefaultBranchResponse> future = catalogServiceClient.getDefaultBranchCallable().futureCall(request); // Do something. GetDefaultBranchResponse response = future.get(); }
-
getCompletionConfig
public final CompletionConfig getCompletionConfig(CompletionConfigName name)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { CompletionConfigName name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); CompletionConfig response = catalogServiceClient.getCompletionConfig(name); }
- Parameters:
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
-
getCompletionConfig
public final CompletionConfig getCompletionConfig(String name)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { String name = CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); CompletionConfig response = catalogServiceClient.getCompletionConfig(name); }
- Parameters:
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
-
getCompletionConfig
public final CompletionConfig getCompletionConfig(GetCompletionConfigRequest request)
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetCompletionConfigRequest request = GetCompletionConfigRequest.newBuilder() .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); CompletionConfig response = catalogServiceClient.getCompletionConfig(request); }
- Parameters:
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
-
getCompletionConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetCompletionConfigRequest,CompletionConfig> getCompletionConfigCallable()
Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetCompletionConfigRequest request = GetCompletionConfigRequest.newBuilder() .setName(CompletionConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); ApiFuture<CompletionConfig> future = catalogServiceClient.getCompletionConfigCallable().futureCall(request); // Do something. CompletionConfig response = future.get(); }
-
updateCompletionConfig
public final CompletionConfig updateCompletionConfig(CompletionConfig completionConfig, com.google.protobuf.FieldMask updateMask)
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { CompletionConfig completionConfig = CompletionConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); CompletionConfig response = catalogServiceClient.updateCompletionConfig(completionConfig, updateMask); }
- Parameters:
completionConfig
- Required. The [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update.If the caller does not have permission to update the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig], then a PERMISSION_DENIED error is returned.
If the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update does not exist, a NOT_FOUND error is returned.
updateMask
- Indicates which fields in the provided [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. The following are the only supported fields:- [CompletionConfig.matching_order][google.cloud.retail.v2alpha.CompletionConfig.matching_order]
- [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]
- [CompletionConfig.min_prefix_length][google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length]
- [CompletionConfig.auto_learning][google.cloud.retail.v2alpha.CompletionConfig.auto_learning]
If not set, all supported fields are updated.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateCompletionConfig
public final CompletionConfig updateCompletionConfig(UpdateCompletionConfigRequest request)
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateCompletionConfigRequest request = UpdateCompletionConfigRequest.newBuilder() .setCompletionConfig(CompletionConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); CompletionConfig response = catalogServiceClient.updateCompletionConfig(request); }
- Parameters:
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
-
updateCompletionConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateCompletionConfigRequest,CompletionConfig> updateCompletionConfigCallable()
Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateCompletionConfigRequest request = UpdateCompletionConfigRequest.newBuilder() .setCompletionConfig(CompletionConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<CompletionConfig> future = catalogServiceClient.updateCompletionConfigCallable().futureCall(request); // Do something. CompletionConfig response = future.get(); }
-
getAttributesConfig
public final AttributesConfig getAttributesConfig(AttributesConfigName name)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { AttributesConfigName name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); AttributesConfig response = catalogServiceClient.getAttributesConfig(name); }
- Parameters:
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
-
getAttributesConfig
public final AttributesConfig getAttributesConfig(String name)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { String name = AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); AttributesConfig response = catalogServiceClient.getAttributesConfig(name); }
- Parameters:
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
-
getAttributesConfig
public final AttributesConfig getAttributesConfig(GetAttributesConfigRequest request)
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetAttributesConfigRequest request = GetAttributesConfigRequest.newBuilder() .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); AttributesConfig response = catalogServiceClient.getAttributesConfig(request); }
- Parameters:
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
-
getAttributesConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetAttributesConfigRequest,AttributesConfig> getAttributesConfigCallable()
Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { GetAttributesConfigRequest request = GetAttributesConfigRequest.newBuilder() .setName(AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); ApiFuture<AttributesConfig> future = catalogServiceClient.getAttributesConfigCallable().futureCall(request); // Do something. AttributesConfig response = future.get(); }
-
updateAttributesConfig
public final AttributesConfig updateAttributesConfig(AttributesConfig attributesConfig, com.google.protobuf.FieldMask updateMask)
Updates the [AttributesConfig][google.cloud.retail.v2alpha.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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { AttributesConfig attributesConfig = AttributesConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); AttributesConfig response = catalogServiceClient.updateAttributesConfig(attributesConfig, updateMask); }
- Parameters:
attributesConfig
- Required. The [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update.updateMask
- Indicates which fields in the provided [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. The following is the only supported field:- [AttributesConfig.catalog_attributes][google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes]
If not set, all supported fields are updated.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateAttributesConfig
public final AttributesConfig updateAttributesConfig(UpdateAttributesConfigRequest request)
Updates the [AttributesConfig][google.cloud.retail.v2alpha.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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateAttributesConfigRequest request = UpdateAttributesConfigRequest.newBuilder() .setAttributesConfig(AttributesConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); AttributesConfig response = catalogServiceClient.updateAttributesConfig(request); }
- Parameters:
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
-
updateAttributesConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateAttributesConfigRequest,AttributesConfig> updateAttributesConfigCallable()
Updates the [AttributesConfig][google.cloud.retail.v2alpha.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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { UpdateAttributesConfigRequest request = UpdateAttributesConfigRequest.newBuilder() .setAttributesConfig(AttributesConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<AttributesConfig> future = catalogServiceClient.updateAttributesConfigCallable().futureCall(request); // Do something. AttributesConfig response = future.get(); }
-
addCatalogAttribute
public final AttributesConfig addCatalogAttribute(AddCatalogAttributeRequest request)
Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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); }
- Parameters:
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
-
addCatalogAttributeCallable
public final com.google.api.gax.rpc.UnaryCallable<AddCatalogAttributeRequest,AttributesConfig> addCatalogAttributeCallable()
Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { AddCatalogAttributeRequest request = AddCatalogAttributeRequest.newBuilder() .setAttributesConfig( AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setCatalogAttribute(CatalogAttribute.newBuilder().build()) .build(); ApiFuture<AttributesConfig> future = catalogServiceClient.addCatalogAttributeCallable().futureCall(request); // Do something. AttributesConfig response = future.get(); }
-
removeCatalogAttribute
public final AttributesConfig removeCatalogAttribute(RemoveCatalogAttributeRequest request)
Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { RemoveCatalogAttributeRequest request = RemoveCatalogAttributeRequest.newBuilder() .setAttributesConfig( AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setKey("key106079") .build(); AttributesConfig response = catalogServiceClient.removeCatalogAttribute(request); }
- Parameters:
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
-
removeCatalogAttributeCallable
public final com.google.api.gax.rpc.UnaryCallable<RemoveCatalogAttributeRequest,AttributesConfig> removeCatalogAttributeCallable()
Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { RemoveCatalogAttributeRequest request = RemoveCatalogAttributeRequest.newBuilder() .setAttributesConfig( AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setKey("key106079") .build(); ApiFuture<AttributesConfig> future = catalogServiceClient.removeCatalogAttributeCallable().futureCall(request); // Do something. AttributesConfig response = future.get(); }
-
batchRemoveCatalogAttributes
public final BatchRemoveCatalogAttributesResponse batchRemoveCatalogAttributes(BatchRemoveCatalogAttributesRequest request)
Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { BatchRemoveCatalogAttributesRequest request = BatchRemoveCatalogAttributesRequest.newBuilder() .setAttributesConfig( AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .addAllAttributeKeys(new ArrayList<String>()) .build(); BatchRemoveCatalogAttributesResponse response = catalogServiceClient.batchRemoveCatalogAttributes(request); }
- Parameters:
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
-
batchRemoveCatalogAttributesCallable
public final com.google.api.gax.rpc.UnaryCallable<BatchRemoveCatalogAttributesRequest,BatchRemoveCatalogAttributesResponse> batchRemoveCatalogAttributesCallable()
Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) { BatchRemoveCatalogAttributesRequest request = BatchRemoveCatalogAttributesRequest.newBuilder() .setAttributesConfig( AttributesConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .addAllAttributeKeys(new ArrayList<String>()) .build(); ApiFuture<BatchRemoveCatalogAttributesResponse> future = catalogServiceClient.batchRemoveCatalogAttributesCallable().futureCall(request); // Do something. BatchRemoveCatalogAttributesResponse response = future.get(); }
-
replaceCatalogAttribute
public final AttributesConfig replaceCatalogAttribute(ReplaceCatalogAttributeRequest request)
Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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); }
- Parameters:
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
-
replaceCatalogAttributeCallable
public final com.google.api.gax.rpc.UnaryCallable<ReplaceCatalogAttributeRequest,AttributesConfig> replaceCatalogAttributeCallable()
Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key].If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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<AttributesConfig> future = catalogServiceClient.replaceCatalogAttributeCallable().futureCall(request); // Do something. AttributesConfig response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-