diff --git a/ShoppingCommonProtos/metadata/Type/Types.php b/ShoppingCommonProtos/metadata/Type/Types.php index b0f3259bdbf..e9a56532be3 100644 Binary files a/ShoppingCommonProtos/metadata/Type/Types.php and b/ShoppingCommonProtos/metadata/Type/Types.php differ diff --git a/ShoppingCommonProtos/src/Type/Price.php b/ShoppingCommonProtos/src/Type/Price.php index d54d15dc6e6..769212ad4d8 100644 --- a/ShoppingCommonProtos/src/Type/Price.php +++ b/ShoppingCommonProtos/src/Type/Price.php @@ -19,8 +19,6 @@ class Price extends \Google\Protobuf\Internal\Message * The price represented as a number in micros (1 million micros is an * equivalent to one's currency standard unit, for example, 1 USD = 1000000 * micros). - * This field can also be set as infinity by setting to -1. - * This field only support -1 and positive value. * * Generated from protobuf field optional int64 amount_micros = 1; */ @@ -43,8 +41,6 @@ class Price extends \Google\Protobuf\Internal\Message * The price represented as a number in micros (1 million micros is an * equivalent to one's currency standard unit, for example, 1 USD = 1000000 * micros). - * This field can also be set as infinity by setting to -1. - * This field only support -1 and positive value. * @type string $currency_code * The currency of the price using three-letter acronyms according to [ISO * 4217](http://en.wikipedia.org/wiki/ISO_4217). @@ -59,8 +55,6 @@ public function __construct($data = NULL) { * The price represented as a number in micros (1 million micros is an * equivalent to one's currency standard unit, for example, 1 USD = 1000000 * micros). - * This field can also be set as infinity by setting to -1. - * This field only support -1 and positive value. * * Generated from protobuf field optional int64 amount_micros = 1; * @return int|string @@ -84,8 +78,6 @@ public function clearAmountMicros() * The price represented as a number in micros (1 million micros is an * equivalent to one's currency standard unit, for example, 1 USD = 1000000 * micros). - * This field can also be set as infinity by setting to -1. - * This field only support -1 and positive value. * * Generated from protobuf field optional int64 amount_micros = 1; * @param int|string $var diff --git a/ShoppingCommonProtos/src/Type/Weight.php b/ShoppingCommonProtos/src/Type/Weight.php new file mode 100644 index 00000000000..755cc80f58f --- /dev/null +++ b/ShoppingCommonProtos/src/Type/Weight.php @@ -0,0 +1,131 @@ +google.shopping.type.Weight + */ +class Weight extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The weight represented as a number in micros (1 million micros is + * an equivalent to one's currency standard unit, for example, 1 kg = 1000000 + * micros). + * This field can also be set as infinity by setting to -1. + * This field only support -1 and positive value. + * + * Generated from protobuf field optional int64 amount_micros = 1; + */ + protected $amount_micros = null; + /** + * Required. The weight unit. + * Acceptable values are: kg and lb + * + * Generated from protobuf field .google.shopping.type.Weight.WeightUnit unit = 2; + */ + protected $unit = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $amount_micros + * Required. The weight represented as a number in micros (1 million micros is + * an equivalent to one's currency standard unit, for example, 1 kg = 1000000 + * micros). + * This field can also be set as infinity by setting to -1. + * This field only support -1 and positive value. + * @type int $unit + * Required. The weight unit. + * Acceptable values are: kg and lb + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Type\Types::initOnce(); + parent::__construct($data); + } + + /** + * Required. The weight represented as a number in micros (1 million micros is + * an equivalent to one's currency standard unit, for example, 1 kg = 1000000 + * micros). + * This field can also be set as infinity by setting to -1. + * This field only support -1 and positive value. + * + * Generated from protobuf field optional int64 amount_micros = 1; + * @return int|string + */ + public function getAmountMicros() + { + return isset($this->amount_micros) ? $this->amount_micros : 0; + } + + public function hasAmountMicros() + { + return isset($this->amount_micros); + } + + public function clearAmountMicros() + { + unset($this->amount_micros); + } + + /** + * Required. The weight represented as a number in micros (1 million micros is + * an equivalent to one's currency standard unit, for example, 1 kg = 1000000 + * micros). + * This field can also be set as infinity by setting to -1. + * This field only support -1 and positive value. + * + * Generated from protobuf field optional int64 amount_micros = 1; + * @param int|string $var + * @return $this + */ + public function setAmountMicros($var) + { + GPBUtil::checkInt64($var); + $this->amount_micros = $var; + + return $this; + } + + /** + * Required. The weight unit. + * Acceptable values are: kg and lb + * + * Generated from protobuf field .google.shopping.type.Weight.WeightUnit unit = 2; + * @return int + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Required. The weight unit. + * Acceptable values are: kg and lb + * + * Generated from protobuf field .google.shopping.type.Weight.WeightUnit unit = 2; + * @param int $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Type\Weight\WeightUnit::class); + $this->unit = $var; + + return $this; + } + +} + diff --git a/ShoppingCommonProtos/src/Type/Weight/WeightUnit.php b/ShoppingCommonProtos/src/Type/Weight/WeightUnit.php new file mode 100644 index 00000000000..c51ac683e3c --- /dev/null +++ b/ShoppingCommonProtos/src/Type/Weight/WeightUnit.php @@ -0,0 +1,64 @@ +google.shopping.type.Weight.WeightUnit + */ +class WeightUnit +{ + /** + * unit unspecified + * + * Generated from protobuf enum WEIGHT_UNIT_UNSPECIFIED = 0; + */ + const WEIGHT_UNIT_UNSPECIFIED = 0; + /** + * lb unit. + * + * Generated from protobuf enum POUND = 1; + */ + const POUND = 1; + /** + * kg unit. + * + * Generated from protobuf enum KILOGRAM = 2; + */ + const KILOGRAM = 2; + + private static $valueToName = [ + self::WEIGHT_UNIT_UNSPECIFIED => 'WEIGHT_UNIT_UNSPECIFIED', + self::POUND => 'POUND', + self::KILOGRAM => 'KILOGRAM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WeightUnit::class, \Google\Shopping\Type\Weight_WeightUnit::class); +