@google-shopping/lfp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/googleapis/google-cloud-node/compare/lfp-v0.1.0...lfp-v0.2.0) (2024-05-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * [shopping] add `Weight` to common types for Shopping APIs to be used for accounts bundle ([#5291](https://github.com/googleapis/google-cloud-node/issues/5291)) ([27a72a6](https://github.com/googleapis/google-cloud-node/commit/27a72a6d16079ff025b4a9ac702c6d1bffd017ce))
9
+
3
10
  ## 0.1.0 (2024-04-18)
4
11
 
5
12
 
@@ -22,13 +22,37 @@ option java_multiple_files = true;
22
22
  option java_outer_classname = "TypesProto";
23
23
  option java_package = "com.google.shopping.type";
24
24
 
25
+ // The weight represented as the value in string and the unit.
26
+ message Weight {
27
+ // The weight unit.
28
+ enum WeightUnit {
29
+ // unit unspecified
30
+ WEIGHT_UNIT_UNSPECIFIED = 0;
31
+
32
+ // lb unit.
33
+ POUND = 1;
34
+
35
+ // kg unit.
36
+ KILOGRAM = 2;
37
+ }
38
+
39
+ // Required. The weight represented as a number in micros (1 million micros is
40
+ // an equivalent to one's currency standard unit, for example, 1 kg = 1000000
41
+ // micros).
42
+ // This field can also be set as infinity by setting to -1.
43
+ // This field only support -1 and positive value.
44
+ optional int64 amount_micros = 1;
45
+
46
+ // Required. The weight unit.
47
+ // Acceptable values are: kg and lb
48
+ WeightUnit unit = 2;
49
+ }
50
+
25
51
  // The price represented as a number and currency.
26
52
  message Price {
27
53
  // The price represented as a number in micros (1 million micros is an
28
54
  // equivalent to one's currency standard unit, for example, 1 USD = 1000000
29
55
  // micros).
30
- // This field can also be set as infinity by setting to -1.
31
- // This field only support -1 and positive value.
32
56
  optional int64 amount_micros = 1;
33
57
 
34
58
  // The currency of the price using three-letter acronyms according to [ISO
@@ -1495,6 +1495,122 @@ export namespace google {
1495
1495
  /** Namespace type. */
1496
1496
  namespace type {
1497
1497
 
1498
+ /** Properties of a Weight. */
1499
+ interface IWeight {
1500
+
1501
+ /** Weight amountMicros */
1502
+ amountMicros?: (number|Long|string|null);
1503
+
1504
+ /** Weight unit */
1505
+ unit?: (google.shopping.type.Weight.WeightUnit|keyof typeof google.shopping.type.Weight.WeightUnit|null);
1506
+ }
1507
+
1508
+ /** Represents a Weight. */
1509
+ class Weight implements IWeight {
1510
+
1511
+ /**
1512
+ * Constructs a new Weight.
1513
+ * @param [properties] Properties to set
1514
+ */
1515
+ constructor(properties?: google.shopping.type.IWeight);
1516
+
1517
+ /** Weight amountMicros. */
1518
+ public amountMicros?: (number|Long|string|null);
1519
+
1520
+ /** Weight unit. */
1521
+ public unit: (google.shopping.type.Weight.WeightUnit|keyof typeof google.shopping.type.Weight.WeightUnit);
1522
+
1523
+ /** Weight _amountMicros. */
1524
+ public _amountMicros?: "amountMicros";
1525
+
1526
+ /**
1527
+ * Creates a new Weight instance using the specified properties.
1528
+ * @param [properties] Properties to set
1529
+ * @returns Weight instance
1530
+ */
1531
+ public static create(properties?: google.shopping.type.IWeight): google.shopping.type.Weight;
1532
+
1533
+ /**
1534
+ * Encodes the specified Weight message. Does not implicitly {@link google.shopping.type.Weight.verify|verify} messages.
1535
+ * @param message Weight message or plain object to encode
1536
+ * @param [writer] Writer to encode to
1537
+ * @returns Writer
1538
+ */
1539
+ public static encode(message: google.shopping.type.IWeight, writer?: $protobuf.Writer): $protobuf.Writer;
1540
+
1541
+ /**
1542
+ * Encodes the specified Weight message, length delimited. Does not implicitly {@link google.shopping.type.Weight.verify|verify} messages.
1543
+ * @param message Weight message or plain object to encode
1544
+ * @param [writer] Writer to encode to
1545
+ * @returns Writer
1546
+ */
1547
+ public static encodeDelimited(message: google.shopping.type.IWeight, writer?: $protobuf.Writer): $protobuf.Writer;
1548
+
1549
+ /**
1550
+ * Decodes a Weight message from the specified reader or buffer.
1551
+ * @param reader Reader or buffer to decode from
1552
+ * @param [length] Message length if known beforehand
1553
+ * @returns Weight
1554
+ * @throws {Error} If the payload is not a reader or valid buffer
1555
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1556
+ */
1557
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.shopping.type.Weight;
1558
+
1559
+ /**
1560
+ * Decodes a Weight message from the specified reader or buffer, length delimited.
1561
+ * @param reader Reader or buffer to decode from
1562
+ * @returns Weight
1563
+ * @throws {Error} If the payload is not a reader or valid buffer
1564
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1565
+ */
1566
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.shopping.type.Weight;
1567
+
1568
+ /**
1569
+ * Verifies a Weight message.
1570
+ * @param message Plain object to verify
1571
+ * @returns `null` if valid, otherwise the reason why it is not
1572
+ */
1573
+ public static verify(message: { [k: string]: any }): (string|null);
1574
+
1575
+ /**
1576
+ * Creates a Weight message from a plain object. Also converts values to their respective internal types.
1577
+ * @param object Plain object
1578
+ * @returns Weight
1579
+ */
1580
+ public static fromObject(object: { [k: string]: any }): google.shopping.type.Weight;
1581
+
1582
+ /**
1583
+ * Creates a plain object from a Weight message. Also converts values to other types if specified.
1584
+ * @param message Weight
1585
+ * @param [options] Conversion options
1586
+ * @returns Plain object
1587
+ */
1588
+ public static toObject(message: google.shopping.type.Weight, options?: $protobuf.IConversionOptions): { [k: string]: any };
1589
+
1590
+ /**
1591
+ * Converts this Weight to JSON.
1592
+ * @returns JSON object
1593
+ */
1594
+ public toJSON(): { [k: string]: any };
1595
+
1596
+ /**
1597
+ * Gets the default type url for Weight
1598
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1599
+ * @returns The default type url
1600
+ */
1601
+ public static getTypeUrl(typeUrlPrefix?: string): string;
1602
+ }
1603
+
1604
+ namespace Weight {
1605
+
1606
+ /** WeightUnit enum. */
1607
+ enum WeightUnit {
1608
+ WEIGHT_UNIT_UNSPECIFIED = 0,
1609
+ POUND = 1,
1610
+ KILOGRAM = 2
1611
+ }
1612
+ }
1613
+
1498
1614
  /** Properties of a Price. */
1499
1615
  interface IPrice {
1500
1616
 
@@ -3762,6 +3762,301 @@
3762
3762
  */
3763
3763
  var type = {};
3764
3764
 
3765
+ type.Weight = (function() {
3766
+
3767
+ /**
3768
+ * Properties of a Weight.
3769
+ * @memberof google.shopping.type
3770
+ * @interface IWeight
3771
+ * @property {number|Long|null} [amountMicros] Weight amountMicros
3772
+ * @property {google.shopping.type.Weight.WeightUnit|null} [unit] Weight unit
3773
+ */
3774
+
3775
+ /**
3776
+ * Constructs a new Weight.
3777
+ * @memberof google.shopping.type
3778
+ * @classdesc Represents a Weight.
3779
+ * @implements IWeight
3780
+ * @constructor
3781
+ * @param {google.shopping.type.IWeight=} [properties] Properties to set
3782
+ */
3783
+ function Weight(properties) {
3784
+ if (properties)
3785
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3786
+ if (properties[keys[i]] != null)
3787
+ this[keys[i]] = properties[keys[i]];
3788
+ }
3789
+
3790
+ /**
3791
+ * Weight amountMicros.
3792
+ * @member {number|Long|null|undefined} amountMicros
3793
+ * @memberof google.shopping.type.Weight
3794
+ * @instance
3795
+ */
3796
+ Weight.prototype.amountMicros = null;
3797
+
3798
+ /**
3799
+ * Weight unit.
3800
+ * @member {google.shopping.type.Weight.WeightUnit} unit
3801
+ * @memberof google.shopping.type.Weight
3802
+ * @instance
3803
+ */
3804
+ Weight.prototype.unit = 0;
3805
+
3806
+ // OneOf field names bound to virtual getters and setters
3807
+ var $oneOfFields;
3808
+
3809
+ /**
3810
+ * Weight _amountMicros.
3811
+ * @member {"amountMicros"|undefined} _amountMicros
3812
+ * @memberof google.shopping.type.Weight
3813
+ * @instance
3814
+ */
3815
+ Object.defineProperty(Weight.prototype, "_amountMicros", {
3816
+ get: $util.oneOfGetter($oneOfFields = ["amountMicros"]),
3817
+ set: $util.oneOfSetter($oneOfFields)
3818
+ });
3819
+
3820
+ /**
3821
+ * Creates a new Weight instance using the specified properties.
3822
+ * @function create
3823
+ * @memberof google.shopping.type.Weight
3824
+ * @static
3825
+ * @param {google.shopping.type.IWeight=} [properties] Properties to set
3826
+ * @returns {google.shopping.type.Weight} Weight instance
3827
+ */
3828
+ Weight.create = function create(properties) {
3829
+ return new Weight(properties);
3830
+ };
3831
+
3832
+ /**
3833
+ * Encodes the specified Weight message. Does not implicitly {@link google.shopping.type.Weight.verify|verify} messages.
3834
+ * @function encode
3835
+ * @memberof google.shopping.type.Weight
3836
+ * @static
3837
+ * @param {google.shopping.type.IWeight} message Weight message or plain object to encode
3838
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3839
+ * @returns {$protobuf.Writer} Writer
3840
+ */
3841
+ Weight.encode = function encode(message, writer) {
3842
+ if (!writer)
3843
+ writer = $Writer.create();
3844
+ if (message.amountMicros != null && Object.hasOwnProperty.call(message, "amountMicros"))
3845
+ writer.uint32(/* id 1, wireType 0 =*/8).int64(message.amountMicros);
3846
+ if (message.unit != null && Object.hasOwnProperty.call(message, "unit"))
3847
+ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.unit);
3848
+ return writer;
3849
+ };
3850
+
3851
+ /**
3852
+ * Encodes the specified Weight message, length delimited. Does not implicitly {@link google.shopping.type.Weight.verify|verify} messages.
3853
+ * @function encodeDelimited
3854
+ * @memberof google.shopping.type.Weight
3855
+ * @static
3856
+ * @param {google.shopping.type.IWeight} message Weight message or plain object to encode
3857
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3858
+ * @returns {$protobuf.Writer} Writer
3859
+ */
3860
+ Weight.encodeDelimited = function encodeDelimited(message, writer) {
3861
+ return this.encode(message, writer).ldelim();
3862
+ };
3863
+
3864
+ /**
3865
+ * Decodes a Weight message from the specified reader or buffer.
3866
+ * @function decode
3867
+ * @memberof google.shopping.type.Weight
3868
+ * @static
3869
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3870
+ * @param {number} [length] Message length if known beforehand
3871
+ * @returns {google.shopping.type.Weight} Weight
3872
+ * @throws {Error} If the payload is not a reader or valid buffer
3873
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3874
+ */
3875
+ Weight.decode = function decode(reader, length) {
3876
+ if (!(reader instanceof $Reader))
3877
+ reader = $Reader.create(reader);
3878
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.shopping.type.Weight();
3879
+ while (reader.pos < end) {
3880
+ var tag = reader.uint32();
3881
+ switch (tag >>> 3) {
3882
+ case 1: {
3883
+ message.amountMicros = reader.int64();
3884
+ break;
3885
+ }
3886
+ case 2: {
3887
+ message.unit = reader.int32();
3888
+ break;
3889
+ }
3890
+ default:
3891
+ reader.skipType(tag & 7);
3892
+ break;
3893
+ }
3894
+ }
3895
+ return message;
3896
+ };
3897
+
3898
+ /**
3899
+ * Decodes a Weight message from the specified reader or buffer, length delimited.
3900
+ * @function decodeDelimited
3901
+ * @memberof google.shopping.type.Weight
3902
+ * @static
3903
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3904
+ * @returns {google.shopping.type.Weight} Weight
3905
+ * @throws {Error} If the payload is not a reader or valid buffer
3906
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3907
+ */
3908
+ Weight.decodeDelimited = function decodeDelimited(reader) {
3909
+ if (!(reader instanceof $Reader))
3910
+ reader = new $Reader(reader);
3911
+ return this.decode(reader, reader.uint32());
3912
+ };
3913
+
3914
+ /**
3915
+ * Verifies a Weight message.
3916
+ * @function verify
3917
+ * @memberof google.shopping.type.Weight
3918
+ * @static
3919
+ * @param {Object.<string,*>} message Plain object to verify
3920
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3921
+ */
3922
+ Weight.verify = function verify(message) {
3923
+ if (typeof message !== "object" || message === null)
3924
+ return "object expected";
3925
+ var properties = {};
3926
+ if (message.amountMicros != null && message.hasOwnProperty("amountMicros")) {
3927
+ properties._amountMicros = 1;
3928
+ if (!$util.isInteger(message.amountMicros) && !(message.amountMicros && $util.isInteger(message.amountMicros.low) && $util.isInteger(message.amountMicros.high)))
3929
+ return "amountMicros: integer|Long expected";
3930
+ }
3931
+ if (message.unit != null && message.hasOwnProperty("unit"))
3932
+ switch (message.unit) {
3933
+ default:
3934
+ return "unit: enum value expected";
3935
+ case 0:
3936
+ case 1:
3937
+ case 2:
3938
+ break;
3939
+ }
3940
+ return null;
3941
+ };
3942
+
3943
+ /**
3944
+ * Creates a Weight message from a plain object. Also converts values to their respective internal types.
3945
+ * @function fromObject
3946
+ * @memberof google.shopping.type.Weight
3947
+ * @static
3948
+ * @param {Object.<string,*>} object Plain object
3949
+ * @returns {google.shopping.type.Weight} Weight
3950
+ */
3951
+ Weight.fromObject = function fromObject(object) {
3952
+ if (object instanceof $root.google.shopping.type.Weight)
3953
+ return object;
3954
+ var message = new $root.google.shopping.type.Weight();
3955
+ if (object.amountMicros != null)
3956
+ if ($util.Long)
3957
+ (message.amountMicros = $util.Long.fromValue(object.amountMicros)).unsigned = false;
3958
+ else if (typeof object.amountMicros === "string")
3959
+ message.amountMicros = parseInt(object.amountMicros, 10);
3960
+ else if (typeof object.amountMicros === "number")
3961
+ message.amountMicros = object.amountMicros;
3962
+ else if (typeof object.amountMicros === "object")
3963
+ message.amountMicros = new $util.LongBits(object.amountMicros.low >>> 0, object.amountMicros.high >>> 0).toNumber();
3964
+ switch (object.unit) {
3965
+ default:
3966
+ if (typeof object.unit === "number") {
3967
+ message.unit = object.unit;
3968
+ break;
3969
+ }
3970
+ break;
3971
+ case "WEIGHT_UNIT_UNSPECIFIED":
3972
+ case 0:
3973
+ message.unit = 0;
3974
+ break;
3975
+ case "POUND":
3976
+ case 1:
3977
+ message.unit = 1;
3978
+ break;
3979
+ case "KILOGRAM":
3980
+ case 2:
3981
+ message.unit = 2;
3982
+ break;
3983
+ }
3984
+ return message;
3985
+ };
3986
+
3987
+ /**
3988
+ * Creates a plain object from a Weight message. Also converts values to other types if specified.
3989
+ * @function toObject
3990
+ * @memberof google.shopping.type.Weight
3991
+ * @static
3992
+ * @param {google.shopping.type.Weight} message Weight
3993
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3994
+ * @returns {Object.<string,*>} Plain object
3995
+ */
3996
+ Weight.toObject = function toObject(message, options) {
3997
+ if (!options)
3998
+ options = {};
3999
+ var object = {};
4000
+ if (options.defaults)
4001
+ object.unit = options.enums === String ? "WEIGHT_UNIT_UNSPECIFIED" : 0;
4002
+ if (message.amountMicros != null && message.hasOwnProperty("amountMicros")) {
4003
+ if (typeof message.amountMicros === "number")
4004
+ object.amountMicros = options.longs === String ? String(message.amountMicros) : message.amountMicros;
4005
+ else
4006
+ object.amountMicros = options.longs === String ? $util.Long.prototype.toString.call(message.amountMicros) : options.longs === Number ? new $util.LongBits(message.amountMicros.low >>> 0, message.amountMicros.high >>> 0).toNumber() : message.amountMicros;
4007
+ if (options.oneofs)
4008
+ object._amountMicros = "amountMicros";
4009
+ }
4010
+ if (message.unit != null && message.hasOwnProperty("unit"))
4011
+ object.unit = options.enums === String ? $root.google.shopping.type.Weight.WeightUnit[message.unit] === undefined ? message.unit : $root.google.shopping.type.Weight.WeightUnit[message.unit] : message.unit;
4012
+ return object;
4013
+ };
4014
+
4015
+ /**
4016
+ * Converts this Weight to JSON.
4017
+ * @function toJSON
4018
+ * @memberof google.shopping.type.Weight
4019
+ * @instance
4020
+ * @returns {Object.<string,*>} JSON object
4021
+ */
4022
+ Weight.prototype.toJSON = function toJSON() {
4023
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4024
+ };
4025
+
4026
+ /**
4027
+ * Gets the default type url for Weight
4028
+ * @function getTypeUrl
4029
+ * @memberof google.shopping.type.Weight
4030
+ * @static
4031
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4032
+ * @returns {string} The default type url
4033
+ */
4034
+ Weight.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4035
+ if (typeUrlPrefix === undefined) {
4036
+ typeUrlPrefix = "type.googleapis.com";
4037
+ }
4038
+ return typeUrlPrefix + "/google.shopping.type.Weight";
4039
+ };
4040
+
4041
+ /**
4042
+ * WeightUnit enum.
4043
+ * @name google.shopping.type.Weight.WeightUnit
4044
+ * @enum {number}
4045
+ * @property {number} WEIGHT_UNIT_UNSPECIFIED=0 WEIGHT_UNIT_UNSPECIFIED value
4046
+ * @property {number} POUND=1 POUND value
4047
+ * @property {number} KILOGRAM=2 KILOGRAM value
4048
+ */
4049
+ Weight.WeightUnit = (function() {
4050
+ var valuesById = {}, values = Object.create(valuesById);
4051
+ values[valuesById[0] = "WEIGHT_UNIT_UNSPECIFIED"] = 0;
4052
+ values[valuesById[1] = "POUND"] = 1;
4053
+ values[valuesById[2] = "KILOGRAM"] = 2;
4054
+ return values;
4055
+ })();
4056
+
4057
+ return Weight;
4058
+ })();
4059
+
3765
4060
  type.Price = (function() {
3766
4061
 
3767
4062
  /**
@@ -667,6 +667,37 @@
667
667
  "java_package": "com.google.shopping.type"
668
668
  },
669
669
  "nested": {
670
+ "Weight": {
671
+ "oneofs": {
672
+ "_amountMicros": {
673
+ "oneof": [
674
+ "amountMicros"
675
+ ]
676
+ }
677
+ },
678
+ "fields": {
679
+ "amountMicros": {
680
+ "type": "int64",
681
+ "id": 1,
682
+ "options": {
683
+ "proto3_optional": true
684
+ }
685
+ },
686
+ "unit": {
687
+ "type": "WeightUnit",
688
+ "id": 2
689
+ }
690
+ },
691
+ "nested": {
692
+ "WeightUnit": {
693
+ "values": {
694
+ "WEIGHT_UNIT_UNSPECIFIED": 0,
695
+ "POUND": 1,
696
+ "KILOGRAM": 2
697
+ }
698
+ }
699
+ }
700
+ },
670
701
  "Price": {
671
702
  "oneofs": {
672
703
  "_amountMicros": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-shopping/lfp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Merchant API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",