Skip to content

Commit 5db8939

Browse files
feat: [google-shopping-css] UpdateCssProduct is added to CssProductInput proto (#13382)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: UpdateCssProduct is added to CssProductInput proto docs: Mark `freshness_time` as deprecated docs : Mark `feed_id` as deprecated docs: A comment for field `page_size` in message `.google.shopping.css.v1.ListChildAccountsRequest` is changed docs: A comment for field `low_price` in message `.google.shopping.css.v1.Attributes` is changed docs: A comment for field `high_price` in message `.google.shopping.css.v1.Attributes` is changed docs: A comment for field `number_of_offers` in message `.google.shopping.css.v1.Attributes` is changed docs: A comment for field `headline_offer_price` in message `.google.shopping.css.v1.Attributes` is changed docs: A comment for field `headline_offer_shipping_price` in message `.google.shopping.css.v1.Attributes` is changed docs: A comment for field `approved_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed docs: A comment for field `pending_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed docs: A comment for field `disapproved_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed docs: A comment for field `servability` in message `.google.shopping.css.v1.CssProductStatus` is changed docs: A comment for field `applicable_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed docs: A comment for field `feed_id` in message`.google.shopping.css.v1.InsertCssProductInputRequest` is changed docs: A comment for message `CssProduct` is changed END_COMMIT_OVERRIDE PiperOrigin-RevId: 708397816 Source-Link: googleapis/googleapis@892e72f Source-Link: googleapis/googleapis-gen@09992f0 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLWNzcy8uT3dsQm90LnlhbWwiLCJoIjoiMDk5OTJmMGQ5NDViZWIwOTIxMjJmYTFiZGY0NTNmNTMyMWJjMGY4YyJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 57232b6 commit 5db8939

27 files changed

+2342
-433
lines changed

packages/google-shopping-css/google/shopping/css/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
CssProductInput,
7373
DeleteCssProductInputRequest,
7474
InsertCssProductInputRequest,
75+
UpdateCssProductInputRequest,
7576
)
7677
from google.shopping.css_v1.types.css_products import (
7778
CssProduct,
@@ -112,6 +113,7 @@
112113
"CssProductInput",
113114
"DeleteCssProductInputRequest",
114115
"InsertCssProductInputRequest",
116+
"UpdateCssProductInputRequest",
115117
"CssProduct",
116118
"GetCssProductRequest",
117119
"ListCssProductsRequest",

packages/google-shopping-css/google/shopping/css/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.11" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-shopping-css/google/shopping/css_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
CssProductInput,
6262
DeleteCssProductInputRequest,
6363
InsertCssProductInputRequest,
64+
UpdateCssProductInputRequest,
6465
)
6566
from .types.css_products import (
6667
CssProduct,
@@ -105,4 +106,5 @@
105106
"SubscriptionPeriod",
106107
"UpdateAccountLabelRequest",
107108
"UpdateAccountLabelsRequest",
109+
"UpdateCssProductInputRequest",
108110
)

packages/google-shopping-css/google/shopping/css_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@
162162
"methods": [
163163
"insert_css_product_input"
164164
]
165+
},
166+
"UpdateCssProductInput": {
167+
"methods": [
168+
"update_css_product_input"
169+
]
165170
}
166171
}
167172
},
@@ -177,6 +182,11 @@
177182
"methods": [
178183
"insert_css_product_input"
179184
]
185+
},
186+
"UpdateCssProductInput": {
187+
"methods": [
188+
"update_css_product_input"
189+
]
180190
}
181191
}
182192
},
@@ -192,6 +202,11 @@
192202
"methods": [
193203
"insert_css_product_input"
194204
]
205+
},
206+
"UpdateCssProductInput": {
207+
"methods": [
208+
"update_css_product_input"
209+
]
195210
}
196211
}
197212
}

packages/google-shopping-css/google/shopping/css_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.11" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-shopping-css/google/shopping/css_v1/services/css_product_inputs_service/async_client.py

Lines changed: 153 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
except AttributeError: # pragma: NO COVER
4444
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4545

46+
from google.protobuf import field_mask_pb2 # type: ignore
4647
from google.protobuf import timestamp_pb2 # type: ignore
4748
from google.shopping.type.types import types
4849

@@ -347,7 +348,6 @@ async def sample_insert_css_product_input():
347348
request = css_v1.InsertCssProductInputRequest(
348349
parent="parent_value",
349350
css_product_input=css_product_input,
350-
feed_id=704,
351351
)
352352
353353
# Make the request
@@ -409,6 +409,158 @@ async def sample_insert_css_product_input():
409409
# Done; return the response.
410410
return response
411411

