node-cs2
Version:
Modern CS2/CS:GO Game Coordinator integration with latest GameTracking-CS2 protobuf definitions. Includes support for highlight_reel, wrapped_sticker, variations, Promise-based API, crate opening, sticker/patch/keychain operations, and all modern CS2 fiel
987 lines (906 loc) • 377 kB
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.COAuthToken_ImplicitGrantNoPrompt_Request = (function() {
/**
* Properties of a COAuthToken_ImplicitGrantNoPrompt_Request.
* @exports ICOAuthToken_ImplicitGrantNoPrompt_Request
* @interface ICOAuthToken_ImplicitGrantNoPrompt_Request
* @property {string|null} [clientid] COAuthToken_ImplicitGrantNoPrompt_Request clientid
*/
/**
* Constructs a new COAuthToken_ImplicitGrantNoPrompt_Request.
* @exports COAuthToken_ImplicitGrantNoPrompt_Request
* @classdesc Represents a COAuthToken_ImplicitGrantNoPrompt_Request.
* @implements ICOAuthToken_ImplicitGrantNoPrompt_Request
* @constructor
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request=} [properties] Properties to set
*/
function COAuthToken_ImplicitGrantNoPrompt_Request(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]];
}
/**
* COAuthToken_ImplicitGrantNoPrompt_Request clientid.
* @member {string} clientid
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @instance
*/
COAuthToken_ImplicitGrantNoPrompt_Request.prototype.clientid = "";
/**
* Creates a new COAuthToken_ImplicitGrantNoPrompt_Request instance using the specified properties.
* @function create
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request=} [properties] Properties to set
* @returns {COAuthToken_ImplicitGrantNoPrompt_Request} COAuthToken_ImplicitGrantNoPrompt_Request instance
*/
COAuthToken_ImplicitGrantNoPrompt_Request.create = function create(properties) {
return new COAuthToken_ImplicitGrantNoPrompt_Request(properties);
};
/**
* Encodes the specified COAuthToken_ImplicitGrantNoPrompt_Request message. Does not implicitly {@link COAuthToken_ImplicitGrantNoPrompt_Request.verify|verify} messages.
* @function encode
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request} message COAuthToken_ImplicitGrantNoPrompt_Request message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
COAuthToken_ImplicitGrantNoPrompt_Request.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.clientid != null && Object.hasOwnProperty.call(message, "clientid"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.clientid);
return writer;
};
/**
* Encodes the specified COAuthToken_ImplicitGrantNoPrompt_Request message, length delimited. Does not implicitly {@link COAuthToken_ImplicitGrantNoPrompt_Request.verify|verify} messages.
* @function encodeDelimited
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request} message COAuthToken_ImplicitGrantNoPrompt_Request message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
COAuthToken_ImplicitGrantNoPrompt_Request.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a COAuthToken_ImplicitGrantNoPrompt_Request message from the specified reader or buffer.
* @function decode
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {COAuthToken_ImplicitGrantNoPrompt_Request} COAuthToken_ImplicitGrantNoPrompt_Request
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
COAuthToken_ImplicitGrantNoPrompt_Request.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.COAuthToken_ImplicitGrantNoPrompt_Request();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.clientid = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a COAuthToken_ImplicitGrantNoPrompt_Request message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {COAuthToken_ImplicitGrantNoPrompt_Request} COAuthToken_ImplicitGrantNoPrompt_Request
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
COAuthToken_ImplicitGrantNoPrompt_Request.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a COAuthToken_ImplicitGrantNoPrompt_Request message.
* @function verify
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
COAuthToken_ImplicitGrantNoPrompt_Request.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.clientid != null && message.hasOwnProperty("clientid"))
if (!$util.isString(message.clientid))
return "clientid: string expected";
return null;
};
/**
* Creates a COAuthToken_ImplicitGrantNoPrompt_Request message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {Object.<string,*>} object Plain object
* @returns {COAuthToken_ImplicitGrantNoPrompt_Request} COAuthToken_ImplicitGrantNoPrompt_Request
*/
COAuthToken_ImplicitGrantNoPrompt_Request.fromObject = function fromObject(object) {
if (object instanceof $root.COAuthToken_ImplicitGrantNoPrompt_Request)
return object;
var message = new $root.COAuthToken_ImplicitGrantNoPrompt_Request();
if (object.clientid != null)
message.clientid = String(object.clientid);
return message;
};
/**
* Creates a plain object from a COAuthToken_ImplicitGrantNoPrompt_Request message. Also converts values to other types if specified.
* @function toObject
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {COAuthToken_ImplicitGrantNoPrompt_Request} message COAuthToken_ImplicitGrantNoPrompt_Request
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
COAuthToken_ImplicitGrantNoPrompt_Request.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.clientid = "";
if (message.clientid != null && message.hasOwnProperty("clientid"))
object.clientid = message.clientid;
return object;
};
/**
* Converts this COAuthToken_ImplicitGrantNoPrompt_Request to JSON.
* @function toJSON
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @instance
* @returns {Object.<string,*>} JSON object
*/
COAuthToken_ImplicitGrantNoPrompt_Request.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for COAuthToken_ImplicitGrantNoPrompt_Request
* @function getTypeUrl
* @memberof COAuthToken_ImplicitGrantNoPrompt_Request
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
COAuthToken_ImplicitGrantNoPrompt_Request.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/COAuthToken_ImplicitGrantNoPrompt_Request";
};
return COAuthToken_ImplicitGrantNoPrompt_Request;
})();
$root.COAuthToken_ImplicitGrantNoPrompt_Response = (function() {
/**
* Properties of a COAuthToken_ImplicitGrantNoPrompt_Response.
* @exports ICOAuthToken_ImplicitGrantNoPrompt_Response
* @interface ICOAuthToken_ImplicitGrantNoPrompt_Response
* @property {string|null} [access_token] COAuthToken_ImplicitGrantNoPrompt_Response access_token
* @property {string|null} [redirect_uri] COAuthToken_ImplicitGrantNoPrompt_Response redirect_uri
*/
/**
* Constructs a new COAuthToken_ImplicitGrantNoPrompt_Response.
* @exports COAuthToken_ImplicitGrantNoPrompt_Response
* @classdesc Represents a COAuthToken_ImplicitGrantNoPrompt_Response.
* @implements ICOAuthToken_ImplicitGrantNoPrompt_Response
* @constructor
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Response=} [properties] Properties to set
*/
function COAuthToken_ImplicitGrantNoPrompt_Response(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]];
}
/**
* COAuthToken_ImplicitGrantNoPrompt_Response access_token.
* @member {string} access_token
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @instance
*/
COAuthToken_ImplicitGrantNoPrompt_Response.prototype.access_token = "";
/**
* COAuthToken_ImplicitGrantNoPrompt_Response redirect_uri.
* @member {string} redirect_uri
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @instance
*/
COAuthToken_ImplicitGrantNoPrompt_Response.prototype.redirect_uri = "";
/**
* Creates a new COAuthToken_ImplicitGrantNoPrompt_Response instance using the specified properties.
* @function create
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Response=} [properties] Properties to set
* @returns {COAuthToken_ImplicitGrantNoPrompt_Response} COAuthToken_ImplicitGrantNoPrompt_Response instance
*/
COAuthToken_ImplicitGrantNoPrompt_Response.create = function create(properties) {
return new COAuthToken_ImplicitGrantNoPrompt_Response(properties);
};
/**
* Encodes the specified COAuthToken_ImplicitGrantNoPrompt_Response message. Does not implicitly {@link COAuthToken_ImplicitGrantNoPrompt_Response.verify|verify} messages.
* @function encode
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Response} message COAuthToken_ImplicitGrantNoPrompt_Response message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
COAuthToken_ImplicitGrantNoPrompt_Response.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.access_token != null && Object.hasOwnProperty.call(message, "access_token"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.access_token);
if (message.redirect_uri != null && Object.hasOwnProperty.call(message, "redirect_uri"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.redirect_uri);
return writer;
};
/**
* Encodes the specified COAuthToken_ImplicitGrantNoPrompt_Response message, length delimited. Does not implicitly {@link COAuthToken_ImplicitGrantNoPrompt_Response.verify|verify} messages.
* @function encodeDelimited
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Response} message COAuthToken_ImplicitGrantNoPrompt_Response message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
COAuthToken_ImplicitGrantNoPrompt_Response.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a COAuthToken_ImplicitGrantNoPrompt_Response message from the specified reader or buffer.
* @function decode
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {COAuthToken_ImplicitGrantNoPrompt_Response} COAuthToken_ImplicitGrantNoPrompt_Response
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
COAuthToken_ImplicitGrantNoPrompt_Response.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.COAuthToken_ImplicitGrantNoPrompt_Response();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.access_token = reader.string();
break;
}
case 2: {
message.redirect_uri = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a COAuthToken_ImplicitGrantNoPrompt_Response message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {COAuthToken_ImplicitGrantNoPrompt_Response} COAuthToken_ImplicitGrantNoPrompt_Response
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
COAuthToken_ImplicitGrantNoPrompt_Response.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a COAuthToken_ImplicitGrantNoPrompt_Response message.
* @function verify
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
COAuthToken_ImplicitGrantNoPrompt_Response.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.access_token != null && message.hasOwnProperty("access_token"))
if (!$util.isString(message.access_token))
return "access_token: string expected";
if (message.redirect_uri != null && message.hasOwnProperty("redirect_uri"))
if (!$util.isString(message.redirect_uri))
return "redirect_uri: string expected";
return null;
};
/**
* Creates a COAuthToken_ImplicitGrantNoPrompt_Response message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {Object.<string,*>} object Plain object
* @returns {COAuthToken_ImplicitGrantNoPrompt_Response} COAuthToken_ImplicitGrantNoPrompt_Response
*/
COAuthToken_ImplicitGrantNoPrompt_Response.fromObject = function fromObject(object) {
if (object instanceof $root.COAuthToken_ImplicitGrantNoPrompt_Response)
return object;
var message = new $root.COAuthToken_ImplicitGrantNoPrompt_Response();
if (object.access_token != null)
message.access_token = String(object.access_token);
if (object.redirect_uri != null)
message.redirect_uri = String(object.redirect_uri);
return message;
};
/**
* Creates a plain object from a COAuthToken_ImplicitGrantNoPrompt_Response message. Also converts values to other types if specified.
* @function toObject
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {COAuthToken_ImplicitGrantNoPrompt_Response} message COAuthToken_ImplicitGrantNoPrompt_Response
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
COAuthToken_ImplicitGrantNoPrompt_Response.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.access_token = "";
object.redirect_uri = "";
}
if (message.access_token != null && message.hasOwnProperty("access_token"))
object.access_token = message.access_token;
if (message.redirect_uri != null && message.hasOwnProperty("redirect_uri"))
object.redirect_uri = message.redirect_uri;
return object;
};
/**
* Converts this COAuthToken_ImplicitGrantNoPrompt_Response to JSON.
* @function toJSON
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @instance
* @returns {Object.<string,*>} JSON object
*/
COAuthToken_ImplicitGrantNoPrompt_Response.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for COAuthToken_ImplicitGrantNoPrompt_Response
* @function getTypeUrl
* @memberof COAuthToken_ImplicitGrantNoPrompt_Response
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
COAuthToken_ImplicitGrantNoPrompt_Response.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/COAuthToken_ImplicitGrantNoPrompt_Response";
};
return COAuthToken_ImplicitGrantNoPrompt_Response;
})();
$root.OAuthToken = (function() {
/**
* Constructs a new OAuthToken service.
* @exports OAuthToken
* @classdesc Represents a OAuthToken
* @extends $protobuf.rpc.Service
* @constructor
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
*/
function OAuthToken(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(OAuthToken.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = OAuthToken;
/**
* Creates new OAuthToken service using the specified rpc implementation.
* @function create
* @memberof OAuthToken
* @static
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
* @returns {OAuthToken} RPC service. Useful where requests and/or responses are streamed.
*/
OAuthToken.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link OAuthToken#implicitGrantNoPrompt}.
* @memberof OAuthToken
* @typedef ImplicitGrantNoPromptCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {COAuthToken_ImplicitGrantNoPrompt_Response} [response] COAuthToken_ImplicitGrantNoPrompt_Response
*/
/**
* Calls ImplicitGrantNoPrompt.
* @function implicitGrantNoPrompt
* @memberof OAuthToken
* @instance
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request} request COAuthToken_ImplicitGrantNoPrompt_Request message or plain object
* @param {OAuthToken.ImplicitGrantNoPromptCallback} callback Node-style callback called with the error, if any, and COAuthToken_ImplicitGrantNoPrompt_Response
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(OAuthToken.prototype.implicitGrantNoPrompt = function implicitGrantNoPrompt(request, callback) {
return this.rpcCall(implicitGrantNoPrompt, $root.COAuthToken_ImplicitGrantNoPrompt_Request, $root.COAuthToken_ImplicitGrantNoPrompt_Response, request, callback);
}, "name", { value: "ImplicitGrantNoPrompt" });
/**
* Calls ImplicitGrantNoPrompt.
* @function implicitGrantNoPrompt
* @memberof OAuthToken
* @instance
* @param {ICOAuthToken_ImplicitGrantNoPrompt_Request} request COAuthToken_ImplicitGrantNoPrompt_Request message or plain object
* @returns {Promise<COAuthToken_ImplicitGrantNoPrompt_Response>} Promise
* @variation 2
*/
return OAuthToken;
})();
/**
* EProtoExecutionSite enum.
* @exports EProtoExecutionSite
* @enum {number}
* @property {number} k_EProtoExecutionSiteUnknown=0 k_EProtoExecutionSiteUnknown value
* @property {number} k_EProtoExecutionSiteSteamClient=3 k_EProtoExecutionSiteSteamClient value
*/
$root.EProtoExecutionSite = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "k_EProtoExecutionSiteUnknown"] = 0;
values[valuesById[3] = "k_EProtoExecutionSiteSteamClient"] = 3;
return values;
})();
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.protobuf = (function() {
/**
* Namespace protobuf.
* @memberof google
* @namespace
*/
var protobuf = {};
protobuf.FileDescriptorSet = (function() {
/**
* Properties of a FileDescriptorSet.
* @memberof google.protobuf
* @interface IFileDescriptorSet
* @property {Array.<google.protobuf.IFileDescriptorProto>|null} [file] FileDescriptorSet file
*/
/**
* Constructs a new FileDescriptorSet.
* @memberof google.protobuf
* @classdesc Represents a FileDescriptorSet.
* @implements IFileDescriptorSet
* @constructor
* @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set
*/
function FileDescriptorSet(properties) {
this.file = [];
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]];
}
/**
* FileDescriptorSet file.
* @member {Array.<google.protobuf.IFileDescriptorProto>} file
* @memberof google.protobuf.FileDescriptorSet
* @instance
*/
FileDescriptorSet.prototype.file = $util.emptyArray;
/**
* Creates a new FileDescriptorSet instance using the specified properties.
* @function create
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set
* @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance
*/
FileDescriptorSet.create = function create(properties) {
return new FileDescriptorSet(properties);
};
/**
* Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages.
* @function encode
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FileDescriptorSet.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.file != null && message.file.length)
for (var i = 0; i < message.file.length; ++i)
$root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages.
* @function encodeDelimited
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a FileDescriptorSet message from the specified reader or buffer.
* @function decode
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
FileDescriptorSet.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
if (!(message.file && message.file.length))
message.file = [];
message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a FileDescriptorSet message.
* @function verify
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
FileDescriptorSet.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.file != null && message.hasOwnProperty("file")) {
if (!Array.isArray(message.file))
return "file: array expected";
for (var i = 0; i < message.file.length; ++i) {
var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]);
if (error)
return "file." + error;
}
}
return null;
};
/**
* Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet
*/
FileDescriptorSet.fromObject = function fromObject(object) {
if (object instanceof $root.google.protobuf.FileDescriptorSet)
return object;
var message = new $root.google.protobuf.FileDescriptorSet();
if (object.file) {
if (!Array.isArray(object.file))
throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected");
message.file = [];
for (var i = 0; i < object.file.length; ++i) {
if (typeof object.file[i] !== "object")
throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected");
message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]);
}
}
return message;
};
/**
* Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified.
* @function toObject
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
FileDescriptorSet.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.file = [];
if (message.file && message.file.length) {
object.file = [];
for (var j = 0; j < message.file.length; ++j)
object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options);
}
return object;
};
/**
* Converts this FileDescriptorSet to JSON.
* @function toJSON
* @memberof google.protobuf.FileDescriptorSet
* @instance
* @returns {Object.<string,*>} JSON object
*/
FileDescriptorSet.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for FileDescriptorSet
* @function getTypeUrl
* @memberof google.protobuf.FileDescriptorSet
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.protobuf.FileDescriptorSet";
};
return FileDescriptorSet;
})();
protobuf.FileDescriptorProto = (function() {
/**
* Properties of a FileDescriptorProto.
* @memberof google.protobuf
* @interface IFileDescriptorProto
* @property {string|null} [name] FileDescriptorProto name
* @property {string|null} ["package"] FileDescriptorProto package
* @property {Array.<string>|null} [dependency] FileDescriptorProto dependency
* @property {Array.<google.protobuf.IDescriptorProto>|null} [message_type] FileDescriptorProto message_type
* @property {Array.<google.protobuf.IEnumDescriptorProto>|null} [enum_type] FileDescriptorProto enum_type
* @property {Array.<google.protobuf.IServiceDescriptorProto>|null} [service] FileDescriptorProto service
* @property {Array.<google.protobuf.IFieldDescriptorProto>|null} [extension] FileDescriptorProto extension
* @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options
* @property {google.protobuf.ISourceCodeInfo|null} [source_code_info] FileDescriptorProto source_code_info
*/
/**
* Constructs a new FileDescriptorProto.
* @memberof google.protobuf
* @classdesc Represents a FileDescriptorProto.
* @implements IFileDescriptorProto
* @constructor
* @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set
*/
function FileDescriptorProto(properties) {
this.dependency = [];
this.message_type = [];
this.enum_type = [];
this.service = [];
this.extension = [];
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]];
}
/**
* FileDescriptorProto name.
* @member {string} name
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.name = "";
/**
* FileDescriptorProto package.
* @member {string} package
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype["package"] = "";
/**
* FileDescriptorProto dependency.
* @member {Array.<string>} dependency
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.dependency = $util.emptyArray;
/**
* FileDescriptorProto message_type.
* @member {Array.<google.protobuf.IDescriptorProto>} message_type
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.message_type = $util.emptyArray;
/**
* FileDescriptorProto enum_type.
* @member {Array.<google.protobuf.IEnumDescriptorProto>} enum_type
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.enum_type = $util.emptyArray;
/**
* FileDescriptorProto service.
* @member {Array.<google.protobuf.IServiceDescriptorProto>} service
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.service = $util.emptyArray;
/**
* FileDescriptorProto extension.
* @member {Array.<google.protobuf.IFieldDescriptorProto>} extension
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.extension = $util.emptyArray;
/**
* FileDescriptorProto options.
* @member {google.protobuf.IFileOptions|null|undefined} options
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.options = null;
/**
* FileDescriptorProto source_code_info.
* @member {google.protobuf.ISourceCodeInfo|null|undefined} source_code_info
* @memberof google.protobuf.FileDescriptorProto
* @instance
*/
FileDescriptorProto.prototype.source_code_info = null;
/**
* Creates a new FileDescriptorProto instance using the specified properties.
* @function create
* @memberof google.protobuf.FileDescriptorProto
* @static
* @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set
* @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance
*/
FileDescriptorProto.create = function create(properties) {
return new FileDescriptorProto(properties);
};
/**
* Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages.
* @function encode
* @memberof google.protobuf.FileDescriptorProto
* @static
* @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FileDescriptorProto.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
if (message["package"] != null && Object.hasOwnProperty.call(message, "package"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]);
if (message.dependency != null && message.dependency.length)
for (var i = 0; i < message.dependency.length; ++i)
writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]);
if (message.message_type != null && message.message_type.length)
for (var i = 0; i < message.message_type.length; ++i)
$root.google.protobuf.DescriptorProto.encode(message.message_type[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.enum_type != null && message.enum_type.length)
for (var i = 0; i < message.enum_type.length; ++i)
$root.google.protobuf.EnumDescriptorProto.encode(message.enum_type[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
if (message.service != null && message.service.length)
for (var i = 0; i < message.service.length; ++i)
$root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.extension != null && message.extension.length)
for (var i = 0; i < message.extension.length; ++i)
$root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.options != null && Object.hasOwnProperty.call(message, "options"))
$root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
if (message.source_code_info != null && Object.hasOwnProperty.call(message, "source_code_info"))
$root.google.protobuf.SourceCodeInfo.encode(message.source_code_info, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
return writer;
};
/**
* Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages.
* @function encodeDelimited
* @memberof google.protobuf.FileDescriptorProto
* @static
* @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a FileDescriptorProto message from the specified reader or buffer.
* @function decode
* @memberof google.protobuf.FileDescriptorProto
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
FileDescriptorProto.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
message["package"] = reader.string();
break;
}
case 3: {
if (!(message.dependency && message.dependency.length))
message.dependency = [];
message.dependency.push(reader.string());
break;
}
case 4: {
if (!(message.message_type && message.message_type.length))