Skip to content

Commit

Permalink
feat: [google-shopping-css] UpdateCssProduct is added to CssProductIn…
Browse files Browse the repository at this point in the history
…put 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Dec 23, 2024
1 parent 57232b6 commit 5db8939
Show file tree
Hide file tree
Showing 27 changed files with 2,342 additions and 433 deletions.
2 changes: 2 additions & 0 deletions packages/google-shopping-css/google/shopping/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
CssProductInput,
DeleteCssProductInputRequest,
InsertCssProductInputRequest,
UpdateCssProductInputRequest,
)
from google.shopping.css_v1.types.css_products import (
CssProduct,
Expand Down Expand Up @@ -112,6 +113,7 @@
"CssProductInput",
"DeleteCssProductInputRequest",
"InsertCssProductInputRequest",
"UpdateCssProductInputRequest",
"CssProduct",
"GetCssProductRequest",
"ListCssProductsRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.11" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
CssProductInput,
DeleteCssProductInputRequest,
InsertCssProductInputRequest,
UpdateCssProductInputRequest,
)
from .types.css_products import (
CssProduct,
Expand Down Expand Up @@ -105,4 +106,5 @@
"SubscriptionPeriod",
"UpdateAccountLabelRequest",
"UpdateAccountLabelsRequest",
"UpdateCssProductInputRequest",
)
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@
"methods": [
"insert_css_product_input"
]
},
"UpdateCssProductInput": {
"methods": [
"update_css_product_input"
]
}
}
},
Expand All @@ -177,6 +182,11 @@
"methods": [
"insert_css_product_input"
]
},
"UpdateCssProductInput": {
"methods": [
"update_css_product_input"
]
}
}
},
Expand All @@ -192,6 +202,11 @@
"methods": [
"insert_css_product_input"
]
},
"UpdateCssProductInput": {
"methods": [
"update_css_product_input"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.11" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore

from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.shopping.type.types import types

Expand Down Expand Up @@ -347,7 +348,6 @@ async def sample_insert_css_product_input():
request = css_v1.InsertCssProductInputRequest(
parent="parent_value",
css_product_input=css_product_input,
feed_id=704,
)
# Make the request
Expand Down Expand Up @@ -409,6 +409,158 @@ async def sample_insert_css_product_input():
# Done; return the response.
return response

async def update_css_product_input(
self,
request: Optional[
Union[css_product_inputs.UpdateCssProductInputRequest, dict]
] = None,
*,
css_product_input: Optional[css_product_inputs.CssProductInput] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> css_product_inputs.CssProductInput:
r"""Updates the existing Css Product input in your CSS
Center account.
After inserting, updating, or deleting a CSS Product
input, it may take several minutes before the processed
Css Product can be retrieved.
.. 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.shopping import css_v1
async def sample_update_css_product_input():
# Create a client
client = css_v1.CssProductInputsServiceAsyncClient()
# Initialize request argument(s)
css_product_input = css_v1.CssProductInput()
css_product_input.raw_provided_id = "raw_provided_id_value"
css_product_input.content_language = "content_language_value"
css_product_input.feed_label = "feed_label_value"
request = css_v1.UpdateCssProductInputRequest(
css_product_input=css_product_input,
)
# Make the request
response = await client.update_css_product_input(request=request)
# Handle the response
print(response)
Args:
request (Optional[Union[google.shopping.css_v1.types.UpdateCssProductInputRequest, dict]]):
The request object. Request message for the
UpdateCssProductInput method.
css_product_input (:class:`google.shopping.css_v1.types.CssProductInput`):
Required. The CSS product input
resource to update. Information you
submit will be applied to the processed
CSS product as well.
This corresponds to the ``css_product_input`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
The list of CSS product attributes to be updated.
If the update mask is omitted, then it is treated as
implied field mask equivalent to all fields that are
populated (have a non-empty value).
Attributes specified in the update mask without a value
specified in the body will be deleted from the CSS
product.
Update mask can only be specified for top level fields
in attributes and custom attributes.
To specify the update mask for custom attributes you
need to add the ``custom_attribute.`` prefix.
Providing special "*" value for full CSS product
replacement is not supported.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.shopping.css_v1.types.CssProductInput:
This resource represents input data
you submit for a CSS Product, not the
processed CSS Product that you see in
CSS Center, in Shopping Ads, or across
Google surfaces.
"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([css_product_input, update_mask])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, css_product_inputs.UpdateCssProductInputRequest):
request = css_product_inputs.UpdateCssProductInputRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if css_product_input is not None:
request.css_product_input = css_product_input
if update_mask is not None:
request.update_mask = update_mask

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

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

# Validate the universe domain.
self._client._validate_universe_domain()

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

# Done; return the response.
return response

async def delete_css_product_input(
self,
request: Optional[
Expand Down
Loading

0 comments on commit 5db8939

Please sign in to comment.