Skip to content

Commit 0e5f93b

Browse files
feat: [google-shopping-type] add Weight to common types for Shopping APIs to be used for accounts bundle (#12645)
BEGIN_COMMIT_OVERRIDE feat: add Weight to common types for Shopping APIs to be used for accounts bundle docs: A comment for field amount_micros in message .google.shopping.type.Price is changed END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. docs: A comment for field `amount_micros` in message `.google.shopping.type.Price` is changed PiperOrigin-RevId: 629159171 Source-Link: googleapis/googleapis@a3a2dc6 Source-Link: googleapis/googleapis-gen@7a59876 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLXR5cGUvLk93bEJvdC55YW1sIiwiaCI6IjdhNTk4NzYxZjkwMjEzMjhiYzJkZWE0NmVjMGMwODUyYWRjMjZkODMifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 18b3c0d commit 0e5f93b

File tree

4 files changed

+68
-6
lines changed

4 files changed

+68
-6
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@
1818
__version__ = package_version.__version__
1919

2020

21-
from .types.types import Channel, CustomAttribute, Destination, Price, ReportingContext
21+
from .types.types import (
22+
Channel,
23+
CustomAttribute,
24+
Destination,
25+
Price,
26+
ReportingContext,
27+
Weight,
28+
)
2229

2330
__all__ = (
2431
"Channel",
2532
"CustomAttribute",
2633
"Destination",
2734
"Price",
2835
"ReportingContext",
36+
"Weight",
2937
)

packages/google-shopping-type/google/shopping/type/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.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-shopping-type/google/shopping/type/types/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from .types import Channel, CustomAttribute, Destination, Price, ReportingContext
16+
from .types import (
17+
Channel,
18+
CustomAttribute,
19+
Destination,
20+
Price,
21+
ReportingContext,
22+
Weight,
23+
)
1724

1825
__all__ = (
1926
"Channel",
2027
"CustomAttribute",
2128
"Destination",
2229
"Price",
2330
"ReportingContext",
31+
"Weight",
2432
)

packages/google-shopping-type/google/shopping/type/types/types.py

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
__protobuf__ = proto.module(
2323
package="google.shopping.type",
2424
manifest={
25+
"Weight",
2526
"Price",
2627
"CustomAttribute",
2728
"Destination",
@@ -31,6 +32,54 @@
3132
)
3233

3334

35+
class Weight(proto.Message):
36+
r"""The weight represented as the value in string and the unit.
37+
38+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
39+
40+
Attributes:
41+
amount_micros (int):
42+
Required. The weight represented as a number
43+
in micros (1 million micros is an equivalent to
44+
one's currency standard unit, for example, 1 kg
45+
= 1000000 micros).
46+
This field can also be set as infinity by
47+
setting to -1. This field only support -1 and
48+
positive value.
49+
50+
This field is a member of `oneof`_ ``_amount_micros``.
51+
unit (google.shopping.type.types.Weight.WeightUnit):
52+
Required. The weight unit.
53+
Acceptable values are: kg and lb
54+
"""
55+
56+
class WeightUnit(proto.Enum):
57+
r"""The weight unit.
58+
59+
Values:
60+
WEIGHT_UNIT_UNSPECIFIED (0):
61+
unit unspecified
62+
POUND (1):
63+
lb unit.
64+
KILOGRAM (2):
65+
kg unit.
66+
"""
67+
WEIGHT_UNIT_UNSPECIFIED = 0
68+
POUND = 1
69+
KILOGRAM = 2
70+
71+
amount_micros: int = proto.Field(
72+
proto.INT64,
73+
number=1,
74+
optional=True,
75+
)
76+
unit: WeightUnit = proto.Field(
77+
proto.ENUM,
78+
number=2,
79+
enum=WeightUnit,
80+
)
81+
82+
3483
class Price(proto.Message):
3584
r"""The price represented as a number and currency.
3685
@@ -42,9 +91,6 @@ class Price(proto.Message):
4291
(1 million micros is an equivalent to one's
4392
currency standard unit, for example, 1 USD =
4493
1000000 micros).
45-
This field can also be set as infinity by
46-
setting to -1. This field only support -1 and
47-
positive value.
4894
4995
This field is a member of `oneof`_ ``_amount_micros``.
5096
currency_code (str):

0 commit comments

Comments
 (0)