diff --git a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/async_client.py b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/async_client.py index 0bbfa470..c0ddbb9d 100644 --- a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/async_client.py +++ b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/async_client.py @@ -380,11 +380,8 @@ async def create_merchant_center_account_link( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: - r"""Creates a MerchantCenterAccountLink. - - [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - cannot be set to a different oneof field, if so an - INVALID_ARGUMENT is returned. + r"""Creates a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. .. code-block:: python @@ -497,14 +494,7 @@ async def sample_create_merchant_center_account_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "merchant_center_account_link.name", - request.merchant_center_account_link.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -540,7 +530,9 @@ async def delete_merchant_center_account_link( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Deletes a MerchantCenterAccountLink. If the + r"""Deletes a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. + If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned. diff --git a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py index 26983894..6004f2bc 100644 --- a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py +++ b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py @@ -625,11 +625,8 @@ def create_merchant_center_account_link( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: - r"""Creates a MerchantCenterAccountLink. - - [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - cannot be set to a different oneof field, if so an - INVALID_ARGUMENT is returned. + r"""Creates a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. .. code-block:: python @@ -745,14 +742,7 @@ def sample_create_merchant_center_account_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "merchant_center_account_link.name", - request.merchant_center_account_link.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -788,7 +778,9 @@ def delete_merchant_center_account_link( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Deletes a MerchantCenterAccountLink. If the + r"""Deletes a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. + If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned. diff --git a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc.py b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc.py index 705e9d40..bb67a179 100644 --- a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc.py +++ b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc.py @@ -294,11 +294,8 @@ def create_merchant_center_account_link( r"""Return a callable for the create merchant center account link method over gRPC. - Creates a MerchantCenterAccountLink. - - [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - cannot be set to a different oneof field, if so an - INVALID_ARGUMENT is returned. + Creates a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. Returns: Callable[[~.CreateMerchantCenterAccountLinkRequest], @@ -330,7 +327,9 @@ def delete_merchant_center_account_link( r"""Return a callable for the delete merchant center account link method over gRPC. - Deletes a MerchantCenterAccountLink. If the + Deletes a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. + If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned. diff --git a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc_asyncio.py b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc_asyncio.py index d84de76f..6c239312 100644 --- a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc_asyncio.py +++ b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/grpc_asyncio.py @@ -301,11 +301,8 @@ def create_merchant_center_account_link( r"""Return a callable for the create merchant center account link method over gRPC. - Creates a MerchantCenterAccountLink. - - [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - cannot be set to a different oneof field, if so an - INVALID_ARGUMENT is returned. + Creates a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. Returns: Callable[[~.CreateMerchantCenterAccountLinkRequest], @@ -337,7 +334,9 @@ def delete_merchant_center_account_link( r"""Return a callable for the delete merchant center account link method over gRPC. - Deletes a MerchantCenterAccountLink. If the + Deletes a + [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. + If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned. diff --git a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/rest.py b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/rest.py index e9bba943..4253fd3e 100644 --- a/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/rest.py +++ b/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/transports/rest.py @@ -385,9 +385,7 @@ class _CreateMerchantCenterAccountLink(MerchantCenterAccountLinkServiceRestStub) def __hash__(self): return hash("CreateMerchantCenterAccountLink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - "parent": "", - } + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @classmethod def _get_unset_required_fields(cls, message_dict): @@ -430,7 +428,7 @@ def __call__( http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v2alpha/{merchant_center_account_link.name=projects/*/locations/*/catalogs/*/merchantCenterAccountLinks/*}", + "uri": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks", "body": "merchant_center_account_link", }, ] diff --git a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json index 1dbadcfc..1a31fd9b 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.16.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json index 5a3171e7..55845bb0 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.16.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json index 3ded517a..edada0c1 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.16.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py b/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py index cf357eda..5cdf1b3a 100644 --- a/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py +++ b/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py @@ -1161,7 +1161,7 @@ def test_create_merchant_center_account_link_field_headers(): merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest() ) - request.merchant_center_account_link.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1179,7 +1179,7 @@ def test_create_merchant_center_account_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "merchant_center_account_link.name=name_value", + "parent=parent_value", ) in kw["metadata"] @@ -1195,7 +1195,7 @@ async def test_create_merchant_center_account_link_field_headers_async(): merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest() ) - request.merchant_center_account_link.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1215,7 +1215,7 @@ async def test_create_merchant_center_account_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "merchant_center_account_link.name=name_value", + "parent=parent_value", ) in kw["metadata"] @@ -1882,13 +1882,9 @@ def test_create_merchant_center_account_link_rest(request_type): ) # send a request that will satisfy transcoding - request_init = { - "merchant_center_account_link": { - "name": "projects/sample1/locations/sample2/catalogs/sample3/merchantCenterAccountLinks/sample4" - } - } + request_init = {"parent": "projects/sample1/locations/sample2/catalogs/sample3"} request_init["merchant_center_account_link"] = { - "name": "projects/sample1/locations/sample2/catalogs/sample3/merchantCenterAccountLinks/sample4", + "name": "name_value", "id": "id_value", "merchant_center_account_id": 2730, "branch_id": "branch_id_value", @@ -1938,7 +1934,6 @@ def test_create_merchant_center_account_link_rest_required_fields( ) # verify fields with default values are dropped - assert "parent" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() @@ -1946,16 +1941,12 @@ def test_create_merchant_center_account_link_rest_required_fields( jsonified_request.update(unset_fields) # verify required fields with default values are now present - assert "parent" in jsonified_request - assert jsonified_request["parent"] == request_init["parent"] jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() ).create_merchant_center_account_link._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("parent",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1996,13 +1987,7 @@ def test_create_merchant_center_account_link_rest_required_fields( response = client.create_merchant_center_account_link(request) - expected_params = [ - ( - "parent", - "", - ), - ("$alt", "json;enum-encoding=int"), - ] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -2016,7 +2001,7 @@ def test_create_merchant_center_account_link_rest_unset_required_fields(): transport.create_merchant_center_account_link._get_unset_required_fields({}) ) assert set(unset_fields) == ( - set(("parent",)) + set(()) & set( ( "parent", @@ -2099,13 +2084,9 @@ def test_create_merchant_center_account_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "merchant_center_account_link": { - "name": "projects/sample1/locations/sample2/catalogs/sample3/merchantCenterAccountLinks/sample4" - } - } + request_init = {"parent": "projects/sample1/locations/sample2/catalogs/sample3"} request_init["merchant_center_account_link"] = { - "name": "projects/sample1/locations/sample2/catalogs/sample3/merchantCenterAccountLinks/sample4", + "name": "name_value", "id": "id_value", "merchant_center_account_id": 2730, "branch_id": "branch_id_value", @@ -2144,9 +2125,7 @@ def test_create_merchant_center_account_link_rest_flattened(): # get arguments that satisfy an http rule for this method sample_request = { - "merchant_center_account_link": { - "name": "projects/sample1/locations/sample2/catalogs/sample3/merchantCenterAccountLinks/sample4" - } + "parent": "projects/sample1/locations/sample2/catalogs/sample3" } # get truthy value for each flattened field @@ -2172,7 +2151,7 @@ def test_create_merchant_center_account_link_rest_flattened(): assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v2alpha/{merchant_center_account_link.name=projects/*/locations/*/catalogs/*/merchantCenterAccountLinks/*}" + "%s/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks" % client.transport._host, args[1], )