1 | /**
|
2 | * @fileoverview
|
3 | * @enhanceable
|
4 | * @suppress {messageConventions} JS Compiler reports an error if a variable or
|
5 | * field starts with 'MSG_' and isn't a translatable message.
|
6 | * @public
|
7 | */
|
8 | // GENERATED CODE -- DO NOT EDIT!
|
9 |
|
10 | var jspb = require('google-protobuf');
|
11 | var goog = jspb;
|
12 | var global = Function('return this')();
|
13 |
|
14 | goog.exportSymbol('proto.protocol.InventoryItems', null, global);
|
15 |
|
16 | /**
|
17 | * Generated by JsPbCodeGenerator.
|
18 | * @param {Array=} opt_data Optional initial data array, typically from a
|
19 | * server response, or constructed directly in Javascript. The array is used
|
20 | * in place and becomes part of the constructed object. It is not cloned.
|
21 | * If no data is provided, the constructed object will be empty, but still
|
22 | * valid.
|
23 | * @extends {jspb.Message}
|
24 | * @constructor
|
25 | */
|
26 | proto.protocol.InventoryItems = function(opt_data) {
|
27 | jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.InventoryItems.repeatedFields_, null);
|
28 | };
|
29 | goog.inherits(proto.protocol.InventoryItems, jspb.Message);
|
30 | if (goog.DEBUG && !COMPILED) {
|
31 | proto.protocol.InventoryItems.displayName = 'proto.protocol.InventoryItems';
|
32 | }
|
33 | /**
|
34 | * List of repeated fields within this message type.
|
35 | * @private {!Array<number>}
|
36 | * @const
|
37 | */
|
38 | proto.protocol.InventoryItems.repeatedFields_ = [2];
|
39 |
|
40 |
|
41 |
|
42 | if (jspb.Message.GENERATE_TO_OBJECT) {
|
43 | /**
|
44 | * Creates an object representation of this proto suitable for use in Soy templates.
|
45 | * Field names that are reserved in JavaScript and will be renamed to pb_name.
|
46 | * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
47 | * For the list of reserved names please see:
|
48 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
49 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
50 | * for transitional soy proto support: http://goto/soy-param-migration
|
51 | * @return {!Object}
|
52 | */
|
53 | proto.protocol.InventoryItems.prototype.toObject = function(opt_includeInstance) {
|
54 | return proto.protocol.InventoryItems.toObject(opt_includeInstance, this);
|
55 | };
|
56 |
|
57 |
|
58 | /**
|
59 | * Static version of the {@see toObject} method.
|
60 | * @param {boolean|undefined} includeInstance Whether to include the JSPB
|
61 | * instance for transitional soy proto support:
|
62 | * http://goto/soy-param-migration
|
63 | * @param {!proto.protocol.InventoryItems} msg The msg instance to transform.
|
64 | * @return {!Object}
|
65 | * @suppress {unusedLocalVariables} f is only used for nested messages
|
66 | */
|
67 | proto.protocol.InventoryItems.toObject = function(includeInstance, msg) {
|
68 | var f, obj = {
|
69 | type: jspb.Message.getFieldWithDefault(msg, 1, 0),
|
70 | itemsList: msg.getItemsList_asB64()
|
71 | };
|
72 |
|
73 | if (includeInstance) {
|
74 | obj.$jspbMessageInstance = msg;
|
75 | }
|
76 | return obj;
|
77 | };
|
78 | }
|
79 |
|
80 |
|
81 | /**
|
82 | * Deserializes binary data (in protobuf wire format).
|
83 | * @param {jspb.ByteSource} bytes The bytes to deserialize.
|
84 | * @return {!proto.protocol.InventoryItems}
|
85 | */
|
86 | proto.protocol.InventoryItems.deserializeBinary = function(bytes) {
|
87 | var reader = new jspb.BinaryReader(bytes);
|
88 | var msg = new proto.protocol.InventoryItems;
|
89 | return proto.protocol.InventoryItems.deserializeBinaryFromReader(msg, reader);
|
90 | };
|
91 |
|
92 |
|
93 | /**
|
94 | * Deserializes binary data (in protobuf wire format) from the
|
95 | * given reader into the given message object.
|
96 | * @param {!proto.protocol.InventoryItems} msg The message object to deserialize into.
|
97 | * @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
98 | * @return {!proto.protocol.InventoryItems}
|
99 | */
|
100 | proto.protocol.InventoryItems.deserializeBinaryFromReader = function(msg, reader) {
|
101 | while (reader.nextField()) {
|
102 | if (reader.isEndGroup()) {
|
103 | break;
|
104 | }
|
105 | var field = reader.getFieldNumber();
|
106 | switch (field) {
|
107 | case 1:
|
108 | var value = /** @type {number} */ (reader.readInt32());
|
109 | msg.setType(value);
|
110 | break;
|
111 | case 2:
|
112 | var value = /** @type {!Uint8Array} */ (reader.readBytes());
|
113 | msg.addItems(value);
|
114 | break;
|
115 | default:
|
116 | reader.skipField();
|
117 | break;
|
118 | }
|
119 | }
|
120 | return msg;
|
121 | };
|
122 |
|
123 |
|
124 | /**
|
125 | * Serializes the message to binary data (in protobuf wire format).
|
126 | * @return {!Uint8Array}
|
127 | */
|
128 | proto.protocol.InventoryItems.prototype.serializeBinary = function() {
|
129 | var writer = new jspb.BinaryWriter();
|
130 | proto.protocol.InventoryItems.serializeBinaryToWriter(this, writer);
|
131 | return writer.getResultBuffer();
|
132 | };
|
133 |
|
134 |
|
135 | /**
|
136 | * Serializes the given message to binary data (in protobuf wire
|
137 | * format), writing to the given BinaryWriter.
|
138 | * @param {!proto.protocol.InventoryItems} message
|
139 | * @param {!jspb.BinaryWriter} writer
|
140 | * @suppress {unusedLocalVariables} f is only used for nested messages
|
141 | */
|
142 | proto.protocol.InventoryItems.serializeBinaryToWriter = function(message, writer) {
|
143 | var f = undefined;
|
144 | f = message.getType();
|
145 | if (f !== 0) {
|
146 | writer.writeInt32(
|
147 | 1,
|
148 | f
|
149 | );
|
150 | }
|
151 | f = message.getItemsList_asU8();
|
152 | if (f.length > 0) {
|
153 | writer.writeRepeatedBytes(
|
154 | 2,
|
155 | f
|
156 | );
|
157 | }
|
158 | };
|
159 |
|
160 |
|
161 | /**
|
162 | * optional int32 type = 1;
|
163 | * @return {number}
|
164 | */
|
165 | proto.protocol.InventoryItems.prototype.getType = function() {
|
166 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
|
167 | };
|
168 |
|
169 |
|
170 | /** @param {number} value */
|
171 | proto.protocol.InventoryItems.prototype.setType = function(value) {
|
172 | jspb.Message.setProto3IntField(this, 1, value);
|
173 | };
|
174 |
|
175 |
|
176 | /**
|
177 | * repeated bytes items = 2;
|
178 | * @return {!(Array<!Uint8Array>|Array<string>)}
|
179 | */
|
180 | proto.protocol.InventoryItems.prototype.getItemsList = function() {
|
181 | return /** @type {!(Array<!Uint8Array>|Array<string>)} */ (jspb.Message.getRepeatedField(this, 2));
|
182 | };
|
183 |
|
184 |
|
185 | /**
|
186 | * repeated bytes items = 2;
|
187 | * This is a type-conversion wrapper around `getItemsList()`
|
188 | * @return {!Array.<string>}
|
189 | */
|
190 | proto.protocol.InventoryItems.prototype.getItemsList_asB64 = function() {
|
191 | return /** @type {!Array.<string>} */ (jspb.Message.bytesListAsB64(
|
192 | this.getItemsList()));
|
193 | };
|
194 |
|
195 |
|
196 | /**
|
197 | * repeated bytes items = 2;
|
198 | * Note that Uint8Array is not supported on all browsers.
|
199 | * @see http://caniuse.com/Uint8Array
|
200 | * This is a type-conversion wrapper around `getItemsList()`
|
201 | * @return {!Array.<!Uint8Array>}
|
202 | */
|
203 | proto.protocol.InventoryItems.prototype.getItemsList_asU8 = function() {
|
204 | return /** @type {!Array.<!Uint8Array>} */ (jspb.Message.bytesListAsU8(
|
205 | this.getItemsList()));
|
206 | };
|
207 |
|
208 |
|
209 | /** @param {!(Array<!Uint8Array>|Array<string>)} value */
|
210 | proto.protocol.InventoryItems.prototype.setItemsList = function(value) {
|
211 | jspb.Message.setField(this, 2, value || []);
|
212 | };
|
213 |
|
214 |
|
215 | /**
|
216 | * @param {!(string|Uint8Array)} value
|
217 | * @param {number=} opt_index
|
218 | */
|
219 | proto.protocol.InventoryItems.prototype.addItems = function(value, opt_index) {
|
220 | jspb.Message.addToRepeatedField(this, 2, value, opt_index);
|
221 | };
|
222 |
|
223 |
|
224 | proto.protocol.InventoryItems.prototype.clearItemsList = function() {
|
225 | this.setItemsList([]);
|
226 | };
|
227 |
|
228 |
|
229 | goog.object.extend(exports, proto.protocol);
|