123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491 |
- /*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
- (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.tutorial = (function() {
-
- /**
- * Namespace tutorial.
- * @exports tutorial
- * @namespace
- */
- var tutorial = {};
-
- tutorial.Message = (function() {
-
- /**
- * Properties of a Message.
- * @memberof tutorial
- * @interface IMessage
- * @property {tutorial.Message.Type|null} [type] Message type
- * @property {tutorial.Message.IChatMessage|null} [chatMessage] Message chatMessage
- * @property {tutorial.Message.ICommonMessage|null} [commonMessage] Message commonMessage
- * @property {tutorial.Message.IDataMessage|null} [dataMessage] Message dataMessage
- */
-
- /**
- * Constructs a new Message.
- * @memberof tutorial
- * @classdesc Represents a Message.
- * @implements IMessage
- * @constructor
- * @param {tutorial.IMessage=} [properties] Properties to set
- */
- function Message(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]];
- }
-
- /**
- * Message type.
- * @member {tutorial.Message.Type} type
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.type = 0;
-
- /**
- * Message chatMessage.
- * @member {tutorial.Message.IChatMessage|null|undefined} chatMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.chatMessage = null;
-
- /**
- * Message commonMessage.
- * @member {tutorial.Message.ICommonMessage|null|undefined} commonMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.commonMessage = null;
-
- /**
- * Message dataMessage.
- * @member {tutorial.Message.IDataMessage|null|undefined} dataMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.dataMessage = null;
-
- /**
- * Creates a new Message instance using the specified properties.
- * @function create
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage=} [properties] Properties to set
- * @returns {tutorial.Message} Message instance
- */
- Message.create = function create(properties) {
- return new Message(properties);
- };
-
- /**
- * Encodes the specified Message message. Does not implicitly {@link tutorial.Message.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage} message Message message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- Message.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.type != null && message.hasOwnProperty("type"))
- writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
- if (message.chatMessage != null && message.hasOwnProperty("chatMessage"))
- $root.tutorial.Message.ChatMessage.encode(message.chatMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
- if (message.commonMessage != null && message.hasOwnProperty("commonMessage"))
- $root.tutorial.Message.CommonMessage.encode(message.commonMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
- $root.tutorial.Message.DataMessage.encode(message.dataMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
- return writer;
- };
-
- /**
- * Encodes the specified Message message, length delimited. Does not implicitly {@link tutorial.Message.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage} message Message message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- Message.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a Message message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message} Message
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- Message.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.tutorial.Message();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.type = reader.int32();
- break;
- case 2:
- message.chatMessage = $root.tutorial.Message.ChatMessage.decode(reader, reader.uint32());
- break;
- case 3:
- message.commonMessage = $root.tutorial.Message.CommonMessage.decode(reader, reader.uint32());
- break;
- case 4:
- message.dataMessage = $root.tutorial.Message.DataMessage.decode(reader, reader.uint32());
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a Message message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message} Message
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- Message.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a Message message.
- * @function verify
- * @memberof tutorial.Message
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- Message.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.type != null && message.hasOwnProperty("type"))
- switch (message.type) {
- default:
- return "type: enum value expected";
- case 0:
- case 1:
- case 2:
- break;
- }
- if (message.chatMessage != null && message.hasOwnProperty("chatMessage")) {
- var error = $root.tutorial.Message.ChatMessage.verify(message.chatMessage);
- if (error)
- return "chatMessage." + error;
- }
- if (message.commonMessage != null && message.hasOwnProperty("commonMessage")) {
- var error = $root.tutorial.Message.CommonMessage.verify(message.commonMessage);
- if (error)
- return "commonMessage." + error;
- }
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage")) {
- var error = $root.tutorial.Message.DataMessage.verify(message.dataMessage);
- if (error)
- return "dataMessage." + error;
- }
- return null;
- };
-
- /**
- * Creates a Message message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message} Message
- */
- Message.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message)
- return object;
- var message = new $root.tutorial.Message();
- switch (object.type) {
- case "COMMON":
- case 0:
- message.type = 0;
- break;
- case "CHAT":
- case 1:
- message.type = 1;
- break;
- case "DATA":
- case 2:
- message.type = 2;
- break;
- }
- if (object.chatMessage != null) {
- if (typeof object.chatMessage !== "object")
- throw TypeError(".tutorial.Message.chatMessage: object expected");
- message.chatMessage = $root.tutorial.Message.ChatMessage.fromObject(object.chatMessage);
- }
- if (object.commonMessage != null) {
- if (typeof object.commonMessage !== "object")
- throw TypeError(".tutorial.Message.commonMessage: object expected");
- message.commonMessage = $root.tutorial.Message.CommonMessage.fromObject(object.commonMessage);
- }
- if (object.dataMessage != null) {
- if (typeof object.dataMessage !== "object")
- throw TypeError(".tutorial.Message.dataMessage: object expected");
- message.dataMessage = $root.tutorial.Message.DataMessage.fromObject(object.dataMessage);
- }
- return message;
- };
-
- /**
- * Creates a plain object from a Message message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.Message} message Message
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- Message.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- object.type = options.enums === String ? "COMMON" : 0;
- object.chatMessage = null;
- object.commonMessage = null;
- object.dataMessage = null;
- }
- if (message.type != null && message.hasOwnProperty("type"))
- object.type = options.enums === String ? $root.tutorial.Message.Type[message.type] : message.type;
- if (message.chatMessage != null && message.hasOwnProperty("chatMessage"))
- object.chatMessage = $root.tutorial.Message.ChatMessage.toObject(message.chatMessage, options);
- if (message.commonMessage != null && message.hasOwnProperty("commonMessage"))
- object.commonMessage = $root.tutorial.Message.CommonMessage.toObject(message.commonMessage, options);
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
- object.dataMessage = $root.tutorial.Message.DataMessage.toObject(message.dataMessage, options);
- return object;
- };
-
- /**
- * Converts this Message to JSON.
- * @function toJSON
- * @memberof tutorial.Message
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- Message.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- /**
- * Type enum.
- * @name tutorial.Message.Type
- * @enum {string}
- * @property {number} COMMON=0 COMMON value
- * @property {number} CHAT=1 CHAT value
- * @property {number} DATA=2 DATA value
- */
- Message.Type = (function() {
- var valuesById = {}, values = Object.create(valuesById);
- values[valuesById[0] = "COMMON"] = 0;
- values[valuesById[1] = "CHAT"] = 1;
- values[valuesById[2] = "DATA"] = 2;
- return values;
- })();
-
- Message.ChatMessage = (function() {
-
- /**
- * Properties of a ChatMessage.
- * @memberof tutorial.Message
- * @interface IChatMessage
- * @property {number|Long|null} [id] ChatMessage id
- * @property {number|Long|null} [uid] ChatMessage uid
- * @property {number|Long|null} [receiveUid] ChatMessage receiveUid
- * @property {number|null} [bType] ChatMessage bType
- * @property {number|null} [contentType] ChatMessage contentType
- * @property {string|null} [msg] ChatMessage msg
- * @property {number|null} [contentLen] ChatMessage contentLen
- * @property {number|null} [hasAuth] ChatMessage hasAuth
- * @property {number|Long|null} [sendTime] ChatMessage sendTime
- * @property {number|null} [isRead] ChatMessage isRead
- * @property {tutorial.Message.IUserInfo|null} [sender] ChatMessage sender
- */
-
- /**
- * Constructs a new ChatMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a ChatMessage.
- * @implements IChatMessage
- * @constructor
- * @param {tutorial.Message.IChatMessage=} [properties] Properties to set
- */
- function ChatMessage(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]];
- }
-
- /**
- * ChatMessage id.
- * @member {number|Long} id
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * ChatMessage uid.
- * @member {number|Long} uid
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.uid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * ChatMessage receiveUid.
- * @member {number|Long} receiveUid
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.receiveUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * ChatMessage bType.
- * @member {number} bType
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.bType = 0;
-
- /**
- * ChatMessage contentType.
- * @member {number} contentType
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.contentType = 0;
-
- /**
- * ChatMessage msg.
- * @member {string} msg
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.msg = "";
-
- /**
- * ChatMessage contentLen.
- * @member {number} contentLen
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.contentLen = 0;
-
- /**
- * ChatMessage hasAuth.
- * @member {number} hasAuth
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.hasAuth = 0;
-
- /**
- * ChatMessage sendTime.
- * @member {number|Long} sendTime
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.sendTime = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * ChatMessage isRead.
- * @member {number} isRead
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.isRead = 0;
-
- /**
- * ChatMessage sender.
- * @member {tutorial.Message.IUserInfo|null|undefined} sender
- * @memberof tutorial.Message.ChatMessage
- * @instance
- */
- ChatMessage.prototype.sender = null;
-
- /**
- * Creates a new ChatMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {tutorial.Message.IChatMessage=} [properties] Properties to set
- * @returns {tutorial.Message.ChatMessage} ChatMessage instance
- */
- ChatMessage.create = function create(properties) {
- return new ChatMessage(properties);
- };
-
- /**
- * Encodes the specified ChatMessage message. Does not implicitly {@link tutorial.Message.ChatMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {tutorial.Message.IChatMessage} message ChatMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- ChatMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.id != null && message.hasOwnProperty("id"))
- writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id);
- if (message.uid != null && message.hasOwnProperty("uid"))
- writer.uint32(/* id 2, wireType 0 =*/16).int64(message.uid);
- if (message.receiveUid != null && message.hasOwnProperty("receiveUid"))
- writer.uint32(/* id 3, wireType 0 =*/24).int64(message.receiveUid);
- if (message.bType != null && message.hasOwnProperty("bType"))
- writer.uint32(/* id 4, wireType 0 =*/32).int32(message.bType);
- if (message.contentType != null && message.hasOwnProperty("contentType"))
- writer.uint32(/* id 5, wireType 0 =*/40).int32(message.contentType);
- if (message.msg != null && message.hasOwnProperty("msg"))
- writer.uint32(/* id 6, wireType 2 =*/50).string(message.msg);
- if (message.contentLen != null && message.hasOwnProperty("contentLen"))
- writer.uint32(/* id 7, wireType 0 =*/56).int32(message.contentLen);
- if (message.hasAuth != null && message.hasOwnProperty("hasAuth"))
- writer.uint32(/* id 8, wireType 0 =*/64).int32(message.hasAuth);
- if (message.sendTime != null && message.hasOwnProperty("sendTime"))
- writer.uint32(/* id 9, wireType 0 =*/72).int64(message.sendTime);
- if (message.isRead != null && message.hasOwnProperty("isRead"))
- writer.uint32(/* id 10, wireType 0 =*/80).int32(message.isRead);
- if (message.sender != null && message.hasOwnProperty("sender"))
- $root.tutorial.Message.UserInfo.encode(message.sender, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
- return writer;
- };
-
- /**
- * Encodes the specified ChatMessage message, length delimited. Does not implicitly {@link tutorial.Message.ChatMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {tutorial.Message.IChatMessage} message ChatMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- ChatMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a ChatMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.ChatMessage} ChatMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- ChatMessage.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.tutorial.Message.ChatMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.id = reader.int64();
- break;
- case 2:
- message.uid = reader.int64();
- break;
- case 3:
- message.receiveUid = reader.int64();
- break;
- case 4:
- message.bType = reader.int32();
- break;
- case 5:
- message.contentType = reader.int32();
- break;
- case 6:
- message.msg = reader.string();
- break;
- case 7:
- message.contentLen = reader.int32();
- break;
- case 8:
- message.hasAuth = reader.int32();
- break;
- case 9:
- message.sendTime = reader.int64();
- break;
- case 10:
- message.isRead = reader.int32();
- break;
- case 11:
- message.sender = $root.tutorial.Message.UserInfo.decode(reader, reader.uint32());
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a ChatMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.ChatMessage} ChatMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- ChatMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a ChatMessage message.
- * @function verify
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- ChatMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.id != null && message.hasOwnProperty("id"))
- if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
- return "id: integer|Long expected";
- if (message.uid != null && message.hasOwnProperty("uid"))
- if (!$util.isInteger(message.uid) && !(message.uid && $util.isInteger(message.uid.low) && $util.isInteger(message.uid.high)))
- return "uid: integer|Long expected";
- if (message.receiveUid != null && message.hasOwnProperty("receiveUid"))
- if (!$util.isInteger(message.receiveUid) && !(message.receiveUid && $util.isInteger(message.receiveUid.low) && $util.isInteger(message.receiveUid.high)))
- return "receiveUid: integer|Long expected";
- if (message.bType != null && message.hasOwnProperty("bType"))
- if (!$util.isInteger(message.bType))
- return "bType: integer expected";
- if (message.contentType != null && message.hasOwnProperty("contentType"))
- if (!$util.isInteger(message.contentType))
- return "contentType: integer expected";
- if (message.msg != null && message.hasOwnProperty("msg"))
- if (!$util.isString(message.msg))
- return "msg: string expected";
- if (message.contentLen != null && message.hasOwnProperty("contentLen"))
- if (!$util.isInteger(message.contentLen))
- return "contentLen: integer expected";
- if (message.hasAuth != null && message.hasOwnProperty("hasAuth"))
- if (!$util.isInteger(message.hasAuth))
- return "hasAuth: integer expected";
- if (message.sendTime != null && message.hasOwnProperty("sendTime"))
- if (!$util.isInteger(message.sendTime) && !(message.sendTime && $util.isInteger(message.sendTime.low) && $util.isInteger(message.sendTime.high)))
- return "sendTime: integer|Long expected";
- if (message.isRead != null && message.hasOwnProperty("isRead"))
- if (!$util.isInteger(message.isRead))
- return "isRead: integer expected";
- if (message.sender != null && message.hasOwnProperty("sender")) {
- var error = $root.tutorial.Message.UserInfo.verify(message.sender);
- if (error)
- return "sender." + error;
- }
- return null;
- };
-
- /**
- * Creates a ChatMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.ChatMessage} ChatMessage
- */
- ChatMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.ChatMessage)
- return object;
- var message = new $root.tutorial.Message.ChatMessage();
- if (object.id != null)
- if ($util.Long)
- (message.id = $util.Long.fromValue(object.id)).unsigned = false;
- else if (typeof object.id === "string")
- message.id = parseInt(object.id, 10);
- else if (typeof object.id === "number")
- message.id = object.id;
- else if (typeof object.id === "object")
- message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber();
- if (object.uid != null)
- if ($util.Long)
- (message.uid = $util.Long.fromValue(object.uid)).unsigned = false;
- else if (typeof object.uid === "string")
- message.uid = parseInt(object.uid, 10);
- else if (typeof object.uid === "number")
- message.uid = object.uid;
- else if (typeof object.uid === "object")
- message.uid = new $util.LongBits(object.uid.low >>> 0, object.uid.high >>> 0).toNumber();
- if (object.receiveUid != null)
- if ($util.Long)
- (message.receiveUid = $util.Long.fromValue(object.receiveUid)).unsigned = false;
- else if (typeof object.receiveUid === "string")
- message.receiveUid = parseInt(object.receiveUid, 10);
- else if (typeof object.receiveUid === "number")
- message.receiveUid = object.receiveUid;
- else if (typeof object.receiveUid === "object")
- message.receiveUid = new $util.LongBits(object.receiveUid.low >>> 0, object.receiveUid.high >>> 0).toNumber();
- if (object.bType != null)
- message.bType = object.bType | 0;
- if (object.contentType != null)
- message.contentType = object.contentType | 0;
- if (object.msg != null)
- message.msg = String(object.msg);
- if (object.contentLen != null)
- message.contentLen = object.contentLen | 0;
- if (object.hasAuth != null)
- message.hasAuth = object.hasAuth | 0;
- if (object.sendTime != null)
- if ($util.Long)
- (message.sendTime = $util.Long.fromValue(object.sendTime)).unsigned = false;
- else if (typeof object.sendTime === "string")
- message.sendTime = parseInt(object.sendTime, 10);
- else if (typeof object.sendTime === "number")
- message.sendTime = object.sendTime;
- else if (typeof object.sendTime === "object")
- message.sendTime = new $util.LongBits(object.sendTime.low >>> 0, object.sendTime.high >>> 0).toNumber();
- if (object.isRead != null)
- message.isRead = object.isRead | 0;
- if (object.sender != null) {
- if (typeof object.sender !== "object")
- throw TypeError(".tutorial.Message.ChatMessage.sender: object expected");
- message.sender = $root.tutorial.Message.UserInfo.fromObject(object.sender);
- }
- return message;
- };
-
- /**
- * Creates a plain object from a ChatMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.ChatMessage
- * @static
- * @param {tutorial.Message.ChatMessage} message ChatMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- ChatMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.id = options.longs === String ? "0" : 0;
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.uid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.uid = options.longs === String ? "0" : 0;
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.receiveUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.receiveUid = options.longs === String ? "0" : 0;
- object.bType = 0;
- object.contentType = 0;
- object.msg = "";
- object.contentLen = 0;
- object.hasAuth = 0;
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.sendTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.sendTime = options.longs === String ? "0" : 0;
- object.isRead = 0;
- object.sender = null;
- }
- if (message.id != null && message.hasOwnProperty("id"))
- if (typeof message.id === "number")
- object.id = options.longs === String ? String(message.id) : message.id;
- else
- object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id;
- if (message.uid != null && message.hasOwnProperty("uid"))
- if (typeof message.uid === "number")
- object.uid = options.longs === String ? String(message.uid) : message.uid;
- else
- object.uid = options.longs === String ? $util.Long.prototype.toString.call(message.uid) : options.longs === Number ? new $util.LongBits(message.uid.low >>> 0, message.uid.high >>> 0).toNumber() : message.uid;
- if (message.receiveUid != null && message.hasOwnProperty("receiveUid"))
- if (typeof message.receiveUid === "number")
- object.receiveUid = options.longs === String ? String(message.receiveUid) : message.receiveUid;
- else
- object.receiveUid = options.longs === String ? $util.Long.prototype.toString.call(message.receiveUid) : options.longs === Number ? new $util.LongBits(message.receiveUid.low >>> 0, message.receiveUid.high >>> 0).toNumber() : message.receiveUid;
- if (message.bType != null && message.hasOwnProperty("bType"))
- object.bType = message.bType;
- if (message.contentType != null && message.hasOwnProperty("contentType"))
- object.contentType = message.contentType;
- if (message.msg != null && message.hasOwnProperty("msg"))
- object.msg = message.msg;
- if (message.contentLen != null && message.hasOwnProperty("contentLen"))
- object.contentLen = message.contentLen;
- if (message.hasAuth != null && message.hasOwnProperty("hasAuth"))
- object.hasAuth = message.hasAuth;
- if (message.sendTime != null && message.hasOwnProperty("sendTime"))
- if (typeof message.sendTime === "number")
- object.sendTime = options.longs === String ? String(message.sendTime) : message.sendTime;
- else
- object.sendTime = options.longs === String ? $util.Long.prototype.toString.call(message.sendTime) : options.longs === Number ? new $util.LongBits(message.sendTime.low >>> 0, message.sendTime.high >>> 0).toNumber() : message.sendTime;
- if (message.isRead != null && message.hasOwnProperty("isRead"))
- object.isRead = message.isRead;
- if (message.sender != null && message.hasOwnProperty("sender"))
- object.sender = $root.tutorial.Message.UserInfo.toObject(message.sender, options);
- return object;
- };
-
- /**
- * Converts this ChatMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.ChatMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- ChatMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return ChatMessage;
- })();
-
- Message.CommonMessage = (function() {
-
- /**
- * Properties of a CommonMessage.
- * @memberof tutorial.Message
- * @interface ICommonMessage
- * @property {string|null} [msg] CommonMessage msg
- */
-
- /**
- * Constructs a new CommonMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a CommonMessage.
- * @implements ICommonMessage
- * @constructor
- * @param {tutorial.Message.ICommonMessage=} [properties] Properties to set
- */
- function CommonMessage(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]];
- }
-
- /**
- * CommonMessage msg.
- * @member {string} msg
- * @memberof tutorial.Message.CommonMessage
- * @instance
- */
- CommonMessage.prototype.msg = "";
-
- /**
- * Creates a new CommonMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {tutorial.Message.ICommonMessage=} [properties] Properties to set
- * @returns {tutorial.Message.CommonMessage} CommonMessage instance
- */
- CommonMessage.create = function create(properties) {
- return new CommonMessage(properties);
- };
-
- /**
- * Encodes the specified CommonMessage message. Does not implicitly {@link tutorial.Message.CommonMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {tutorial.Message.ICommonMessage} message CommonMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- CommonMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.msg != null && message.hasOwnProperty("msg"))
- writer.uint32(/* id 1, wireType 2 =*/10).string(message.msg);
- return writer;
- };
-
- /**
- * Encodes the specified CommonMessage message, length delimited. Does not implicitly {@link tutorial.Message.CommonMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {tutorial.Message.ICommonMessage} message CommonMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- CommonMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a CommonMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.CommonMessage} CommonMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- CommonMessage.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.tutorial.Message.CommonMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.msg = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a CommonMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.CommonMessage} CommonMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- CommonMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a CommonMessage message.
- * @function verify
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- CommonMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.msg != null && message.hasOwnProperty("msg"))
- if (!$util.isString(message.msg))
- return "msg: string expected";
- return null;
- };
-
- /**
- * Creates a CommonMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.CommonMessage} CommonMessage
- */
- CommonMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.CommonMessage)
- return object;
- var message = new $root.tutorial.Message.CommonMessage();
- if (object.msg != null)
- message.msg = String(object.msg);
- return message;
- };
-
- /**
- * Creates a plain object from a CommonMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.CommonMessage
- * @static
- * @param {tutorial.Message.CommonMessage} message CommonMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- CommonMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults)
- object.msg = "";
- if (message.msg != null && message.hasOwnProperty("msg"))
- object.msg = message.msg;
- return object;
- };
-
- /**
- * Converts this CommonMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.CommonMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- CommonMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return CommonMessage;
- })();
-
- Message.DataMessage = (function() {
-
- /**
- * Properties of a DataMessage.
- * @memberof tutorial.Message
- * @interface IDataMessage
- * @property {number|null} [code] DataMessage code
- * @property {number|null} [result] DataMessage result
- * @property {string|null} [data] DataMessage data
- * @property {string|null} [msg] DataMessage msg
- */
-
- /**
- * Constructs a new DataMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a DataMessage.
- * @implements IDataMessage
- * @constructor
- * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
- */
- function DataMessage(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]];
- }
-
- /**
- * DataMessage code.
- * @member {number} code
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.code = 0;
-
- /**
- * DataMessage result.
- * @member {number} result
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.result = 0;
-
- /**
- * DataMessage data.
- * @member {string} data
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.data = "";
-
- /**
- * DataMessage msg.
- * @member {string} msg
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.msg = "";
-
- /**
- * Creates a new DataMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
- * @returns {tutorial.Message.DataMessage} DataMessage instance
- */
- DataMessage.create = function create(properties) {
- return new DataMessage(properties);
- };
-
- /**
- * Encodes the specified DataMessage message. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- DataMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.code != null && message.hasOwnProperty("code"))
- writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
- if (message.result != null && message.hasOwnProperty("result"))
- writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result);
- if (message.data != null && message.hasOwnProperty("data"))
- writer.uint32(/* id 3, wireType 2 =*/26).string(message.data);
- if (message.msg != null && message.hasOwnProperty("msg"))
- writer.uint32(/* id 4, wireType 2 =*/34).string(message.msg);
- return writer;
- };
-
- /**
- * Encodes the specified DataMessage message, length delimited. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- DataMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a DataMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.DataMessage} DataMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- DataMessage.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.tutorial.Message.DataMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.code = reader.int32();
- break;
- case 2:
- message.result = reader.int32();
- break;
- case 3:
- message.data = reader.string();
- break;
- case 4:
- message.msg = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a DataMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.DataMessage} DataMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- DataMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a DataMessage message.
- * @function verify
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- DataMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.code != null && message.hasOwnProperty("code"))
- if (!$util.isInteger(message.code))
- return "code: integer expected";
- if (message.result != null && message.hasOwnProperty("result"))
- if (!$util.isInteger(message.result))
- return "result: integer expected";
- if (message.data != null && message.hasOwnProperty("data"))
- if (!$util.isString(message.data))
- return "data: string expected";
- if (message.msg != null && message.hasOwnProperty("msg"))
- if (!$util.isString(message.msg))
- return "msg: string expected";
- return null;
- };
-
- /**
- * Creates a DataMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.DataMessage} DataMessage
- */
- DataMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.DataMessage)
- return object;
- var message = new $root.tutorial.Message.DataMessage();
- if (object.code != null)
- message.code = object.code | 0;
- if (object.result != null)
- message.result = object.result | 0;
- if (object.data != null)
- message.data = String(object.data);
- if (object.msg != null)
- message.msg = String(object.msg);
- return message;
- };
-
- /**
- * Creates a plain object from a DataMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.DataMessage} message DataMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- DataMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- object.code = 0;
- object.result = 0;
- object.data = "";
- object.msg = "";
- }
- if (message.code != null && message.hasOwnProperty("code"))
- object.code = message.code;
- if (message.result != null && message.hasOwnProperty("result"))
- object.result = message.result;
- if (message.data != null && message.hasOwnProperty("data"))
- object.data = message.data;
- if (message.msg != null && message.hasOwnProperty("msg"))
- object.msg = message.msg;
- return object;
- };
-
- /**
- * Converts this DataMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.DataMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- DataMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return DataMessage;
- })();
-
- Message.UserInfo = (function() {
-
- /**
- * Properties of a UserInfo.
- * @memberof tutorial.Message
- * @interface IUserInfo
- * @property {number|Long|null} [uid] UserInfo uid
- * @property {string|null} [nick] UserInfo nick
- * @property {string|null} [head] UserInfo head
- */
-
- /**
- * Constructs a new UserInfo.
- * @memberof tutorial.Message
- * @classdesc Represents a UserInfo.
- * @implements IUserInfo
- * @constructor
- * @param {tutorial.Message.IUserInfo=} [properties] Properties to set
- */
- function UserInfo(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]];
- }
-
- /**
- * UserInfo uid.
- * @member {number|Long} uid
- * @memberof tutorial.Message.UserInfo
- * @instance
- */
- UserInfo.prototype.uid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * UserInfo nick.
- * @member {string} nick
- * @memberof tutorial.Message.UserInfo
- * @instance
- */
- UserInfo.prototype.nick = "";
-
- /**
- * UserInfo head.
- * @member {string} head
- * @memberof tutorial.Message.UserInfo
- * @instance
- */
- UserInfo.prototype.head = "";
-
- /**
- * Creates a new UserInfo instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {tutorial.Message.IUserInfo=} [properties] Properties to set
- * @returns {tutorial.Message.UserInfo} UserInfo instance
- */
- UserInfo.create = function create(properties) {
- return new UserInfo(properties);
- };
-
- /**
- * Encodes the specified UserInfo message. Does not implicitly {@link tutorial.Message.UserInfo.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {tutorial.Message.IUserInfo} message UserInfo message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- UserInfo.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.uid != null && message.hasOwnProperty("uid"))
- writer.uint32(/* id 1, wireType 0 =*/8).int64(message.uid);
- if (message.nick != null && message.hasOwnProperty("nick"))
- writer.uint32(/* id 2, wireType 2 =*/18).string(message.nick);
- if (message.head != null && message.hasOwnProperty("head"))
- writer.uint32(/* id 3, wireType 2 =*/26).string(message.head);
- return writer;
- };
-
- /**
- * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link tutorial.Message.UserInfo.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {tutorial.Message.IUserInfo} message UserInfo message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- UserInfo.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a UserInfo message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.UserInfo} UserInfo
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- UserInfo.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.tutorial.Message.UserInfo();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.uid = reader.int64();
- break;
- case 2:
- message.nick = reader.string();
- break;
- case 3:
- message.head = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a UserInfo message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.UserInfo} UserInfo
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- UserInfo.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a UserInfo message.
- * @function verify
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- UserInfo.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.uid != null && message.hasOwnProperty("uid"))
- if (!$util.isInteger(message.uid) && !(message.uid && $util.isInteger(message.uid.low) && $util.isInteger(message.uid.high)))
- return "uid: integer|Long expected";
- if (message.nick != null && message.hasOwnProperty("nick"))
- if (!$util.isString(message.nick))
- return "nick: string expected";
- if (message.head != null && message.hasOwnProperty("head"))
- if (!$util.isString(message.head))
- return "head: string expected";
- return null;
- };
-
- /**
- * Creates a UserInfo message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.UserInfo} UserInfo
- */
- UserInfo.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.UserInfo)
- return object;
- var message = new $root.tutorial.Message.UserInfo();
- if (object.uid != null)
- if ($util.Long)
- (message.uid = $util.Long.fromValue(object.uid)).unsigned = false;
- else if (typeof object.uid === "string")
- message.uid = parseInt(object.uid, 10);
- else if (typeof object.uid === "number")
- message.uid = object.uid;
- else if (typeof object.uid === "object")
- message.uid = new $util.LongBits(object.uid.low >>> 0, object.uid.high >>> 0).toNumber();
- if (object.nick != null)
- message.nick = String(object.nick);
- if (object.head != null)
- message.head = String(object.head);
- return message;
- };
-
- /**
- * Creates a plain object from a UserInfo message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.UserInfo
- * @static
- * @param {tutorial.Message.UserInfo} message UserInfo
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- UserInfo.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.uid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.uid = options.longs === String ? "0" : 0;
- object.nick = "";
- object.head = "";
- }
- if (message.uid != null && message.hasOwnProperty("uid"))
- if (typeof message.uid === "number")
- object.uid = options.longs === String ? String(message.uid) : message.uid;
- else
- object.uid = options.longs === String ? $util.Long.prototype.toString.call(message.uid) : options.longs === Number ? new $util.LongBits(message.uid.low >>> 0, message.uid.high >>> 0).toNumber() : message.uid;
- if (message.nick != null && message.hasOwnProperty("nick"))
- object.nick = message.nick;
- if (message.head != null && message.hasOwnProperty("head"))
- object.head = message.head;
- return object;
- };
-
- /**
- * Converts this UserInfo to JSON.
- * @function toJSON
- * @memberof tutorial.Message.UserInfo
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- UserInfo.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return UserInfo;
- })();
-
- return Message;
- })();
-
- return tutorial;
- })();
- return $root;
- });
|