949 lines
46 KiB
JavaScript
949 lines
46 KiB
JavaScript
|
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||
|
(function(global, factory) { /* global define, require, module */
|
||
|
|
||
|
/* AMD */ if (typeof define === 'function' && define.amd)
|
||
|
define(["protobufjs/minimal"], factory);
|
||
|
|
||
|
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
|
||
|
module.exports = factory(require("protobufjs/minimal"));
|
||
|
|
||
|
})(this, function($protobuf) {
|
||
|
"use strict";
|
||
|
|
||
|
// Common aliases
|
||
|
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||
|
|
||
|
// Exported root namespace
|
||
|
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
|
||
|
|
||
|
$root.google = (function() {
|
||
|
|
||
|
/**
|
||
|
* Namespace google.
|
||
|
* @exports google
|
||
|
* @namespace
|
||
|
*/
|
||
|
var google = {};
|
||
|
|
||
|
google.api = (function() {
|
||
|
|
||
|
/**
|
||
|
* Namespace api.
|
||
|
* @memberof google
|
||
|
* @namespace
|
||
|
*/
|
||
|
var api = {};
|
||
|
|
||
|
api.Http = (function() {
|
||
|
|
||
|
/**
|
||
|
* Properties of a Http.
|
||
|
* @memberof google.api
|
||
|
* @interface IHttp
|
||
|
* @property {Array.<google.api.IHttpRule>|null} [rules] Http rules
|
||
|
* @property {boolean|null} [fully_decode_reserved_expansion] Http fully_decode_reserved_expansion
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Constructs a new Http.
|
||
|
* @memberof google.api
|
||
|
* @classdesc Represents a Http.
|
||
|
* @implements IHttp
|
||
|
* @constructor
|
||
|
* @param {google.api.IHttp=} [properties] Properties to set
|
||
|
*/
|
||
|
function Http(properties) {
|
||
|
this.rules = [];
|
||
|
if (properties)
|
||
|
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||
|
if (properties[keys[i]] != null)
|
||
|
this[keys[i]] = properties[keys[i]];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Http rules.
|
||
|
* @member {Array.<google.api.IHttpRule>} rules
|
||
|
* @memberof google.api.Http
|
||
|
* @instance
|
||
|
*/
|
||
|
Http.prototype.rules = $util.emptyArray;
|
||
|
|
||
|
/**
|
||
|
* Http fully_decode_reserved_expansion.
|
||
|
* @member {boolean} fully_decode_reserved_expansion
|
||
|
* @memberof google.api.Http
|
||
|
* @instance
|
||
|
*/
|
||
|
Http.prototype.fully_decode_reserved_expansion = false;
|
||
|
|
||
|
/**
|
||
|
* Creates a new Http instance using the specified properties.
|
||
|
* @function create
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {google.api.IHttp=} [properties] Properties to set
|
||
|
* @returns {google.api.Http} Http instance
|
||
|
*/
|
||
|
Http.create = function create(properties) {
|
||
|
return new Http(properties);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages.
|
||
|
* @function encode
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {google.api.IHttp} message Http message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
Http.encode = function encode(message, writer) {
|
||
|
if (!writer)
|
||
|
writer = $Writer.create();
|
||
|
if (message.rules != null && message.rules.length)
|
||
|
for (var i = 0; i < message.rules.length; ++i)
|
||
|
$root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
||
|
if (message.fully_decode_reserved_expansion != null && Object.hasOwnProperty.call(message, "fully_decode_reserved_expansion"))
|
||
|
writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fully_decode_reserved_expansion);
|
||
|
return writer;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages.
|
||
|
* @function encodeDelimited
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {google.api.IHttp} message Http message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
Http.encodeDelimited = function encodeDelimited(message, writer) {
|
||
|
return this.encode(message, writer).ldelim();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a Http message from the specified reader or buffer.
|
||
|
* @function decode
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @param {number} [length] Message length if known beforehand
|
||
|
* @returns {google.api.Http} Http
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
Http.decode = function decode(reader, length) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = $Reader.create(reader);
|
||
|
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http();
|
||
|
while (reader.pos < end) {
|
||
|
var tag = reader.uint32();
|
||
|
switch (tag >>> 3) {
|
||
|
case 1:
|
||
|
if (!(message.rules && message.rules.length))
|
||
|
message.rules = [];
|
||
|
message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32()));
|
||
|
break;
|
||
|
case 2:
|
||
|
message.fully_decode_reserved_expansion = reader.bool();
|
||
|
break;
|
||
|
default:
|
||
|
reader.skipType(tag & 7);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a Http message from the specified reader or buffer, length delimited.
|
||
|
* @function decodeDelimited
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @returns {google.api.Http} Http
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
Http.decodeDelimited = function decodeDelimited(reader) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = new $Reader(reader);
|
||
|
return this.decode(reader, reader.uint32());
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Verifies a Http message.
|
||
|
* @function verify
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} message Plain object to verify
|
||
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||
|
*/
|
||
|
Http.verify = function verify(message) {
|
||
|
if (typeof message !== "object" || message === null)
|
||
|
return "object expected";
|
||
|
if (message.rules != null && message.hasOwnProperty("rules")) {
|
||
|
if (!Array.isArray(message.rules))
|
||
|
return "rules: array expected";
|
||
|
for (var i = 0; i < message.rules.length; ++i) {
|
||
|
var error = $root.google.api.HttpRule.verify(message.rules[i]);
|
||
|
if (error)
|
||
|
return "rules." + error;
|
||
|
}
|
||
|
}
|
||
|
if (message.fully_decode_reserved_expansion != null && message.hasOwnProperty("fully_decode_reserved_expansion"))
|
||
|
if (typeof message.fully_decode_reserved_expansion !== "boolean")
|
||
|
return "fully_decode_reserved_expansion: boolean expected";
|
||
|
return null;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a Http message from a plain object. Also converts values to their respective internal types.
|
||
|
* @function fromObject
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} object Plain object
|
||
|
* @returns {google.api.Http} Http
|
||
|
*/
|
||
|
Http.fromObject = function fromObject(object) {
|
||
|
if (object instanceof $root.google.api.Http)
|
||
|
return object;
|
||
|
var message = new $root.google.api.Http();
|
||
|
if (object.rules) {
|
||
|
if (!Array.isArray(object.rules))
|
||
|
throw TypeError(".google.api.Http.rules: array expected");
|
||
|
message.rules = [];
|
||
|
for (var i = 0; i < object.rules.length; ++i) {
|
||
|
if (typeof object.rules[i] !== "object")
|
||
|
throw TypeError(".google.api.Http.rules: object expected");
|
||
|
message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]);
|
||
|
}
|
||
|
}
|
||
|
if (object.fully_decode_reserved_expansion != null)
|
||
|
message.fully_decode_reserved_expansion = Boolean(object.fully_decode_reserved_expansion);
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a plain object from a Http message. Also converts values to other types if specified.
|
||
|
* @function toObject
|
||
|
* @memberof google.api.Http
|
||
|
* @static
|
||
|
* @param {google.api.Http} message Http
|
||
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||
|
* @returns {Object.<string,*>} Plain object
|
||
|
*/
|
||
|
Http.toObject = function toObject(message, options) {
|
||
|
if (!options)
|
||
|
options = {};
|
||
|
var object = {};
|
||
|
if (options.arrays || options.defaults)
|
||
|
object.rules = [];
|
||
|
if (options.defaults)
|
||
|
object.fully_decode_reserved_expansion = false;
|
||
|
if (message.rules && message.rules.length) {
|
||
|
object.rules = [];
|
||
|
for (var j = 0; j < message.rules.length; ++j)
|
||
|
object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options);
|
||
|
}
|
||
|
if (message.fully_decode_reserved_expansion != null && message.hasOwnProperty("fully_decode_reserved_expansion"))
|
||
|
object.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion;
|
||
|
return object;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Converts this Http to JSON.
|
||
|
* @function toJSON
|
||
|
* @memberof google.api.Http
|
||
|
* @instance
|
||
|
* @returns {Object.<string,*>} JSON object
|
||
|
*/
|
||
|
Http.prototype.toJSON = function toJSON() {
|
||
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||
|
};
|
||
|
|
||
|
return Http;
|
||
|
})();
|
||
|
|
||
|
api.HttpRule = (function() {
|
||
|
|
||
|
/**
|
||
|
* Properties of a HttpRule.
|
||
|
* @memberof google.api
|
||
|
* @interface IHttpRule
|
||
|
* @property {string|null} [selector] HttpRule selector
|
||
|
* @property {string|null} [get] HttpRule get
|
||
|
* @property {string|null} [put] HttpRule put
|
||
|
* @property {string|null} [post] HttpRule post
|
||
|
* @property {string|null} ["delete"] HttpRule delete
|
||
|
* @property {string|null} [patch] HttpRule patch
|
||
|
* @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom
|
||
|
* @property {string|null} [body] HttpRule body
|
||
|
* @property {string|null} [response_body] HttpRule response_body
|
||
|
* @property {Array.<google.api.IHttpRule>|null} [additional_bindings] HttpRule additional_bindings
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Constructs a new HttpRule.
|
||
|
* @memberof google.api
|
||
|
* @classdesc Represents a HttpRule.
|
||
|
* @implements IHttpRule
|
||
|
* @constructor
|
||
|
* @param {google.api.IHttpRule=} [properties] Properties to set
|
||
|
*/
|
||
|
function HttpRule(properties) {
|
||
|
this.additional_bindings = [];
|
||
|
if (properties)
|
||
|
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||
|
if (properties[keys[i]] != null)
|
||
|
this[keys[i]] = properties[keys[i]];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* HttpRule selector.
|
||
|
* @member {string} selector
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.selector = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule get.
|
||
|
* @member {string} get
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.get = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule put.
|
||
|
* @member {string} put
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.put = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule post.
|
||
|
* @member {string} post
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.post = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule delete.
|
||
|
* @member {string} delete
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype["delete"] = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule patch.
|
||
|
* @member {string} patch
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.patch = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule custom.
|
||
|
* @member {google.api.ICustomHttpPattern|null|undefined} custom
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.custom = null;
|
||
|
|
||
|
/**
|
||
|
* HttpRule body.
|
||
|
* @member {string} body
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.body = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule response_body.
|
||
|
* @member {string} response_body
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.response_body = "";
|
||
|
|
||
|
/**
|
||
|
* HttpRule additional_bindings.
|
||
|
* @member {Array.<google.api.IHttpRule>} additional_bindings
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
HttpRule.prototype.additional_bindings = $util.emptyArray;
|
||
|
|
||
|
// OneOf field names bound to virtual getters and setters
|
||
|
var $oneOfFields;
|
||
|
|
||
|
/**
|
||
|
* HttpRule pattern.
|
||
|
* @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
*/
|
||
|
Object.defineProperty(HttpRule.prototype, "pattern", {
|
||
|
get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]),
|
||
|
set: $util.oneOfSetter($oneOfFields)
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* Creates a new HttpRule instance using the specified properties.
|
||
|
* @function create
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {google.api.IHttpRule=} [properties] Properties to set
|
||
|
* @returns {google.api.HttpRule} HttpRule instance
|
||
|
*/
|
||
|
HttpRule.create = function create(properties) {
|
||
|
return new HttpRule(properties);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages.
|
||
|
* @function encode
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {google.api.IHttpRule} message HttpRule message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
HttpRule.encode = function encode(message, writer) {
|
||
|
if (!writer)
|
||
|
writer = $Writer.create();
|
||
|
if (message.selector != null && Object.hasOwnProperty.call(message, "selector"))
|
||
|
writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector);
|
||
|
if (message.get != null && Object.hasOwnProperty.call(message, "get"))
|
||
|
writer.uint32(/* id 2, wireType 2 =*/18).string(message.get);
|
||
|
if (message.put != null && Object.hasOwnProperty.call(message, "put"))
|
||
|
writer.uint32(/* id 3, wireType 2 =*/26).string(message.put);
|
||
|
if (message.post != null && Object.hasOwnProperty.call(message, "post"))
|
||
|
writer.uint32(/* id 4, wireType 2 =*/34).string(message.post);
|
||
|
if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete"))
|
||
|
writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]);
|
||
|
if (message.patch != null && Object.hasOwnProperty.call(message, "patch"))
|
||
|
writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch);
|
||
|
if (message.body != null && Object.hasOwnProperty.call(message, "body"))
|
||
|
writer.uint32(/* id 7, wireType 2 =*/58).string(message.body);
|
||
|
if (message.custom != null && Object.hasOwnProperty.call(message, "custom"))
|
||
|
$root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
|
||
|
if (message.additional_bindings != null && message.additional_bindings.length)
|
||
|
for (var i = 0; i < message.additional_bindings.length; ++i)
|
||
|
$root.google.api.HttpRule.encode(message.additional_bindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
|
||
|
if (message.response_body != null && Object.hasOwnProperty.call(message, "response_body"))
|
||
|
writer.uint32(/* id 12, wireType 2 =*/98).string(message.response_body);
|
||
|
return writer;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages.
|
||
|
* @function encodeDelimited
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {google.api.IHttpRule} message HttpRule message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
HttpRule.encodeDelimited = function encodeDelimited(message, writer) {
|
||
|
return this.encode(message, writer).ldelim();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a HttpRule message from the specified reader or buffer.
|
||
|
* @function decode
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @param {number} [length] Message length if known beforehand
|
||
|
* @returns {google.api.HttpRule} HttpRule
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
HttpRule.decode = function decode(reader, length) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = $Reader.create(reader);
|
||
|
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule();
|
||
|
while (reader.pos < end) {
|
||
|
var tag = reader.uint32();
|
||
|
switch (tag >>> 3) {
|
||
|
case 1:
|
||
|
message.selector = reader.string();
|
||
|
break;
|
||
|
case 2:
|
||
|
message.get = reader.string();
|
||
|
break;
|
||
|
case 3:
|
||
|
message.put = reader.string();
|
||
|
break;
|
||
|
case 4:
|
||
|
message.post = reader.string();
|
||
|
break;
|
||
|
case 5:
|
||
|
message["delete"] = reader.string();
|
||
|
break;
|
||
|
case 6:
|
||
|
message.patch = reader.string();
|
||
|
break;
|
||
|
case 8:
|
||
|
message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32());
|
||
|
break;
|
||
|
case 7:
|
||
|
message.body = reader.string();
|
||
|
break;
|
||
|
case 12:
|
||
|
message.response_body = reader.string();
|
||
|
break;
|
||
|
case 11:
|
||
|
if (!(message.additional_bindings && message.additional_bindings.length))
|
||
|
message.additional_bindings = [];
|
||
|
message.additional_bindings.push($root.google.api.HttpRule.decode(reader, reader.uint32()));
|
||
|
break;
|
||
|
default:
|
||
|
reader.skipType(tag & 7);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a HttpRule message from the specified reader or buffer, length delimited.
|
||
|
* @function decodeDelimited
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @returns {google.api.HttpRule} HttpRule
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
HttpRule.decodeDelimited = function decodeDelimited(reader) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = new $Reader(reader);
|
||
|
return this.decode(reader, reader.uint32());
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Verifies a HttpRule message.
|
||
|
* @function verify
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} message Plain object to verify
|
||
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||
|
*/
|
||
|
HttpRule.verify = function verify(message) {
|
||
|
if (typeof message !== "object" || message === null)
|
||
|
return "object expected";
|
||
|
var properties = {};
|
||
|
if (message.selector != null && message.hasOwnProperty("selector"))
|
||
|
if (!$util.isString(message.selector))
|
||
|
return "selector: string expected";
|
||
|
if (message.get != null && message.hasOwnProperty("get")) {
|
||
|
properties.pattern = 1;
|
||
|
if (!$util.isString(message.get))
|
||
|
return "get: string expected";
|
||
|
}
|
||
|
if (message.put != null && message.hasOwnProperty("put")) {
|
||
|
if (properties.pattern === 1)
|
||
|
return "pattern: multiple values";
|
||
|
properties.pattern = 1;
|
||
|
if (!$util.isString(message.put))
|
||
|
return "put: string expected";
|
||
|
}
|
||
|
if (message.post != null && message.hasOwnProperty("post")) {
|
||
|
if (properties.pattern === 1)
|
||
|
return "pattern: multiple values";
|
||
|
properties.pattern = 1;
|
||
|
if (!$util.isString(message.post))
|
||
|
return "post: string expected";
|
||
|
}
|
||
|
if (message["delete"] != null && message.hasOwnProperty("delete")) {
|
||
|
if (properties.pattern === 1)
|
||
|
return "pattern: multiple values";
|
||
|
properties.pattern = 1;
|
||
|
if (!$util.isString(message["delete"]))
|
||
|
return "delete: string expected";
|
||
|
}
|
||
|
if (message.patch != null && message.hasOwnProperty("patch")) {
|
||
|
if (properties.pattern === 1)
|
||
|
return "pattern: multiple values";
|
||
|
properties.pattern = 1;
|
||
|
if (!$util.isString(message.patch))
|
||
|
return "patch: string expected";
|
||
|
}
|
||
|
if (message.custom != null && message.hasOwnProperty("custom")) {
|
||
|
if (properties.pattern === 1)
|
||
|
return "pattern: multiple values";
|
||
|
properties.pattern = 1;
|
||
|
{
|
||
|
var error = $root.google.api.CustomHttpPattern.verify(message.custom);
|
||
|
if (error)
|
||
|
return "custom." + error;
|
||
|
}
|
||
|
}
|
||
|
if (message.body != null && message.hasOwnProperty("body"))
|
||
|
if (!$util.isString(message.body))
|
||
|
return "body: string expected";
|
||
|
if (message.response_body != null && message.hasOwnProperty("response_body"))
|
||
|
if (!$util.isString(message.response_body))
|
||
|
return "response_body: string expected";
|
||
|
if (message.additional_bindings != null && message.hasOwnProperty("additional_bindings")) {
|
||
|
if (!Array.isArray(message.additional_bindings))
|
||
|
return "additional_bindings: array expected";
|
||
|
for (var i = 0; i < message.additional_bindings.length; ++i) {
|
||
|
var error = $root.google.api.HttpRule.verify(message.additional_bindings[i]);
|
||
|
if (error)
|
||
|
return "additional_bindings." + error;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a HttpRule message from a plain object. Also converts values to their respective internal types.
|
||
|
* @function fromObject
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} object Plain object
|
||
|
* @returns {google.api.HttpRule} HttpRule
|
||
|
*/
|
||
|
HttpRule.fromObject = function fromObject(object) {
|
||
|
if (object instanceof $root.google.api.HttpRule)
|
||
|
return object;
|
||
|
var message = new $root.google.api.HttpRule();
|
||
|
if (object.selector != null)
|
||
|
message.selector = String(object.selector);
|
||
|
if (object.get != null)
|
||
|
message.get = String(object.get);
|
||
|
if (object.put != null)
|
||
|
message.put = String(object.put);
|
||
|
if (object.post != null)
|
||
|
message.post = String(object.post);
|
||
|
if (object["delete"] != null)
|
||
|
message["delete"] = String(object["delete"]);
|
||
|
if (object.patch != null)
|
||
|
message.patch = String(object.patch);
|
||
|
if (object.custom != null) {
|
||
|
if (typeof object.custom !== "object")
|
||
|
throw TypeError(".google.api.HttpRule.custom: object expected");
|
||
|
message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom);
|
||
|
}
|
||
|
if (object.body != null)
|
||
|
message.body = String(object.body);
|
||
|
if (object.response_body != null)
|
||
|
message.response_body = String(object.response_body);
|
||
|
if (object.additional_bindings) {
|
||
|
if (!Array.isArray(object.additional_bindings))
|
||
|
throw TypeError(".google.api.HttpRule.additional_bindings: array expected");
|
||
|
message.additional_bindings = [];
|
||
|
for (var i = 0; i < object.additional_bindings.length; ++i) {
|
||
|
if (typeof object.additional_bindings[i] !== "object")
|
||
|
throw TypeError(".google.api.HttpRule.additional_bindings: object expected");
|
||
|
message.additional_bindings[i] = $root.google.api.HttpRule.fromObject(object.additional_bindings[i]);
|
||
|
}
|
||
|
}
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a plain object from a HttpRule message. Also converts values to other types if specified.
|
||
|
* @function toObject
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @static
|
||
|
* @param {google.api.HttpRule} message HttpRule
|
||
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||
|
* @returns {Object.<string,*>} Plain object
|
||
|
*/
|
||
|
HttpRule.toObject = function toObject(message, options) {
|
||
|
if (!options)
|
||
|
options = {};
|
||
|
var object = {};
|
||
|
if (options.arrays || options.defaults)
|
||
|
object.additional_bindings = [];
|
||
|
if (options.defaults) {
|
||
|
object.selector = "";
|
||
|
object.body = "";
|
||
|
object.response_body = "";
|
||
|
}
|
||
|
if (message.selector != null && message.hasOwnProperty("selector"))
|
||
|
object.selector = message.selector;
|
||
|
if (message.get != null && message.hasOwnProperty("get")) {
|
||
|
object.get = message.get;
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "get";
|
||
|
}
|
||
|
if (message.put != null && message.hasOwnProperty("put")) {
|
||
|
object.put = message.put;
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "put";
|
||
|
}
|
||
|
if (message.post != null && message.hasOwnProperty("post")) {
|
||
|
object.post = message.post;
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "post";
|
||
|
}
|
||
|
if (message["delete"] != null && message.hasOwnProperty("delete")) {
|
||
|
object["delete"] = message["delete"];
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "delete";
|
||
|
}
|
||
|
if (message.patch != null && message.hasOwnProperty("patch")) {
|
||
|
object.patch = message.patch;
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "patch";
|
||
|
}
|
||
|
if (message.body != null && message.hasOwnProperty("body"))
|
||
|
object.body = message.body;
|
||
|
if (message.custom != null && message.hasOwnProperty("custom")) {
|
||
|
object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options);
|
||
|
if (options.oneofs)
|
||
|
object.pattern = "custom";
|
||
|
}
|
||
|
if (message.additional_bindings && message.additional_bindings.length) {
|
||
|
object.additional_bindings = [];
|
||
|
for (var j = 0; j < message.additional_bindings.length; ++j)
|
||
|
object.additional_bindings[j] = $root.google.api.HttpRule.toObject(message.additional_bindings[j], options);
|
||
|
}
|
||
|
if (message.response_body != null && message.hasOwnProperty("response_body"))
|
||
|
object.response_body = message.response_body;
|
||
|
return object;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Converts this HttpRule to JSON.
|
||
|
* @function toJSON
|
||
|
* @memberof google.api.HttpRule
|
||
|
* @instance
|
||
|
* @returns {Object.<string,*>} JSON object
|
||
|
*/
|
||
|
HttpRule.prototype.toJSON = function toJSON() {
|
||
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||
|
};
|
||
|
|
||
|
return HttpRule;
|
||
|
})();
|
||
|
|
||
|
api.CustomHttpPattern = (function() {
|
||
|
|
||
|
/**
|
||
|
* Properties of a CustomHttpPattern.
|
||
|
* @memberof google.api
|
||
|
* @interface ICustomHttpPattern
|
||
|
* @property {string|null} [kind] CustomHttpPattern kind
|
||
|
* @property {string|null} [path] CustomHttpPattern path
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Constructs a new CustomHttpPattern.
|
||
|
* @memberof google.api
|
||
|
* @classdesc Represents a CustomHttpPattern.
|
||
|
* @implements ICustomHttpPattern
|
||
|
* @constructor
|
||
|
* @param {google.api.ICustomHttpPattern=} [properties] Properties to set
|
||
|
*/
|
||
|
function CustomHttpPattern(properties) {
|
||
|
if (properties)
|
||
|
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||
|
if (properties[keys[i]] != null)
|
||
|
this[keys[i]] = properties[keys[i]];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* CustomHttpPattern kind.
|
||
|
* @member {string} kind
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @instance
|
||
|
*/
|
||
|
CustomHttpPattern.prototype.kind = "";
|
||
|
|
||
|
/**
|
||
|
* CustomHttpPattern path.
|
||
|
* @member {string} path
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @instance
|
||
|
*/
|
||
|
CustomHttpPattern.prototype.path = "";
|
||
|
|
||
|
/**
|
||
|
* Creates a new CustomHttpPattern instance using the specified properties.
|
||
|
* @function create
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {google.api.ICustomHttpPattern=} [properties] Properties to set
|
||
|
* @returns {google.api.CustomHttpPattern} CustomHttpPattern instance
|
||
|
*/
|
||
|
CustomHttpPattern.create = function create(properties) {
|
||
|
return new CustomHttpPattern(properties);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages.
|
||
|
* @function encode
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
CustomHttpPattern.encode = function encode(message, writer) {
|
||
|
if (!writer)
|
||
|
writer = $Writer.create();
|
||
|
if (message.kind != null && Object.hasOwnProperty.call(message, "kind"))
|
||
|
writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind);
|
||
|
if (message.path != null && Object.hasOwnProperty.call(message, "path"))
|
||
|
writer.uint32(/* id 2, wireType 2 =*/18).string(message.path);
|
||
|
return writer;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages.
|
||
|
* @function encodeDelimited
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode
|
||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||
|
* @returns {$protobuf.Writer} Writer
|
||
|
*/
|
||
|
CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) {
|
||
|
return this.encode(message, writer).ldelim();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a CustomHttpPattern message from the specified reader or buffer.
|
||
|
* @function decode
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @param {number} [length] Message length if known beforehand
|
||
|
* @returns {google.api.CustomHttpPattern} CustomHttpPattern
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
CustomHttpPattern.decode = function decode(reader, length) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = $Reader.create(reader);
|
||
|
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern();
|
||
|
while (reader.pos < end) {
|
||
|
var tag = reader.uint32();
|
||
|
switch (tag >>> 3) {
|
||
|
case 1:
|
||
|
message.kind = reader.string();
|
||
|
break;
|
||
|
case 2:
|
||
|
message.path = reader.string();
|
||
|
break;
|
||
|
default:
|
||
|
reader.skipType(tag & 7);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited.
|
||
|
* @function decodeDelimited
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||
|
* @returns {google.api.CustomHttpPattern} CustomHttpPattern
|
||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||
|
*/
|
||
|
CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) {
|
||
|
if (!(reader instanceof $Reader))
|
||
|
reader = new $Reader(reader);
|
||
|
return this.decode(reader, reader.uint32());
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Verifies a CustomHttpPattern message.
|
||
|
* @function verify
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} message Plain object to verify
|
||
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||
|
*/
|
||
|
CustomHttpPattern.verify = function verify(message) {
|
||
|
if (typeof message !== "object" || message === null)
|
||
|
return "object expected";
|
||
|
if (message.kind != null && message.hasOwnProperty("kind"))
|
||
|
if (!$util.isString(message.kind))
|
||
|
return "kind: string expected";
|
||
|
if (message.path != null && message.hasOwnProperty("path"))
|
||
|
if (!$util.isString(message.path))
|
||
|
return "path: string expected";
|
||
|
return null;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types.
|
||
|
* @function fromObject
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {Object.<string,*>} object Plain object
|
||
|
* @returns {google.api.CustomHttpPattern} CustomHttpPattern
|
||
|
*/
|
||
|
CustomHttpPattern.fromObject = function fromObject(object) {
|
||
|
if (object instanceof $root.google.api.CustomHttpPattern)
|
||
|
return object;
|
||
|
var message = new $root.google.api.CustomHttpPattern();
|
||
|
if (object.kind != null)
|
||
|
message.kind = String(object.kind);
|
||
|
if (object.path != null)
|
||
|
message.path = String(object.path);
|
||
|
return message;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified.
|
||
|
* @function toObject
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @static
|
||
|
* @param {google.api.CustomHttpPattern} message CustomHttpPattern
|
||
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||
|
* @returns {Object.<string,*>} Plain object
|
||
|
*/
|
||
|
CustomHttpPattern.toObject = function toObject(message, options) {
|
||
|
if (!options)
|
||
|
options = {};
|
||
|
var object = {};
|
||
|
if (options.defaults) {
|
||
|
object.kind = "";
|
||
|
object.path = "";
|
||
|
}
|
||
|
if (message.kind != null && message.hasOwnProperty("kind"))
|
||
|
object.kind = message.kind;
|
||
|
if (message.path != null && message.hasOwnProperty("path"))
|
||
|
object.path = message.path;
|
||
|
return object;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Converts this CustomHttpPattern to JSON.
|
||
|
* @function toJSON
|
||
|
* @memberof google.api.CustomHttpPattern
|
||
|
* @instance
|
||
|
* @returns {Object.<string,*>} JSON object
|
||
|
*/
|
||
|
CustomHttpPattern.prototype.toJSON = function toJSON() {
|
||
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||
|
};
|
||
|
|
||
|
return CustomHttpPattern;
|
||
|
})();
|
||
|
|
||
|
return api;
|
||
|
})();
|
||
|
|
||
|
return google;
|
||
|
})();
|
||
|
|
||
|
return $root;
|
||
|
});
|