UNPKG

46.8 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(function(global, factory) { /* global define, require, module */
3
4 /* AMD */ if (typeof define === 'function' && define.amd)
5 define(["protobufjs/minimal"], factory);
6
7 /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
8 module.exports = factory(require("protobufjs/minimal"));
9
10})(this, function($protobuf) {
11 "use strict";
12
13 // Common aliases
14 var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
15
16 // Exported root namespace
17 var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
18
19 $root.google = (function() {
20
21 /**
22 * Namespace google.
23 * @exports google
24 * @namespace
25 */
26 var google = {};
27
28 google.api = (function() {
29
30 /**
31 * Namespace api.
32 * @memberof google
33 * @namespace
34 */
35 var api = {};
36
37 api.Http = (function() {
38
39 /**
40 * Properties of a Http.
41 * @memberof google.api
42 * @interface IHttp
43 * @property {Array.<google.api.IHttpRule>|null} [rules] Http rules
44 * @property {boolean|null} [fully_decode_reserved_expansion] Http fully_decode_reserved_expansion
45 */
46
47 /**
48 * Constructs a new Http.
49 * @memberof google.api
50 * @classdesc Represents a Http.
51 * @implements IHttp
52 * @constructor
53 * @param {google.api.IHttp=} [properties] Properties to set
54 */
55 function Http(properties) {
56 this.rules = [];
57 if (properties)
58 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
59 if (properties[keys[i]] != null)
60 this[keys[i]] = properties[keys[i]];
61 }
62
63 /**
64 * Http rules.
65 * @member {Array.<google.api.IHttpRule>} rules
66 * @memberof google.api.Http
67 * @instance
68 */
69 Http.prototype.rules = $util.emptyArray;
70
71 /**
72 * Http fully_decode_reserved_expansion.
73 * @member {boolean} fully_decode_reserved_expansion
74 * @memberof google.api.Http
75 * @instance
76 */
77 Http.prototype.fully_decode_reserved_expansion = false;
78
79 /**
80 * Creates a new Http instance using the specified properties.
81 * @function create
82 * @memberof google.api.Http
83 * @static
84 * @param {google.api.IHttp=} [properties] Properties to set
85 * @returns {google.api.Http} Http instance
86 */
87 Http.create = function create(properties) {
88 return new Http(properties);
89 };
90
91 /**
92 * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages.
93 * @function encode
94 * @memberof google.api.Http
95 * @static
96 * @param {google.api.IHttp} message Http message or plain object to encode
97 * @param {$protobuf.Writer} [writer] Writer to encode to
98 * @returns {$protobuf.Writer} Writer
99 */
100 Http.encode = function encode(message, writer) {
101 if (!writer)
102 writer = $Writer.create();
103 if (message.rules != null && message.rules.length)
104 for (var i = 0; i < message.rules.length; ++i)
105 $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
106 if (message.fully_decode_reserved_expansion != null && Object.hasOwnProperty.call(message, "fully_decode_reserved_expansion"))
107 writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fully_decode_reserved_expansion);
108 return writer;
109 };
110
111 /**
112 * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages.
113 * @function encodeDelimited
114 * @memberof google.api.Http
115 * @static
116 * @param {google.api.IHttp} message Http message or plain object to encode
117 * @param {$protobuf.Writer} [writer] Writer to encode to
118 * @returns {$protobuf.Writer} Writer
119 */
120 Http.encodeDelimited = function encodeDelimited(message, writer) {
121 return this.encode(message, writer).ldelim();
122 };
123
124 /**
125 * Decodes a Http message from the specified reader or buffer.
126 * @function decode
127 * @memberof google.api.Http
128 * @static
129 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
130 * @param {number} [length] Message length if known beforehand
131 * @returns {google.api.Http} Http
132 * @throws {Error} If the payload is not a reader or valid buffer
133 * @throws {$protobuf.util.ProtocolError} If required fields are missing
134 */
135 Http.decode = function decode(reader, length) {
136 if (!(reader instanceof $Reader))
137 reader = $Reader.create(reader);
138 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http();
139 while (reader.pos < end) {
140 var tag = reader.uint32();
141 switch (tag >>> 3) {
142 case 1:
143 if (!(message.rules && message.rules.length))
144 message.rules = [];
145 message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32()));
146 break;
147 case 2:
148 message.fully_decode_reserved_expansion = reader.bool();
149 break;
150 default:
151 reader.skipType(tag & 7);
152 break;
153 }
154 }
155 return message;
156 };
157
158 /**
159 * Decodes a Http message from the specified reader or buffer, length delimited.
160 * @function decodeDelimited
161 * @memberof google.api.Http
162 * @static
163 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
164 * @returns {google.api.Http} Http
165 * @throws {Error} If the payload is not a reader or valid buffer
166 * @throws {$protobuf.util.ProtocolError} If required fields are missing
167 */
168 Http.decodeDelimited = function decodeDelimited(reader) {
169 if (!(reader instanceof $Reader))
170 reader = new $Reader(reader);
171 return this.decode(reader, reader.uint32());
172 };
173
174 /**
175 * Verifies a Http message.
176 * @function verify
177 * @memberof google.api.Http
178 * @static
179 * @param {Object.<string,*>} message Plain object to verify
180 * @returns {string|null} `null` if valid, otherwise the reason why it is not
181 */
182 Http.verify = function verify(message) {
183 if (typeof message !== "object" || message === null)
184 return "object expected";
185 if (message.rules != null && message.hasOwnProperty("rules")) {
186 if (!Array.isArray(message.rules))
187 return "rules: array expected";
188 for (var i = 0; i < message.rules.length; ++i) {
189 var error = $root.google.api.HttpRule.verify(message.rules[i]);
190 if (error)
191 return "rules." + error;
192 }
193 }
194 if (message.fully_decode_reserved_expansion != null && message.hasOwnProperty("fully_decode_reserved_expansion"))
195 if (typeof message.fully_decode_reserved_expansion !== "boolean")
196 return "fully_decode_reserved_expansion: boolean expected";
197 return null;
198 };
199
200 /**
201 * Creates a Http message from a plain object. Also converts values to their respective internal types.
202 * @function fromObject
203 * @memberof google.api.Http
204 * @static
205 * @param {Object.<string,*>} object Plain object
206 * @returns {google.api.Http} Http
207 */
208 Http.fromObject = function fromObject(object) {
209 if (object instanceof $root.google.api.Http)
210 return object;
211 var message = new $root.google.api.Http();
212 if (object.rules) {
213 if (!Array.isArray(object.rules))
214 throw TypeError(".google.api.Http.rules: array expected");
215 message.rules = [];
216 for (var i = 0; i < object.rules.length; ++i) {
217 if (typeof object.rules[i] !== "object")
218 throw TypeError(".google.api.Http.rules: object expected");
219 message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]);
220 }
221 }
222 if (object.fully_decode_reserved_expansion != null)
223 message.fully_decode_reserved_expansion = Boolean(object.fully_decode_reserved_expansion);
224 return message;
225 };
226
227 /**
228 * Creates a plain object from a Http message. Also converts values to other types if specified.
229 * @function toObject
230 * @memberof google.api.Http
231 * @static
232 * @param {google.api.Http} message Http
233 * @param {$protobuf.IConversionOptions} [options] Conversion options
234 * @returns {Object.<string,*>} Plain object
235 */
236 Http.toObject = function toObject(message, options) {
237 if (!options)
238 options = {};
239 var object = {};
240 if (options.arrays || options.defaults)
241 object.rules = [];
242 if (options.defaults)
243 object.fully_decode_reserved_expansion = false;
244 if (message.rules && message.rules.length) {
245 object.rules = [];
246 for (var j = 0; j < message.rules.length; ++j)
247 object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options);
248 }
249 if (message.fully_decode_reserved_expansion != null && message.hasOwnProperty("fully_decode_reserved_expansion"))
250 object.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion;
251 return object;
252 };
253
254 /**
255 * Converts this Http to JSON.
256 * @function toJSON
257 * @memberof google.api.Http
258 * @instance
259 * @returns {Object.<string,*>} JSON object
260 */
261 Http.prototype.toJSON = function toJSON() {
262 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
263 };
264
265 return Http;
266 })();
267
268 api.HttpRule = (function() {
269
270 /**
271 * Properties of a HttpRule.
272 * @memberof google.api
273 * @interface IHttpRule
274 * @property {string|null} [selector] HttpRule selector
275 * @property {string|null} [get] HttpRule get
276 * @property {string|null} [put] HttpRule put
277 * @property {string|null} [post] HttpRule post
278 * @property {string|null} ["delete"] HttpRule delete
279 * @property {string|null} [patch] HttpRule patch
280 * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom
281 * @property {string|null} [body] HttpRule body
282 * @property {string|null} [response_body] HttpRule response_body
283 * @property {Array.<google.api.IHttpRule>|null} [additional_bindings] HttpRule additional_bindings
284 */
285
286 /**
287 * Constructs a new HttpRule.
288 * @memberof google.api
289 * @classdesc Represents a HttpRule.
290 * @implements IHttpRule
291 * @constructor
292 * @param {google.api.IHttpRule=} [properties] Properties to set
293 */
294 function HttpRule(properties) {
295 this.additional_bindings = [];
296 if (properties)
297 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
298 if (properties[keys[i]] != null)
299 this[keys[i]] = properties[keys[i]];
300 }
301
302 /**
303 * HttpRule selector.
304 * @member {string} selector
305 * @memberof google.api.HttpRule
306 * @instance
307 */
308 HttpRule.prototype.selector = "";
309
310 /**
311 * HttpRule get.
312 * @member {string} get
313 * @memberof google.api.HttpRule
314 * @instance
315 */
316 HttpRule.prototype.get = "";
317
318 /**
319 * HttpRule put.
320 * @member {string} put
321 * @memberof google.api.HttpRule
322 * @instance
323 */
324 HttpRule.prototype.put = "";
325
326 /**
327 * HttpRule post.
328 * @member {string} post
329 * @memberof google.api.HttpRule
330 * @instance
331 */
332 HttpRule.prototype.post = "";
333
334 /**
335 * HttpRule delete.
336 * @member {string} delete
337 * @memberof google.api.HttpRule
338 * @instance
339 */
340 HttpRule.prototype["delete"] = "";
341
342 /**
343 * HttpRule patch.
344 * @member {string} patch
345 * @memberof google.api.HttpRule
346 * @instance
347 */
348 HttpRule.prototype.patch = "";
349
350 /**
351 * HttpRule custom.
352 * @member {google.api.ICustomHttpPattern|null|undefined} custom
353 * @memberof google.api.HttpRule
354 * @instance
355 */
356 HttpRule.prototype.custom = null;
357
358 /**
359 * HttpRule body.
360 * @member {string} body
361 * @memberof google.api.HttpRule
362 * @instance
363 */
364 HttpRule.prototype.body = "";
365
366 /**
367 * HttpRule response_body.
368 * @member {string} response_body
369 * @memberof google.api.HttpRule
370 * @instance
371 */
372 HttpRule.prototype.response_body = "";
373
374 /**
375 * HttpRule additional_bindings.
376 * @member {Array.<google.api.IHttpRule>} additional_bindings
377 * @memberof google.api.HttpRule
378 * @instance
379 */
380 HttpRule.prototype.additional_bindings = $util.emptyArray;
381
382 // OneOf field names bound to virtual getters and setters
383 var $oneOfFields;
384
385 /**
386 * HttpRule pattern.
387 * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern
388 * @memberof google.api.HttpRule
389 * @instance
390 */
391 Object.defineProperty(HttpRule.prototype, "pattern", {
392 get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]),
393 set: $util.oneOfSetter($oneOfFields)
394 });
395
396 /**
397 * Creates a new HttpRule instance using the specified properties.
398 * @function create
399 * @memberof google.api.HttpRule
400 * @static
401 * @param {google.api.IHttpRule=} [properties] Properties to set
402 * @returns {google.api.HttpRule} HttpRule instance
403 */
404 HttpRule.create = function create(properties) {
405 return new HttpRule(properties);
406 };
407
408 /**
409 * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages.
410 * @function encode
411 * @memberof google.api.HttpRule
412 * @static
413 * @param {google.api.IHttpRule} message HttpRule message or plain object to encode
414 * @param {$protobuf.Writer} [writer] Writer to encode to
415 * @returns {$protobuf.Writer} Writer
416 */
417 HttpRule.encode = function encode(message, writer) {
418 if (!writer)
419 writer = $Writer.create();
420 if (message.selector != null && Object.hasOwnProperty.call(message, "selector"))
421 writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector);
422 if (message.get != null && Object.hasOwnProperty.call(message, "get"))
423 writer.uint32(/* id 2, wireType 2 =*/18).string(message.get);
424 if (message.put != null && Object.hasOwnProperty.call(message, "put"))
425 writer.uint32(/* id 3, wireType 2 =*/26).string(message.put);
426 if (message.post != null && Object.hasOwnProperty.call(message, "post"))
427 writer.uint32(/* id 4, wireType 2 =*/34).string(message.post);
428 if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete"))
429 writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]);
430 if (message.patch != null && Object.hasOwnProperty.call(message, "patch"))
431 writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch);
432 if (message.body != null && Object.hasOwnProperty.call(message, "body"))
433 writer.uint32(/* id 7, wireType 2 =*/58).string(message.body);
434 if (message.custom != null && Object.hasOwnProperty.call(message, "custom"))
435 $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
436 if (message.additional_bindings != null && message.additional_bindings.length)
437 for (var i = 0; i < message.additional_bindings.length; ++i)
438 $root.google.api.HttpRule.encode(message.additional_bindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
439 if (message.response_body != null && Object.hasOwnProperty.call(message, "response_body"))
440 writer.uint32(/* id 12, wireType 2 =*/98).string(message.response_body);
441 return writer;
442 };
443
444 /**
445 * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages.
446 * @function encodeDelimited
447 * @memberof google.api.HttpRule
448 * @static
449 * @param {google.api.IHttpRule} message HttpRule message or plain object to encode
450 * @param {$protobuf.Writer} [writer] Writer to encode to
451 * @returns {$protobuf.Writer} Writer
452 */
453 HttpRule.encodeDelimited = function encodeDelimited(message, writer) {
454 return this.encode(message, writer).ldelim();
455 };
456
457 /**
458 * Decodes a HttpRule message from the specified reader or buffer.
459 * @function decode
460 * @memberof google.api.HttpRule
461 * @static
462 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
463 * @param {number} [length] Message length if known beforehand
464 * @returns {google.api.HttpRule} HttpRule
465 * @throws {Error} If the payload is not a reader or valid buffer
466 * @throws {$protobuf.util.ProtocolError} If required fields are missing
467 */
468 HttpRule.decode = function decode(reader, length) {
469 if (!(reader instanceof $Reader))
470 reader = $Reader.create(reader);
471 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule();
472 while (reader.pos < end) {
473 var tag = reader.uint32();
474 switch (tag >>> 3) {
475 case 1:
476 message.selector = reader.string();
477 break;
478 case 2:
479 message.get = reader.string();
480 break;
481 case 3:
482 message.put = reader.string();
483 break;
484 case 4:
485 message.post = reader.string();
486 break;
487 case 5:
488 message["delete"] = reader.string();
489 break;
490 case 6:
491 message.patch = reader.string();
492 break;
493 case 8:
494 message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32());
495 break;
496 case 7:
497 message.body = reader.string();
498 break;
499 case 12:
500 message.response_body = reader.string();
501 break;
502 case 11:
503 if (!(message.additional_bindings && message.additional_bindings.length))
504 message.additional_bindings = [];
505 message.additional_bindings.push($root.google.api.HttpRule.decode(reader, reader.uint32()));
506 break;
507 default:
508 reader.skipType(tag & 7);
509 break;
510 }
511 }
512 return message;
513 };
514
515 /**
516 * Decodes a HttpRule message from the specified reader or buffer, length delimited.
517 * @function decodeDelimited
518 * @memberof google.api.HttpRule
519 * @static
520 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
521 * @returns {google.api.HttpRule} HttpRule
522 * @throws {Error} If the payload is not a reader or valid buffer
523 * @throws {$protobuf.util.ProtocolError} If required fields are missing
524 */
525 HttpRule.decodeDelimited = function decodeDelimited(reader) {
526 if (!(reader instanceof $Reader))
527 reader = new $Reader(reader);
528 return this.decode(reader, reader.uint32());
529 };
530
531 /**
532 * Verifies a HttpRule message.
533 * @function verify
534 * @memberof google.api.HttpRule
535 * @static
536 * @param {Object.<string,*>} message Plain object to verify
537 * @returns {string|null} `null` if valid, otherwise the reason why it is not
538 */
539 HttpRule.verify = function verify(message) {
540 if (typeof message !== "object" || message === null)
541 return "object expected";
542 var properties = {};
543 if (message.selector != null && message.hasOwnProperty("selector"))
544 if (!$util.isString(message.selector))
545 return "selector: string expected";
546 if (message.get != null && message.hasOwnProperty("get")) {
547 properties.pattern = 1;
548 if (!$util.isString(message.get))
549 return "get: string expected";
550 }
551 if (message.put != null && message.hasOwnProperty("put")) {
552 if (properties.pattern === 1)
553 return "pattern: multiple values";
554 properties.pattern = 1;
555 if (!$util.isString(message.put))
556 return "put: string expected";
557 }
558 if (message.post != null && message.hasOwnProperty("post")) {
559 if (properties.pattern === 1)
560 return "pattern: multiple values";
561 properties.pattern = 1;
562 if (!$util.isString(message.post))
563 return "post: string expected";
564 }
565 if (message["delete"] != null && message.hasOwnProperty("delete")) {
566 if (properties.pattern === 1)
567 return "pattern: multiple values";
568 properties.pattern = 1;
569 if (!$util.isString(message["delete"]))
570 return "delete: string expected";
571 }
572 if (message.patch != null && message.hasOwnProperty("patch")) {
573 if (properties.pattern === 1)
574 return "pattern: multiple values";
575 properties.pattern = 1;
576 if (!$util.isString(message.patch))
577 return "patch: string expected";
578 }
579 if (message.custom != null && message.hasOwnProperty("custom")) {
580 if (properties.pattern === 1)
581 return "pattern: multiple values";
582 properties.pattern = 1;
583 {
584 var error = $root.google.api.CustomHttpPattern.verify(message.custom);
585 if (error)
586 return "custom." + error;
587 }
588 }
589 if (message.body != null && message.hasOwnProperty("body"))
590 if (!$util.isString(message.body))
591 return "body: string expected";
592 if (message.response_body != null && message.hasOwnProperty("response_body"))
593 if (!$util.isString(message.response_body))
594 return "response_body: string expected";
595 if (message.additional_bindings != null && message.hasOwnProperty("additional_bindings")) {
596 if (!Array.isArray(message.additional_bindings))
597 return "additional_bindings: array expected";
598 for (var i = 0; i < message.additional_bindings.length; ++i) {
599 var error = $root.google.api.HttpRule.verify(message.additional_bindings[i]);
600 if (error)
601 return "additional_bindings." + error;
602 }
603 }
604 return null;
605 };
606
607 /**
608 * Creates a HttpRule message from a plain object. Also converts values to their respective internal types.
609 * @function fromObject
610 * @memberof google.api.HttpRule
611 * @static
612 * @param {Object.<string,*>} object Plain object
613 * @returns {google.api.HttpRule} HttpRule
614 */
615 HttpRule.fromObject = function fromObject(object) {
616 if (object instanceof $root.google.api.HttpRule)
617 return object;
618 var message = new $root.google.api.HttpRule();
619 if (object.selector != null)
620 message.selector = String(object.selector);
621 if (object.get != null)
622 message.get = String(object.get);
623 if (object.put != null)
624 message.put = String(object.put);
625 if (object.post != null)
626 message.post = String(object.post);
627 if (object["delete"] != null)
628 message["delete"] = String(object["delete"]);
629 if (object.patch != null)
630 message.patch = String(object.patch);
631 if (object.custom != null) {
632 if (typeof object.custom !== "object")
633 throw TypeError(".google.api.HttpRule.custom: object expected");
634 message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom);
635 }
636 if (object.body != null)
637 message.body = String(object.body);
638 if (object.response_body != null)
639 message.response_body = String(object.response_body);
640 if (object.additional_bindings) {
641 if (!Array.isArray(object.additional_bindings))
642 throw TypeError(".google.api.HttpRule.additional_bindings: array expected");
643 message.additional_bindings = [];
644 for (var i = 0; i < object.additional_bindings.length; ++i) {
645 if (typeof object.additional_bindings[i] !== "object")
646 throw TypeError(".google.api.HttpRule.additional_bindings: object expected");
647 message.additional_bindings[i] = $root.google.api.HttpRule.fromObject(object.additional_bindings[i]);
648 }
649 }
650 return message;
651 };
652
653 /**
654 * Creates a plain object from a HttpRule message. Also converts values to other types if specified.
655 * @function toObject
656 * @memberof google.api.HttpRule
657 * @static
658 * @param {google.api.HttpRule} message HttpRule
659 * @param {$protobuf.IConversionOptions} [options] Conversion options
660 * @returns {Object.<string,*>} Plain object
661 */
662 HttpRule.toObject = function toObject(message, options) {
663 if (!options)
664 options = {};
665 var object = {};
666 if (options.arrays || options.defaults)
667 object.additional_bindings = [];
668 if (options.defaults) {
669 object.selector = "";
670 object.body = "";
671 object.response_body = "";
672 }
673 if (message.selector != null && message.hasOwnProperty("selector"))
674 object.selector = message.selector;
675 if (message.get != null && message.hasOwnProperty("get")) {
676 object.get = message.get;
677 if (options.oneofs)
678 object.pattern = "get";
679 }
680 if (message.put != null && message.hasOwnProperty("put")) {
681 object.put = message.put;
682 if (options.oneofs)
683 object.pattern = "put";
684 }
685 if (message.post != null && message.hasOwnProperty("post")) {
686 object.post = message.post;
687 if (options.oneofs)
688 object.pattern = "post";
689 }
690 if (message["delete"] != null && message.hasOwnProperty("delete")) {
691 object["delete"] = message["delete"];
692 if (options.oneofs)
693 object.pattern = "delete";
694 }
695 if (message.patch != null && message.hasOwnProperty("patch")) {
696 object.patch = message.patch;
697 if (options.oneofs)
698 object.pattern = "patch";
699 }
700 if (message.body != null && message.hasOwnProperty("body"))
701 object.body = message.body;
702 if (message.custom != null && message.hasOwnProperty("custom")) {
703 object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options);
704 if (options.oneofs)
705 object.pattern = "custom";
706 }
707 if (message.additional_bindings && message.additional_bindings.length) {
708 object.additional_bindings = [];
709 for (var j = 0; j < message.additional_bindings.length; ++j)
710 object.additional_bindings[j] = $root.google.api.HttpRule.toObject(message.additional_bindings[j], options);
711 }
712 if (message.response_body != null && message.hasOwnProperty("response_body"))
713 object.response_body = message.response_body;
714 return object;
715 };
716
717 /**
718 * Converts this HttpRule to JSON.
719 * @function toJSON
720 * @memberof google.api.HttpRule
721 * @instance
722 * @returns {Object.<string,*>} JSON object
723 */
724 HttpRule.prototype.toJSON = function toJSON() {
725 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
726 };
727
728 return HttpRule;
729 })();
730
731 api.CustomHttpPattern = (function() {
732
733 /**
734 * Properties of a CustomHttpPattern.
735 * @memberof google.api
736 * @interface ICustomHttpPattern
737 * @property {string|null} [kind] CustomHttpPattern kind
738 * @property {string|null} [path] CustomHttpPattern path
739 */
740
741 /**
742 * Constructs a new CustomHttpPattern.
743 * @memberof google.api
744 * @classdesc Represents a CustomHttpPattern.
745 * @implements ICustomHttpPattern
746 * @constructor
747 * @param {google.api.ICustomHttpPattern=} [properties] Properties to set
748 */
749 function CustomHttpPattern(properties) {
750 if (properties)
751 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
752 if (properties[keys[i]] != null)
753 this[keys[i]] = properties[keys[i]];
754 }
755
756 /**
757 * CustomHttpPattern kind.
758 * @member {string} kind
759 * @memberof google.api.CustomHttpPattern
760 * @instance
761 */
762 CustomHttpPattern.prototype.kind = "";
763
764 /**
765 * CustomHttpPattern path.
766 * @member {string} path
767 * @memberof google.api.CustomHttpPattern
768 * @instance
769 */
770 CustomHttpPattern.prototype.path = "";
771
772 /**
773 * Creates a new CustomHttpPattern instance using the specified properties.
774 * @function create
775 * @memberof google.api.CustomHttpPattern
776 * @static
777 * @param {google.api.ICustomHttpPattern=} [properties] Properties to set
778 * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance
779 */
780 CustomHttpPattern.create = function create(properties) {
781 return new CustomHttpPattern(properties);
782 };
783
784 /**
785 * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages.
786 * @function encode
787 * @memberof google.api.CustomHttpPattern
788 * @static
789 * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode
790 * @param {$protobuf.Writer} [writer] Writer to encode to
791 * @returns {$protobuf.Writer} Writer
792 */
793 CustomHttpPattern.encode = function encode(message, writer) {
794 if (!writer)
795 writer = $Writer.create();
796 if (message.kind != null && Object.hasOwnProperty.call(message, "kind"))
797 writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind);
798 if (message.path != null && Object.hasOwnProperty.call(message, "path"))
799 writer.uint32(/* id 2, wireType 2 =*/18).string(message.path);
800 return writer;
801 };
802
803 /**
804 * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages.
805 * @function encodeDelimited
806 * @memberof google.api.CustomHttpPattern
807 * @static
808 * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode
809 * @param {$protobuf.Writer} [writer] Writer to encode to
810 * @returns {$protobuf.Writer} Writer
811 */
812 CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) {
813 return this.encode(message, writer).ldelim();
814 };
815
816 /**
817 * Decodes a CustomHttpPattern message from the specified reader or buffer.
818 * @function decode
819 * @memberof google.api.CustomHttpPattern
820 * @static
821 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
822 * @param {number} [length] Message length if known beforehand
823 * @returns {google.api.CustomHttpPattern} CustomHttpPattern
824 * @throws {Error} If the payload is not a reader or valid buffer
825 * @throws {$protobuf.util.ProtocolError} If required fields are missing
826 */
827 CustomHttpPattern.decode = function decode(reader, length) {
828 if (!(reader instanceof $Reader))
829 reader = $Reader.create(reader);
830 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern();
831 while (reader.pos < end) {
832 var tag = reader.uint32();
833 switch (tag >>> 3) {
834 case 1:
835 message.kind = reader.string();
836 break;
837 case 2:
838 message.path = reader.string();
839 break;
840 default:
841 reader.skipType(tag & 7);
842 break;
843 }
844 }
845 return message;
846 };
847
848 /**
849 * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited.
850 * @function decodeDelimited
851 * @memberof google.api.CustomHttpPattern
852 * @static
853 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
854 * @returns {google.api.CustomHttpPattern} CustomHttpPattern
855 * @throws {Error} If the payload is not a reader or valid buffer
856 * @throws {$protobuf.util.ProtocolError} If required fields are missing
857 */
858 CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) {
859 if (!(reader instanceof $Reader))
860 reader = new $Reader(reader);
861 return this.decode(reader, reader.uint32());
862 };
863
864 /**
865 * Verifies a CustomHttpPattern message.
866 * @function verify
867 * @memberof google.api.CustomHttpPattern
868 * @static
869 * @param {Object.<string,*>} message Plain object to verify
870 * @returns {string|null} `null` if valid, otherwise the reason why it is not
871 */
872 CustomHttpPattern.verify = function verify(message) {
873 if (typeof message !== "object" || message === null)
874 return "object expected";
875 if (message.kind != null && message.hasOwnProperty("kind"))
876 if (!$util.isString(message.kind))
877 return "kind: string expected";
878 if (message.path != null && message.hasOwnProperty("path"))
879 if (!$util.isString(message.path))
880 return "path: string expected";
881 return null;
882 };
883
884 /**
885 * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types.
886 * @function fromObject
887 * @memberof google.api.CustomHttpPattern
888 * @static
889 * @param {Object.<string,*>} object Plain object
890 * @returns {google.api.CustomHttpPattern} CustomHttpPattern
891 */
892 CustomHttpPattern.fromObject = function fromObject(object) {
893 if (object instanceof $root.google.api.CustomHttpPattern)
894 return object;
895 var message = new $root.google.api.CustomHttpPattern();
896 if (object.kind != null)
897 message.kind = String(object.kind);
898 if (object.path != null)
899 message.path = String(object.path);
900 return message;
901 };
902
903 /**
904 * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified.
905 * @function toObject
906 * @memberof google.api.CustomHttpPattern
907 * @static
908 * @param {google.api.CustomHttpPattern} message CustomHttpPattern
909 * @param {$protobuf.IConversionOptions} [options] Conversion options
910 * @returns {Object.<string,*>} Plain object
911 */
912 CustomHttpPattern.toObject = function toObject(message, options) {
913 if (!options)
914 options = {};
915 var object = {};
916 if (options.defaults) {
917 object.kind = "";
918 object.path = "";
919 }
920 if (message.kind != null && message.hasOwnProperty("kind"))
921 object.kind = message.kind;
922 if (message.path != null && message.hasOwnProperty("path"))
923 object.path = message.path;
924 return object;
925 };
926
927 /**
928 * Converts this CustomHttpPattern to JSON.
929 * @function toJSON
930 * @memberof google.api.CustomHttpPattern
931 * @instance
932 * @returns {Object.<string,*>} JSON object
933 */
934 CustomHttpPattern.prototype.toJSON = function toJSON() {
935 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
936 };
937
938 return CustomHttpPattern;
939 })();
940
941 return api;
942 })();
943
944 return google;
945 })();
946
947 return $root;
948});