412+
async def update_css_product_input(
413+
self,
414+
request: Optional[
415+
Union[css_product_inputs.UpdateCssProductInputRequest, dict]
416+
] = None,
417+
*,
418+
css_product_input: Optional[css_product_inputs.CssProductInput] = None,
419+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
420+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
421+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
422+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
423+
) -> css_product_inputs.CssProductInput:
424+
r"""Updates the existing Css Product input in your CSS
425+
Center account.
426+
After inserting, updating, or deleting a CSS Product
427+
input, it may take several minutes before the processed
428+
Css Product can be retrieved.
429+
430+
.. code-block:: python
431+
432+
# This snippet has been automatically generated and should be regarded as a
433+
# code template only.
434+
# It will require modifications to work:
435+
# - It may require correct/in-range values for request initialization.
436+
# - It may require specifying regional endpoints when creating the service
437+
# client as shown in:
438+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
439+
from google.shopping import css_v1
440+
441+
async def sample_update_css_product_input():
442+
# Create a client
443+
client = css_v1.CssProductInputsServiceAsyncClient()
444+
445+
# Initialize request argument(s)
446+
css_product_input = css_v1.CssProductInput()
447+
css_product_input.raw_provided_id = "raw_provided_id_value"
448+
css_product_input.content_language = "content_language_value"
449+
css_product_input.feed_label = "feed_label_value"
450+
451+
request = css_v1.UpdateCssProductInputRequest(
452+
css_product_input=css_product_input,
453+
)
454+
455+
# Make the request
456+
response = await client.update_css_product_input(request=request)
457+
458+
# Handle the response
459+
print(response)
460+
461+
Args:
462+
request (Optional[Union[google.shopping.css_v1.types.UpdateCssProductInputRequest, dict]]):
463+
The request object. Request message for the
464+
UpdateCssProductInput method.
465+
css_product_input (:class:`google.shopping.css_v1.types.CssProductInput`):
466+
Required. The CSS product input
467+
resource to update. Information you
468+
submit will be applied to the processed
469+
CSS product as well.
470+
471+
This corresponds to the ``css_product_input`` field
472+
on the ``request`` instance; if ``request`` is provided, this
473+
should not be set.
474+
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
475+
The list of CSS product attributes to be updated.
476+
477+
If the update mask is omitted, then it is treated as
478+
implied field mask equivalent to all fields that are
479+
populated (have a non-empty value).
480+
481+
Attributes specified in the update mask without a value
482+
specified in the body will be deleted from the CSS
483+
product.
484+
485+
Update mask can only be specified for top level fields
486+
in attributes and custom attributes.
487+
488+
To specify the update mask for custom attributes you
489+
need to add the ``custom_attribute.`` prefix.
490+
491+
Providing special "*" value for full CSS product
492+
replacement is not supported.
493+
494+
This corresponds to the ``update_mask`` field
495+
on the ``request`` instance; if ``request`` is provided, this
496+
should not be set.
497+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
498+
should be retried.
499+
timeout (float): The timeout for this request.
500+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
501+
sent along with the request as metadata. Normally, each value must be of type `str`,
502+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
503+
be of type `bytes`.
504+
505+
Returns:
506+
google.shopping.css_v1.types.CssProductInput:
507+
This resource represents input data
508+
you submit for a CSS Product, not the
509+
processed CSS Product that you see in
510+
CSS Center, in Shopping Ads, or across
511+
Google surfaces.
512+
513+
"""
514+
# Create or coerce a protobuf request object.
515+
# - Quick check: If we got a request object, we should *not* have
516+
# gotten any keyword arguments that map to the request.
517+
has_flattened_params = any([css_product_input, update_mask])
518+
if request is not None and has_flattened_params:
519+
raise ValueError(
520+
"If the `request` argument is set, then none of "
521+
"the individual field arguments should be set."
522+
)
523+
524+
# - Use the request object if provided (there's no risk of modifying the input as
525+
# there are no flattened fields), or create one.
526+
if not isinstance(request, css_product_inputs.UpdateCssProductInputRequest):
527+
request = css_product_inputs.UpdateCssProductInputRequest(request)
528+
529+
# If we have keyword arguments corresponding to fields on the
530+
# request, apply these.
531+
if css_product_input is not None:
532+
request.css_product_input = css_product_input
533+
if update_mask is not None:
534+
request.update_mask = update_mask
535+
536+
# Wrap the RPC method; this adds retry and timeout information,
537+
# and friendly error handling.
538+
rpc = self._client._transport._wrapped_methods[
539+
self._client._transport.update_css_product_input
540+
]
541+
542+
# Certain fields should be provided within the metadata header;
543+
# add these here.
544+
metadata = tuple(metadata) + (
545+
gapic_v1.routing_header.to_grpc_metadata(
546+
(("css_product_input.name", request.css_product_input.name),)
547+
),
548+
)
549+
550+
# Validate the universe domain.
551+
self._client._validate_universe_domain()
552+
553+
# Send the request.
554+
response = await rpc(
555+
request,
556+
retry=retry,
557+
timeout=timeout,
558+
metadata=metadata,
559+
)
560+
561+
# Done; return the response.
562+
return response
563+
412564
async def delete_css_product_input(
413565
self,
414566
request: Optional[

0 commit comments

Comments
 (0)