Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
feat: support async write mode for WriteUserEvent API (#369)
Browse files Browse the repository at this point in the history
* feat: support async write mode for WriteUserEvent API
feat: support collect and import GA4 event format with prebuilt whistle rule
feat: support exact searchable and retrievable in catalog attribute config
feat: deprecate retrievable_fields in product attribute
feat: support diversity type in serving config
feat: allow set feed id in merchant center link
feat: support batch remove catalog attribute config
feat: support attribute suggestion in autocomplete
feat: support data output to GCS
feat: expose the local inventory data in product data retrieval
feat: return personal product labels in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 495450955

Source-Link: googleapis/googleapis@4e4e58c

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8c05bffff889a77614526e4d3b90d41c75c31bc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhjMDViZmZmZjg4OWE3NzYxNDUyNmU0ZDNiOTBkNDFjNzVjMzFiYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Dec 15, 2022
1 parent a4f8f62 commit 3ee1ee4
Show file tree
Hide file tree
Showing 63 changed files with 1,958 additions and 592 deletions.
10 changes: 10 additions & 0 deletions google/cloud/retail_v2alpha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@
Catalog,
CatalogAttribute,
CompletionConfig,
MerchantCenterFeedFilter,
MerchantCenterLink,
MerchantCenterLinkingConfig,
ProductLevelConfig,
)
from .types.catalog_service import (
AddCatalogAttributeRequest,
BatchRemoveCatalogAttributesRequest,
BatchRemoveCatalogAttributesResponse,
GetAttributesConfigRequest,
GetCompletionConfigRequest,
GetDefaultBranchRequest,
Expand Down Expand Up @@ -97,6 +100,7 @@
ExportMetadata,
ExportProductsResponse,
ExportUserEventsResponse,
GcsOutputResult,
OutputResult,
)
from .types.import_config import (
Expand All @@ -113,6 +117,7 @@
ImportUserEventsResponse,
ProductInlineSource,
ProductInputConfig,
TransformedUserEventsMetadata,
UserEventImportSummary,
UserEventInlineSource,
UserEventInputConfig,
Expand Down Expand Up @@ -212,6 +217,8 @@
"AttributeConfigLevel",
"AttributesConfig",
"Audience",
"BatchRemoveCatalogAttributesRequest",
"BatchRemoveCatalogAttributesResponse",
"BigQueryOutputResult",
"BigQuerySource",
"Catalog",
Expand Down Expand Up @@ -243,6 +250,7 @@
"ExportProductsResponse",
"ExportUserEventsResponse",
"FulfillmentInfo",
"GcsOutputResult",
"GcsSource",
"GetAttributesConfigRequest",
"GetCompletionConfigRequest",
Expand Down Expand Up @@ -272,6 +280,7 @@
"ListServingConfigsRequest",
"ListServingConfigsResponse",
"LocalInventory",
"MerchantCenterFeedFilter",
"MerchantCenterLink",
"MerchantCenterLinkingConfig",
"Model",
Expand Down Expand Up @@ -323,6 +332,7 @@
"SetInventoryRequest",
"SetInventoryResponse",
"SolutionType",
"TransformedUserEventsMetadata",
"TuneModelMetadata",
"TuneModelRequest",
"TuneModelResponse",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/retail_v2alpha/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"add_catalog_attribute"
]
},
"BatchRemoveCatalogAttributes": {
"methods": [
"batch_remove_catalog_attributes"
]
},
"GetAttributesConfig": {
"methods": [
"get_attributes_config"
Expand Down Expand Up @@ -75,6 +80,11 @@
"add_catalog_attribute"
]
},
"BatchRemoveCatalogAttributes": {
"methods": [
"batch_remove_catalog_attributes"
]
},
"GetAttributesConfig": {
"methods": [
"get_attributes_config"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ async def sample_get_completion_config():
method.
name (:class:`str`):
Required. Full CompletionConfig resource name. Format:
projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
``projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -1377,6 +1377,95 @@ async def sample_remove_catalog_attribute():
# Done; return the response.
return response

async def batch_remove_catalog_attributes(
self,
request: Optional[
Union[catalog_service.BatchRemoveCatalogAttributesRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> catalog_service.BatchRemoveCatalogAttributesResponse:
r"""Removes all specified
[CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s
from the
[AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].
.. code-block:: python
# 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://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import retail_v2alpha
async def sample_batch_remove_catalog_attributes():
# Create a client
client = retail_v2alpha.CatalogServiceAsyncClient()
# Initialize request argument(s)
request = retail_v2alpha.BatchRemoveCatalogAttributesRequest(
attributes_config="attributes_config_value",
attribute_keys=['attribute_keys_value1', 'attribute_keys_value2'],
)
# Make the request
response = await client.batch_remove_catalog_attributes(request=request)
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.retail_v2alpha.types.BatchRemoveCatalogAttributesRequest, dict]]):
The request object. Request for
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes]
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.retail_v2alpha.types.BatchRemoveCatalogAttributesResponse:
Response of the
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes].
"""
# Create or coerce a protobuf request object.
request = catalog_service.BatchRemoveCatalogAttributesRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.batch_remove_catalog_attributes,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("attributes_config", request.attributes_config),)
),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def replace_catalog_attribute(
self,
request: Optional[
Expand Down
94 changes: 93 additions & 1 deletion google/cloud/retail_v2alpha/services/catalog_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def sample_get_completion_config():
method.
name (str):
Required. Full CompletionConfig resource name. Format:
projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
``projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -1664,6 +1664,98 @@ def sample_remove_catalog_attribute():
# Done; return the response.
return response

def batch_remove_catalog_attributes(
self,
request: Optional[
Union[catalog_service.BatchRemoveCatalogAttributesRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> catalog_service.BatchRemoveCatalogAttributesResponse:
r"""Removes all specified
[CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s
from the
[AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].
.. code-block:: python
# 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://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import retail_v2alpha
def sample_batch_remove_catalog_attributes():
# Create a client
client = retail_v2alpha.CatalogServiceClient()
# Initialize request argument(s)
request = retail_v2alpha.BatchRemoveCatalogAttributesRequest(
attributes_config="attributes_config_value",
attribute_keys=['attribute_keys_value1', 'attribute_keys_value2'],
)
# Make the request
response = client.batch_remove_catalog_attributes(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.retail_v2alpha.types.BatchRemoveCatalogAttributesRequest, dict]):
The request object. Request for
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes]
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.retail_v2alpha.types.BatchRemoveCatalogAttributesResponse:
Response of the
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes].
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
# in a catalog_service.BatchRemoveCatalogAttributesRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, catalog_service.BatchRemoveCatalogAttributesRequest):
request = catalog_service.BatchRemoveCatalogAttributesRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.batch_remove_catalog_attributes
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("attributes_config", request.attributes_config),)
),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

def replace_catalog_attribute(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.batch_remove_catalog_attributes: gapic_v1.method.wrap_method(
self.batch_remove_catalog_attributes,
default_timeout=None,
client_info=client_info,
),
self.replace_catalog_attribute: gapic_v1.method.wrap_method(
self.replace_catalog_attribute,
default_timeout=None,
Expand Down Expand Up @@ -287,6 +292,18 @@ def remove_catalog_attribute(
]:
raise NotImplementedError()

@property
def batch_remove_catalog_attributes(
self,
) -> Callable[
[catalog_service.BatchRemoveCatalogAttributesRequest],
Union[
catalog_service.BatchRemoveCatalogAttributesResponse,
Awaitable[catalog_service.BatchRemoveCatalogAttributesResponse],
],
]:
raise NotImplementedError()

@property
def replace_catalog_attribute(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,41 @@ def remove_catalog_attribute(
)
return self._stubs["remove_catalog_attribute"]

@property
def batch_remove_catalog_attributes(
self,
) -> Callable[
[catalog_service.BatchRemoveCatalogAttributesRequest],
catalog_service.BatchRemoveCatalogAttributesResponse,
]:
r"""Return a callable for the batch remove catalog
attributes method over gRPC.
Removes all specified
[CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s
from the
[AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].
Returns:
Callable[[~.BatchRemoveCatalogAttributesRequest],
~.BatchRemoveCatalogAttributesResponse]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "batch_remove_catalog_attributes" not in self._stubs:
self._stubs[
"batch_remove_catalog_attributes"
] = self.grpc_channel.unary_unary(
"/google.cloud.retail.v2alpha.CatalogService/BatchRemoveCatalogAttributes",
request_serializer=catalog_service.BatchRemoveCatalogAttributesRequest.serialize,
response_deserializer=catalog_service.BatchRemoveCatalogAttributesResponse.deserialize,
)
return self._stubs["batch_remove_catalog_attributes"]

@property
def replace_catalog_attribute(
self,
Expand Down
Loading

0 comments on commit 3ee1ee4

Please sign in to comment.