UNPKG

188 kBJavaScriptView Raw
1/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2"use strict";
3
4var $protobuf = require("protobufjs/minimal");
5
6// Common aliases
7var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
8
9// Exported root namespace
10var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
11
12$root.google = (function() {
13
14 /**
15 * Namespace google.
16 * @exports google
17 * @namespace
18 */
19 var google = {};
20
21 google.protobuf = (function() {
22
23 /**
24 * Namespace protobuf.
25 * @memberof google
26 * @namespace
27 */
28 var protobuf = {};
29
30 protobuf.Struct = (function() {
31
32 /**
33 * Properties of a Struct.
34 * @memberof google.protobuf
35 * @interface IStruct
36 * @property {Object.<string,google.protobuf.IValue>|null} [fields] Struct fields
37 */
38
39 /**
40 * Constructs a new Struct.
41 * @memberof google.protobuf
42 * @classdesc Represents a Struct.
43 * @implements IStruct
44 * @constructor
45 * @param {google.protobuf.IStruct=} [properties] Properties to set
46 */
47 function Struct(properties) {
48 this.fields = {};
49 if (properties)
50 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
51 if (properties[keys[i]] != null)
52 this[keys[i]] = properties[keys[i]];
53 }
54
55 /**
56 * Struct fields.
57 * @member {Object.<string,google.protobuf.IValue>} fields
58 * @memberof google.protobuf.Struct
59 * @instance
60 */
61 Struct.prototype.fields = $util.emptyObject;
62
63 /**
64 * Creates a new Struct instance using the specified properties.
65 * @function create
66 * @memberof google.protobuf.Struct
67 * @static
68 * @param {google.protobuf.IStruct=} [properties] Properties to set
69 * @returns {google.protobuf.Struct} Struct instance
70 */
71 Struct.create = function create(properties) {
72 return new Struct(properties);
73 };
74
75 /**
76 * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages.
77 * @function encode
78 * @memberof google.protobuf.Struct
79 * @static
80 * @param {google.protobuf.IStruct} message Struct message or plain object to encode
81 * @param {$protobuf.Writer} [writer] Writer to encode to
82 * @returns {$protobuf.Writer} Writer
83 */
84 Struct.encode = function encode(message, writer) {
85 if (!writer)
86 writer = $Writer.create();
87 if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
88 for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
89 writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
90 $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
91 }
92 return writer;
93 };
94
95 /**
96 * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages.
97 * @function encodeDelimited
98 * @memberof google.protobuf.Struct
99 * @static
100 * @param {google.protobuf.IStruct} message Struct message or plain object to encode
101 * @param {$protobuf.Writer} [writer] Writer to encode to
102 * @returns {$protobuf.Writer} Writer
103 */
104 Struct.encodeDelimited = function encodeDelimited(message, writer) {
105 return this.encode(message, writer).ldelim();
106 };
107
108 /**
109 * Decodes a Struct message from the specified reader or buffer.
110 * @function decode
111 * @memberof google.protobuf.Struct
112 * @static
113 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
114 * @param {number} [length] Message length if known beforehand
115 * @returns {google.protobuf.Struct} Struct
116 * @throws {Error} If the payload is not a reader or valid buffer
117 * @throws {$protobuf.util.ProtocolError} If required fields are missing
118 */
119 Struct.decode = function decode(reader, length) {
120 if (!(reader instanceof $Reader))
121 reader = $Reader.create(reader);
122 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value;
123 while (reader.pos < end) {
124 var tag = reader.uint32();
125 switch (tag >>> 3) {
126 case 1: {
127 if (message.fields === $util.emptyObject)
128 message.fields = {};
129 var end2 = reader.uint32() + reader.pos;
130 key = "";
131 value = null;
132 while (reader.pos < end2) {
133 var tag2 = reader.uint32();
134 switch (tag2 >>> 3) {
135 case 1:
136 key = reader.string();
137 break;
138 case 2:
139 value = $root.google.protobuf.Value.decode(reader, reader.uint32());
140 break;
141 default:
142 reader.skipType(tag2 & 7);
143 break;
144 }
145 }
146 message.fields[key] = value;
147 break;
148 }
149 default:
150 reader.skipType(tag & 7);
151 break;
152 }
153 }
154 return message;
155 };
156
157 /**
158 * Decodes a Struct message from the specified reader or buffer, length delimited.
159 * @function decodeDelimited
160 * @memberof google.protobuf.Struct
161 * @static
162 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
163 * @returns {google.protobuf.Struct} Struct
164 * @throws {Error} If the payload is not a reader or valid buffer
165 * @throws {$protobuf.util.ProtocolError} If required fields are missing
166 */
167 Struct.decodeDelimited = function decodeDelimited(reader) {
168 if (!(reader instanceof $Reader))
169 reader = new $Reader(reader);
170 return this.decode(reader, reader.uint32());
171 };
172
173 /**
174 * Verifies a Struct message.
175 * @function verify
176 * @memberof google.protobuf.Struct
177 * @static
178 * @param {Object.<string,*>} message Plain object to verify
179 * @returns {string|null} `null` if valid, otherwise the reason why it is not
180 */
181 Struct.verify = function verify(message) {
182 if (typeof message !== "object" || message === null)
183 return "object expected";
184 if (message.fields != null && message.hasOwnProperty("fields")) {
185 if (!$util.isObject(message.fields))
186 return "fields: object expected";
187 var key = Object.keys(message.fields);
188 for (var i = 0; i < key.length; ++i) {
189 var error = $root.google.protobuf.Value.verify(message.fields[key[i]]);
190 if (error)
191 return "fields." + error;
192 }
193 }
194 return null;
195 };
196
197 /**
198 * Creates a Struct message from a plain object. Also converts values to their respective internal types.
199 * @function fromObject
200 * @memberof google.protobuf.Struct
201 * @static
202 * @param {Object.<string,*>} object Plain object
203 * @returns {google.protobuf.Struct} Struct
204 */
205 Struct.fromObject = function fromObject(object) {
206 if (object instanceof $root.google.protobuf.Struct)
207 return object;
208 var message = new $root.google.protobuf.Struct();
209 if (object.fields) {
210 if (typeof object.fields !== "object")
211 throw TypeError(".google.protobuf.Struct.fields: object expected");
212 message.fields = {};
213 for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
214 if (typeof object.fields[keys[i]] !== "object")
215 throw TypeError(".google.protobuf.Struct.fields: object expected");
216 message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]);
217 }
218 }
219 return message;
220 };
221
222 /**
223 * Creates a plain object from a Struct message. Also converts values to other types if specified.
224 * @function toObject
225 * @memberof google.protobuf.Struct
226 * @static
227 * @param {google.protobuf.Struct} message Struct
228 * @param {$protobuf.IConversionOptions} [options] Conversion options
229 * @returns {Object.<string,*>} Plain object
230 */
231 Struct.toObject = function toObject(message, options) {
232 if (!options)
233 options = {};
234 var object = {};
235 if (options.objects || options.defaults)
236 object.fields = {};
237 var keys2;
238 if (message.fields && (keys2 = Object.keys(message.fields)).length) {
239 object.fields = {};
240 for (var j = 0; j < keys2.length; ++j)
241 object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options);
242 }
243 return object;
244 };
245
246 /**
247 * Converts this Struct to JSON.
248 * @function toJSON
249 * @memberof google.protobuf.Struct
250 * @instance
251 * @returns {Object.<string,*>} JSON object
252 */
253 Struct.prototype.toJSON = function toJSON() {
254 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
255 };
256
257 /**
258 * Gets the default type url for Struct
259 * @function getTypeUrl
260 * @memberof google.protobuf.Struct
261 * @static
262 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
263 * @returns {string} The default type url
264 */
265 Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
266 if (typeUrlPrefix === undefined) {
267 typeUrlPrefix = "type.googleapis.com";
268 }
269 return typeUrlPrefix + "/google.protobuf.Struct";
270 };
271
272 return Struct;
273 })();
274
275 protobuf.Value = (function() {
276
277 /**
278 * Properties of a Value.
279 * @memberof google.protobuf
280 * @interface IValue
281 * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue
282 * @property {number|null} [numberValue] Value numberValue
283 * @property {string|null} [stringValue] Value stringValue
284 * @property {boolean|null} [boolValue] Value boolValue
285 * @property {google.protobuf.IStruct|null} [structValue] Value structValue
286 * @property {google.protobuf.IListValue|null} [listValue] Value listValue
287 */
288
289 /**
290 * Constructs a new Value.
291 * @memberof google.protobuf
292 * @classdesc Represents a Value.
293 * @implements IValue
294 * @constructor
295 * @param {google.protobuf.IValue=} [properties] Properties to set
296 */
297 function Value(properties) {
298 if (properties)
299 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
300 if (properties[keys[i]] != null)
301 this[keys[i]] = properties[keys[i]];
302 }
303
304 /**
305 * Value nullValue.
306 * @member {google.protobuf.NullValue|null|undefined} nullValue
307 * @memberof google.protobuf.Value
308 * @instance
309 */
310 Value.prototype.nullValue = null;
311
312 /**
313 * Value numberValue.
314 * @member {number|null|undefined} numberValue
315 * @memberof google.protobuf.Value
316 * @instance
317 */
318 Value.prototype.numberValue = null;
319
320 /**
321 * Value stringValue.
322 * @member {string|null|undefined} stringValue
323 * @memberof google.protobuf.Value
324 * @instance
325 */
326 Value.prototype.stringValue = null;
327
328 /**
329 * Value boolValue.
330 * @member {boolean|null|undefined} boolValue
331 * @memberof google.protobuf.Value
332 * @instance
333 */
334 Value.prototype.boolValue = null;
335
336 /**
337 * Value structValue.
338 * @member {google.protobuf.IStruct|null|undefined} structValue
339 * @memberof google.protobuf.Value
340 * @instance
341 */
342 Value.prototype.structValue = null;
343
344 /**
345 * Value listValue.
346 * @member {google.protobuf.IListValue|null|undefined} listValue
347 * @memberof google.protobuf.Value
348 * @instance
349 */
350 Value.prototype.listValue = null;
351
352 // OneOf field names bound to virtual getters and setters
353 var $oneOfFields;
354
355 /**
356 * Value kind.
357 * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind
358 * @memberof google.protobuf.Value
359 * @instance
360 */
361 Object.defineProperty(Value.prototype, "kind", {
362 get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]),
363 set: $util.oneOfSetter($oneOfFields)
364 });
365
366 /**
367 * Creates a new Value instance using the specified properties.
368 * @function create
369 * @memberof google.protobuf.Value
370 * @static
371 * @param {google.protobuf.IValue=} [properties] Properties to set
372 * @returns {google.protobuf.Value} Value instance
373 */
374 Value.create = function create(properties) {
375 return new Value(properties);
376 };
377
378 /**
379 * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages.
380 * @function encode
381 * @memberof google.protobuf.Value
382 * @static
383 * @param {google.protobuf.IValue} message Value message or plain object to encode
384 * @param {$protobuf.Writer} [writer] Writer to encode to
385 * @returns {$protobuf.Writer} Writer
386 */
387 Value.encode = function encode(message, writer) {
388 if (!writer)
389 writer = $Writer.create();
390 if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue"))
391 writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue);
392 if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue"))
393 writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue);
394 if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
395 writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue);
396 if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue"))
397 writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue);
398 if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue"))
399 $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
400 if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue"))
401 $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
402 return writer;
403 };
404
405 /**
406 * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages.
407 * @function encodeDelimited
408 * @memberof google.protobuf.Value
409 * @static
410 * @param {google.protobuf.IValue} message Value message or plain object to encode
411 * @param {$protobuf.Writer} [writer] Writer to encode to
412 * @returns {$protobuf.Writer} Writer
413 */
414 Value.encodeDelimited = function encodeDelimited(message, writer) {
415 return this.encode(message, writer).ldelim();
416 };
417
418 /**
419 * Decodes a Value message from the specified reader or buffer.
420 * @function decode
421 * @memberof google.protobuf.Value
422 * @static
423 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
424 * @param {number} [length] Message length if known beforehand
425 * @returns {google.protobuf.Value} Value
426 * @throws {Error} If the payload is not a reader or valid buffer
427 * @throws {$protobuf.util.ProtocolError} If required fields are missing
428 */
429 Value.decode = function decode(reader, length) {
430 if (!(reader instanceof $Reader))
431 reader = $Reader.create(reader);
432 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value();
433 while (reader.pos < end) {
434 var tag = reader.uint32();
435 switch (tag >>> 3) {
436 case 1: {
437 message.nullValue = reader.int32();
438 break;
439 }
440 case 2: {
441 message.numberValue = reader.double();
442 break;
443 }
444 case 3: {
445 message.stringValue = reader.string();
446 break;
447 }
448 case 4: {
449 message.boolValue = reader.bool();
450 break;
451 }
452 case 5: {
453 message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32());
454 break;
455 }
456 case 6: {
457 message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32());
458 break;
459 }
460 default:
461 reader.skipType(tag & 7);
462 break;
463 }
464 }
465 return message;
466 };
467
468 /**
469 * Decodes a Value message from the specified reader or buffer, length delimited.
470 * @function decodeDelimited
471 * @memberof google.protobuf.Value
472 * @static
473 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
474 * @returns {google.protobuf.Value} Value
475 * @throws {Error} If the payload is not a reader or valid buffer
476 * @throws {$protobuf.util.ProtocolError} If required fields are missing
477 */
478 Value.decodeDelimited = function decodeDelimited(reader) {
479 if (!(reader instanceof $Reader))
480 reader = new $Reader(reader);
481 return this.decode(reader, reader.uint32());
482 };
483
484 /**
485 * Verifies a Value message.
486 * @function verify
487 * @memberof google.protobuf.Value
488 * @static
489 * @param {Object.<string,*>} message Plain object to verify
490 * @returns {string|null} `null` if valid, otherwise the reason why it is not
491 */
492 Value.verify = function verify(message) {
493 if (typeof message !== "object" || message === null)
494 return "object expected";
495 var properties = {};
496 if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
497 properties.kind = 1;
498 switch (message.nullValue) {
499 default:
500 return "nullValue: enum value expected";
501 case 0:
502 break;
503 }
504 }
505 if (message.numberValue != null && message.hasOwnProperty("numberValue")) {
506 if (properties.kind === 1)
507 return "kind: multiple values";
508 properties.kind = 1;
509 if (typeof message.numberValue !== "number")
510 return "numberValue: number expected";
511 }
512 if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
513 if (properties.kind === 1)
514 return "kind: multiple values";
515 properties.kind = 1;
516 if (!$util.isString(message.stringValue))
517 return "stringValue: string expected";
518 }
519 if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
520 if (properties.kind === 1)
521 return "kind: multiple values";
522 properties.kind = 1;
523 if (typeof message.boolValue !== "boolean")
524 return "boolValue: boolean expected";
525 }
526 if (message.structValue != null && message.hasOwnProperty("structValue")) {
527 if (properties.kind === 1)
528 return "kind: multiple values";
529 properties.kind = 1;
530 {
531 var error = $root.google.protobuf.Struct.verify(message.structValue);
532 if (error)
533 return "structValue." + error;
534 }
535 }
536 if (message.listValue != null && message.hasOwnProperty("listValue")) {
537 if (properties.kind === 1)
538 return "kind: multiple values";
539 properties.kind = 1;
540 {
541 var error = $root.google.protobuf.ListValue.verify(message.listValue);
542 if (error)
543 return "listValue." + error;
544 }
545 }
546 return null;
547 };
548
549 /**
550 * Creates a Value message from a plain object. Also converts values to their respective internal types.
551 * @function fromObject
552 * @memberof google.protobuf.Value
553 * @static
554 * @param {Object.<string,*>} object Plain object
555 * @returns {google.protobuf.Value} Value
556 */
557 Value.fromObject = function fromObject(object) {
558 if (object instanceof $root.google.protobuf.Value)
559 return object;
560 var message = new $root.google.protobuf.Value();
561 switch (object.nullValue) {
562 default:
563 if (typeof object.nullValue === "number") {
564 message.nullValue = object.nullValue;
565 break;
566 }
567 break;
568 case "NULL_VALUE":
569 case 0:
570 message.nullValue = 0;
571 break;
572 }
573 if (object.numberValue != null)
574 message.numberValue = Number(object.numberValue);
575 if (object.stringValue != null)
576 message.stringValue = String(object.stringValue);
577 if (object.boolValue != null)
578 message.boolValue = Boolean(object.boolValue);
579 if (object.structValue != null) {
580 if (typeof object.structValue !== "object")
581 throw TypeError(".google.protobuf.Value.structValue: object expected");
582 message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue);
583 }
584 if (object.listValue != null) {
585 if (typeof object.listValue !== "object")
586 throw TypeError(".google.protobuf.Value.listValue: object expected");
587 message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue);
588 }
589 return message;
590 };
591
592 /**
593 * Creates a plain object from a Value message. Also converts values to other types if specified.
594 * @function toObject
595 * @memberof google.protobuf.Value
596 * @static
597 * @param {google.protobuf.Value} message Value
598 * @param {$protobuf.IConversionOptions} [options] Conversion options
599 * @returns {Object.<string,*>} Plain object
600 */
601 Value.toObject = function toObject(message, options) {
602 if (!options)
603 options = {};
604 var object = {};
605 if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
606 object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue;
607 if (options.oneofs)
608 object.kind = "nullValue";
609 }
610 if (message.numberValue != null && message.hasOwnProperty("numberValue")) {
611 object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue;
612 if (options.oneofs)
613 object.kind = "numberValue";
614 }
615 if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
616 object.stringValue = message.stringValue;
617 if (options.oneofs)
618 object.kind = "stringValue";
619 }
620 if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
621 object.boolValue = message.boolValue;
622 if (options.oneofs)
623 object.kind = "boolValue";
624 }
625 if (message.structValue != null && message.hasOwnProperty("structValue")) {
626 object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options);
627 if (options.oneofs)
628 object.kind = "structValue";
629 }
630 if (message.listValue != null && message.hasOwnProperty("listValue")) {
631 object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options);
632 if (options.oneofs)
633 object.kind = "listValue";
634 }
635 return object;
636 };
637
638 /**
639 * Converts this Value to JSON.
640 * @function toJSON
641 * @memberof google.protobuf.Value
642 * @instance
643 * @returns {Object.<string,*>} JSON object
644 */
645 Value.prototype.toJSON = function toJSON() {
646 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
647 };
648
649 /**
650 * Gets the default type url for Value
651 * @function getTypeUrl
652 * @memberof google.protobuf.Value
653 * @static
654 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
655 * @returns {string} The default type url
656 */
657 Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
658 if (typeUrlPrefix === undefined) {
659 typeUrlPrefix = "type.googleapis.com";
660 }
661 return typeUrlPrefix + "/google.protobuf.Value";
662 };
663
664 return Value;
665 })();
666
667 /**
668 * NullValue enum.
669 * @name google.protobuf.NullValue
670 * @enum {number}
671 * @property {number} NULL_VALUE=0 NULL_VALUE value
672 */
673 protobuf.NullValue = (function() {
674 var valuesById = {}, values = Object.create(valuesById);
675 values[valuesById[0] = "NULL_VALUE"] = 0;
676 return values;
677 })();
678
679 protobuf.ListValue = (function() {
680
681 /**
682 * Properties of a ListValue.
683 * @memberof google.protobuf
684 * @interface IListValue
685 * @property {Array.<google.protobuf.IValue>|null} [values] ListValue values
686 */
687
688 /**
689 * Constructs a new ListValue.
690 * @memberof google.protobuf
691 * @classdesc Represents a ListValue.
692 * @implements IListValue
693 * @constructor
694 * @param {google.protobuf.IListValue=} [properties] Properties to set
695 */
696 function ListValue(properties) {
697 this.values = [];
698 if (properties)
699 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
700 if (properties[keys[i]] != null)
701 this[keys[i]] = properties[keys[i]];
702 }
703
704 /**
705 * ListValue values.
706 * @member {Array.<google.protobuf.IValue>} values
707 * @memberof google.protobuf.ListValue
708 * @instance
709 */
710 ListValue.prototype.values = $util.emptyArray;
711
712 /**
713 * Creates a new ListValue instance using the specified properties.
714 * @function create
715 * @memberof google.protobuf.ListValue
716 * @static
717 * @param {google.protobuf.IListValue=} [properties] Properties to set
718 * @returns {google.protobuf.ListValue} ListValue instance
719 */
720 ListValue.create = function create(properties) {
721 return new ListValue(properties);
722 };
723
724 /**
725 * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages.
726 * @function encode
727 * @memberof google.protobuf.ListValue
728 * @static
729 * @param {google.protobuf.IListValue} message ListValue message or plain object to encode
730 * @param {$protobuf.Writer} [writer] Writer to encode to
731 * @returns {$protobuf.Writer} Writer
732 */
733 ListValue.encode = function encode(message, writer) {
734 if (!writer)
735 writer = $Writer.create();
736 if (message.values != null && message.values.length)
737 for (var i = 0; i < message.values.length; ++i)
738 $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
739 return writer;
740 };
741
742 /**
743 * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages.
744 * @function encodeDelimited
745 * @memberof google.protobuf.ListValue
746 * @static
747 * @param {google.protobuf.IListValue} message ListValue message or plain object to encode
748 * @param {$protobuf.Writer} [writer] Writer to encode to
749 * @returns {$protobuf.Writer} Writer
750 */
751 ListValue.encodeDelimited = function encodeDelimited(message, writer) {
752 return this.encode(message, writer).ldelim();
753 };
754
755 /**
756 * Decodes a ListValue message from the specified reader or buffer.
757 * @function decode
758 * @memberof google.protobuf.ListValue
759 * @static
760 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
761 * @param {number} [length] Message length if known beforehand
762 * @returns {google.protobuf.ListValue} ListValue
763 * @throws {Error} If the payload is not a reader or valid buffer
764 * @throws {$protobuf.util.ProtocolError} If required fields are missing
765 */
766 ListValue.decode = function decode(reader, length) {
767 if (!(reader instanceof $Reader))
768 reader = $Reader.create(reader);
769 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue();
770 while (reader.pos < end) {
771 var tag = reader.uint32();
772 switch (tag >>> 3) {
773 case 1: {
774 if (!(message.values && message.values.length))
775 message.values = [];
776 message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32()));
777 break;
778 }
779 default:
780 reader.skipType(tag & 7);
781 break;
782 }
783 }
784 return message;
785 };
786
787 /**
788 * Decodes a ListValue message from the specified reader or buffer, length delimited.
789 * @function decodeDelimited
790 * @memberof google.protobuf.ListValue
791 * @static
792 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
793 * @returns {google.protobuf.ListValue} ListValue
794 * @throws {Error} If the payload is not a reader or valid buffer
795 * @throws {$protobuf.util.ProtocolError} If required fields are missing
796 */
797 ListValue.decodeDelimited = function decodeDelimited(reader) {
798 if (!(reader instanceof $Reader))
799 reader = new $Reader(reader);
800 return this.decode(reader, reader.uint32());
801 };
802
803 /**
804 * Verifies a ListValue message.
805 * @function verify
806 * @memberof google.protobuf.ListValue
807 * @static
808 * @param {Object.<string,*>} message Plain object to verify
809 * @returns {string|null} `null` if valid, otherwise the reason why it is not
810 */
811 ListValue.verify = function verify(message) {
812 if (typeof message !== "object" || message === null)
813 return "object expected";
814 if (message.values != null && message.hasOwnProperty("values")) {
815 if (!Array.isArray(message.values))
816 return "values: array expected";
817 for (var i = 0; i < message.values.length; ++i) {
818 var error = $root.google.protobuf.Value.verify(message.values[i]);
819 if (error)
820 return "values." + error;
821 }
822 }
823 return null;
824 };
825
826 /**
827 * Creates a ListValue message from a plain object. Also converts values to their respective internal types.
828 * @function fromObject
829 * @memberof google.protobuf.ListValue
830 * @static
831 * @param {Object.<string,*>} object Plain object
832 * @returns {google.protobuf.ListValue} ListValue
833 */
834 ListValue.fromObject = function fromObject(object) {
835 if (object instanceof $root.google.protobuf.ListValue)
836 return object;
837 var message = new $root.google.protobuf.ListValue();
838 if (object.values) {
839 if (!Array.isArray(object.values))
840 throw TypeError(".google.protobuf.ListValue.values: array expected");
841 message.values = [];
842 for (var i = 0; i < object.values.length; ++i) {
843 if (typeof object.values[i] !== "object")
844 throw TypeError(".google.protobuf.ListValue.values: object expected");
845 message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]);
846 }
847 }
848 return message;
849 };
850
851 /**
852 * Creates a plain object from a ListValue message. Also converts values to other types if specified.
853 * @function toObject
854 * @memberof google.protobuf.ListValue
855 * @static
856 * @param {google.protobuf.ListValue} message ListValue
857 * @param {$protobuf.IConversionOptions} [options] Conversion options
858 * @returns {Object.<string,*>} Plain object
859 */
860 ListValue.toObject = function toObject(message, options) {
861 if (!options)
862 options = {};
863 var object = {};
864 if (options.arrays || options.defaults)
865 object.values = [];
866 if (message.values && message.values.length) {
867 object.values = [];
868 for (var j = 0; j < message.values.length; ++j)
869 object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options);
870 }
871 return object;
872 };
873
874 /**
875 * Converts this ListValue to JSON.
876 * @function toJSON
877 * @memberof google.protobuf.ListValue
878 * @instance
879 * @returns {Object.<string,*>} JSON object
880 */
881 ListValue.prototype.toJSON = function toJSON() {
882 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
883 };
884
885 /**
886 * Gets the default type url for ListValue
887 * @function getTypeUrl
888 * @memberof google.protobuf.ListValue
889 * @static
890 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
891 * @returns {string} The default type url
892 */
893 ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
894 if (typeUrlPrefix === undefined) {
895 typeUrlPrefix = "type.googleapis.com";
896 }
897 return typeUrlPrefix + "/google.protobuf.ListValue";
898 };
899
900 return ListValue;
901 })();
902
903 protobuf.Timestamp = (function() {
904
905 /**
906 * Properties of a Timestamp.
907 * @memberof google.protobuf
908 * @interface ITimestamp
909 * @property {number|Long|null} [seconds] Timestamp seconds
910 * @property {number|null} [nanos] Timestamp nanos
911 */
912
913 /**
914 * Constructs a new Timestamp.
915 * @memberof google.protobuf
916 * @classdesc Represents a Timestamp.
917 * @implements ITimestamp
918 * @constructor
919 * @param {google.protobuf.ITimestamp=} [properties] Properties to set
920 */
921 function Timestamp(properties) {
922 if (properties)
923 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
924 if (properties[keys[i]] != null)
925 this[keys[i]] = properties[keys[i]];
926 }
927
928 /**
929 * Timestamp seconds.
930 * @member {number|Long} seconds
931 * @memberof google.protobuf.Timestamp
932 * @instance
933 */
934 Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
935
936 /**
937 * Timestamp nanos.
938 * @member {number} nanos
939 * @memberof google.protobuf.Timestamp
940 * @instance
941 */
942 Timestamp.prototype.nanos = 0;
943
944 /**
945 * Creates a new Timestamp instance using the specified properties.
946 * @function create
947 * @memberof google.protobuf.Timestamp
948 * @static
949 * @param {google.protobuf.ITimestamp=} [properties] Properties to set
950 * @returns {google.protobuf.Timestamp} Timestamp instance
951 */
952 Timestamp.create = function create(properties) {
953 return new Timestamp(properties);
954 };
955
956 /**
957 * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
958 * @function encode
959 * @memberof google.protobuf.Timestamp
960 * @static
961 * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
962 * @param {$protobuf.Writer} [writer] Writer to encode to
963 * @returns {$protobuf.Writer} Writer
964 */
965 Timestamp.encode = function encode(message, writer) {
966 if (!writer)
967 writer = $Writer.create();
968 if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds"))
969 writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds);
970 if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos"))
971 writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos);
972 return writer;
973 };
974
975 /**
976 * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
977 * @function encodeDelimited
978 * @memberof google.protobuf.Timestamp
979 * @static
980 * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
981 * @param {$protobuf.Writer} [writer] Writer to encode to
982 * @returns {$protobuf.Writer} Writer
983 */
984 Timestamp.encodeDelimited = function encodeDelimited(message, writer) {
985 return this.encode(message, writer).ldelim();
986 };
987
988 /**
989 * Decodes a Timestamp message from the specified reader or buffer.
990 * @function decode
991 * @memberof google.protobuf.Timestamp
992 * @static
993 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
994 * @param {number} [length] Message length if known beforehand
995 * @returns {google.protobuf.Timestamp} Timestamp
996 * @throws {Error} If the payload is not a reader or valid buffer
997 * @throws {$protobuf.util.ProtocolError} If required fields are missing
998 */
999 Timestamp.decode = function decode(reader, length) {
1000 if (!(reader instanceof $Reader))
1001 reader = $Reader.create(reader);
1002 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp();
1003 while (reader.pos < end) {
1004 var tag = reader.uint32();
1005 switch (tag >>> 3) {
1006 case 1: {
1007 message.seconds = reader.int64();
1008 break;
1009 }
1010 case 2: {
1011 message.nanos = reader.int32();
1012 break;
1013 }
1014 default:
1015 reader.skipType(tag & 7);
1016 break;
1017 }
1018 }
1019 return message;
1020 };
1021
1022 /**
1023 * Decodes a Timestamp message from the specified reader or buffer, length delimited.
1024 * @function decodeDelimited
1025 * @memberof google.protobuf.Timestamp
1026 * @static
1027 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1028 * @returns {google.protobuf.Timestamp} Timestamp
1029 * @throws {Error} If the payload is not a reader or valid buffer
1030 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1031 */
1032 Timestamp.decodeDelimited = function decodeDelimited(reader) {
1033 if (!(reader instanceof $Reader))
1034 reader = new $Reader(reader);
1035 return this.decode(reader, reader.uint32());
1036 };
1037
1038 /**
1039 * Verifies a Timestamp message.
1040 * @function verify
1041 * @memberof google.protobuf.Timestamp
1042 * @static
1043 * @param {Object.<string,*>} message Plain object to verify
1044 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1045 */
1046 Timestamp.verify = function verify(message) {
1047 if (typeof message !== "object" || message === null)
1048 return "object expected";
1049 if (message.seconds != null && message.hasOwnProperty("seconds"))
1050 if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high)))
1051 return "seconds: integer|Long expected";
1052 if (message.nanos != null && message.hasOwnProperty("nanos"))
1053 if (!$util.isInteger(message.nanos))
1054 return "nanos: integer expected";
1055 return null;
1056 };
1057
1058 /**
1059 * Creates a Timestamp message from a plain object. Also converts values to their respective internal types.
1060 * @function fromObject
1061 * @memberof google.protobuf.Timestamp
1062 * @static
1063 * @param {Object.<string,*>} object Plain object
1064 * @returns {google.protobuf.Timestamp} Timestamp
1065 */
1066 Timestamp.fromObject = function fromObject(object) {
1067 if (object instanceof $root.google.protobuf.Timestamp)
1068 return object;
1069 var message = new $root.google.protobuf.Timestamp();
1070 if (object.seconds != null)
1071 if ($util.Long)
1072 (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false;
1073 else if (typeof object.seconds === "string")
1074 message.seconds = parseInt(object.seconds, 10);
1075 else if (typeof object.seconds === "number")
1076 message.seconds = object.seconds;
1077 else if (typeof object.seconds === "object")
1078 message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber();
1079 if (object.nanos != null)
1080 message.nanos = object.nanos | 0;
1081 return message;
1082 };
1083
1084 /**
1085 * Creates a plain object from a Timestamp message. Also converts values to other types if specified.
1086 * @function toObject
1087 * @memberof google.protobuf.Timestamp
1088 * @static
1089 * @param {google.protobuf.Timestamp} message Timestamp
1090 * @param {$protobuf.IConversionOptions} [options] Conversion options
1091 * @returns {Object.<string,*>} Plain object
1092 */
1093 Timestamp.toObject = function toObject(message, options) {
1094 if (!options)
1095 options = {};
1096 var object = {};
1097 if (options.defaults) {
1098 if ($util.Long) {
1099 var long = new $util.Long(0, 0, false);
1100 object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
1101 } else
1102 object.seconds = options.longs === String ? "0" : 0;
1103 object.nanos = 0;
1104 }
1105 if (message.seconds != null && message.hasOwnProperty("seconds"))
1106 if (typeof message.seconds === "number")
1107 object.seconds = options.longs === String ? String(message.seconds) : message.seconds;
1108 else
1109 object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds;
1110 if (message.nanos != null && message.hasOwnProperty("nanos"))
1111 object.nanos = message.nanos;
1112 return object;
1113 };
1114
1115 /**
1116 * Converts this Timestamp to JSON.
1117 * @function toJSON
1118 * @memberof google.protobuf.Timestamp
1119 * @instance
1120 * @returns {Object.<string,*>} JSON object
1121 */
1122 Timestamp.prototype.toJSON = function toJSON() {
1123 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1124 };
1125
1126 /**
1127 * Gets the default type url for Timestamp
1128 * @function getTypeUrl
1129 * @memberof google.protobuf.Timestamp
1130 * @static
1131 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1132 * @returns {string} The default type url
1133 */
1134 Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1135 if (typeUrlPrefix === undefined) {
1136 typeUrlPrefix = "type.googleapis.com";
1137 }
1138 return typeUrlPrefix + "/google.protobuf.Timestamp";
1139 };
1140
1141 return Timestamp;
1142 })();
1143
1144 protobuf.Any = (function() {
1145
1146 /**
1147 * Properties of an Any.
1148 * @memberof google.protobuf
1149 * @interface IAny
1150 * @property {string|null} [typeUrl] Any typeUrl
1151 * @property {Uint8Array|null} [value] Any value
1152 */
1153
1154 /**
1155 * Constructs a new Any.
1156 * @memberof google.protobuf
1157 * @classdesc Represents an Any.
1158 * @implements IAny
1159 * @constructor
1160 * @param {google.protobuf.IAny=} [properties] Properties to set
1161 */
1162 function Any(properties) {
1163 if (properties)
1164 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1165 if (properties[keys[i]] != null)
1166 this[keys[i]] = properties[keys[i]];
1167 }
1168
1169 /**
1170 * Any typeUrl.
1171 * @member {string} typeUrl
1172 * @memberof google.protobuf.Any
1173 * @instance
1174 */
1175 Any.prototype.typeUrl = "";
1176
1177 /**
1178 * Any value.
1179 * @member {Uint8Array} value
1180 * @memberof google.protobuf.Any
1181 * @instance
1182 */
1183 Any.prototype.value = $util.newBuffer([]);
1184
1185 /**
1186 * Creates a new Any instance using the specified properties.
1187 * @function create
1188 * @memberof google.protobuf.Any
1189 * @static
1190 * @param {google.protobuf.IAny=} [properties] Properties to set
1191 * @returns {google.protobuf.Any} Any instance
1192 */
1193 Any.create = function create(properties) {
1194 return new Any(properties);
1195 };
1196
1197 /**
1198 * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
1199 * @function encode
1200 * @memberof google.protobuf.Any
1201 * @static
1202 * @param {google.protobuf.IAny} message Any message or plain object to encode
1203 * @param {$protobuf.Writer} [writer] Writer to encode to
1204 * @returns {$protobuf.Writer} Writer
1205 */
1206 Any.encode = function encode(message, writer) {
1207 if (!writer)
1208 writer = $Writer.create();
1209 if (message.typeUrl != null && Object.hasOwnProperty.call(message, "typeUrl"))
1210 writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeUrl);
1211 if (message.value != null && Object.hasOwnProperty.call(message, "value"))
1212 writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value);
1213 return writer;
1214 };
1215
1216 /**
1217 * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
1218 * @function encodeDelimited
1219 * @memberof google.protobuf.Any
1220 * @static
1221 * @param {google.protobuf.IAny} message Any message or plain object to encode
1222 * @param {$protobuf.Writer} [writer] Writer to encode to
1223 * @returns {$protobuf.Writer} Writer
1224 */
1225 Any.encodeDelimited = function encodeDelimited(message, writer) {
1226 return this.encode(message, writer).ldelim();
1227 };
1228
1229 /**
1230 * Decodes an Any message from the specified reader or buffer.
1231 * @function decode
1232 * @memberof google.protobuf.Any
1233 * @static
1234 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1235 * @param {number} [length] Message length if known beforehand
1236 * @returns {google.protobuf.Any} Any
1237 * @throws {Error} If the payload is not a reader or valid buffer
1238 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1239 */
1240 Any.decode = function decode(reader, length) {
1241 if (!(reader instanceof $Reader))
1242 reader = $Reader.create(reader);
1243 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any();
1244 while (reader.pos < end) {
1245 var tag = reader.uint32();
1246 switch (tag >>> 3) {
1247 case 1: {
1248 message.typeUrl = reader.string();
1249 break;
1250 }
1251 case 2: {
1252 message.value = reader.bytes();
1253 break;
1254 }
1255 default:
1256 reader.skipType(tag & 7);
1257 break;
1258 }
1259 }
1260 return message;
1261 };
1262
1263 /**
1264 * Decodes an Any message from the specified reader or buffer, length delimited.
1265 * @function decodeDelimited
1266 * @memberof google.protobuf.Any
1267 * @static
1268 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1269 * @returns {google.protobuf.Any} Any
1270 * @throws {Error} If the payload is not a reader or valid buffer
1271 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1272 */
1273 Any.decodeDelimited = function decodeDelimited(reader) {
1274 if (!(reader instanceof $Reader))
1275 reader = new $Reader(reader);
1276 return this.decode(reader, reader.uint32());
1277 };
1278
1279 /**
1280 * Verifies an Any message.
1281 * @function verify
1282 * @memberof google.protobuf.Any
1283 * @static
1284 * @param {Object.<string,*>} message Plain object to verify
1285 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1286 */
1287 Any.verify = function verify(message) {
1288 if (typeof message !== "object" || message === null)
1289 return "object expected";
1290 if (message.typeUrl != null && message.hasOwnProperty("typeUrl"))
1291 if (!$util.isString(message.typeUrl))
1292 return "typeUrl: string expected";
1293 if (message.value != null && message.hasOwnProperty("value"))
1294 if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value)))
1295 return "value: buffer expected";
1296 return null;
1297 };
1298
1299 /**
1300 * Creates an Any message from a plain object. Also converts values to their respective internal types.
1301 * @function fromObject
1302 * @memberof google.protobuf.Any
1303 * @static
1304 * @param {Object.<string,*>} object Plain object
1305 * @returns {google.protobuf.Any} Any
1306 */
1307 Any.fromObject = function fromObject(object) {
1308 if (object instanceof $root.google.protobuf.Any)
1309 return object;
1310 var message = new $root.google.protobuf.Any();
1311 if (object.typeUrl != null)
1312 message.typeUrl = String(object.typeUrl);
1313 if (object.value != null)
1314 if (typeof object.value === "string")
1315 $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0);
1316 else if (object.value.length >= 0)
1317 message.value = object.value;
1318 return message;
1319 };
1320
1321 /**
1322 * Creates a plain object from an Any message. Also converts values to other types if specified.
1323 * @function toObject
1324 * @memberof google.protobuf.Any
1325 * @static
1326 * @param {google.protobuf.Any} message Any
1327 * @param {$protobuf.IConversionOptions} [options] Conversion options
1328 * @returns {Object.<string,*>} Plain object
1329 */
1330 Any.toObject = function toObject(message, options) {
1331 if (!options)
1332 options = {};
1333 var object = {};
1334 if (options.defaults) {
1335 object.typeUrl = "";
1336 if (options.bytes === String)
1337 object.value = "";
1338 else {
1339 object.value = [];
1340 if (options.bytes !== Array)
1341 object.value = $util.newBuffer(object.value);
1342 }
1343 }
1344 if (message.typeUrl != null && message.hasOwnProperty("typeUrl"))
1345 object.typeUrl = message.typeUrl;
1346 if (message.value != null && message.hasOwnProperty("value"))
1347 object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value;
1348 return object;
1349 };
1350
1351 /**
1352 * Converts this Any to JSON.
1353 * @function toJSON
1354 * @memberof google.protobuf.Any
1355 * @instance
1356 * @returns {Object.<string,*>} JSON object
1357 */
1358 Any.prototype.toJSON = function toJSON() {
1359 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1360 };
1361
1362 /**
1363 * Gets the default type url for Any
1364 * @function getTypeUrl
1365 * @memberof google.protobuf.Any
1366 * @static
1367 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1368 * @returns {string} The default type url
1369 */
1370 Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1371 if (typeUrlPrefix === undefined) {
1372 typeUrlPrefix = "type.googleapis.com";
1373 }
1374 return typeUrlPrefix + "/google.protobuf.Any";
1375 };
1376
1377 return Any;
1378 })();
1379
1380 return protobuf;
1381 })();
1382
1383 google.events = (function() {
1384
1385 /**
1386 * Namespace events.
1387 * @memberof google
1388 * @namespace
1389 */
1390 var events = {};
1391
1392 events.cloud = (function() {
1393
1394 /**
1395 * Namespace cloud.
1396 * @memberof google.events
1397 * @namespace
1398 */
1399 var cloud = {};
1400
1401 cloud.firestore = (function() {
1402
1403 /**
1404 * Namespace firestore.
1405 * @memberof google.events.cloud
1406 * @namespace
1407 */
1408 var firestore = {};
1409
1410 firestore.v1 = (function() {
1411
1412 /**
1413 * Namespace v1.
1414 * @memberof google.events.cloud.firestore
1415 * @namespace
1416 */
1417 var v1 = {};
1418
1419 v1.DocumentEventData = (function() {
1420
1421 /**
1422 * Properties of a DocumentEventData.
1423 * @memberof google.events.cloud.firestore.v1
1424 * @interface IDocumentEventData
1425 * @property {google.events.cloud.firestore.v1.IDocument|null} [value] DocumentEventData value
1426 * @property {google.events.cloud.firestore.v1.IDocument|null} [oldValue] DocumentEventData oldValue
1427 * @property {google.events.cloud.firestore.v1.IDocumentMask|null} [updateMask] DocumentEventData updateMask
1428 */
1429
1430 /**
1431 * Constructs a new DocumentEventData.
1432 * @memberof google.events.cloud.firestore.v1
1433 * @classdesc Represents a DocumentEventData.
1434 * @implements IDocumentEventData
1435 * @constructor
1436 * @param {google.events.cloud.firestore.v1.IDocumentEventData=} [properties] Properties to set
1437 */
1438 function DocumentEventData(properties) {
1439 if (properties)
1440 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1441 if (properties[keys[i]] != null)
1442 this[keys[i]] = properties[keys[i]];
1443 }
1444
1445 /**
1446 * DocumentEventData value.
1447 * @member {google.events.cloud.firestore.v1.IDocument|null|undefined} value
1448 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1449 * @instance
1450 */
1451 DocumentEventData.prototype.value = null;
1452
1453 /**
1454 * DocumentEventData oldValue.
1455 * @member {google.events.cloud.firestore.v1.IDocument|null|undefined} oldValue
1456 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1457 * @instance
1458 */
1459 DocumentEventData.prototype.oldValue = null;
1460
1461 /**
1462 * DocumentEventData updateMask.
1463 * @member {google.events.cloud.firestore.v1.IDocumentMask|null|undefined} updateMask
1464 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1465 * @instance
1466 */
1467 DocumentEventData.prototype.updateMask = null;
1468
1469 /**
1470 * Creates a new DocumentEventData instance using the specified properties.
1471 * @function create
1472 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1473 * @static
1474 * @param {google.events.cloud.firestore.v1.IDocumentEventData=} [properties] Properties to set
1475 * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData instance
1476 */
1477 DocumentEventData.create = function create(properties) {
1478 return new DocumentEventData(properties);
1479 };
1480
1481 /**
1482 * Encodes the specified DocumentEventData message. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentEventData.verify|verify} messages.
1483 * @function encode
1484 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1485 * @static
1486 * @param {google.events.cloud.firestore.v1.IDocumentEventData} message DocumentEventData message or plain object to encode
1487 * @param {$protobuf.Writer} [writer] Writer to encode to
1488 * @returns {$protobuf.Writer} Writer
1489 */
1490 DocumentEventData.encode = function encode(message, writer) {
1491 if (!writer)
1492 writer = $Writer.create();
1493 if (message.value != null && Object.hasOwnProperty.call(message, "value"))
1494 $root.google.events.cloud.firestore.v1.Document.encode(message.value, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
1495 if (message.oldValue != null && Object.hasOwnProperty.call(message, "oldValue"))
1496 $root.google.events.cloud.firestore.v1.Document.encode(message.oldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
1497 if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask"))
1498 $root.google.events.cloud.firestore.v1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
1499 return writer;
1500 };
1501
1502 /**
1503 * Encodes the specified DocumentEventData message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentEventData.verify|verify} messages.
1504 * @function encodeDelimited
1505 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1506 * @static
1507 * @param {google.events.cloud.firestore.v1.IDocumentEventData} message DocumentEventData message or plain object to encode
1508 * @param {$protobuf.Writer} [writer] Writer to encode to
1509 * @returns {$protobuf.Writer} Writer
1510 */
1511 DocumentEventData.encodeDelimited = function encodeDelimited(message, writer) {
1512 return this.encode(message, writer).ldelim();
1513 };
1514
1515 /**
1516 * Decodes a DocumentEventData message from the specified reader or buffer.
1517 * @function decode
1518 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1519 * @static
1520 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1521 * @param {number} [length] Message length if known beforehand
1522 * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1523 * @throws {Error} If the payload is not a reader or valid buffer
1524 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1525 */
1526 DocumentEventData.decode = function decode(reader, length) {
1527 if (!(reader instanceof $Reader))
1528 reader = $Reader.create(reader);
1529 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.DocumentEventData();
1530 while (reader.pos < end) {
1531 var tag = reader.uint32();
1532 switch (tag >>> 3) {
1533 case 1: {
1534 message.value = $root.google.events.cloud.firestore.v1.Document.decode(reader, reader.uint32());
1535 break;
1536 }
1537 case 2: {
1538 message.oldValue = $root.google.events.cloud.firestore.v1.Document.decode(reader, reader.uint32());
1539 break;
1540 }
1541 case 3: {
1542 message.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.decode(reader, reader.uint32());
1543 break;
1544 }
1545 default:
1546 reader.skipType(tag & 7);
1547 break;
1548 }
1549 }
1550 return message;
1551 };
1552
1553 /**
1554 * Decodes a DocumentEventData message from the specified reader or buffer, length delimited.
1555 * @function decodeDelimited
1556 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1557 * @static
1558 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1559 * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1560 * @throws {Error} If the payload is not a reader or valid buffer
1561 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1562 */
1563 DocumentEventData.decodeDelimited = function decodeDelimited(reader) {
1564 if (!(reader instanceof $Reader))
1565 reader = new $Reader(reader);
1566 return this.decode(reader, reader.uint32());
1567 };
1568
1569 /**
1570 * Verifies a DocumentEventData message.
1571 * @function verify
1572 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1573 * @static
1574 * @param {Object.<string,*>} message Plain object to verify
1575 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1576 */
1577 DocumentEventData.verify = function verify(message) {
1578 if (typeof message !== "object" || message === null)
1579 return "object expected";
1580 if (message.value != null && message.hasOwnProperty("value")) {
1581 var error = $root.google.events.cloud.firestore.v1.Document.verify(message.value);
1582 if (error)
1583 return "value." + error;
1584 }
1585 if (message.oldValue != null && message.hasOwnProperty("oldValue")) {
1586 var error = $root.google.events.cloud.firestore.v1.Document.verify(message.oldValue);
1587 if (error)
1588 return "oldValue." + error;
1589 }
1590 if (message.updateMask != null && message.hasOwnProperty("updateMask")) {
1591 var error = $root.google.events.cloud.firestore.v1.DocumentMask.verify(message.updateMask);
1592 if (error)
1593 return "updateMask." + error;
1594 }
1595 return null;
1596 };
1597
1598 /**
1599 * Creates a DocumentEventData message from a plain object. Also converts values to their respective internal types.
1600 * @function fromObject
1601 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1602 * @static
1603 * @param {Object.<string,*>} object Plain object
1604 * @returns {google.events.cloud.firestore.v1.DocumentEventData} DocumentEventData
1605 */
1606 DocumentEventData.fromObject = function fromObject(object) {
1607 if (object instanceof $root.google.events.cloud.firestore.v1.DocumentEventData)
1608 return object;
1609 var message = new $root.google.events.cloud.firestore.v1.DocumentEventData();
1610 if (object.value != null) {
1611 if (typeof object.value !== "object")
1612 throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.value: object expected");
1613 message.value = $root.google.events.cloud.firestore.v1.Document.fromObject(object.value);
1614 }
1615 if (object.oldValue != null) {
1616 if (typeof object.oldValue !== "object")
1617 throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.oldValue: object expected");
1618 message.oldValue = $root.google.events.cloud.firestore.v1.Document.fromObject(object.oldValue);
1619 }
1620 if (object.updateMask != null) {
1621 if (typeof object.updateMask !== "object")
1622 throw TypeError(".google.events.cloud.firestore.v1.DocumentEventData.updateMask: object expected");
1623 message.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.fromObject(object.updateMask);
1624 }
1625 return message;
1626 };
1627
1628 /**
1629 * Creates a plain object from a DocumentEventData message. Also converts values to other types if specified.
1630 * @function toObject
1631 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1632 * @static
1633 * @param {google.events.cloud.firestore.v1.DocumentEventData} message DocumentEventData
1634 * @param {$protobuf.IConversionOptions} [options] Conversion options
1635 * @returns {Object.<string,*>} Plain object
1636 */
1637 DocumentEventData.toObject = function toObject(message, options) {
1638 if (!options)
1639 options = {};
1640 var object = {};
1641 if (options.defaults) {
1642 object.value = null;
1643 object.oldValue = null;
1644 object.updateMask = null;
1645 }
1646 if (message.value != null && message.hasOwnProperty("value"))
1647 object.value = $root.google.events.cloud.firestore.v1.Document.toObject(message.value, options);
1648 if (message.oldValue != null && message.hasOwnProperty("oldValue"))
1649 object.oldValue = $root.google.events.cloud.firestore.v1.Document.toObject(message.oldValue, options);
1650 if (message.updateMask != null && message.hasOwnProperty("updateMask"))
1651 object.updateMask = $root.google.events.cloud.firestore.v1.DocumentMask.toObject(message.updateMask, options);
1652 return object;
1653 };
1654
1655 /**
1656 * Converts this DocumentEventData to JSON.
1657 * @function toJSON
1658 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1659 * @instance
1660 * @returns {Object.<string,*>} JSON object
1661 */
1662 DocumentEventData.prototype.toJSON = function toJSON() {
1663 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1664 };
1665
1666 /**
1667 * Gets the default type url for DocumentEventData
1668 * @function getTypeUrl
1669 * @memberof google.events.cloud.firestore.v1.DocumentEventData
1670 * @static
1671 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1672 * @returns {string} The default type url
1673 */
1674 DocumentEventData.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1675 if (typeUrlPrefix === undefined) {
1676 typeUrlPrefix = "type.googleapis.com";
1677 }
1678 return typeUrlPrefix + "/google.events.cloud.firestore.v1.DocumentEventData";
1679 };
1680
1681 return DocumentEventData;
1682 })();
1683
1684 v1.DocumentMask = (function() {
1685
1686 /**
1687 * Properties of a DocumentMask.
1688 * @memberof google.events.cloud.firestore.v1
1689 * @interface IDocumentMask
1690 * @property {Array.<string>|null} [fieldPaths] DocumentMask fieldPaths
1691 */
1692
1693 /**
1694 * Constructs a new DocumentMask.
1695 * @memberof google.events.cloud.firestore.v1
1696 * @classdesc Represents a DocumentMask.
1697 * @implements IDocumentMask
1698 * @constructor
1699 * @param {google.events.cloud.firestore.v1.IDocumentMask=} [properties] Properties to set
1700 */
1701 function DocumentMask(properties) {
1702 this.fieldPaths = [];
1703 if (properties)
1704 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1705 if (properties[keys[i]] != null)
1706 this[keys[i]] = properties[keys[i]];
1707 }
1708
1709 /**
1710 * DocumentMask fieldPaths.
1711 * @member {Array.<string>} fieldPaths
1712 * @memberof google.events.cloud.firestore.v1.DocumentMask
1713 * @instance
1714 */
1715 DocumentMask.prototype.fieldPaths = $util.emptyArray;
1716
1717 /**
1718 * Creates a new DocumentMask instance using the specified properties.
1719 * @function create
1720 * @memberof google.events.cloud.firestore.v1.DocumentMask
1721 * @static
1722 * @param {google.events.cloud.firestore.v1.IDocumentMask=} [properties] Properties to set
1723 * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask instance
1724 */
1725 DocumentMask.create = function create(properties) {
1726 return new DocumentMask(properties);
1727 };
1728
1729 /**
1730 * Encodes the specified DocumentMask message. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentMask.verify|verify} messages.
1731 * @function encode
1732 * @memberof google.events.cloud.firestore.v1.DocumentMask
1733 * @static
1734 * @param {google.events.cloud.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode
1735 * @param {$protobuf.Writer} [writer] Writer to encode to
1736 * @returns {$protobuf.Writer} Writer
1737 */
1738 DocumentMask.encode = function encode(message, writer) {
1739 if (!writer)
1740 writer = $Writer.create();
1741 if (message.fieldPaths != null && message.fieldPaths.length)
1742 for (var i = 0; i < message.fieldPaths.length; ++i)
1743 writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPaths[i]);
1744 return writer;
1745 };
1746
1747 /**
1748 * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.DocumentMask.verify|verify} messages.
1749 * @function encodeDelimited
1750 * @memberof google.events.cloud.firestore.v1.DocumentMask
1751 * @static
1752 * @param {google.events.cloud.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode
1753 * @param {$protobuf.Writer} [writer] Writer to encode to
1754 * @returns {$protobuf.Writer} Writer
1755 */
1756 DocumentMask.encodeDelimited = function encodeDelimited(message, writer) {
1757 return this.encode(message, writer).ldelim();
1758 };
1759
1760 /**
1761 * Decodes a DocumentMask message from the specified reader or buffer.
1762 * @function decode
1763 * @memberof google.events.cloud.firestore.v1.DocumentMask
1764 * @static
1765 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1766 * @param {number} [length] Message length if known beforehand
1767 * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1768 * @throws {Error} If the payload is not a reader or valid buffer
1769 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1770 */
1771 DocumentMask.decode = function decode(reader, length) {
1772 if (!(reader instanceof $Reader))
1773 reader = $Reader.create(reader);
1774 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.DocumentMask();
1775 while (reader.pos < end) {
1776 var tag = reader.uint32();
1777 switch (tag >>> 3) {
1778 case 1: {
1779 if (!(message.fieldPaths && message.fieldPaths.length))
1780 message.fieldPaths = [];
1781 message.fieldPaths.push(reader.string());
1782 break;
1783 }
1784 default:
1785 reader.skipType(tag & 7);
1786 break;
1787 }
1788 }
1789 return message;
1790 };
1791
1792 /**
1793 * Decodes a DocumentMask message from the specified reader or buffer, length delimited.
1794 * @function decodeDelimited
1795 * @memberof google.events.cloud.firestore.v1.DocumentMask
1796 * @static
1797 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1798 * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1799 * @throws {Error} If the payload is not a reader or valid buffer
1800 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1801 */
1802 DocumentMask.decodeDelimited = function decodeDelimited(reader) {
1803 if (!(reader instanceof $Reader))
1804 reader = new $Reader(reader);
1805 return this.decode(reader, reader.uint32());
1806 };
1807
1808 /**
1809 * Verifies a DocumentMask message.
1810 * @function verify
1811 * @memberof google.events.cloud.firestore.v1.DocumentMask
1812 * @static
1813 * @param {Object.<string,*>} message Plain object to verify
1814 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1815 */
1816 DocumentMask.verify = function verify(message) {
1817 if (typeof message !== "object" || message === null)
1818 return "object expected";
1819 if (message.fieldPaths != null && message.hasOwnProperty("fieldPaths")) {
1820 if (!Array.isArray(message.fieldPaths))
1821 return "fieldPaths: array expected";
1822 for (var i = 0; i < message.fieldPaths.length; ++i)
1823 if (!$util.isString(message.fieldPaths[i]))
1824 return "fieldPaths: string[] expected";
1825 }
1826 return null;
1827 };
1828
1829 /**
1830 * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types.
1831 * @function fromObject
1832 * @memberof google.events.cloud.firestore.v1.DocumentMask
1833 * @static
1834 * @param {Object.<string,*>} object Plain object
1835 * @returns {google.events.cloud.firestore.v1.DocumentMask} DocumentMask
1836 */
1837 DocumentMask.fromObject = function fromObject(object) {
1838 if (object instanceof $root.google.events.cloud.firestore.v1.DocumentMask)
1839 return object;
1840 var message = new $root.google.events.cloud.firestore.v1.DocumentMask();
1841 if (object.fieldPaths) {
1842 if (!Array.isArray(object.fieldPaths))
1843 throw TypeError(".google.events.cloud.firestore.v1.DocumentMask.fieldPaths: array expected");
1844 message.fieldPaths = [];
1845 for (var i = 0; i < object.fieldPaths.length; ++i)
1846 message.fieldPaths[i] = String(object.fieldPaths[i]);
1847 }
1848 return message;
1849 };
1850
1851 /**
1852 * Creates a plain object from a DocumentMask message. Also converts values to other types if specified.
1853 * @function toObject
1854 * @memberof google.events.cloud.firestore.v1.DocumentMask
1855 * @static
1856 * @param {google.events.cloud.firestore.v1.DocumentMask} message DocumentMask
1857 * @param {$protobuf.IConversionOptions} [options] Conversion options
1858 * @returns {Object.<string,*>} Plain object
1859 */
1860 DocumentMask.toObject = function toObject(message, options) {
1861 if (!options)
1862 options = {};
1863 var object = {};
1864 if (options.arrays || options.defaults)
1865 object.fieldPaths = [];
1866 if (message.fieldPaths && message.fieldPaths.length) {
1867 object.fieldPaths = [];
1868 for (var j = 0; j < message.fieldPaths.length; ++j)
1869 object.fieldPaths[j] = message.fieldPaths[j];
1870 }
1871 return object;
1872 };
1873
1874 /**
1875 * Converts this DocumentMask to JSON.
1876 * @function toJSON
1877 * @memberof google.events.cloud.firestore.v1.DocumentMask
1878 * @instance
1879 * @returns {Object.<string,*>} JSON object
1880 */
1881 DocumentMask.prototype.toJSON = function toJSON() {
1882 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1883 };
1884
1885 /**
1886 * Gets the default type url for DocumentMask
1887 * @function getTypeUrl
1888 * @memberof google.events.cloud.firestore.v1.DocumentMask
1889 * @static
1890 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1891 * @returns {string} The default type url
1892 */
1893 DocumentMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1894 if (typeUrlPrefix === undefined) {
1895 typeUrlPrefix = "type.googleapis.com";
1896 }
1897 return typeUrlPrefix + "/google.events.cloud.firestore.v1.DocumentMask";
1898 };
1899
1900 return DocumentMask;
1901 })();
1902
1903 v1.Document = (function() {
1904
1905 /**
1906 * Properties of a Document.
1907 * @memberof google.events.cloud.firestore.v1
1908 * @interface IDocument
1909 * @property {string|null} [name] Document name
1910 * @property {Object.<string,google.events.cloud.firestore.v1.IValue>|null} [fields] Document fields
1911 * @property {google.protobuf.ITimestamp|null} [createTime] Document createTime
1912 * @property {google.protobuf.ITimestamp|null} [updateTime] Document updateTime
1913 */
1914
1915 /**
1916 * Constructs a new Document.
1917 * @memberof google.events.cloud.firestore.v1
1918 * @classdesc Represents a Document.
1919 * @implements IDocument
1920 * @constructor
1921 * @param {google.events.cloud.firestore.v1.IDocument=} [properties] Properties to set
1922 */
1923 function Document(properties) {
1924 this.fields = {};
1925 if (properties)
1926 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1927 if (properties[keys[i]] != null)
1928 this[keys[i]] = properties[keys[i]];
1929 }
1930
1931 /**
1932 * Document name.
1933 * @member {string} name
1934 * @memberof google.events.cloud.firestore.v1.Document
1935 * @instance
1936 */
1937 Document.prototype.name = "";
1938
1939 /**
1940 * Document fields.
1941 * @member {Object.<string,google.events.cloud.firestore.v1.IValue>} fields
1942 * @memberof google.events.cloud.firestore.v1.Document
1943 * @instance
1944 */
1945 Document.prototype.fields = $util.emptyObject;
1946
1947 /**
1948 * Document createTime.
1949 * @member {google.protobuf.ITimestamp|null|undefined} createTime
1950 * @memberof google.events.cloud.firestore.v1.Document
1951 * @instance
1952 */
1953 Document.prototype.createTime = null;
1954
1955 /**
1956 * Document updateTime.
1957 * @member {google.protobuf.ITimestamp|null|undefined} updateTime
1958 * @memberof google.events.cloud.firestore.v1.Document
1959 * @instance
1960 */
1961 Document.prototype.updateTime = null;
1962
1963 /**
1964 * Creates a new Document instance using the specified properties.
1965 * @function create
1966 * @memberof google.events.cloud.firestore.v1.Document
1967 * @static
1968 * @param {google.events.cloud.firestore.v1.IDocument=} [properties] Properties to set
1969 * @returns {google.events.cloud.firestore.v1.Document} Document instance
1970 */
1971 Document.create = function create(properties) {
1972 return new Document(properties);
1973 };
1974
1975 /**
1976 * Encodes the specified Document message. Does not implicitly {@link google.events.cloud.firestore.v1.Document.verify|verify} messages.
1977 * @function encode
1978 * @memberof google.events.cloud.firestore.v1.Document
1979 * @static
1980 * @param {google.events.cloud.firestore.v1.IDocument} message Document message or plain object to encode
1981 * @param {$protobuf.Writer} [writer] Writer to encode to
1982 * @returns {$protobuf.Writer} Writer
1983 */
1984 Document.encode = function encode(message, writer) {
1985 if (!writer)
1986 writer = $Writer.create();
1987 if (message.name != null && Object.hasOwnProperty.call(message, "name"))
1988 writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
1989 if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
1990 for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
1991 writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
1992 $root.google.events.cloud.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
1993 }
1994 if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime"))
1995 $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
1996 if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime"))
1997 $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
1998 return writer;
1999 };
2000
2001 /**
2002 * Encodes the specified Document message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.Document.verify|verify} messages.
2003 * @function encodeDelimited
2004 * @memberof google.events.cloud.firestore.v1.Document
2005 * @static
2006 * @param {google.events.cloud.firestore.v1.IDocument} message Document message or plain object to encode
2007 * @param {$protobuf.Writer} [writer] Writer to encode to
2008 * @returns {$protobuf.Writer} Writer
2009 */
2010 Document.encodeDelimited = function encodeDelimited(message, writer) {
2011 return this.encode(message, writer).ldelim();
2012 };
2013
2014 /**
2015 * Decodes a Document message from the specified reader or buffer.
2016 * @function decode
2017 * @memberof google.events.cloud.firestore.v1.Document
2018 * @static
2019 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2020 * @param {number} [length] Message length if known beforehand
2021 * @returns {google.events.cloud.firestore.v1.Document} Document
2022 * @throws {Error} If the payload is not a reader or valid buffer
2023 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2024 */
2025 Document.decode = function decode(reader, length) {
2026 if (!(reader instanceof $Reader))
2027 reader = $Reader.create(reader);
2028 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.Document(), key, value;
2029 while (reader.pos < end) {
2030 var tag = reader.uint32();
2031 switch (tag >>> 3) {
2032 case 1: {
2033 message.name = reader.string();
2034 break;
2035 }
2036 case 2: {
2037 if (message.fields === $util.emptyObject)
2038 message.fields = {};
2039 var end2 = reader.uint32() + reader.pos;
2040 key = "";
2041 value = null;
2042 while (reader.pos < end2) {
2043 var tag2 = reader.uint32();
2044 switch (tag2 >>> 3) {
2045 case 1:
2046 key = reader.string();
2047 break;
2048 case 2:
2049 value = $root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32());
2050 break;
2051 default:
2052 reader.skipType(tag2 & 7);
2053 break;
2054 }
2055 }
2056 message.fields[key] = value;
2057 break;
2058 }
2059 case 3: {
2060 message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2061 break;
2062 }
2063 case 4: {
2064 message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2065 break;
2066 }
2067 default:
2068 reader.skipType(tag & 7);
2069 break;
2070 }
2071 }
2072 return message;
2073 };
2074
2075 /**
2076 * Decodes a Document message from the specified reader or buffer, length delimited.
2077 * @function decodeDelimited
2078 * @memberof google.events.cloud.firestore.v1.Document
2079 * @static
2080 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2081 * @returns {google.events.cloud.firestore.v1.Document} Document
2082 * @throws {Error} If the payload is not a reader or valid buffer
2083 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2084 */
2085 Document.decodeDelimited = function decodeDelimited(reader) {
2086 if (!(reader instanceof $Reader))
2087 reader = new $Reader(reader);
2088 return this.decode(reader, reader.uint32());
2089 };
2090
2091 /**
2092 * Verifies a Document message.
2093 * @function verify
2094 * @memberof google.events.cloud.firestore.v1.Document
2095 * @static
2096 * @param {Object.<string,*>} message Plain object to verify
2097 * @returns {string|null} `null` if valid, otherwise the reason why it is not
2098 */
2099 Document.verify = function verify(message) {
2100 if (typeof message !== "object" || message === null)
2101 return "object expected";
2102 if (message.name != null && message.hasOwnProperty("name"))
2103 if (!$util.isString(message.name))
2104 return "name: string expected";
2105 if (message.fields != null && message.hasOwnProperty("fields")) {
2106 if (!$util.isObject(message.fields))
2107 return "fields: object expected";
2108 var key = Object.keys(message.fields);
2109 for (var i = 0; i < key.length; ++i) {
2110 var error = $root.google.events.cloud.firestore.v1.Value.verify(message.fields[key[i]]);
2111 if (error)
2112 return "fields." + error;
2113 }
2114 }
2115 if (message.createTime != null && message.hasOwnProperty("createTime")) {
2116 var error = $root.google.protobuf.Timestamp.verify(message.createTime);
2117 if (error)
2118 return "createTime." + error;
2119 }
2120 if (message.updateTime != null && message.hasOwnProperty("updateTime")) {
2121 var error = $root.google.protobuf.Timestamp.verify(message.updateTime);
2122 if (error)
2123 return "updateTime." + error;
2124 }
2125 return null;
2126 };
2127
2128 /**
2129 * Creates a Document message from a plain object. Also converts values to their respective internal types.
2130 * @function fromObject
2131 * @memberof google.events.cloud.firestore.v1.Document
2132 * @static
2133 * @param {Object.<string,*>} object Plain object
2134 * @returns {google.events.cloud.firestore.v1.Document} Document
2135 */
2136 Document.fromObject = function fromObject(object) {
2137 if (object instanceof $root.google.events.cloud.firestore.v1.Document)
2138 return object;
2139 var message = new $root.google.events.cloud.firestore.v1.Document();
2140 if (object.name != null)
2141 message.name = String(object.name);
2142 if (object.fields) {
2143 if (typeof object.fields !== "object")
2144 throw TypeError(".google.events.cloud.firestore.v1.Document.fields: object expected");
2145 message.fields = {};
2146 for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
2147 if (typeof object.fields[keys[i]] !== "object")
2148 throw TypeError(".google.events.cloud.firestore.v1.Document.fields: object expected");
2149 message.fields[keys[i]] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.fields[keys[i]]);
2150 }
2151 }
2152 if (object.createTime != null) {
2153 if (typeof object.createTime !== "object")
2154 throw TypeError(".google.events.cloud.firestore.v1.Document.createTime: object expected");
2155 message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime);
2156 }
2157 if (object.updateTime != null) {
2158 if (typeof object.updateTime !== "object")
2159 throw TypeError(".google.events.cloud.firestore.v1.Document.updateTime: object expected");
2160 message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime);
2161 }
2162 return message;
2163 };
2164
2165 /**
2166 * Creates a plain object from a Document message. Also converts values to other types if specified.
2167 * @function toObject
2168 * @memberof google.events.cloud.firestore.v1.Document
2169 * @static
2170 * @param {google.events.cloud.firestore.v1.Document} message Document
2171 * @param {$protobuf.IConversionOptions} [options] Conversion options
2172 * @returns {Object.<string,*>} Plain object
2173 */
2174 Document.toObject = function toObject(message, options) {
2175 if (!options)
2176 options = {};
2177 var object = {};
2178 if (options.objects || options.defaults)
2179 object.fields = {};
2180 if (options.defaults) {
2181 object.name = "";
2182 object.createTime = null;
2183 object.updateTime = null;
2184 }
2185 if (message.name != null && message.hasOwnProperty("name"))
2186 object.name = message.name;
2187 var keys2;
2188 if (message.fields && (keys2 = Object.keys(message.fields)).length) {
2189 object.fields = {};
2190 for (var j = 0; j < keys2.length; ++j)
2191 object.fields[keys2[j]] = $root.google.events.cloud.firestore.v1.Value.toObject(message.fields[keys2[j]], options);
2192 }
2193 if (message.createTime != null && message.hasOwnProperty("createTime"))
2194 object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options);
2195 if (message.updateTime != null && message.hasOwnProperty("updateTime"))
2196 object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options);
2197 return object;
2198 };
2199
2200 /**
2201 * Converts this Document to JSON.
2202 * @function toJSON
2203 * @memberof google.events.cloud.firestore.v1.Document
2204 * @instance
2205 * @returns {Object.<string,*>} JSON object
2206 */
2207 Document.prototype.toJSON = function toJSON() {
2208 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2209 };
2210
2211 /**
2212 * Gets the default type url for Document
2213 * @function getTypeUrl
2214 * @memberof google.events.cloud.firestore.v1.Document
2215 * @static
2216 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2217 * @returns {string} The default type url
2218 */
2219 Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2220 if (typeUrlPrefix === undefined) {
2221 typeUrlPrefix = "type.googleapis.com";
2222 }
2223 return typeUrlPrefix + "/google.events.cloud.firestore.v1.Document";
2224 };
2225
2226 return Document;
2227 })();
2228
2229 v1.Value = (function() {
2230
2231 /**
2232 * Properties of a Value.
2233 * @memberof google.events.cloud.firestore.v1
2234 * @interface IValue
2235 * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue
2236 * @property {boolean|null} [booleanValue] Value booleanValue
2237 * @property {number|Long|null} [integerValue] Value integerValue
2238 * @property {number|null} [doubleValue] Value doubleValue
2239 * @property {google.protobuf.ITimestamp|null} [timestampValue] Value timestampValue
2240 * @property {string|null} [stringValue] Value stringValue
2241 * @property {Uint8Array|null} [bytesValue] Value bytesValue
2242 * @property {string|null} [referenceValue] Value referenceValue
2243 * @property {google.type.ILatLng|null} [geoPointValue] Value geoPointValue
2244 * @property {google.events.cloud.firestore.v1.IArrayValue|null} [arrayValue] Value arrayValue
2245 * @property {google.events.cloud.firestore.v1.IMapValue|null} [mapValue] Value mapValue
2246 */
2247
2248 /**
2249 * Constructs a new Value.
2250 * @memberof google.events.cloud.firestore.v1
2251 * @classdesc Represents a Value.
2252 * @implements IValue
2253 * @constructor
2254 * @param {google.events.cloud.firestore.v1.IValue=} [properties] Properties to set
2255 */
2256 function Value(properties) {
2257 if (properties)
2258 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2259 if (properties[keys[i]] != null)
2260 this[keys[i]] = properties[keys[i]];
2261 }
2262
2263 /**
2264 * Value nullValue.
2265 * @member {google.protobuf.NullValue|null|undefined} nullValue
2266 * @memberof google.events.cloud.firestore.v1.Value
2267 * @instance
2268 */
2269 Value.prototype.nullValue = null;
2270
2271 /**
2272 * Value booleanValue.
2273 * @member {boolean|null|undefined} booleanValue
2274 * @memberof google.events.cloud.firestore.v1.Value
2275 * @instance
2276 */
2277 Value.prototype.booleanValue = null;
2278
2279 /**
2280 * Value integerValue.
2281 * @member {number|Long|null|undefined} integerValue
2282 * @memberof google.events.cloud.firestore.v1.Value
2283 * @instance
2284 */
2285 Value.prototype.integerValue = null;
2286
2287 /**
2288 * Value doubleValue.
2289 * @member {number|null|undefined} doubleValue
2290 * @memberof google.events.cloud.firestore.v1.Value
2291 * @instance
2292 */
2293 Value.prototype.doubleValue = null;
2294
2295 /**
2296 * Value timestampValue.
2297 * @member {google.protobuf.ITimestamp|null|undefined} timestampValue
2298 * @memberof google.events.cloud.firestore.v1.Value
2299 * @instance
2300 */
2301 Value.prototype.timestampValue = null;
2302
2303 /**
2304 * Value stringValue.
2305 * @member {string|null|undefined} stringValue
2306 * @memberof google.events.cloud.firestore.v1.Value
2307 * @instance
2308 */
2309 Value.prototype.stringValue = null;
2310
2311 /**
2312 * Value bytesValue.
2313 * @member {Uint8Array|null|undefined} bytesValue
2314 * @memberof google.events.cloud.firestore.v1.Value
2315 * @instance
2316 */
2317 Value.prototype.bytesValue = null;
2318
2319 /**
2320 * Value referenceValue.
2321 * @member {string|null|undefined} referenceValue
2322 * @memberof google.events.cloud.firestore.v1.Value
2323 * @instance
2324 */
2325 Value.prototype.referenceValue = null;
2326
2327 /**
2328 * Value geoPointValue.
2329 * @member {google.type.ILatLng|null|undefined} geoPointValue
2330 * @memberof google.events.cloud.firestore.v1.Value
2331 * @instance
2332 */
2333 Value.prototype.geoPointValue = null;
2334
2335 /**
2336 * Value arrayValue.
2337 * @member {google.events.cloud.firestore.v1.IArrayValue|null|undefined} arrayValue
2338 * @memberof google.events.cloud.firestore.v1.Value
2339 * @instance
2340 */
2341 Value.prototype.arrayValue = null;
2342
2343 /**
2344 * Value mapValue.
2345 * @member {google.events.cloud.firestore.v1.IMapValue|null|undefined} mapValue
2346 * @memberof google.events.cloud.firestore.v1.Value
2347 * @instance
2348 */
2349 Value.prototype.mapValue = null;
2350
2351 // OneOf field names bound to virtual getters and setters
2352 var $oneOfFields;
2353
2354 /**
2355 * Value valueType.
2356 * @member {"nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"|undefined} valueType
2357 * @memberof google.events.cloud.firestore.v1.Value
2358 * @instance
2359 */
2360 Object.defineProperty(Value.prototype, "valueType", {
2361 get: $util.oneOfGetter($oneOfFields = ["nullValue", "booleanValue", "integerValue", "doubleValue", "timestampValue", "stringValue", "bytesValue", "referenceValue", "geoPointValue", "arrayValue", "mapValue"]),
2362 set: $util.oneOfSetter($oneOfFields)
2363 });
2364
2365 /**
2366 * Creates a new Value instance using the specified properties.
2367 * @function create
2368 * @memberof google.events.cloud.firestore.v1.Value
2369 * @static
2370 * @param {google.events.cloud.firestore.v1.IValue=} [properties] Properties to set
2371 * @returns {google.events.cloud.firestore.v1.Value} Value instance
2372 */
2373 Value.create = function create(properties) {
2374 return new Value(properties);
2375 };
2376
2377 /**
2378 * Encodes the specified Value message. Does not implicitly {@link google.events.cloud.firestore.v1.Value.verify|verify} messages.
2379 * @function encode
2380 * @memberof google.events.cloud.firestore.v1.Value
2381 * @static
2382 * @param {google.events.cloud.firestore.v1.IValue} message Value message or plain object to encode
2383 * @param {$protobuf.Writer} [writer] Writer to encode to
2384 * @returns {$protobuf.Writer} Writer
2385 */
2386 Value.encode = function encode(message, writer) {
2387 if (!writer)
2388 writer = $Writer.create();
2389 if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue"))
2390 writer.uint32(/* id 1, wireType 0 =*/8).bool(message.booleanValue);
2391 if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue"))
2392 writer.uint32(/* id 2, wireType 0 =*/16).int64(message.integerValue);
2393 if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue"))
2394 writer.uint32(/* id 3, wireType 1 =*/25).double(message.doubleValue);
2395 if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue"))
2396 writer.uint32(/* id 5, wireType 2 =*/42).string(message.referenceValue);
2397 if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue"))
2398 $root.google.events.cloud.firestore.v1.MapValue.encode(message.mapValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
2399 if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue"))
2400 $root.google.type.LatLng.encode(message.geoPointValue, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
2401 if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue"))
2402 $root.google.events.cloud.firestore.v1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
2403 if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue"))
2404 $root.google.protobuf.Timestamp.encode(message.timestampValue, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
2405 if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue"))
2406 writer.uint32(/* id 11, wireType 0 =*/88).int32(message.nullValue);
2407 if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
2408 writer.uint32(/* id 17, wireType 2 =*/138).string(message.stringValue);
2409 if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue"))
2410 writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.bytesValue);
2411 return writer;
2412 };
2413
2414 /**
2415 * Encodes the specified Value message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.Value.verify|verify} messages.
2416 * @function encodeDelimited
2417 * @memberof google.events.cloud.firestore.v1.Value
2418 * @static
2419 * @param {google.events.cloud.firestore.v1.IValue} message Value message or plain object to encode
2420 * @param {$protobuf.Writer} [writer] Writer to encode to
2421 * @returns {$protobuf.Writer} Writer
2422 */
2423 Value.encodeDelimited = function encodeDelimited(message, writer) {
2424 return this.encode(message, writer).ldelim();
2425 };
2426
2427 /**
2428 * Decodes a Value message from the specified reader or buffer.
2429 * @function decode
2430 * @memberof google.events.cloud.firestore.v1.Value
2431 * @static
2432 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2433 * @param {number} [length] Message length if known beforehand
2434 * @returns {google.events.cloud.firestore.v1.Value} Value
2435 * @throws {Error} If the payload is not a reader or valid buffer
2436 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2437 */
2438 Value.decode = function decode(reader, length) {
2439 if (!(reader instanceof $Reader))
2440 reader = $Reader.create(reader);
2441 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.Value();
2442 while (reader.pos < end) {
2443 var tag = reader.uint32();
2444 switch (tag >>> 3) {
2445 case 11: {
2446 message.nullValue = reader.int32();
2447 break;
2448 }
2449 case 1: {
2450 message.booleanValue = reader.bool();
2451 break;
2452 }
2453 case 2: {
2454 message.integerValue = reader.int64();
2455 break;
2456 }
2457 case 3: {
2458 message.doubleValue = reader.double();
2459 break;
2460 }
2461 case 10: {
2462 message.timestampValue = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
2463 break;
2464 }
2465 case 17: {
2466 message.stringValue = reader.string();
2467 break;
2468 }
2469 case 18: {
2470 message.bytesValue = reader.bytes();
2471 break;
2472 }
2473 case 5: {
2474 message.referenceValue = reader.string();
2475 break;
2476 }
2477 case 8: {
2478 message.geoPointValue = $root.google.type.LatLng.decode(reader, reader.uint32());
2479 break;
2480 }
2481 case 9: {
2482 message.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.decode(reader, reader.uint32());
2483 break;
2484 }
2485 case 6: {
2486 message.mapValue = $root.google.events.cloud.firestore.v1.MapValue.decode(reader, reader.uint32());
2487 break;
2488 }
2489 default:
2490 reader.skipType(tag & 7);
2491 break;
2492 }
2493 }
2494 return message;
2495 };
2496
2497 /**
2498 * Decodes a Value message from the specified reader or buffer, length delimited.
2499 * @function decodeDelimited
2500 * @memberof google.events.cloud.firestore.v1.Value
2501 * @static
2502 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2503 * @returns {google.events.cloud.firestore.v1.Value} Value
2504 * @throws {Error} If the payload is not a reader or valid buffer
2505 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2506 */
2507 Value.decodeDelimited = function decodeDelimited(reader) {
2508 if (!(reader instanceof $Reader))
2509 reader = new $Reader(reader);
2510 return this.decode(reader, reader.uint32());
2511 };
2512
2513 /**
2514 * Verifies a Value message.
2515 * @function verify
2516 * @memberof google.events.cloud.firestore.v1.Value
2517 * @static
2518 * @param {Object.<string,*>} message Plain object to verify
2519 * @returns {string|null} `null` if valid, otherwise the reason why it is not
2520 */
2521 Value.verify = function verify(message) {
2522 if (typeof message !== "object" || message === null)
2523 return "object expected";
2524 var properties = {};
2525 if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
2526 properties.valueType = 1;
2527 switch (message.nullValue) {
2528 default:
2529 return "nullValue: enum value expected";
2530 case 0:
2531 break;
2532 }
2533 }
2534 if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) {
2535 if (properties.valueType === 1)
2536 return "valueType: multiple values";
2537 properties.valueType = 1;
2538 if (typeof message.booleanValue !== "boolean")
2539 return "booleanValue: boolean expected";
2540 }
2541 if (message.integerValue != null && message.hasOwnProperty("integerValue")) {
2542 if (properties.valueType === 1)
2543 return "valueType: multiple values";
2544 properties.valueType = 1;
2545 if (!$util.isInteger(message.integerValue) && !(message.integerValue && $util.isInteger(message.integerValue.low) && $util.isInteger(message.integerValue.high)))
2546 return "integerValue: integer|Long expected";
2547 }
2548 if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
2549 if (properties.valueType === 1)
2550 return "valueType: multiple values";
2551 properties.valueType = 1;
2552 if (typeof message.doubleValue !== "number")
2553 return "doubleValue: number expected";
2554 }
2555 if (message.timestampValue != null && message.hasOwnProperty("timestampValue")) {
2556 if (properties.valueType === 1)
2557 return "valueType: multiple values";
2558 properties.valueType = 1;
2559 {
2560 var error = $root.google.protobuf.Timestamp.verify(message.timestampValue);
2561 if (error)
2562 return "timestampValue." + error;
2563 }
2564 }
2565 if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2566 if (properties.valueType === 1)
2567 return "valueType: multiple values";
2568 properties.valueType = 1;
2569 if (!$util.isString(message.stringValue))
2570 return "stringValue: string expected";
2571 }
2572 if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
2573 if (properties.valueType === 1)
2574 return "valueType: multiple values";
2575 properties.valueType = 1;
2576 if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue)))
2577 return "bytesValue: buffer expected";
2578 }
2579 if (message.referenceValue != null && message.hasOwnProperty("referenceValue")) {
2580 if (properties.valueType === 1)
2581 return "valueType: multiple values";
2582 properties.valueType = 1;
2583 if (!$util.isString(message.referenceValue))
2584 return "referenceValue: string expected";
2585 }
2586 if (message.geoPointValue != null && message.hasOwnProperty("geoPointValue")) {
2587 if (properties.valueType === 1)
2588 return "valueType: multiple values";
2589 properties.valueType = 1;
2590 {
2591 var error = $root.google.type.LatLng.verify(message.geoPointValue);
2592 if (error)
2593 return "geoPointValue." + error;
2594 }
2595 }
2596 if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
2597 if (properties.valueType === 1)
2598 return "valueType: multiple values";
2599 properties.valueType = 1;
2600 {
2601 var error = $root.google.events.cloud.firestore.v1.ArrayValue.verify(message.arrayValue);
2602 if (error)
2603 return "arrayValue." + error;
2604 }
2605 }
2606 if (message.mapValue != null && message.hasOwnProperty("mapValue")) {
2607 if (properties.valueType === 1)
2608 return "valueType: multiple values";
2609 properties.valueType = 1;
2610 {
2611 var error = $root.google.events.cloud.firestore.v1.MapValue.verify(message.mapValue);
2612 if (error)
2613 return "mapValue." + error;
2614 }
2615 }
2616 return null;
2617 };
2618
2619 /**
2620 * Creates a Value message from a plain object. Also converts values to their respective internal types.
2621 * @function fromObject
2622 * @memberof google.events.cloud.firestore.v1.Value
2623 * @static
2624 * @param {Object.<string,*>} object Plain object
2625 * @returns {google.events.cloud.firestore.v1.Value} Value
2626 */
2627 Value.fromObject = function fromObject(object) {
2628 if (object instanceof $root.google.events.cloud.firestore.v1.Value)
2629 return object;
2630 var message = new $root.google.events.cloud.firestore.v1.Value();
2631 switch (object.nullValue) {
2632 default:
2633 if (typeof object.nullValue === "number") {
2634 message.nullValue = object.nullValue;
2635 break;
2636 }
2637 break;
2638 case "NULL_VALUE":
2639 case 0:
2640 message.nullValue = 0;
2641 break;
2642 }
2643 if (object.booleanValue != null)
2644 message.booleanValue = Boolean(object.booleanValue);
2645 if (object.integerValue != null)
2646 if ($util.Long)
2647 (message.integerValue = $util.Long.fromValue(object.integerValue)).unsigned = false;
2648 else if (typeof object.integerValue === "string")
2649 message.integerValue = parseInt(object.integerValue, 10);
2650 else if (typeof object.integerValue === "number")
2651 message.integerValue = object.integerValue;
2652 else if (typeof object.integerValue === "object")
2653 message.integerValue = new $util.LongBits(object.integerValue.low >>> 0, object.integerValue.high >>> 0).toNumber();
2654 if (object.doubleValue != null)
2655 message.doubleValue = Number(object.doubleValue);
2656 if (object.timestampValue != null) {
2657 if (typeof object.timestampValue !== "object")
2658 throw TypeError(".google.events.cloud.firestore.v1.Value.timestampValue: object expected");
2659 message.timestampValue = $root.google.protobuf.Timestamp.fromObject(object.timestampValue);
2660 }
2661 if (object.stringValue != null)
2662 message.stringValue = String(object.stringValue);
2663 if (object.bytesValue != null)
2664 if (typeof object.bytesValue === "string")
2665 $util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0);
2666 else if (object.bytesValue.length >= 0)
2667 message.bytesValue = object.bytesValue;
2668 if (object.referenceValue != null)
2669 message.referenceValue = String(object.referenceValue);
2670 if (object.geoPointValue != null) {
2671 if (typeof object.geoPointValue !== "object")
2672 throw TypeError(".google.events.cloud.firestore.v1.Value.geoPointValue: object expected");
2673 message.geoPointValue = $root.google.type.LatLng.fromObject(object.geoPointValue);
2674 }
2675 if (object.arrayValue != null) {
2676 if (typeof object.arrayValue !== "object")
2677 throw TypeError(".google.events.cloud.firestore.v1.Value.arrayValue: object expected");
2678 message.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.fromObject(object.arrayValue);
2679 }
2680 if (object.mapValue != null) {
2681 if (typeof object.mapValue !== "object")
2682 throw TypeError(".google.events.cloud.firestore.v1.Value.mapValue: object expected");
2683 message.mapValue = $root.google.events.cloud.firestore.v1.MapValue.fromObject(object.mapValue);
2684 }
2685 return message;
2686 };
2687
2688 /**
2689 * Creates a plain object from a Value message. Also converts values to other types if specified.
2690 * @function toObject
2691 * @memberof google.events.cloud.firestore.v1.Value
2692 * @static
2693 * @param {google.events.cloud.firestore.v1.Value} message Value
2694 * @param {$protobuf.IConversionOptions} [options] Conversion options
2695 * @returns {Object.<string,*>} Plain object
2696 */
2697 Value.toObject = function toObject(message, options) {
2698 if (!options)
2699 options = {};
2700 var object = {};
2701 if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) {
2702 object.booleanValue = message.booleanValue;
2703 if (options.oneofs)
2704 object.valueType = "booleanValue";
2705 }
2706 if (message.integerValue != null && message.hasOwnProperty("integerValue")) {
2707 if (typeof message.integerValue === "number")
2708 object.integerValue = options.longs === String ? String(message.integerValue) : message.integerValue;
2709 else
2710 object.integerValue = options.longs === String ? $util.Long.prototype.toString.call(message.integerValue) : options.longs === Number ? new $util.LongBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0).toNumber() : message.integerValue;
2711 if (options.oneofs)
2712 object.valueType = "integerValue";
2713 }
2714 if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
2715 object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue;
2716 if (options.oneofs)
2717 object.valueType = "doubleValue";
2718 }
2719 if (message.referenceValue != null && message.hasOwnProperty("referenceValue")) {
2720 object.referenceValue = message.referenceValue;
2721 if (options.oneofs)
2722 object.valueType = "referenceValue";
2723 }
2724 if (message.mapValue != null && message.hasOwnProperty("mapValue")) {
2725 object.mapValue = $root.google.events.cloud.firestore.v1.MapValue.toObject(message.mapValue, options);
2726 if (options.oneofs)
2727 object.valueType = "mapValue";
2728 }
2729 if (message.geoPointValue != null && message.hasOwnProperty("geoPointValue")) {
2730 object.geoPointValue = $root.google.type.LatLng.toObject(message.geoPointValue, options);
2731 if (options.oneofs)
2732 object.valueType = "geoPointValue";
2733 }
2734 if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
2735 object.arrayValue = $root.google.events.cloud.firestore.v1.ArrayValue.toObject(message.arrayValue, options);
2736 if (options.oneofs)
2737 object.valueType = "arrayValue";
2738 }
2739 if (message.timestampValue != null && message.hasOwnProperty("timestampValue")) {
2740 object.timestampValue = $root.google.protobuf.Timestamp.toObject(message.timestampValue, options);
2741 if (options.oneofs)
2742 object.valueType = "timestampValue";
2743 }
2744 if (message.nullValue != null && message.hasOwnProperty("nullValue")) {
2745 object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue;
2746 if (options.oneofs)
2747 object.valueType = "nullValue";
2748 }
2749 if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2750 object.stringValue = message.stringValue;
2751 if (options.oneofs)
2752 object.valueType = "stringValue";
2753 }
2754 if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
2755 object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue;
2756 if (options.oneofs)
2757 object.valueType = "bytesValue";
2758 }
2759 return object;
2760 };
2761
2762 /**
2763 * Converts this Value to JSON.
2764 * @function toJSON
2765 * @memberof google.events.cloud.firestore.v1.Value
2766 * @instance
2767 * @returns {Object.<string,*>} JSON object
2768 */
2769 Value.prototype.toJSON = function toJSON() {
2770 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2771 };
2772
2773 /**
2774 * Gets the default type url for Value
2775 * @function getTypeUrl
2776 * @memberof google.events.cloud.firestore.v1.Value
2777 * @static
2778 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2779 * @returns {string} The default type url
2780 */
2781 Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2782 if (typeUrlPrefix === undefined) {
2783 typeUrlPrefix = "type.googleapis.com";
2784 }
2785 return typeUrlPrefix + "/google.events.cloud.firestore.v1.Value";
2786 };
2787
2788 return Value;
2789 })();
2790
2791 v1.ArrayValue = (function() {
2792
2793 /**
2794 * Properties of an ArrayValue.
2795 * @memberof google.events.cloud.firestore.v1
2796 * @interface IArrayValue
2797 * @property {Array.<google.events.cloud.firestore.v1.IValue>|null} [values] ArrayValue values
2798 */
2799
2800 /**
2801 * Constructs a new ArrayValue.
2802 * @memberof google.events.cloud.firestore.v1
2803 * @classdesc Represents an ArrayValue.
2804 * @implements IArrayValue
2805 * @constructor
2806 * @param {google.events.cloud.firestore.v1.IArrayValue=} [properties] Properties to set
2807 */
2808 function ArrayValue(properties) {
2809 this.values = [];
2810 if (properties)
2811 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2812 if (properties[keys[i]] != null)
2813 this[keys[i]] = properties[keys[i]];
2814 }
2815
2816 /**
2817 * ArrayValue values.
2818 * @member {Array.<google.events.cloud.firestore.v1.IValue>} values
2819 * @memberof google.events.cloud.firestore.v1.ArrayValue
2820 * @instance
2821 */
2822 ArrayValue.prototype.values = $util.emptyArray;
2823
2824 /**
2825 * Creates a new ArrayValue instance using the specified properties.
2826 * @function create
2827 * @memberof google.events.cloud.firestore.v1.ArrayValue
2828 * @static
2829 * @param {google.events.cloud.firestore.v1.IArrayValue=} [properties] Properties to set
2830 * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue instance
2831 */
2832 ArrayValue.create = function create(properties) {
2833 return new ArrayValue(properties);
2834 };
2835
2836 /**
2837 * Encodes the specified ArrayValue message. Does not implicitly {@link google.events.cloud.firestore.v1.ArrayValue.verify|verify} messages.
2838 * @function encode
2839 * @memberof google.events.cloud.firestore.v1.ArrayValue
2840 * @static
2841 * @param {google.events.cloud.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode
2842 * @param {$protobuf.Writer} [writer] Writer to encode to
2843 * @returns {$protobuf.Writer} Writer
2844 */
2845 ArrayValue.encode = function encode(message, writer) {
2846 if (!writer)
2847 writer = $Writer.create();
2848 if (message.values != null && message.values.length)
2849 for (var i = 0; i < message.values.length; ++i)
2850 $root.google.events.cloud.firestore.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
2851 return writer;
2852 };
2853
2854 /**
2855 * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.ArrayValue.verify|verify} messages.
2856 * @function encodeDelimited
2857 * @memberof google.events.cloud.firestore.v1.ArrayValue
2858 * @static
2859 * @param {google.events.cloud.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode
2860 * @param {$protobuf.Writer} [writer] Writer to encode to
2861 * @returns {$protobuf.Writer} Writer
2862 */
2863 ArrayValue.encodeDelimited = function encodeDelimited(message, writer) {
2864 return this.encode(message, writer).ldelim();
2865 };
2866
2867 /**
2868 * Decodes an ArrayValue message from the specified reader or buffer.
2869 * @function decode
2870 * @memberof google.events.cloud.firestore.v1.ArrayValue
2871 * @static
2872 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2873 * @param {number} [length] Message length if known beforehand
2874 * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2875 * @throws {Error} If the payload is not a reader or valid buffer
2876 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2877 */
2878 ArrayValue.decode = function decode(reader, length) {
2879 if (!(reader instanceof $Reader))
2880 reader = $Reader.create(reader);
2881 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.ArrayValue();
2882 while (reader.pos < end) {
2883 var tag = reader.uint32();
2884 switch (tag >>> 3) {
2885 case 1: {
2886 if (!(message.values && message.values.length))
2887 message.values = [];
2888 message.values.push($root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32()));
2889 break;
2890 }
2891 default:
2892 reader.skipType(tag & 7);
2893 break;
2894 }
2895 }
2896 return message;
2897 };
2898
2899 /**
2900 * Decodes an ArrayValue message from the specified reader or buffer, length delimited.
2901 * @function decodeDelimited
2902 * @memberof google.events.cloud.firestore.v1.ArrayValue
2903 * @static
2904 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2905 * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2906 * @throws {Error} If the payload is not a reader or valid buffer
2907 * @throws {$protobuf.util.ProtocolError} If required fields are missing
2908 */
2909 ArrayValue.decodeDelimited = function decodeDelimited(reader) {
2910 if (!(reader instanceof $Reader))
2911 reader = new $Reader(reader);
2912 return this.decode(reader, reader.uint32());
2913 };
2914
2915 /**
2916 * Verifies an ArrayValue message.
2917 * @function verify
2918 * @memberof google.events.cloud.firestore.v1.ArrayValue
2919 * @static
2920 * @param {Object.<string,*>} message Plain object to verify
2921 * @returns {string|null} `null` if valid, otherwise the reason why it is not
2922 */
2923 ArrayValue.verify = function verify(message) {
2924 if (typeof message !== "object" || message === null)
2925 return "object expected";
2926 if (message.values != null && message.hasOwnProperty("values")) {
2927 if (!Array.isArray(message.values))
2928 return "values: array expected";
2929 for (var i = 0; i < message.values.length; ++i) {
2930 var error = $root.google.events.cloud.firestore.v1.Value.verify(message.values[i]);
2931 if (error)
2932 return "values." + error;
2933 }
2934 }
2935 return null;
2936 };
2937
2938 /**
2939 * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types.
2940 * @function fromObject
2941 * @memberof google.events.cloud.firestore.v1.ArrayValue
2942 * @static
2943 * @param {Object.<string,*>} object Plain object
2944 * @returns {google.events.cloud.firestore.v1.ArrayValue} ArrayValue
2945 */
2946 ArrayValue.fromObject = function fromObject(object) {
2947 if (object instanceof $root.google.events.cloud.firestore.v1.ArrayValue)
2948 return object;
2949 var message = new $root.google.events.cloud.firestore.v1.ArrayValue();
2950 if (object.values) {
2951 if (!Array.isArray(object.values))
2952 throw TypeError(".google.events.cloud.firestore.v1.ArrayValue.values: array expected");
2953 message.values = [];
2954 for (var i = 0; i < object.values.length; ++i) {
2955 if (typeof object.values[i] !== "object")
2956 throw TypeError(".google.events.cloud.firestore.v1.ArrayValue.values: object expected");
2957 message.values[i] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.values[i]);
2958 }
2959 }
2960 return message;
2961 };
2962
2963 /**
2964 * Creates a plain object from an ArrayValue message. Also converts values to other types if specified.
2965 * @function toObject
2966 * @memberof google.events.cloud.firestore.v1.ArrayValue
2967 * @static
2968 * @param {google.events.cloud.firestore.v1.ArrayValue} message ArrayValue
2969 * @param {$protobuf.IConversionOptions} [options] Conversion options
2970 * @returns {Object.<string,*>} Plain object
2971 */
2972 ArrayValue.toObject = function toObject(message, options) {
2973 if (!options)
2974 options = {};
2975 var object = {};
2976 if (options.arrays || options.defaults)
2977 object.values = [];
2978 if (message.values && message.values.length) {
2979 object.values = [];
2980 for (var j = 0; j < message.values.length; ++j)
2981 object.values[j] = $root.google.events.cloud.firestore.v1.Value.toObject(message.values[j], options);
2982 }
2983 return object;
2984 };
2985
2986 /**
2987 * Converts this ArrayValue to JSON.
2988 * @function toJSON
2989 * @memberof google.events.cloud.firestore.v1.ArrayValue
2990 * @instance
2991 * @returns {Object.<string,*>} JSON object
2992 */
2993 ArrayValue.prototype.toJSON = function toJSON() {
2994 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2995 };
2996
2997 /**
2998 * Gets the default type url for ArrayValue
2999 * @function getTypeUrl
3000 * @memberof google.events.cloud.firestore.v1.ArrayValue
3001 * @static
3002 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3003 * @returns {string} The default type url
3004 */
3005 ArrayValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3006 if (typeUrlPrefix === undefined) {
3007 typeUrlPrefix = "type.googleapis.com";
3008 }
3009 return typeUrlPrefix + "/google.events.cloud.firestore.v1.ArrayValue";
3010 };
3011
3012 return ArrayValue;
3013 })();
3014
3015 v1.MapValue = (function() {
3016
3017 /**
3018 * Properties of a MapValue.
3019 * @memberof google.events.cloud.firestore.v1
3020 * @interface IMapValue
3021 * @property {Object.<string,google.events.cloud.firestore.v1.IValue>|null} [fields] MapValue fields
3022 */
3023
3024 /**
3025 * Constructs a new MapValue.
3026 * @memberof google.events.cloud.firestore.v1
3027 * @classdesc Represents a MapValue.
3028 * @implements IMapValue
3029 * @constructor
3030 * @param {google.events.cloud.firestore.v1.IMapValue=} [properties] Properties to set
3031 */
3032 function MapValue(properties) {
3033 this.fields = {};
3034 if (properties)
3035 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3036 if (properties[keys[i]] != null)
3037 this[keys[i]] = properties[keys[i]];
3038 }
3039
3040 /**
3041 * MapValue fields.
3042 * @member {Object.<string,google.events.cloud.firestore.v1.IValue>} fields
3043 * @memberof google.events.cloud.firestore.v1.MapValue
3044 * @instance
3045 */
3046 MapValue.prototype.fields = $util.emptyObject;
3047
3048 /**
3049 * Creates a new MapValue instance using the specified properties.
3050 * @function create
3051 * @memberof google.events.cloud.firestore.v1.MapValue
3052 * @static
3053 * @param {google.events.cloud.firestore.v1.IMapValue=} [properties] Properties to set
3054 * @returns {google.events.cloud.firestore.v1.MapValue} MapValue instance
3055 */
3056 MapValue.create = function create(properties) {
3057 return new MapValue(properties);
3058 };
3059
3060 /**
3061 * Encodes the specified MapValue message. Does not implicitly {@link google.events.cloud.firestore.v1.MapValue.verify|verify} messages.
3062 * @function encode
3063 * @memberof google.events.cloud.firestore.v1.MapValue
3064 * @static
3065 * @param {google.events.cloud.firestore.v1.IMapValue} message MapValue message or plain object to encode
3066 * @param {$protobuf.Writer} [writer] Writer to encode to
3067 * @returns {$protobuf.Writer} Writer
3068 */
3069 MapValue.encode = function encode(message, writer) {
3070 if (!writer)
3071 writer = $Writer.create();
3072 if (message.fields != null && Object.hasOwnProperty.call(message, "fields"))
3073 for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) {
3074 writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
3075 $root.google.events.cloud.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
3076 }
3077 return writer;
3078 };
3079
3080 /**
3081 * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.events.cloud.firestore.v1.MapValue.verify|verify} messages.
3082 * @function encodeDelimited
3083 * @memberof google.events.cloud.firestore.v1.MapValue
3084 * @static
3085 * @param {google.events.cloud.firestore.v1.IMapValue} message MapValue message or plain object to encode
3086 * @param {$protobuf.Writer} [writer] Writer to encode to
3087 * @returns {$protobuf.Writer} Writer
3088 */
3089 MapValue.encodeDelimited = function encodeDelimited(message, writer) {
3090 return this.encode(message, writer).ldelim();
3091 };
3092
3093 /**
3094 * Decodes a MapValue message from the specified reader or buffer.
3095 * @function decode
3096 * @memberof google.events.cloud.firestore.v1.MapValue
3097 * @static
3098 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3099 * @param {number} [length] Message length if known beforehand
3100 * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3101 * @throws {Error} If the payload is not a reader or valid buffer
3102 * @throws {$protobuf.util.ProtocolError} If required fields are missing
3103 */
3104 MapValue.decode = function decode(reader, length) {
3105 if (!(reader instanceof $Reader))
3106 reader = $Reader.create(reader);
3107 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.events.cloud.firestore.v1.MapValue(), key, value;
3108 while (reader.pos < end) {
3109 var tag = reader.uint32();
3110 switch (tag >>> 3) {
3111 case 1: {
3112 if (message.fields === $util.emptyObject)
3113 message.fields = {};
3114 var end2 = reader.uint32() + reader.pos;
3115 key = "";
3116 value = null;
3117 while (reader.pos < end2) {
3118 var tag2 = reader.uint32();
3119 switch (tag2 >>> 3) {
3120 case 1:
3121 key = reader.string();
3122 break;
3123 case 2:
3124 value = $root.google.events.cloud.firestore.v1.Value.decode(reader, reader.uint32());
3125 break;
3126 default:
3127 reader.skipType(tag2 & 7);
3128 break;
3129 }
3130 }
3131 message.fields[key] = value;
3132 break;
3133 }
3134 default:
3135 reader.skipType(tag & 7);
3136 break;
3137 }
3138 }
3139 return message;
3140 };
3141
3142 /**
3143 * Decodes a MapValue message from the specified reader or buffer, length delimited.
3144 * @function decodeDelimited
3145 * @memberof google.events.cloud.firestore.v1.MapValue
3146 * @static
3147 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3148 * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3149 * @throws {Error} If the payload is not a reader or valid buffer
3150 * @throws {$protobuf.util.ProtocolError} If required fields are missing
3151 */
3152 MapValue.decodeDelimited = function decodeDelimited(reader) {
3153 if (!(reader instanceof $Reader))
3154 reader = new $Reader(reader);
3155 return this.decode(reader, reader.uint32());
3156 };
3157
3158 /**
3159 * Verifies a MapValue message.
3160 * @function verify
3161 * @memberof google.events.cloud.firestore.v1.MapValue
3162 * @static
3163 * @param {Object.<string,*>} message Plain object to verify
3164 * @returns {string|null} `null` if valid, otherwise the reason why it is not
3165 */
3166 MapValue.verify = function verify(message) {
3167 if (typeof message !== "object" || message === null)
3168 return "object expected";
3169 if (message.fields != null && message.hasOwnProperty("fields")) {
3170 if (!$util.isObject(message.fields))
3171 return "fields: object expected";
3172 var key = Object.keys(message.fields);
3173 for (var i = 0; i < key.length; ++i) {
3174 var error = $root.google.events.cloud.firestore.v1.Value.verify(message.fields[key[i]]);
3175 if (error)
3176 return "fields." + error;
3177 }
3178 }
3179 return null;
3180 };
3181
3182 /**
3183 * Creates a MapValue message from a plain object. Also converts values to their respective internal types.
3184 * @function fromObject
3185 * @memberof google.events.cloud.firestore.v1.MapValue
3186 * @static
3187 * @param {Object.<string,*>} object Plain object
3188 * @returns {google.events.cloud.firestore.v1.MapValue} MapValue
3189 */
3190 MapValue.fromObject = function fromObject(object) {
3191 if (object instanceof $root.google.events.cloud.firestore.v1.MapValue)
3192 return object;
3193 var message = new $root.google.events.cloud.firestore.v1.MapValue();
3194 if (object.fields) {
3195 if (typeof object.fields !== "object")
3196 throw TypeError(".google.events.cloud.firestore.v1.MapValue.fields: object expected");
3197 message.fields = {};
3198 for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) {
3199 if (typeof object.fields[keys[i]] !== "object")
3200 throw TypeError(".google.events.cloud.firestore.v1.MapValue.fields: object expected");
3201 message.fields[keys[i]] = $root.google.events.cloud.firestore.v1.Value.fromObject(object.fields[keys[i]]);
3202 }
3203 }
3204 return message;
3205 };
3206
3207 /**
3208 * Creates a plain object from a MapValue message. Also converts values to other types if specified.
3209 * @function toObject
3210 * @memberof google.events.cloud.firestore.v1.MapValue
3211 * @static
3212 * @param {google.events.cloud.firestore.v1.MapValue} message MapValue
3213 * @param {$protobuf.IConversionOptions} [options] Conversion options
3214 * @returns {Object.<string,*>} Plain object
3215 */
3216 MapValue.toObject = function toObject(message, options) {
3217 if (!options)
3218 options = {};
3219 var object = {};
3220 if (options.objects || options.defaults)
3221 object.fields = {};
3222 var keys2;
3223 if (message.fields && (keys2 = Object.keys(message.fields)).length) {
3224 object.fields = {};
3225 for (var j = 0; j < keys2.length; ++j)
3226 object.fields[keys2[j]] = $root.google.events.cloud.firestore.v1.Value.toObject(message.fields[keys2[j]], options);
3227 }
3228 return object;
3229 };
3230
3231 /**
3232 * Converts this MapValue to JSON.
3233 * @function toJSON
3234 * @memberof google.events.cloud.firestore.v1.MapValue
3235 * @instance
3236 * @returns {Object.<string,*>} JSON object
3237 */
3238 MapValue.prototype.toJSON = function toJSON() {
3239 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3240 };
3241
3242 /**
3243 * Gets the default type url for MapValue
3244 * @function getTypeUrl
3245 * @memberof google.events.cloud.firestore.v1.MapValue
3246 * @static
3247 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3248 * @returns {string} The default type url
3249 */
3250 MapValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3251 if (typeUrlPrefix === undefined) {
3252 typeUrlPrefix = "type.googleapis.com";
3253 }
3254 return typeUrlPrefix + "/google.events.cloud.firestore.v1.MapValue";
3255 };
3256
3257 return MapValue;
3258 })();
3259
3260 return v1;
3261 })();
3262
3263 return firestore;
3264 })();
3265
3266 return cloud;
3267 })();
3268
3269 return events;
3270 })();
3271
3272 google.type = (function() {
3273
3274 /**
3275 * Namespace type.
3276 * @memberof google
3277 * @namespace
3278 */
3279 var type = {};
3280
3281 type.LatLng = (function() {
3282
3283 /**
3284 * Properties of a LatLng.
3285 * @memberof google.type
3286 * @interface ILatLng
3287 * @property {number|null} [latitude] LatLng latitude
3288 * @property {number|null} [longitude] LatLng longitude
3289 */
3290
3291 /**
3292 * Constructs a new LatLng.
3293 * @memberof google.type
3294 * @classdesc Represents a LatLng.
3295 * @implements ILatLng
3296 * @constructor
3297 * @param {google.type.ILatLng=} [properties] Properties to set
3298 */
3299 function LatLng(properties) {
3300 if (properties)
3301 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3302 if (properties[keys[i]] != null)
3303 this[keys[i]] = properties[keys[i]];
3304 }
3305
3306 /**
3307 * LatLng latitude.
3308 * @member {number} latitude
3309 * @memberof google.type.LatLng
3310 * @instance
3311 */
3312 LatLng.prototype.latitude = 0;
3313
3314 /**
3315 * LatLng longitude.
3316 * @member {number} longitude
3317 * @memberof google.type.LatLng
3318 * @instance
3319 */
3320 LatLng.prototype.longitude = 0;
3321
3322 /**
3323 * Creates a new LatLng instance using the specified properties.
3324 * @function create
3325 * @memberof google.type.LatLng
3326 * @static
3327 * @param {google.type.ILatLng=} [properties] Properties to set
3328 * @returns {google.type.LatLng} LatLng instance
3329 */
3330 LatLng.create = function create(properties) {
3331 return new LatLng(properties);
3332 };
3333
3334 /**
3335 * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages.
3336 * @function encode
3337 * @memberof google.type.LatLng
3338 * @static
3339 * @param {google.type.ILatLng} message LatLng message or plain object to encode
3340 * @param {$protobuf.Writer} [writer] Writer to encode to
3341 * @returns {$protobuf.Writer} Writer
3342 */
3343 LatLng.encode = function encode(message, writer) {
3344 if (!writer)
3345 writer = $Writer.create();
3346 if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude"))
3347 writer.uint32(/* id 1, wireType 1 =*/9).double(message.latitude);
3348 if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude"))
3349 writer.uint32(/* id 2, wireType 1 =*/17).double(message.longitude);
3350 return writer;
3351 };
3352
3353 /**
3354 * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages.
3355 * @function encodeDelimited
3356 * @memberof google.type.LatLng
3357 * @static
3358 * @param {google.type.ILatLng} message LatLng message or plain object to encode
3359 * @param {$protobuf.Writer} [writer] Writer to encode to
3360 * @returns {$protobuf.Writer} Writer
3361 */
3362 LatLng.encodeDelimited = function encodeDelimited(message, writer) {
3363 return this.encode(message, writer).ldelim();
3364 };
3365
3366 /**
3367 * Decodes a LatLng message from the specified reader or buffer.
3368 * @function decode
3369 * @memberof google.type.LatLng
3370 * @static
3371 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3372 * @param {number} [length] Message length if known beforehand
3373 * @returns {google.type.LatLng} LatLng
3374 * @throws {Error} If the payload is not a reader or valid buffer
3375 * @throws {$protobuf.util.ProtocolError} If required fields are missing
3376 */
3377 LatLng.decode = function decode(reader, length) {
3378 if (!(reader instanceof $Reader))
3379 reader = $Reader.create(reader);
3380 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.LatLng();
3381 while (reader.pos < end) {
3382 var tag = reader.uint32();
3383 switch (tag >>> 3) {
3384 case 1: {
3385 message.latitude = reader.double();
3386 break;
3387 }
3388 case 2: {
3389 message.longitude = reader.double();
3390 break;
3391 }
3392 default:
3393 reader.skipType(tag & 7);
3394 break;
3395 }
3396 }
3397 return message;
3398 };
3399
3400 /**
3401 * Decodes a LatLng message from the specified reader or buffer, length delimited.
3402 * @function decodeDelimited
3403 * @memberof google.type.LatLng
3404 * @static
3405 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3406 * @returns {google.type.LatLng} LatLng
3407 * @throws {Error} If the payload is not a reader or valid buffer
3408 * @throws {$protobuf.util.ProtocolError} If required fields are missing
3409 */
3410 LatLng.decodeDelimited = function decodeDelimited(reader) {
3411 if (!(reader instanceof $Reader))
3412 reader = new $Reader(reader);
3413 return this.decode(reader, reader.uint32());
3414 };
3415
3416 /**
3417 * Verifies a LatLng message.
3418 * @function verify
3419 * @memberof google.type.LatLng
3420 * @static
3421 * @param {Object.<string,*>} message Plain object to verify
3422 * @returns {string|null} `null` if valid, otherwise the reason why it is not
3423 */
3424 LatLng.verify = function verify(message) {
3425 if (typeof message !== "object" || message === null)
3426 return "object expected";
3427 if (message.latitude != null && message.hasOwnProperty("latitude"))
3428 if (typeof message.latitude !== "number")
3429 return "latitude: number expected";
3430 if (message.longitude != null && message.hasOwnProperty("longitude"))
3431 if (typeof message.longitude !== "number")
3432 return "longitude: number expected";
3433 return null;
3434 };
3435
3436 /**
3437 * Creates a LatLng message from a plain object. Also converts values to their respective internal types.
3438 * @function fromObject
3439 * @memberof google.type.LatLng
3440 * @static
3441 * @param {Object.<string,*>} object Plain object
3442 * @returns {google.type.LatLng} LatLng
3443 */
3444 LatLng.fromObject = function fromObject(object) {
3445 if (object instanceof $root.google.type.LatLng)
3446 return object;
3447 var message = new $root.google.type.LatLng();
3448 if (object.latitude != null)
3449 message.latitude = Number(object.latitude);
3450 if (object.longitude != null)
3451 message.longitude = Number(object.longitude);
3452 return message;
3453 };
3454
3455 /**
3456 * Creates a plain object from a LatLng message. Also converts values to other types if specified.
3457 * @function toObject
3458 * @memberof google.type.LatLng
3459 * @static
3460 * @param {google.type.LatLng} message LatLng
3461 * @param {$protobuf.IConversionOptions} [options] Conversion options
3462 * @returns {Object.<string,*>} Plain object
3463 */
3464 LatLng.toObject = function toObject(message, options) {
3465 if (!options)
3466 options = {};
3467 var object = {};
3468 if (options.defaults) {
3469 object.latitude = 0;
3470 object.longitude = 0;
3471 }
3472 if (message.latitude != null && message.hasOwnProperty("latitude"))
3473 object.latitude = options.json && !isFinite(message.latitude) ? String(message.latitude) : message.latitude;
3474 if (message.longitude != null && message.hasOwnProperty("longitude"))
3475 object.longitude = options.json && !isFinite(message.longitude) ? String(message.longitude) : message.longitude;
3476 return object;
3477 };
3478
3479 /**
3480 * Converts this LatLng to JSON.
3481 * @function toJSON
3482 * @memberof google.type.LatLng
3483 * @instance
3484 * @returns {Object.<string,*>} JSON object
3485 */
3486 LatLng.prototype.toJSON = function toJSON() {
3487 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3488 };
3489
3490 /**
3491 * Gets the default type url for LatLng
3492 * @function getTypeUrl
3493 * @memberof google.type.LatLng
3494 * @static
3495 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3496 * @returns {string} The default type url
3497 */
3498 LatLng.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3499 if (typeUrlPrefix === undefined) {
3500 typeUrlPrefix = "type.googleapis.com";
3501 }
3502 return typeUrlPrefix + "/google.type.LatLng";
3503 };
3504
3505 return LatLng;
3506 })();
3507
3508 return type;
3509 })();
3510
3511 return google;
3512})();
3513
3514module.exports = $root;