UNPKG

83.4 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; var $Writer = $protobuf.Writer; var $util = $protobuf.util
8
9// Exported root namespace
10var $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {})
11
12$root.logproto = (function () {
13 /**
14 * Namespace logproto.
15 * @exports logproto
16 * @namespace
17 */
18 var logproto = {}
19
20 logproto.Pusher = (function () {
21 /**
22 * Constructs a new Pusher service.
23 * @memberof logproto
24 * @classdesc Represents a Pusher
25 * @extends $protobuf.rpc.Service
26 * @constructor
27 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation
28 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
29 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
30 */
31 function Pusher (rpcImpl, requestDelimited, responseDelimited) {
32 $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited)
33 }
34
35 (Pusher.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Pusher
36
37 /**
38 * Creates new Pusher service using the specified rpc implementation.
39 * @function create
40 * @memberof logproto.Pusher
41 * @static
42 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation
43 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
44 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
45 * @returns {Pusher} RPC service. Useful where requests and/or responses are streamed.
46 */
47 Pusher.create = function create (rpcImpl, requestDelimited, responseDelimited) {
48 return new this(rpcImpl, requestDelimited, responseDelimited)
49 }
50
51 /**
52 * Callback as used by {@link logproto.Pusher#push}.
53 * @memberof logproto.Pusher
54 * @typedef PushCallback
55 * @type {function}
56 * @param {Error|null} error Error, if any
57 * @param {logproto.PushResponse} [response] PushResponse
58 */
59
60 /**
61 * Calls Push.
62 * @function push
63 * @memberof logproto.Pusher
64 * @instance
65 * @param {logproto.IPushRequest} request PushRequest message or plain object
66 * @param {logproto.Pusher.PushCallback} callback Node-style callback called with the error, if any, and PushResponse
67 * @returns {undefined}
68 * @variation 1
69 */
70 Object.defineProperty(Pusher.prototype.push = function push (request, callback) {
71 return this.rpcCall(push, $root.logproto.PushRequest, $root.logproto.PushResponse, request, callback)
72 }, 'name', { value: 'Push' })
73
74 /**
75 * Calls Push.
76 * @function push
77 * @memberof logproto.Pusher
78 * @instance
79 * @param {logproto.IPushRequest} request PushRequest message or plain object
80 * @returns {Promise<logproto.PushResponse>} Promise
81 * @variation 2
82 */
83
84 return Pusher
85 })()
86
87 logproto.Querier = (function () {
88 /**
89 * Constructs a new Querier service.
90 * @memberof logproto
91 * @classdesc Represents a Querier
92 * @extends $protobuf.rpc.Service
93 * @constructor
94 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation
95 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
96 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
97 */
98 function Querier (rpcImpl, requestDelimited, responseDelimited) {
99 $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited)
100 }
101
102 (Querier.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Querier
103
104 /**
105 * Creates new Querier service using the specified rpc implementation.
106 * @function create
107 * @memberof logproto.Querier
108 * @static
109 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation
110 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
111 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
112 * @returns {Querier} RPC service. Useful where requests and/or responses are streamed.
113 */
114 Querier.create = function create (rpcImpl, requestDelimited, responseDelimited) {
115 return new this(rpcImpl, requestDelimited, responseDelimited)
116 }
117
118 /**
119 * Callback as used by {@link logproto.Querier#query}.
120 * @memberof logproto.Querier
121 * @typedef QueryCallback
122 * @type {function}
123 * @param {Error|null} error Error, if any
124 * @param {logproto.QueryResponse} [response] QueryResponse
125 */
126
127 /**
128 * Calls Query.
129 * @function query
130 * @memberof logproto.Querier
131 * @instance
132 * @param {logproto.IQueryRequest} request QueryRequest message or plain object
133 * @param {logproto.Querier.QueryCallback} callback Node-style callback called with the error, if any, and QueryResponse
134 * @returns {undefined}
135 * @variation 1
136 */
137 Object.defineProperty(Querier.prototype.query = function query (request, callback) {
138 return this.rpcCall(query, $root.logproto.QueryRequest, $root.logproto.QueryResponse, request, callback)
139 }, 'name', { value: 'Query' })
140
141 /**
142 * Calls Query.
143 * @function query
144 * @memberof logproto.Querier
145 * @instance
146 * @param {logproto.IQueryRequest} request QueryRequest message or plain object
147 * @returns {Promise<logproto.QueryResponse>} Promise
148 * @variation 2
149 */
150
151 /**
152 * Callback as used by {@link logproto.Querier#label}.
153 * @memberof logproto.Querier
154 * @typedef LabelCallback
155 * @type {function}
156 * @param {Error|null} error Error, if any
157 * @param {logproto.LabelResponse} [response] LabelResponse
158 */
159
160 /**
161 * Calls Label.
162 * @function label
163 * @memberof logproto.Querier
164 * @instance
165 * @param {logproto.ILabelRequest} request LabelRequest message or plain object
166 * @param {logproto.Querier.LabelCallback} callback Node-style callback called with the error, if any, and LabelResponse
167 * @returns {undefined}
168 * @variation 1
169 */
170 Object.defineProperty(Querier.prototype.label = function label (request, callback) {
171 return this.rpcCall(label, $root.logproto.LabelRequest, $root.logproto.LabelResponse, request, callback)
172 }, 'name', { value: 'Label' })
173
174 /**
175 * Calls Label.
176 * @function label
177 * @memberof logproto.Querier
178 * @instance
179 * @param {logproto.ILabelRequest} request LabelRequest message or plain object
180 * @returns {Promise<logproto.LabelResponse>} Promise
181 * @variation 2
182 */
183
184 return Querier
185 })()
186
187 logproto.PushRequest = (function () {
188 /**
189 * Properties of a PushRequest.
190 * @memberof logproto
191 * @interface IPushRequest
192 * @property {Array.<logproto.IStream>|null} [streams] PushRequest streams
193 */
194
195 /**
196 * Constructs a new PushRequest.
197 * @memberof logproto
198 * @classdesc Represents a PushRequest.
199 * @implements IPushRequest
200 * @constructor
201 * @param {logproto.IPushRequest=} [properties] Properties to set
202 */
203 function PushRequest (properties) {
204 this.streams = []
205 if (properties) {
206 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
207 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
208 }
209 }
210 }
211
212 /**
213 * PushRequest streams.
214 * @member {Array.<logproto.IStream>} streams
215 * @memberof logproto.PushRequest
216 * @instance
217 */
218 PushRequest.prototype.streams = $util.emptyArray
219
220 /**
221 * Creates a new PushRequest instance using the specified properties.
222 * @function create
223 * @memberof logproto.PushRequest
224 * @static
225 * @param {logproto.IPushRequest=} [properties] Properties to set
226 * @returns {logproto.PushRequest} PushRequest instance
227 */
228 PushRequest.create = function create (properties) {
229 return new PushRequest(properties)
230 }
231
232 /**
233 * Encodes the specified PushRequest message. Does not implicitly {@link logproto.PushRequest.verify|verify} messages.
234 * @function encode
235 * @memberof logproto.PushRequest
236 * @static
237 * @param {logproto.IPushRequest} message PushRequest message or plain object to encode
238 * @param {$protobuf.Writer} [writer] Writer to encode to
239 * @returns {$protobuf.Writer} Writer
240 */
241 PushRequest.encode = function encode (message, writer) {
242 if (!writer) { writer = $Writer.create() }
243 if (message.streams != null && message.streams.length) {
244 for (var i = 0; i < message.streams.length; ++i) { $root.logproto.Stream.encode(message.streams[i], writer.uint32(/* id 1, wireType 2 = */10).fork()).ldelim() }
245 }
246 return writer
247 }
248
249 /**
250 * Encodes the specified PushRequest message, length delimited. Does not implicitly {@link logproto.PushRequest.verify|verify} messages.
251 * @function encodeDelimited
252 * @memberof logproto.PushRequest
253 * @static
254 * @param {logproto.IPushRequest} message PushRequest message or plain object to encode
255 * @param {$protobuf.Writer} [writer] Writer to encode to
256 * @returns {$protobuf.Writer} Writer
257 */
258 PushRequest.encodeDelimited = function encodeDelimited (message, writer) {
259 return this.encode(message, writer).ldelim()
260 }
261
262 /**
263 * Decodes a PushRequest message from the specified reader or buffer.
264 * @function decode
265 * @memberof logproto.PushRequest
266 * @static
267 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
268 * @param {number} [length] Message length if known beforehand
269 * @returns {logproto.PushRequest} PushRequest
270 * @throws {Error} If the payload is not a reader or valid buffer
271 * @throws {$protobuf.util.ProtocolError} If required fields are missing
272 */
273 PushRequest.decode = function decode (reader, length) {
274 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
275 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.PushRequest()
276 while (reader.pos < end) {
277 var tag = reader.uint32()
278 switch (tag >>> 3) {
279 case 1:
280 if (!(message.streams && message.streams.length)) { message.streams = [] }
281 message.streams.push($root.logproto.Stream.decode(reader, reader.uint32()))
282 break
283 default:
284 reader.skipType(tag & 7)
285 break
286 }
287 }
288 return message
289 }
290
291 /**
292 * Decodes a PushRequest message from the specified reader or buffer, length delimited.
293 * @function decodeDelimited
294 * @memberof logproto.PushRequest
295 * @static
296 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
297 * @returns {logproto.PushRequest} PushRequest
298 * @throws {Error} If the payload is not a reader or valid buffer
299 * @throws {$protobuf.util.ProtocolError} If required fields are missing
300 */
301 PushRequest.decodeDelimited = function decodeDelimited (reader) {
302 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
303 return this.decode(reader, reader.uint32())
304 }
305
306 /**
307 * Verifies a PushRequest message.
308 * @function verify
309 * @memberof logproto.PushRequest
310 * @static
311 * @param {Object.<string,*>} message Plain object to verify
312 * @returns {string|null} `null` if valid, otherwise the reason why it is not
313 */
314 PushRequest.verify = function verify (message) {
315 if (typeof message !== 'object' || message === null) { return 'object expected' }
316 if (message.streams != null && message.hasOwnProperty('streams')) {
317 if (!Array.isArray(message.streams)) { return 'streams: array expected' }
318 for (var i = 0; i < message.streams.length; ++i) {
319 var error = $root.logproto.Stream.verify(message.streams[i])
320 if (error) { return 'streams.' + error }
321 }
322 }
323 return null
324 }
325
326 /**
327 * Creates a PushRequest message from a plain object. Also converts values to their respective internal types.
328 * @function fromObject
329 * @memberof logproto.PushRequest
330 * @static
331 * @param {Object.<string,*>} object Plain object
332 * @returns {logproto.PushRequest} PushRequest
333 */
334 PushRequest.fromObject = function fromObject (object) {
335 if (object instanceof $root.logproto.PushRequest) { return object }
336 var message = new $root.logproto.PushRequest()
337 if (object.streams) {
338 if (!Array.isArray(object.streams)) { throw TypeError('.logproto.PushRequest.streams: array expected') }
339 message.streams = []
340 for (var i = 0; i < object.streams.length; ++i) {
341 if (typeof object.streams[i] !== 'object') { throw TypeError('.logproto.PushRequest.streams: object expected') }
342 message.streams[i] = $root.logproto.Stream.fromObject(object.streams[i])
343 }
344 }
345 return message
346 }
347
348 /**
349 * Creates a plain object from a PushRequest message. Also converts values to other types if specified.
350 * @function toObject
351 * @memberof logproto.PushRequest
352 * @static
353 * @param {logproto.PushRequest} message PushRequest
354 * @param {$protobuf.IConversionOptions} [options] Conversion options
355 * @returns {Object.<string,*>} Plain object
356 */
357 PushRequest.toObject = function toObject (message, options) {
358 if (!options) { options = {} }
359 var object = {}
360 if (options.arrays || options.defaults) { object.streams = [] }
361 if (message.streams && message.streams.length) {
362 object.streams = []
363 for (var j = 0; j < message.streams.length; ++j) { object.streams[j] = $root.logproto.Stream.toObject(message.streams[j], options) }
364 }
365 return object
366 }
367
368 /**
369 * Converts this PushRequest to JSON.
370 * @function toJSON
371 * @memberof logproto.PushRequest
372 * @instance
373 * @returns {Object.<string,*>} JSON object
374 */
375 PushRequest.prototype.toJSON = function toJSON () {
376 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
377 }
378
379 return PushRequest
380 })()
381
382 logproto.PushResponse = (function () {
383 /**
384 * Properties of a PushResponse.
385 * @memberof logproto
386 * @interface IPushResponse
387 */
388
389 /**
390 * Constructs a new PushResponse.
391 * @memberof logproto
392 * @classdesc Represents a PushResponse.
393 * @implements IPushResponse
394 * @constructor
395 * @param {logproto.IPushResponse=} [properties] Properties to set
396 */
397 function PushResponse (properties) {
398 if (properties) {
399 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
400 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
401 }
402 }
403 }
404
405 /**
406 * Creates a new PushResponse instance using the specified properties.
407 * @function create
408 * @memberof logproto.PushResponse
409 * @static
410 * @param {logproto.IPushResponse=} [properties] Properties to set
411 * @returns {logproto.PushResponse} PushResponse instance
412 */
413 PushResponse.create = function create (properties) {
414 return new PushResponse(properties)
415 }
416
417 /**
418 * Encodes the specified PushResponse message. Does not implicitly {@link logproto.PushResponse.verify|verify} messages.
419 * @function encode
420 * @memberof logproto.PushResponse
421 * @static
422 * @param {logproto.IPushResponse} message PushResponse message or plain object to encode
423 * @param {$protobuf.Writer} [writer] Writer to encode to
424 * @returns {$protobuf.Writer} Writer
425 */
426 PushResponse.encode = function encode (message, writer) {
427 if (!writer) { writer = $Writer.create() }
428 return writer
429 }
430
431 /**
432 * Encodes the specified PushResponse message, length delimited. Does not implicitly {@link logproto.PushResponse.verify|verify} messages.
433 * @function encodeDelimited
434 * @memberof logproto.PushResponse
435 * @static
436 * @param {logproto.IPushResponse} message PushResponse message or plain object to encode
437 * @param {$protobuf.Writer} [writer] Writer to encode to
438 * @returns {$protobuf.Writer} Writer
439 */
440 PushResponse.encodeDelimited = function encodeDelimited (message, writer) {
441 return this.encode(message, writer).ldelim()
442 }
443
444 /**
445 * Decodes a PushResponse message from the specified reader or buffer.
446 * @function decode
447 * @memberof logproto.PushResponse
448 * @static
449 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
450 * @param {number} [length] Message length if known beforehand
451 * @returns {logproto.PushResponse} PushResponse
452 * @throws {Error} If the payload is not a reader or valid buffer
453 * @throws {$protobuf.util.ProtocolError} If required fields are missing
454 */
455 PushResponse.decode = function decode (reader, length) {
456 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
457 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.PushResponse()
458 while (reader.pos < end) {
459 var tag = reader.uint32()
460 switch (tag >>> 3) {
461 default:
462 reader.skipType(tag & 7)
463 break
464 }
465 }
466 return message
467 }
468
469 /**
470 * Decodes a PushResponse message from the specified reader or buffer, length delimited.
471 * @function decodeDelimited
472 * @memberof logproto.PushResponse
473 * @static
474 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
475 * @returns {logproto.PushResponse} PushResponse
476 * @throws {Error} If the payload is not a reader or valid buffer
477 * @throws {$protobuf.util.ProtocolError} If required fields are missing
478 */
479 PushResponse.decodeDelimited = function decodeDelimited (reader) {
480 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
481 return this.decode(reader, reader.uint32())
482 }
483
484 /**
485 * Verifies a PushResponse message.
486 * @function verify
487 * @memberof logproto.PushResponse
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 PushResponse.verify = function verify (message) {
493 if (typeof message !== 'object' || message === null) { return 'object expected' }
494 return null
495 }
496
497 /**
498 * Creates a PushResponse message from a plain object. Also converts values to their respective internal types.
499 * @function fromObject
500 * @memberof logproto.PushResponse
501 * @static
502 * @param {Object.<string,*>} object Plain object
503 * @returns {logproto.PushResponse} PushResponse
504 */
505 PushResponse.fromObject = function fromObject (object) {
506 if (object instanceof $root.logproto.PushResponse) { return object }
507 return new $root.logproto.PushResponse()
508 }
509
510 /**
511 * Creates a plain object from a PushResponse message. Also converts values to other types if specified.
512 * @function toObject
513 * @memberof logproto.PushResponse
514 * @static
515 * @param {logproto.PushResponse} message PushResponse
516 * @param {$protobuf.IConversionOptions} [options] Conversion options
517 * @returns {Object.<string,*>} Plain object
518 */
519 PushResponse.toObject = function toObject () {
520 return {}
521 }
522
523 /**
524 * Converts this PushResponse to JSON.
525 * @function toJSON
526 * @memberof logproto.PushResponse
527 * @instance
528 * @returns {Object.<string,*>} JSON object
529 */
530 PushResponse.prototype.toJSON = function toJSON () {
531 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
532 }
533
534 return PushResponse
535 })()
536
537 logproto.QueryRequest = (function () {
538 /**
539 * Properties of a QueryRequest.
540 * @memberof logproto
541 * @interface IQueryRequest
542 * @property {string|null} [query] QueryRequest query
543 * @property {number|null} [limit] QueryRequest limit
544 * @property {google.protobuf.ITimestamp|null} [start] QueryRequest start
545 * @property {google.protobuf.ITimestamp|null} [end] QueryRequest end
546 * @property {logproto.Direction|null} [direction] QueryRequest direction
547 * @property {string|null} [regex] QueryRequest regex
548 */
549
550 /**
551 * Constructs a new QueryRequest.
552 * @memberof logproto
553 * @classdesc Represents a QueryRequest.
554 * @implements IQueryRequest
555 * @constructor
556 * @param {logproto.IQueryRequest=} [properties] Properties to set
557 */
558 function QueryRequest (properties) {
559 if (properties) {
560 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
561 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
562 }
563 }
564 }
565
566 /**
567 * QueryRequest query.
568 * @member {string} query
569 * @memberof logproto.QueryRequest
570 * @instance
571 */
572 QueryRequest.prototype.query = ''
573
574 /**
575 * QueryRequest limit.
576 * @member {number} limit
577 * @memberof logproto.QueryRequest
578 * @instance
579 */
580 QueryRequest.prototype.limit = 0
581
582 /**
583 * QueryRequest start.
584 * @member {google.protobuf.ITimestamp|null|undefined} start
585 * @memberof logproto.QueryRequest
586 * @instance
587 */
588 QueryRequest.prototype.start = null
589
590 /**
591 * QueryRequest end.
592 * @member {google.protobuf.ITimestamp|null|undefined} end
593 * @memberof logproto.QueryRequest
594 * @instance
595 */
596 QueryRequest.prototype.end = null
597
598 /**
599 * QueryRequest direction.
600 * @member {logproto.Direction} direction
601 * @memberof logproto.QueryRequest
602 * @instance
603 */
604 QueryRequest.prototype.direction = 0
605
606 /**
607 * QueryRequest regex.
608 * @member {string} regex
609 * @memberof logproto.QueryRequest
610 * @instance
611 */
612 QueryRequest.prototype.regex = ''
613
614 /**
615 * Creates a new QueryRequest instance using the specified properties.
616 * @function create
617 * @memberof logproto.QueryRequest
618 * @static
619 * @param {logproto.IQueryRequest=} [properties] Properties to set
620 * @returns {logproto.QueryRequest} QueryRequest instance
621 */
622 QueryRequest.create = function create (properties) {
623 return new QueryRequest(properties)
624 }
625
626 /**
627 * Encodes the specified QueryRequest message. Does not implicitly {@link logproto.QueryRequest.verify|verify} messages.
628 * @function encode
629 * @memberof logproto.QueryRequest
630 * @static
631 * @param {logproto.IQueryRequest} message QueryRequest message or plain object to encode
632 * @param {$protobuf.Writer} [writer] Writer to encode to
633 * @returns {$protobuf.Writer} Writer
634 */
635 QueryRequest.encode = function encode (message, writer) {
636 if (!writer) { writer = $Writer.create() }
637 if (message.query != null && message.hasOwnProperty('query')) { writer.uint32(/* id 1, wireType 2 = */10).string(message.query) }
638 if (message.limit != null && message.hasOwnProperty('limit')) { writer.uint32(/* id 2, wireType 0 = */16).uint32(message.limit) }
639 if (message.start != null && message.hasOwnProperty('start')) { $root.google.protobuf.Timestamp.encode(message.start, writer.uint32(/* id 3, wireType 2 = */26).fork()).ldelim() }
640 if (message.end != null && message.hasOwnProperty('end')) { $root.google.protobuf.Timestamp.encode(message.end, writer.uint32(/* id 4, wireType 2 = */34).fork()).ldelim() }
641 if (message.direction != null && message.hasOwnProperty('direction')) { writer.uint32(/* id 5, wireType 0 = */40).int32(message.direction) }
642 if (message.regex != null && message.hasOwnProperty('regex')) { writer.uint32(/* id 6, wireType 2 = */50).string(message.regex) }
643 return writer
644 }
645
646 /**
647 * Encodes the specified QueryRequest message, length delimited. Does not implicitly {@link logproto.QueryRequest.verify|verify} messages.
648 * @function encodeDelimited
649 * @memberof logproto.QueryRequest
650 * @static
651 * @param {logproto.IQueryRequest} message QueryRequest message or plain object to encode
652 * @param {$protobuf.Writer} [writer] Writer to encode to
653 * @returns {$protobuf.Writer} Writer
654 */
655 QueryRequest.encodeDelimited = function encodeDelimited (message, writer) {
656 return this.encode(message, writer).ldelim()
657 }
658
659 /**
660 * Decodes a QueryRequest message from the specified reader or buffer.
661 * @function decode
662 * @memberof logproto.QueryRequest
663 * @static
664 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
665 * @param {number} [length] Message length if known beforehand
666 * @returns {logproto.QueryRequest} QueryRequest
667 * @throws {Error} If the payload is not a reader or valid buffer
668 * @throws {$protobuf.util.ProtocolError} If required fields are missing
669 */
670 QueryRequest.decode = function decode (reader, length) {
671 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
672 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.QueryRequest()
673 while (reader.pos < end) {
674 var tag = reader.uint32()
675 switch (tag >>> 3) {
676 case 1:
677 message.query = reader.string()
678 break
679 case 2:
680 message.limit = reader.uint32()
681 break
682 case 3:
683 message.start = $root.google.protobuf.Timestamp.decode(reader, reader.uint32())
684 break
685 case 4:
686 message.end = $root.google.protobuf.Timestamp.decode(reader, reader.uint32())
687 break
688 case 5:
689 message.direction = reader.int32()
690 break
691 case 6:
692 message.regex = reader.string()
693 break
694 default:
695 reader.skipType(tag & 7)
696 break
697 }
698 }
699 return message
700 }
701
702 /**
703 * Decodes a QueryRequest message from the specified reader or buffer, length delimited.
704 * @function decodeDelimited
705 * @memberof logproto.QueryRequest
706 * @static
707 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
708 * @returns {logproto.QueryRequest} QueryRequest
709 * @throws {Error} If the payload is not a reader or valid buffer
710 * @throws {$protobuf.util.ProtocolError} If required fields are missing
711 */
712 QueryRequest.decodeDelimited = function decodeDelimited (reader) {
713 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
714 return this.decode(reader, reader.uint32())
715 }
716
717 /**
718 * Verifies a QueryRequest message.
719 * @function verify
720 * @memberof logproto.QueryRequest
721 * @static
722 * @param {Object.<string,*>} message Plain object to verify
723 * @returns {string|null} `null` if valid, otherwise the reason why it is not
724 */
725 QueryRequest.verify = function verify (message) {
726 if (typeof message !== 'object' || message === null) { return 'object expected' }
727 if (message.query != null && message.hasOwnProperty('query')) {
728 if (!$util.isString(message.query)) { return 'query: string expected' }
729 }
730 if (message.limit != null && message.hasOwnProperty('limit')) {
731 if (!$util.isInteger(message.limit)) { return 'limit: integer expected' }
732 }
733 if (message.start != null && message.hasOwnProperty('start')) {
734 var error = $root.google.protobuf.Timestamp.verify(message.start)
735 if (error) { return 'start.' + error }
736 }
737 if (message.end != null && message.hasOwnProperty('end')) {
738 var error = $root.google.protobuf.Timestamp.verify(message.end)
739 if (error) { return 'end.' + error }
740 }
741 if (message.direction != null && message.hasOwnProperty('direction')) {
742 switch (message.direction) {
743 default:
744 return 'direction: enum value expected'
745 case 0:
746 case 1:
747 break
748 }
749 }
750 if (message.regex != null && message.hasOwnProperty('regex')) {
751 if (!$util.isString(message.regex)) { return 'regex: string expected' }
752 }
753 return null
754 }
755
756 /**
757 * Creates a QueryRequest message from a plain object. Also converts values to their respective internal types.
758 * @function fromObject
759 * @memberof logproto.QueryRequest
760 * @static
761 * @param {Object.<string,*>} object Plain object
762 * @returns {logproto.QueryRequest} QueryRequest
763 */
764 QueryRequest.fromObject = function fromObject (object) {
765 if (object instanceof $root.logproto.QueryRequest) { return object }
766 var message = new $root.logproto.QueryRequest()
767 if (object.query != null) { message.query = String(object.query) }
768 if (object.limit != null) { message.limit = object.limit >>> 0 }
769 if (object.start != null) {
770 if (typeof object.start !== 'object') { throw TypeError('.logproto.QueryRequest.start: object expected') }
771 message.start = $root.google.protobuf.Timestamp.fromObject(object.start)
772 }
773 if (object.end != null) {
774 if (typeof object.end !== 'object') { throw TypeError('.logproto.QueryRequest.end: object expected') }
775 message.end = $root.google.protobuf.Timestamp.fromObject(object.end)
776 }
777 switch (object.direction) {
778 case 'FORWARD':
779 case 0:
780 message.direction = 0
781 break
782 case 'BACKWARD':
783 case 1:
784 message.direction = 1
785 break
786 }
787 if (object.regex != null) { message.regex = String(object.regex) }
788 return message
789 }
790
791 /**
792 * Creates a plain object from a QueryRequest message. Also converts values to other types if specified.
793 * @function toObject
794 * @memberof logproto.QueryRequest
795 * @static
796 * @param {logproto.QueryRequest} message QueryRequest
797 * @param {$protobuf.IConversionOptions} [options] Conversion options
798 * @returns {Object.<string,*>} Plain object
799 */
800 QueryRequest.toObject = function toObject (message, options) {
801 if (!options) { options = {} }
802 var object = {}
803 if (options.defaults) {
804 object.query = ''
805 object.limit = 0
806 object.start = null
807 object.end = null
808 object.direction = options.enums === String ? 'FORWARD' : 0
809 object.regex = ''
810 }
811 if (message.query != null && message.hasOwnProperty('query')) { object.query = message.query }
812 if (message.limit != null && message.hasOwnProperty('limit')) { object.limit = message.limit }
813 if (message.start != null && message.hasOwnProperty('start')) { object.start = $root.google.protobuf.Timestamp.toObject(message.start, options) }
814 if (message.end != null && message.hasOwnProperty('end')) { object.end = $root.google.protobuf.Timestamp.toObject(message.end, options) }
815 if (message.direction != null && message.hasOwnProperty('direction')) { object.direction = options.enums === String ? $root.logproto.Direction[message.direction] : message.direction }
816 if (message.regex != null && message.hasOwnProperty('regex')) { object.regex = message.regex }
817 return object
818 }
819
820 /**
821 * Converts this QueryRequest to JSON.
822 * @function toJSON
823 * @memberof logproto.QueryRequest
824 * @instance
825 * @returns {Object.<string,*>} JSON object
826 */
827 QueryRequest.prototype.toJSON = function toJSON () {
828 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
829 }
830
831 return QueryRequest
832 })()
833
834 /**
835 * Direction enum.
836 * @name logproto.Direction
837 * @enum {string}
838 * @property {number} FORWARD=0 FORWARD value
839 * @property {number} BACKWARD=1 BACKWARD value
840 */
841 logproto.Direction = (function () {
842 var valuesById = {}; var values = Object.create(valuesById)
843 values[valuesById[0] = 'FORWARD'] = 0
844 values[valuesById[1] = 'BACKWARD'] = 1
845 return values
846 })()
847
848 logproto.QueryResponse = (function () {
849 /**
850 * Properties of a QueryResponse.
851 * @memberof logproto
852 * @interface IQueryResponse
853 * @property {Array.<logproto.IStream>|null} [streams] QueryResponse streams
854 */
855
856 /**
857 * Constructs a new QueryResponse.
858 * @memberof logproto
859 * @classdesc Represents a QueryResponse.
860 * @implements IQueryResponse
861 * @constructor
862 * @param {logproto.IQueryResponse=} [properties] Properties to set
863 */
864 function QueryResponse (properties) {
865 this.streams = []
866 if (properties) {
867 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
868 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
869 }
870 }
871 }
872
873 /**
874 * QueryResponse streams.
875 * @member {Array.<logproto.IStream>} streams
876 * @memberof logproto.QueryResponse
877 * @instance
878 */
879 QueryResponse.prototype.streams = $util.emptyArray
880
881 /**
882 * Creates a new QueryResponse instance using the specified properties.
883 * @function create
884 * @memberof logproto.QueryResponse
885 * @static
886 * @param {logproto.IQueryResponse=} [properties] Properties to set
887 * @returns {logproto.QueryResponse} QueryResponse instance
888 */
889 QueryResponse.create = function create (properties) {
890 return new QueryResponse(properties)
891 }
892
893 /**
894 * Encodes the specified QueryResponse message. Does not implicitly {@link logproto.QueryResponse.verify|verify} messages.
895 * @function encode
896 * @memberof logproto.QueryResponse
897 * @static
898 * @param {logproto.IQueryResponse} message QueryResponse message or plain object to encode
899 * @param {$protobuf.Writer} [writer] Writer to encode to
900 * @returns {$protobuf.Writer} Writer
901 */
902 QueryResponse.encode = function encode (message, writer) {
903 if (!writer) { writer = $Writer.create() }
904 if (message.streams != null && message.streams.length) {
905 for (var i = 0; i < message.streams.length; ++i) { $root.logproto.Stream.encode(message.streams[i], writer.uint32(/* id 1, wireType 2 = */10).fork()).ldelim() }
906 }
907 return writer
908 }
909
910 /**
911 * Encodes the specified QueryResponse message, length delimited. Does not implicitly {@link logproto.QueryResponse.verify|verify} messages.
912 * @function encodeDelimited
913 * @memberof logproto.QueryResponse
914 * @static
915 * @param {logproto.IQueryResponse} message QueryResponse message or plain object to encode
916 * @param {$protobuf.Writer} [writer] Writer to encode to
917 * @returns {$protobuf.Writer} Writer
918 */
919 QueryResponse.encodeDelimited = function encodeDelimited (message, writer) {
920 return this.encode(message, writer).ldelim()
921 }
922
923 /**
924 * Decodes a QueryResponse message from the specified reader or buffer.
925 * @function decode
926 * @memberof logproto.QueryResponse
927 * @static
928 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
929 * @param {number} [length] Message length if known beforehand
930 * @returns {logproto.QueryResponse} QueryResponse
931 * @throws {Error} If the payload is not a reader or valid buffer
932 * @throws {$protobuf.util.ProtocolError} If required fields are missing
933 */
934 QueryResponse.decode = function decode (reader, length) {
935 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
936 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.QueryResponse()
937 while (reader.pos < end) {
938 var tag = reader.uint32()
939 switch (tag >>> 3) {
940 case 1:
941 if (!(message.streams && message.streams.length)) { message.streams = [] }
942 message.streams.push($root.logproto.Stream.decode(reader, reader.uint32()))
943 break
944 default:
945 reader.skipType(tag & 7)
946 break
947 }
948 }
949 return message
950 }
951
952 /**
953 * Decodes a QueryResponse message from the specified reader or buffer, length delimited.
954 * @function decodeDelimited
955 * @memberof logproto.QueryResponse
956 * @static
957 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
958 * @returns {logproto.QueryResponse} QueryResponse
959 * @throws {Error} If the payload is not a reader or valid buffer
960 * @throws {$protobuf.util.ProtocolError} If required fields are missing
961 */
962 QueryResponse.decodeDelimited = function decodeDelimited (reader) {
963 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
964 return this.decode(reader, reader.uint32())
965 }
966
967 /**
968 * Verifies a QueryResponse message.
969 * @function verify
970 * @memberof logproto.QueryResponse
971 * @static
972 * @param {Object.<string,*>} message Plain object to verify
973 * @returns {string|null} `null` if valid, otherwise the reason why it is not
974 */
975 QueryResponse.verify = function verify (message) {
976 if (typeof message !== 'object' || message === null) { return 'object expected' }
977 if (message.streams != null && message.hasOwnProperty('streams')) {
978 if (!Array.isArray(message.streams)) { return 'streams: array expected' }
979 for (var i = 0; i < message.streams.length; ++i) {
980 var error = $root.logproto.Stream.verify(message.streams[i])
981 if (error) { return 'streams.' + error }
982 }
983 }
984 return null
985 }
986
987 /**
988 * Creates a QueryResponse message from a plain object. Also converts values to their respective internal types.
989 * @function fromObject
990 * @memberof logproto.QueryResponse
991 * @static
992 * @param {Object.<string,*>} object Plain object
993 * @returns {logproto.QueryResponse} QueryResponse
994 */
995 QueryResponse.fromObject = function fromObject (object) {
996 if (object instanceof $root.logproto.QueryResponse) { return object }
997 var message = new $root.logproto.QueryResponse()
998 if (object.streams) {
999 if (!Array.isArray(object.streams)) { throw TypeError('.logproto.QueryResponse.streams: array expected') }
1000 message.streams = []
1001 for (var i = 0; i < object.streams.length; ++i) {
1002 if (typeof object.streams[i] !== 'object') { throw TypeError('.logproto.QueryResponse.streams: object expected') }
1003 message.streams[i] = $root.logproto.Stream.fromObject(object.streams[i])
1004 }
1005 }
1006 return message
1007 }
1008
1009 /**
1010 * Creates a plain object from a QueryResponse message. Also converts values to other types if specified.
1011 * @function toObject
1012 * @memberof logproto.QueryResponse
1013 * @static
1014 * @param {logproto.QueryResponse} message QueryResponse
1015 * @param {$protobuf.IConversionOptions} [options] Conversion options
1016 * @returns {Object.<string,*>} Plain object
1017 */
1018 QueryResponse.toObject = function toObject (message, options) {
1019 if (!options) { options = {} }
1020 var object = {}
1021 if (options.arrays || options.defaults) { object.streams = [] }
1022 if (message.streams && message.streams.length) {
1023 object.streams = []
1024 for (var j = 0; j < message.streams.length; ++j) { object.streams[j] = $root.logproto.Stream.toObject(message.streams[j], options) }
1025 }
1026 return object
1027 }
1028
1029 /**
1030 * Converts this QueryResponse to JSON.
1031 * @function toJSON
1032 * @memberof logproto.QueryResponse
1033 * @instance
1034 * @returns {Object.<string,*>} JSON object
1035 */
1036 QueryResponse.prototype.toJSON = function toJSON () {
1037 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
1038 }
1039
1040 return QueryResponse
1041 })()
1042
1043 logproto.LabelRequest = (function () {
1044 /**
1045 * Properties of a LabelRequest.
1046 * @memberof logproto
1047 * @interface ILabelRequest
1048 * @property {string|null} [name] LabelRequest name
1049 * @property {boolean|null} [values] LabelRequest values
1050 */
1051
1052 /**
1053 * Constructs a new LabelRequest.
1054 * @memberof logproto
1055 * @classdesc Represents a LabelRequest.
1056 * @implements ILabelRequest
1057 * @constructor
1058 * @param {logproto.ILabelRequest=} [properties] Properties to set
1059 */
1060 function LabelRequest (properties) {
1061 if (properties) {
1062 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
1063 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
1064 }
1065 }
1066 }
1067
1068 /**
1069 * LabelRequest name.
1070 * @member {string} name
1071 * @memberof logproto.LabelRequest
1072 * @instance
1073 */
1074 LabelRequest.prototype.name = ''
1075
1076 /**
1077 * LabelRequest values.
1078 * @member {boolean} values
1079 * @memberof logproto.LabelRequest
1080 * @instance
1081 */
1082 LabelRequest.prototype.values = false
1083
1084 /**
1085 * Creates a new LabelRequest instance using the specified properties.
1086 * @function create
1087 * @memberof logproto.LabelRequest
1088 * @static
1089 * @param {logproto.ILabelRequest=} [properties] Properties to set
1090 * @returns {logproto.LabelRequest} LabelRequest instance
1091 */
1092 LabelRequest.create = function create (properties) {
1093 return new LabelRequest(properties)
1094 }
1095
1096 /**
1097 * Encodes the specified LabelRequest message. Does not implicitly {@link logproto.LabelRequest.verify|verify} messages.
1098 * @function encode
1099 * @memberof logproto.LabelRequest
1100 * @static
1101 * @param {logproto.ILabelRequest} message LabelRequest message or plain object to encode
1102 * @param {$protobuf.Writer} [writer] Writer to encode to
1103 * @returns {$protobuf.Writer} Writer
1104 */
1105 LabelRequest.encode = function encode (message, writer) {
1106 if (!writer) { writer = $Writer.create() }
1107 if (message.name != null && message.hasOwnProperty('name')) { writer.uint32(/* id 1, wireType 2 = */10).string(message.name) }
1108 if (message.values != null && message.hasOwnProperty('values')) { writer.uint32(/* id 2, wireType 0 = */16).bool(message.values) }
1109 return writer
1110 }
1111
1112 /**
1113 * Encodes the specified LabelRequest message, length delimited. Does not implicitly {@link logproto.LabelRequest.verify|verify} messages.
1114 * @function encodeDelimited
1115 * @memberof logproto.LabelRequest
1116 * @static
1117 * @param {logproto.ILabelRequest} message LabelRequest message or plain object to encode
1118 * @param {$protobuf.Writer} [writer] Writer to encode to
1119 * @returns {$protobuf.Writer} Writer
1120 */
1121 LabelRequest.encodeDelimited = function encodeDelimited (message, writer) {
1122 return this.encode(message, writer).ldelim()
1123 }
1124
1125 /**
1126 * Decodes a LabelRequest message from the specified reader or buffer.
1127 * @function decode
1128 * @memberof logproto.LabelRequest
1129 * @static
1130 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1131 * @param {number} [length] Message length if known beforehand
1132 * @returns {logproto.LabelRequest} LabelRequest
1133 * @throws {Error} If the payload is not a reader or valid buffer
1134 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1135 */
1136 LabelRequest.decode = function decode (reader, length) {
1137 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
1138 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.LabelRequest()
1139 while (reader.pos < end) {
1140 var tag = reader.uint32()
1141 switch (tag >>> 3) {
1142 case 1:
1143 message.name = reader.string()
1144 break
1145 case 2:
1146 message.values = reader.bool()
1147 break
1148 default:
1149 reader.skipType(tag & 7)
1150 break
1151 }
1152 }
1153 return message
1154 }
1155
1156 /**
1157 * Decodes a LabelRequest message from the specified reader or buffer, length delimited.
1158 * @function decodeDelimited
1159 * @memberof logproto.LabelRequest
1160 * @static
1161 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1162 * @returns {logproto.LabelRequest} LabelRequest
1163 * @throws {Error} If the payload is not a reader or valid buffer
1164 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1165 */
1166 LabelRequest.decodeDelimited = function decodeDelimited (reader) {
1167 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
1168 return this.decode(reader, reader.uint32())
1169 }
1170
1171 /**
1172 * Verifies a LabelRequest message.
1173 * @function verify
1174 * @memberof logproto.LabelRequest
1175 * @static
1176 * @param {Object.<string,*>} message Plain object to verify
1177 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1178 */
1179 LabelRequest.verify = function verify (message) {
1180 if (typeof message !== 'object' || message === null) { return 'object expected' }
1181 if (message.name != null && message.hasOwnProperty('name')) {
1182 if (!$util.isString(message.name)) { return 'name: string expected' }
1183 }
1184 if (message.values != null && message.hasOwnProperty('values')) {
1185 if (typeof message.values !== 'boolean') { return 'values: boolean expected' }
1186 }
1187 return null
1188 }
1189
1190 /**
1191 * Creates a LabelRequest message from a plain object. Also converts values to their respective internal types.
1192 * @function fromObject
1193 * @memberof logproto.LabelRequest
1194 * @static
1195 * @param {Object.<string,*>} object Plain object
1196 * @returns {logproto.LabelRequest} LabelRequest
1197 */
1198 LabelRequest.fromObject = function fromObject (object) {
1199 if (object instanceof $root.logproto.LabelRequest) { return object }
1200 var message = new $root.logproto.LabelRequest()
1201 if (object.name != null) { message.name = String(object.name) }
1202 if (object.values != null) { message.values = Boolean(object.values) }
1203 return message
1204 }
1205
1206 /**
1207 * Creates a plain object from a LabelRequest message. Also converts values to other types if specified.
1208 * @function toObject
1209 * @memberof logproto.LabelRequest
1210 * @static
1211 * @param {logproto.LabelRequest} message LabelRequest
1212 * @param {$protobuf.IConversionOptions} [options] Conversion options
1213 * @returns {Object.<string,*>} Plain object
1214 */
1215 LabelRequest.toObject = function toObject (message, options) {
1216 if (!options) { options = {} }
1217 var object = {}
1218 if (options.defaults) {
1219 object.name = ''
1220 object.values = false
1221 }
1222 if (message.name != null && message.hasOwnProperty('name')) { object.name = message.name }
1223 if (message.values != null && message.hasOwnProperty('values')) { object.values = message.values }
1224 return object
1225 }
1226
1227 /**
1228 * Converts this LabelRequest to JSON.
1229 * @function toJSON
1230 * @memberof logproto.LabelRequest
1231 * @instance
1232 * @returns {Object.<string,*>} JSON object
1233 */
1234 LabelRequest.prototype.toJSON = function toJSON () {
1235 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
1236 }
1237
1238 return LabelRequest
1239 })()
1240
1241 logproto.LabelResponse = (function () {
1242 /**
1243 * Properties of a LabelResponse.
1244 * @memberof logproto
1245 * @interface ILabelResponse
1246 * @property {Array.<string>|null} [values] LabelResponse values
1247 */
1248
1249 /**
1250 * Constructs a new LabelResponse.
1251 * @memberof logproto
1252 * @classdesc Represents a LabelResponse.
1253 * @implements ILabelResponse
1254 * @constructor
1255 * @param {logproto.ILabelResponse=} [properties] Properties to set
1256 */
1257 function LabelResponse (properties) {
1258 this.values = []
1259 if (properties) {
1260 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
1261 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
1262 }
1263 }
1264 }
1265
1266 /**
1267 * LabelResponse values.
1268 * @member {Array.<string>} values
1269 * @memberof logproto.LabelResponse
1270 * @instance
1271 */
1272 LabelResponse.prototype.values = $util.emptyArray
1273
1274 /**
1275 * Creates a new LabelResponse instance using the specified properties.
1276 * @function create
1277 * @memberof logproto.LabelResponse
1278 * @static
1279 * @param {logproto.ILabelResponse=} [properties] Properties to set
1280 * @returns {logproto.LabelResponse} LabelResponse instance
1281 */
1282 LabelResponse.create = function create (properties) {
1283 return new LabelResponse(properties)
1284 }
1285
1286 /**
1287 * Encodes the specified LabelResponse message. Does not implicitly {@link logproto.LabelResponse.verify|verify} messages.
1288 * @function encode
1289 * @memberof logproto.LabelResponse
1290 * @static
1291 * @param {logproto.ILabelResponse} message LabelResponse message or plain object to encode
1292 * @param {$protobuf.Writer} [writer] Writer to encode to
1293 * @returns {$protobuf.Writer} Writer
1294 */
1295 LabelResponse.encode = function encode (message, writer) {
1296 if (!writer) { writer = $Writer.create() }
1297 if (message.values != null && message.values.length) {
1298 for (var i = 0; i < message.values.length; ++i) { writer.uint32(/* id 1, wireType 2 = */10).string(message.values[i]) }
1299 }
1300 return writer
1301 }
1302
1303 /**
1304 * Encodes the specified LabelResponse message, length delimited. Does not implicitly {@link logproto.LabelResponse.verify|verify} messages.
1305 * @function encodeDelimited
1306 * @memberof logproto.LabelResponse
1307 * @static
1308 * @param {logproto.ILabelResponse} message LabelResponse message or plain object to encode
1309 * @param {$protobuf.Writer} [writer] Writer to encode to
1310 * @returns {$protobuf.Writer} Writer
1311 */
1312 LabelResponse.encodeDelimited = function encodeDelimited (message, writer) {
1313 return this.encode(message, writer).ldelim()
1314 }
1315
1316 /**
1317 * Decodes a LabelResponse message from the specified reader or buffer.
1318 * @function decode
1319 * @memberof logproto.LabelResponse
1320 * @static
1321 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1322 * @param {number} [length] Message length if known beforehand
1323 * @returns {logproto.LabelResponse} LabelResponse
1324 * @throws {Error} If the payload is not a reader or valid buffer
1325 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1326 */
1327 LabelResponse.decode = function decode (reader, length) {
1328 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
1329 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.LabelResponse()
1330 while (reader.pos < end) {
1331 var tag = reader.uint32()
1332 switch (tag >>> 3) {
1333 case 1:
1334 if (!(message.values && message.values.length)) { message.values = [] }
1335 message.values.push(reader.string())
1336 break
1337 default:
1338 reader.skipType(tag & 7)
1339 break
1340 }
1341 }
1342 return message
1343 }
1344
1345 /**
1346 * Decodes a LabelResponse message from the specified reader or buffer, length delimited.
1347 * @function decodeDelimited
1348 * @memberof logproto.LabelResponse
1349 * @static
1350 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1351 * @returns {logproto.LabelResponse} LabelResponse
1352 * @throws {Error} If the payload is not a reader or valid buffer
1353 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1354 */
1355 LabelResponse.decodeDelimited = function decodeDelimited (reader) {
1356 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
1357 return this.decode(reader, reader.uint32())
1358 }
1359
1360 /**
1361 * Verifies a LabelResponse message.
1362 * @function verify
1363 * @memberof logproto.LabelResponse
1364 * @static
1365 * @param {Object.<string,*>} message Plain object to verify
1366 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1367 */
1368 LabelResponse.verify = function verify (message) {
1369 if (typeof message !== 'object' || message === null) { return 'object expected' }
1370 if (message.values != null && message.hasOwnProperty('values')) {
1371 if (!Array.isArray(message.values)) { return 'values: array expected' }
1372 for (var i = 0; i < message.values.length; ++i) {
1373 if (!$util.isString(message.values[i])) { return 'values: string[] expected' }
1374 }
1375 }
1376 return null
1377 }
1378
1379 /**
1380 * Creates a LabelResponse message from a plain object. Also converts values to their respective internal types.
1381 * @function fromObject
1382 * @memberof logproto.LabelResponse
1383 * @static
1384 * @param {Object.<string,*>} object Plain object
1385 * @returns {logproto.LabelResponse} LabelResponse
1386 */
1387 LabelResponse.fromObject = function fromObject (object) {
1388 if (object instanceof $root.logproto.LabelResponse) { return object }
1389 var message = new $root.logproto.LabelResponse()
1390 if (object.values) {
1391 if (!Array.isArray(object.values)) { throw TypeError('.logproto.LabelResponse.values: array expected') }
1392 message.values = []
1393 for (var i = 0; i < object.values.length; ++i) { message.values[i] = String(object.values[i]) }
1394 }
1395 return message
1396 }
1397
1398 /**
1399 * Creates a plain object from a LabelResponse message. Also converts values to other types if specified.
1400 * @function toObject
1401 * @memberof logproto.LabelResponse
1402 * @static
1403 * @param {logproto.LabelResponse} message LabelResponse
1404 * @param {$protobuf.IConversionOptions} [options] Conversion options
1405 * @returns {Object.<string,*>} Plain object
1406 */
1407 LabelResponse.toObject = function toObject (message, options) {
1408 if (!options) { options = {} }
1409 var object = {}
1410 if (options.arrays || options.defaults) { object.values = [] }
1411 if (message.values && message.values.length) {
1412 object.values = []
1413 for (var j = 0; j < message.values.length; ++j) { object.values[j] = message.values[j] }
1414 }
1415 return object
1416 }
1417
1418 /**
1419 * Converts this LabelResponse to JSON.
1420 * @function toJSON
1421 * @memberof logproto.LabelResponse
1422 * @instance
1423 * @returns {Object.<string,*>} JSON object
1424 */
1425 LabelResponse.prototype.toJSON = function toJSON () {
1426 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
1427 }
1428
1429 return LabelResponse
1430 })()
1431
1432 logproto.Stream = (function () {
1433 /**
1434 * Properties of a Stream.
1435 * @memberof logproto
1436 * @interface IStream
1437 * @property {string|null} [labels] Stream labels
1438 * @property {Array.<logproto.IEntry>|null} [entries] Stream entries
1439 */
1440
1441 /**
1442 * Constructs a new Stream.
1443 * @memberof logproto
1444 * @classdesc Represents a Stream.
1445 * @implements IStream
1446 * @constructor
1447 * @param {logproto.IStream=} [properties] Properties to set
1448 */
1449 function Stream (properties) {
1450 this.entries = []
1451 if (properties) {
1452 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
1453 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
1454 }
1455 }
1456 }
1457
1458 /**
1459 * Stream labels.
1460 * @member {string} labels
1461 * @memberof logproto.Stream
1462 * @instance
1463 */
1464 Stream.prototype.labels = ''
1465
1466 /**
1467 * Stream entries.
1468 * @member {Array.<logproto.IEntry>} entries
1469 * @memberof logproto.Stream
1470 * @instance
1471 */
1472 Stream.prototype.entries = $util.emptyArray
1473
1474 /**
1475 * Creates a new Stream instance using the specified properties.
1476 * @function create
1477 * @memberof logproto.Stream
1478 * @static
1479 * @param {logproto.IStream=} [properties] Properties to set
1480 * @returns {logproto.Stream} Stream instance
1481 */
1482 Stream.create = function create (properties) {
1483 return new Stream(properties)
1484 }
1485
1486 /**
1487 * Encodes the specified Stream message. Does not implicitly {@link logproto.Stream.verify|verify} messages.
1488 * @function encode
1489 * @memberof logproto.Stream
1490 * @static
1491 * @param {logproto.IStream} message Stream message or plain object to encode
1492 * @param {$protobuf.Writer} [writer] Writer to encode to
1493 * @returns {$protobuf.Writer} Writer
1494 */
1495 Stream.encode = function encode (message, writer) {
1496 if (!writer) { writer = $Writer.create() }
1497 if (message.labels != null && message.hasOwnProperty('labels')) { writer.uint32(/* id 1, wireType 2 = */10).string(message.labels) }
1498 if (message.entries != null && message.entries.length) {
1499 for (var i = 0; i < message.entries.length; ++i) { $root.logproto.Entry.encode(message.entries[i], writer.uint32(/* id 2, wireType 2 = */18).fork()).ldelim() }
1500 }
1501 return writer
1502 }
1503
1504 /**
1505 * Encodes the specified Stream message, length delimited. Does not implicitly {@link logproto.Stream.verify|verify} messages.
1506 * @function encodeDelimited
1507 * @memberof logproto.Stream
1508 * @static
1509 * @param {logproto.IStream} message Stream message or plain object to encode
1510 * @param {$protobuf.Writer} [writer] Writer to encode to
1511 * @returns {$protobuf.Writer} Writer
1512 */
1513 Stream.encodeDelimited = function encodeDelimited (message, writer) {
1514 return this.encode(message, writer).ldelim()
1515 }
1516
1517 /**
1518 * Decodes a Stream message from the specified reader or buffer.
1519 * @function decode
1520 * @memberof logproto.Stream
1521 * @static
1522 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1523 * @param {number} [length] Message length if known beforehand
1524 * @returns {logproto.Stream} Stream
1525 * @throws {Error} If the payload is not a reader or valid buffer
1526 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1527 */
1528 Stream.decode = function decode (reader, length) {
1529 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
1530 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.Stream()
1531 while (reader.pos < end) {
1532 var tag = reader.uint32()
1533 switch (tag >>> 3) {
1534 case 1:
1535 message.labels = reader.string()
1536 break
1537 case 2:
1538 if (!(message.entries && message.entries.length)) { message.entries = [] }
1539 message.entries.push($root.logproto.Entry.decode(reader, reader.uint32()))
1540 break
1541 default:
1542 reader.skipType(tag & 7)
1543 break
1544 }
1545 }
1546 return message
1547 }
1548
1549 /**
1550 * Decodes a Stream message from the specified reader or buffer, length delimited.
1551 * @function decodeDelimited
1552 * @memberof logproto.Stream
1553 * @static
1554 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1555 * @returns {logproto.Stream} Stream
1556 * @throws {Error} If the payload is not a reader or valid buffer
1557 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1558 */
1559 Stream.decodeDelimited = function decodeDelimited (reader) {
1560 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
1561 return this.decode(reader, reader.uint32())
1562 }
1563
1564 /**
1565 * Verifies a Stream message.
1566 * @function verify
1567 * @memberof logproto.Stream
1568 * @static
1569 * @param {Object.<string,*>} message Plain object to verify
1570 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1571 */
1572 Stream.verify = function verify (message) {
1573 if (typeof message !== 'object' || message === null) { return 'object expected' }
1574 if (message.labels != null && message.hasOwnProperty('labels')) {
1575 if (!$util.isString(message.labels)) { return 'labels: string expected' }
1576 }
1577 if (message.entries != null && message.hasOwnProperty('entries')) {
1578 if (!Array.isArray(message.entries)) { return 'entries: array expected' }
1579 for (var i = 0; i < message.entries.length; ++i) {
1580 var error = $root.logproto.Entry.verify(message.entries[i])
1581 if (error) { return 'entries.' + error }
1582 }
1583 }
1584 return null
1585 }
1586
1587 /**
1588 * Creates a Stream message from a plain object. Also converts values to their respective internal types.
1589 * @function fromObject
1590 * @memberof logproto.Stream
1591 * @static
1592 * @param {Object.<string,*>} object Plain object
1593 * @returns {logproto.Stream} Stream
1594 */
1595 Stream.fromObject = function fromObject (object) {
1596 if (object instanceof $root.logproto.Stream) { return object }
1597 var message = new $root.logproto.Stream()
1598 if (object.labels != null) { message.labels = String(object.labels) }
1599 if (object.entries) {
1600 if (!Array.isArray(object.entries)) { throw TypeError('.logproto.Stream.entries: array expected') }
1601 message.entries = []
1602 for (var i = 0; i < object.entries.length; ++i) {
1603 if (typeof object.entries[i] !== 'object') { throw TypeError('.logproto.Stream.entries: object expected') }
1604 message.entries[i] = $root.logproto.Entry.fromObject(object.entries[i])
1605 }
1606 }
1607 return message
1608 }
1609
1610 /**
1611 * Creates a plain object from a Stream message. Also converts values to other types if specified.
1612 * @function toObject
1613 * @memberof logproto.Stream
1614 * @static
1615 * @param {logproto.Stream} message Stream
1616 * @param {$protobuf.IConversionOptions} [options] Conversion options
1617 * @returns {Object.<string,*>} Plain object
1618 */
1619 Stream.toObject = function toObject (message, options) {
1620 if (!options) { options = {} }
1621 var object = {}
1622 if (options.arrays || options.defaults) { object.entries = [] }
1623 if (options.defaults) { object.labels = '' }
1624 if (message.labels != null && message.hasOwnProperty('labels')) { object.labels = message.labels }
1625 if (message.entries && message.entries.length) {
1626 object.entries = []
1627 for (var j = 0; j < message.entries.length; ++j) { object.entries[j] = $root.logproto.Entry.toObject(message.entries[j], options) }
1628 }
1629 return object
1630 }
1631
1632 /**
1633 * Converts this Stream to JSON.
1634 * @function toJSON
1635 * @memberof logproto.Stream
1636 * @instance
1637 * @returns {Object.<string,*>} JSON object
1638 */
1639 Stream.prototype.toJSON = function toJSON () {
1640 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
1641 }
1642
1643 return Stream
1644 })()
1645
1646 logproto.Entry = (function () {
1647 /**
1648 * Properties of an Entry.
1649 * @memberof logproto
1650 * @interface IEntry
1651 * @property {google.protobuf.ITimestamp|null} [timestamp] Entry timestamp
1652 * @property {string|null} [line] Entry line
1653 */
1654
1655 /**
1656 * Constructs a new Entry.
1657 * @memberof logproto
1658 * @classdesc Represents an Entry.
1659 * @implements IEntry
1660 * @constructor
1661 * @param {logproto.IEntry=} [properties] Properties to set
1662 */
1663 function Entry (properties) {
1664 if (properties) {
1665 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
1666 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
1667 }
1668 }
1669 }
1670
1671 /**
1672 * Entry timestamp.
1673 * @member {google.protobuf.ITimestamp|null|undefined} timestamp
1674 * @memberof logproto.Entry
1675 * @instance
1676 */
1677 Entry.prototype.timestamp = null
1678
1679 /**
1680 * Entry line.
1681 * @member {string} line
1682 * @memberof logproto.Entry
1683 * @instance
1684 */
1685 Entry.prototype.line = ''
1686
1687 /**
1688 * Creates a new Entry instance using the specified properties.
1689 * @function create
1690 * @memberof logproto.Entry
1691 * @static
1692 * @param {logproto.IEntry=} [properties] Properties to set
1693 * @returns {logproto.Entry} Entry instance
1694 */
1695 Entry.create = function create (properties) {
1696 return new Entry(properties)
1697 }
1698
1699 /**
1700 * Encodes the specified Entry message. Does not implicitly {@link logproto.Entry.verify|verify} messages.
1701 * @function encode
1702 * @memberof logproto.Entry
1703 * @static
1704 * @param {logproto.IEntry} message Entry message or plain object to encode
1705 * @param {$protobuf.Writer} [writer] Writer to encode to
1706 * @returns {$protobuf.Writer} Writer
1707 */
1708 Entry.encode = function encode (message, writer) {
1709 if (!writer) { writer = $Writer.create() }
1710 if (message.timestamp != null && message.hasOwnProperty('timestamp')) { $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 1, wireType 2 = */10).fork()).ldelim() }
1711 if (message.line != null && message.hasOwnProperty('line')) { writer.uint32(/* id 2, wireType 2 = */18).string(message.line) }
1712 return writer
1713 }
1714
1715 /**
1716 * Encodes the specified Entry message, length delimited. Does not implicitly {@link logproto.Entry.verify|verify} messages.
1717 * @function encodeDelimited
1718 * @memberof logproto.Entry
1719 * @static
1720 * @param {logproto.IEntry} message Entry message or plain object to encode
1721 * @param {$protobuf.Writer} [writer] Writer to encode to
1722 * @returns {$protobuf.Writer} Writer
1723 */
1724 Entry.encodeDelimited = function encodeDelimited (message, writer) {
1725 return this.encode(message, writer).ldelim()
1726 }
1727
1728 /**
1729 * Decodes an Entry message from the specified reader or buffer.
1730 * @function decode
1731 * @memberof logproto.Entry
1732 * @static
1733 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1734 * @param {number} [length] Message length if known beforehand
1735 * @returns {logproto.Entry} Entry
1736 * @throws {Error} If the payload is not a reader or valid buffer
1737 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1738 */
1739 Entry.decode = function decode (reader, length) {
1740 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
1741 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.logproto.Entry()
1742 while (reader.pos < end) {
1743 var tag = reader.uint32()
1744 switch (tag >>> 3) {
1745 case 1:
1746 message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32())
1747 break
1748 case 2:
1749 message.line = reader.string()
1750 break
1751 default:
1752 reader.skipType(tag & 7)
1753 break
1754 }
1755 }
1756 return message
1757 }
1758
1759 /**
1760 * Decodes an Entry message from the specified reader or buffer, length delimited.
1761 * @function decodeDelimited
1762 * @memberof logproto.Entry
1763 * @static
1764 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1765 * @returns {logproto.Entry} Entry
1766 * @throws {Error} If the payload is not a reader or valid buffer
1767 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1768 */
1769 Entry.decodeDelimited = function decodeDelimited (reader) {
1770 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
1771 return this.decode(reader, reader.uint32())
1772 }
1773
1774 /**
1775 * Verifies an Entry message.
1776 * @function verify
1777 * @memberof logproto.Entry
1778 * @static
1779 * @param {Object.<string,*>} message Plain object to verify
1780 * @returns {string|null} `null` if valid, otherwise the reason why it is not
1781 */
1782 Entry.verify = function verify (message) {
1783 if (typeof message !== 'object' || message === null) { return 'object expected' }
1784 if (message.timestamp != null && message.hasOwnProperty('timestamp')) {
1785 var error = $root.google.protobuf.Timestamp.verify(message.timestamp)
1786 if (error) { return 'timestamp.' + error }
1787 }
1788 if (message.line != null && message.hasOwnProperty('line')) {
1789 if (!$util.isString(message.line)) { return 'line: string expected' }
1790 }
1791 return null
1792 }
1793
1794 /**
1795 * Creates an Entry message from a plain object. Also converts values to their respective internal types.
1796 * @function fromObject
1797 * @memberof logproto.Entry
1798 * @static
1799 * @param {Object.<string,*>} object Plain object
1800 * @returns {logproto.Entry} Entry
1801 */
1802 Entry.fromObject = function fromObject (object) {
1803 if (object instanceof $root.logproto.Entry) { return object }
1804 var message = new $root.logproto.Entry()
1805 if (object.timestamp != null) {
1806 if (typeof object.timestamp !== 'object') { throw TypeError('.logproto.Entry.timestamp: object expected') }
1807 message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp)
1808 }
1809 if (object.line != null) { message.line = String(object.line) }
1810 return message
1811 }
1812
1813 /**
1814 * Creates a plain object from an Entry message. Also converts values to other types if specified.
1815 * @function toObject
1816 * @memberof logproto.Entry
1817 * @static
1818 * @param {logproto.Entry} message Entry
1819 * @param {$protobuf.IConversionOptions} [options] Conversion options
1820 * @returns {Object.<string,*>} Plain object
1821 */
1822 Entry.toObject = function toObject (message, options) {
1823 if (!options) { options = {} }
1824 var object = {}
1825 if (options.defaults) {
1826 object.timestamp = null
1827 object.line = ''
1828 }
1829 if (message.timestamp != null && message.hasOwnProperty('timestamp')) { object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options) }
1830 if (message.line != null && message.hasOwnProperty('line')) { object.line = message.line }
1831 return object
1832 }
1833
1834 /**
1835 * Converts this Entry to JSON.
1836 * @function toJSON
1837 * @memberof logproto.Entry
1838 * @instance
1839 * @returns {Object.<string,*>} JSON object
1840 */
1841 Entry.prototype.toJSON = function toJSON () {
1842 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
1843 }
1844
1845 return Entry
1846 })()
1847
1848 return logproto
1849})()
1850
1851$root.google = (function () {
1852 /**
1853 * Namespace google.
1854 * @exports google
1855 * @namespace
1856 */
1857 var google = {}
1858
1859 google.protobuf = (function () {
1860 /**
1861 * Namespace protobuf.
1862 * @memberof google
1863 * @namespace
1864 */
1865 var protobuf = {}
1866
1867 protobuf.Timestamp = (function () {
1868 /**
1869 * Properties of a Timestamp.
1870 * @memberof google.protobuf
1871 * @interface ITimestamp
1872 * @property {number|Long|null} [seconds] Timestamp seconds
1873 * @property {number|null} [nanos] Timestamp nanos
1874 */
1875
1876 /**
1877 * Constructs a new Timestamp.
1878 * @memberof google.protobuf
1879 * @classdesc Represents a Timestamp.
1880 * @implements ITimestamp
1881 * @constructor
1882 * @param {google.protobuf.ITimestamp=} [properties] Properties to set
1883 */
1884 function Timestamp (properties) {
1885 if (properties) {
1886 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
1887 if (properties[keys[i]] != null) { this[keys[i]] = properties[keys[i]] }
1888 }
1889 }
1890 }
1891
1892 /**
1893 * Timestamp seconds.
1894 * @member {number|Long} seconds
1895 * @memberof google.protobuf.Timestamp
1896 * @instance
1897 */
1898 Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0, 0, false) : 0
1899
1900 /**
1901 * Timestamp nanos.
1902 * @member {number} nanos
1903 * @memberof google.protobuf.Timestamp
1904 * @instance
1905 */
1906 Timestamp.prototype.nanos = 0
1907
1908 /**
1909 * Creates a new Timestamp instance using the specified properties.
1910 * @function create
1911 * @memberof google.protobuf.Timestamp
1912 * @static
1913 * @param {google.protobuf.ITimestamp=} [properties] Properties to set
1914 * @returns {google.protobuf.Timestamp} Timestamp instance
1915 */
1916 Timestamp.create = function create (properties) {
1917 return new Timestamp(properties)
1918 }
1919
1920 /**
1921 * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
1922 * @function encode
1923 * @memberof google.protobuf.Timestamp
1924 * @static
1925 * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
1926 * @param {$protobuf.Writer} [writer] Writer to encode to
1927 * @returns {$protobuf.Writer} Writer
1928 */
1929 Timestamp.encode = function encode (message, writer) {
1930 if (!writer) { writer = $Writer.create() }
1931 if (message.seconds != null && message.hasOwnProperty('seconds')) { writer.uint32(/* id 1, wireType 0 = */8).int64(message.seconds) }
1932 if (message.nanos != null && message.hasOwnProperty('nanos')) { writer.uint32(/* id 2, wireType 0 = */16).int32(message.nanos) }
1933 return writer
1934 }
1935
1936 /**
1937 * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages.
1938 * @function encodeDelimited
1939 * @memberof google.protobuf.Timestamp
1940 * @static
1941 * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode
1942 * @param {$protobuf.Writer} [writer] Writer to encode to
1943 * @returns {$protobuf.Writer} Writer
1944 */
1945 Timestamp.encodeDelimited = function encodeDelimited (message, writer) {
1946 return this.encode(message, writer).ldelim()
1947 }
1948
1949 /**
1950 * Decodes a Timestamp message from the specified reader or buffer.
1951 * @function decode
1952 * @memberof google.protobuf.Timestamp
1953 * @static
1954 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1955 * @param {number} [length] Message length if known beforehand
1956 * @returns {google.protobuf.Timestamp} Timestamp
1957 * @throws {Error} If the payload is not a reader or valid buffer
1958 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1959 */
1960 Timestamp.decode = function decode (reader, length) {
1961 if (!(reader instanceof $Reader)) { reader = $Reader.create(reader) }
1962 var end = length === undefined ? reader.len : reader.pos + length; var message = new $root.google.protobuf.Timestamp()
1963 while (reader.pos < end) {
1964 var tag = reader.uint32()
1965 switch (tag >>> 3) {
1966 case 1:
1967 message.seconds = reader.int64()
1968 break
1969 case 2:
1970 message.nanos = reader.int32()
1971 break
1972 default:
1973 reader.skipType(tag & 7)
1974 break
1975 }
1976 }
1977 return message
1978 }
1979
1980 /**
1981 * Decodes a Timestamp message from the specified reader or buffer, length delimited.
1982 * @function decodeDelimited
1983 * @memberof google.protobuf.Timestamp
1984 * @static
1985 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1986 * @returns {google.protobuf.Timestamp} Timestamp
1987 * @throws {Error} If the payload is not a reader or valid buffer
1988 * @throws {$protobuf.util.ProtocolError} If required fields are missing
1989 */
1990 Timestamp.decodeDelimited = function decodeDelimited (reader) {
1991 if (!(reader instanceof $Reader)) { reader = new $Reader(reader) }
1992 return this.decode(reader, reader.uint32())
1993 }
1994
1995 /**
1996 * Verifies a Timestamp message.
1997 * @function verify
1998 * @memberof google.protobuf.Timestamp
1999 * @static
2000 * @param {Object.<string,*>} message Plain object to verify
2001 * @returns {string|null} `null` if valid, otherwise the reason why it is not
2002 */
2003 Timestamp.verify = function verify (message) {
2004 if (typeof message !== 'object' || message === null) { return 'object expected' }
2005 if (message.seconds != null && message.hasOwnProperty('seconds')) {
2006 if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) { return 'seconds: integer|Long expected' }
2007 }
2008 if (message.nanos != null && message.hasOwnProperty('nanos')) {
2009 if (!$util.isInteger(message.nanos)) { return 'nanos: integer expected' }
2010 }
2011 return null
2012 }
2013
2014 /**
2015 * Creates a Timestamp message from a plain object. Also converts values to their respective internal types.
2016 * @function fromObject
2017 * @memberof google.protobuf.Timestamp
2018 * @static
2019 * @param {Object.<string,*>} object Plain object
2020 * @returns {google.protobuf.Timestamp} Timestamp
2021 */
2022 Timestamp.fromObject = function fromObject (object) {
2023 if (object instanceof $root.google.protobuf.Timestamp) { return object }
2024 var message = new $root.google.protobuf.Timestamp()
2025 if (object.seconds != null) {
2026 if ($util.Long) { (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false } else if (typeof object.seconds === 'string') { message.seconds = parseInt(object.seconds, 10) } else if (typeof object.seconds === 'number') { message.seconds = object.seconds } else if (typeof object.seconds === 'object') { message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber() }
2027 }
2028 if (object.nanos != null) { message.nanos = object.nanos | 0 }
2029 return message
2030 }
2031
2032 /**
2033 * Creates a plain object from a Timestamp message. Also converts values to other types if specified.
2034 * @function toObject
2035 * @memberof google.protobuf.Timestamp
2036 * @static
2037 * @param {google.protobuf.Timestamp} message Timestamp
2038 * @param {$protobuf.IConversionOptions} [options] Conversion options
2039 * @returns {Object.<string,*>} Plain object
2040 */
2041 Timestamp.toObject = function toObject (message, options) {
2042 if (!options) { options = {} }
2043 var object = {}
2044 if (options.defaults) {
2045 if ($util.Long) {
2046 var long = new $util.Long(0, 0, false)
2047 object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long
2048 } else { object.seconds = options.longs === String ? '0' : 0 }
2049 object.nanos = 0
2050 }
2051 if (message.seconds != null && message.hasOwnProperty('seconds')) {
2052 if (typeof message.seconds === 'number') { object.seconds = options.longs === String ? String(message.seconds) : message.seconds } else { 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 }
2053 }
2054 if (message.nanos != null && message.hasOwnProperty('nanos')) { object.nanos = message.nanos }
2055 return object
2056 }
2057
2058 /**
2059 * Converts this Timestamp to JSON.
2060 * @function toJSON
2061 * @memberof google.protobuf.Timestamp
2062 * @instance
2063 * @returns {Object.<string,*>} JSON object
2064 */
2065 Timestamp.prototype.toJSON = function toJSON () {
2066 return this.constructor.toObject(this, $protobuf.util.toJSONOptions)
2067 }
2068
2069 return Timestamp
2070 })()
2071
2072 return protobuf
2073 })()
2074
2075 return google
2076})()
2077
2078module.exports = $root