1221 lines
44 KiB
JavaScript
1221 lines
44 KiB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
|
"use strict";
|
|
|
|
var $protobuf = require("protobufjs/minimal.js");
|
|
|
|
// Common aliases
|
|
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
|
|
|
// Exported root namespace
|
|
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
|
|
|
|
$root.LoginReq = (function() {
|
|
|
|
/**
|
|
* Properties of a LoginReq.
|
|
* @exports ILoginReq
|
|
* @interface ILoginReq
|
|
* @property {string|null} [username] LoginReq username
|
|
* @property {string|null} [password] LoginReq password
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new LoginReq.
|
|
* @exports LoginReq
|
|
* @classdesc Represents a LoginReq.
|
|
* @implements ILoginReq
|
|
* @constructor
|
|
* @param {ILoginReq=} [properties] Properties to set
|
|
*/
|
|
function LoginReq(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]];
|
|
}
|
|
|
|
/**
|
|
* LoginReq username.
|
|
* @member {string} username
|
|
* @memberof LoginReq
|
|
* @instance
|
|
*/
|
|
LoginReq.prototype.username = "";
|
|
|
|
/**
|
|
* LoginReq password.
|
|
* @member {string} password
|
|
* @memberof LoginReq
|
|
* @instance
|
|
*/
|
|
LoginReq.prototype.password = "";
|
|
|
|
/**
|
|
* Creates a new LoginReq instance using the specified properties.
|
|
* @function create
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {ILoginReq=} [properties] Properties to set
|
|
* @returns {LoginReq} LoginReq instance
|
|
*/
|
|
LoginReq.create = function create(properties) {
|
|
return new LoginReq(properties);
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified LoginReq message. Does not implicitly {@link LoginReq.verify|verify} messages.
|
|
* @function encode
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {ILoginReq} message LoginReq message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
LoginReq.encode = function encode(message, writer) {
|
|
if (!writer)
|
|
writer = $Writer.create();
|
|
if (message.username != null && Object.hasOwnProperty.call(message, "username"))
|
|
writer.uint32(/* id 1, wireType 2 =*/10).string(message.username);
|
|
if (message.password != null && Object.hasOwnProperty.call(message, "password"))
|
|
writer.uint32(/* id 2, wireType 2 =*/18).string(message.password);
|
|
return writer;
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified LoginReq message, length delimited. Does not implicitly {@link LoginReq.verify|verify} messages.
|
|
* @function encodeDelimited
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {ILoginReq} message LoginReq message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
LoginReq.encodeDelimited = function encodeDelimited(message, writer) {
|
|
return this.encode(message, writer).ldelim();
|
|
};
|
|
|
|
/**
|
|
* Decodes a LoginReq message from the specified reader or buffer.
|
|
* @function decode
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @param {number} [length] Message length if known beforehand
|
|
* @returns {LoginReq} LoginReq
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
LoginReq.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.LoginReq();
|
|
while (reader.pos < end) {
|
|
var tag = reader.uint32();
|
|
if (tag === error)
|
|
break;
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
message.username = reader.string();
|
|
break;
|
|
}
|
|
case 2: {
|
|
message.password = reader.string();
|
|
break;
|
|
}
|
|
default:
|
|
reader.skipType(tag & 7);
|
|
break;
|
|
}
|
|
}
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Decodes a LoginReq message from the specified reader or buffer, length delimited.
|
|
* @function decodeDelimited
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @returns {LoginReq} LoginReq
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
LoginReq.decodeDelimited = function decodeDelimited(reader) {
|
|
if (!(reader instanceof $Reader))
|
|
reader = new $Reader(reader);
|
|
return this.decode(reader, reader.uint32());
|
|
};
|
|
|
|
/**
|
|
* Verifies a LoginReq message.
|
|
* @function verify
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {Object.<string,*>} message Plain object to verify
|
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
*/
|
|
LoginReq.verify = function verify(message) {
|
|
if (typeof message !== "object" || message === null)
|
|
return "object expected";
|
|
if (message.username != null && message.hasOwnProperty("username"))
|
|
if (!$util.isString(message.username))
|
|
return "username: string expected";
|
|
if (message.password != null && message.hasOwnProperty("password"))
|
|
if (!$util.isString(message.password))
|
|
return "password: string expected";
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Creates a LoginReq message from a plain object. Also converts values to their respective internal types.
|
|
* @function fromObject
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {Object.<string,*>} object Plain object
|
|
* @returns {LoginReq} LoginReq
|
|
*/
|
|
LoginReq.fromObject = function fromObject(object) {
|
|
if (object instanceof $root.LoginReq)
|
|
return object;
|
|
var message = new $root.LoginReq();
|
|
if (object.username != null)
|
|
message.username = String(object.username);
|
|
if (object.password != null)
|
|
message.password = String(object.password);
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Creates a plain object from a LoginReq message. Also converts values to other types if specified.
|
|
* @function toObject
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {LoginReq} message LoginReq
|
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
* @returns {Object.<string,*>} Plain object
|
|
*/
|
|
LoginReq.toObject = function toObject(message, options) {
|
|
if (!options)
|
|
options = {};
|
|
var object = {};
|
|
if (options.defaults) {
|
|
object.username = "";
|
|
object.password = "";
|
|
}
|
|
if (message.username != null && message.hasOwnProperty("username"))
|
|
object.username = message.username;
|
|
if (message.password != null && message.hasOwnProperty("password"))
|
|
object.password = message.password;
|
|
return object;
|
|
};
|
|
|
|
/**
|
|
* Converts this LoginReq to JSON.
|
|
* @function toJSON
|
|
* @memberof LoginReq
|
|
* @instance
|
|
* @returns {Object.<string,*>} JSON object
|
|
*/
|
|
LoginReq.prototype.toJSON = function toJSON() {
|
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
};
|
|
|
|
/**
|
|
* Gets the default type url for LoginReq
|
|
* @function getTypeUrl
|
|
* @memberof LoginReq
|
|
* @static
|
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
* @returns {string} The default type url
|
|
*/
|
|
LoginReq.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
if (typeUrlPrefix === undefined) {
|
|
typeUrlPrefix = "type.googleapis.com";
|
|
}
|
|
return typeUrlPrefix + "/LoginReq";
|
|
};
|
|
|
|
return LoginReq;
|
|
})();
|
|
|
|
$root.LoginRes = (function() {
|
|
|
|
/**
|
|
* Properties of a LoginRes.
|
|
* @exports ILoginRes
|
|
* @interface ILoginRes
|
|
* @property {boolean|null} [success] LoginRes success
|
|
* @property {string|null} [token] LoginRes token
|
|
* @property {string|null} [message] LoginRes message
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new LoginRes.
|
|
* @exports LoginRes
|
|
* @classdesc Represents a LoginRes.
|
|
* @implements ILoginRes
|
|
* @constructor
|
|
* @param {ILoginRes=} [properties] Properties to set
|
|
*/
|
|
function LoginRes(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]];
|
|
}
|
|
|
|
/**
|
|
* LoginRes success.
|
|
* @member {boolean} success
|
|
* @memberof LoginRes
|
|
* @instance
|
|
*/
|
|
LoginRes.prototype.success = false;
|
|
|
|
/**
|
|
* LoginRes token.
|
|
* @member {string} token
|
|
* @memberof LoginRes
|
|
* @instance
|
|
*/
|
|
LoginRes.prototype.token = "";
|
|
|
|
/**
|
|
* LoginRes message.
|
|
* @member {string} message
|
|
* @memberof LoginRes
|
|
* @instance
|
|
*/
|
|
LoginRes.prototype.message = "";
|
|
|
|
/**
|
|
* Creates a new LoginRes instance using the specified properties.
|
|
* @function create
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {ILoginRes=} [properties] Properties to set
|
|
* @returns {LoginRes} LoginRes instance
|
|
*/
|
|
LoginRes.create = function create(properties) {
|
|
return new LoginRes(properties);
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified LoginRes message. Does not implicitly {@link LoginRes.verify|verify} messages.
|
|
* @function encode
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {ILoginRes} message LoginRes message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
LoginRes.encode = function encode(message, writer) {
|
|
if (!writer)
|
|
writer = $Writer.create();
|
|
if (message.success != null && Object.hasOwnProperty.call(message, "success"))
|
|
writer.uint32(/* id 1, wireType 0 =*/8).bool(message.success);
|
|
if (message.token != null && Object.hasOwnProperty.call(message, "token"))
|
|
writer.uint32(/* id 2, wireType 2 =*/18).string(message.token);
|
|
if (message.message != null && Object.hasOwnProperty.call(message, "message"))
|
|
writer.uint32(/* id 3, wireType 2 =*/26).string(message.message);
|
|
return writer;
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified LoginRes message, length delimited. Does not implicitly {@link LoginRes.verify|verify} messages.
|
|
* @function encodeDelimited
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {ILoginRes} message LoginRes message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
LoginRes.encodeDelimited = function encodeDelimited(message, writer) {
|
|
return this.encode(message, writer).ldelim();
|
|
};
|
|
|
|
/**
|
|
* Decodes a LoginRes message from the specified reader or buffer.
|
|
* @function decode
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @param {number} [length] Message length if known beforehand
|
|
* @returns {LoginRes} LoginRes
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
LoginRes.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.LoginRes();
|
|
while (reader.pos < end) {
|
|
var tag = reader.uint32();
|
|
if (tag === error)
|
|
break;
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
message.success = reader.bool();
|
|
break;
|
|
}
|
|
case 2: {
|
|
message.token = reader.string();
|
|
break;
|
|
}
|
|
case 3: {
|
|
message.message = reader.string();
|
|
break;
|
|
}
|
|
default:
|
|
reader.skipType(tag & 7);
|
|
break;
|
|
}
|
|
}
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Decodes a LoginRes message from the specified reader or buffer, length delimited.
|
|
* @function decodeDelimited
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @returns {LoginRes} LoginRes
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
LoginRes.decodeDelimited = function decodeDelimited(reader) {
|
|
if (!(reader instanceof $Reader))
|
|
reader = new $Reader(reader);
|
|
return this.decode(reader, reader.uint32());
|
|
};
|
|
|
|
/**
|
|
* Verifies a LoginRes message.
|
|
* @function verify
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {Object.<string,*>} message Plain object to verify
|
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
*/
|
|
LoginRes.verify = function verify(message) {
|
|
if (typeof message !== "object" || message === null)
|
|
return "object expected";
|
|
if (message.success != null && message.hasOwnProperty("success"))
|
|
if (typeof message.success !== "boolean")
|
|
return "success: boolean expected";
|
|
if (message.token != null && message.hasOwnProperty("token"))
|
|
if (!$util.isString(message.token))
|
|
return "token: string expected";
|
|
if (message.message != null && message.hasOwnProperty("message"))
|
|
if (!$util.isString(message.message))
|
|
return "message: string expected";
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Creates a LoginRes message from a plain object. Also converts values to their respective internal types.
|
|
* @function fromObject
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {Object.<string,*>} object Plain object
|
|
* @returns {LoginRes} LoginRes
|
|
*/
|
|
LoginRes.fromObject = function fromObject(object) {
|
|
if (object instanceof $root.LoginRes)
|
|
return object;
|
|
var message = new $root.LoginRes();
|
|
if (object.success != null)
|
|
message.success = Boolean(object.success);
|
|
if (object.token != null)
|
|
message.token = String(object.token);
|
|
if (object.message != null)
|
|
message.message = String(object.message);
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Creates a plain object from a LoginRes message. Also converts values to other types if specified.
|
|
* @function toObject
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {LoginRes} message LoginRes
|
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
* @returns {Object.<string,*>} Plain object
|
|
*/
|
|
LoginRes.toObject = function toObject(message, options) {
|
|
if (!options)
|
|
options = {};
|
|
var object = {};
|
|
if (options.defaults) {
|
|
object.success = false;
|
|
object.token = "";
|
|
object.message = "";
|
|
}
|
|
if (message.success != null && message.hasOwnProperty("success"))
|
|
object.success = message.success;
|
|
if (message.token != null && message.hasOwnProperty("token"))
|
|
object.token = message.token;
|
|
if (message.message != null && message.hasOwnProperty("message"))
|
|
object.message = message.message;
|
|
return object;
|
|
};
|
|
|
|
/**
|
|
* Converts this LoginRes to JSON.
|
|
* @function toJSON
|
|
* @memberof LoginRes
|
|
* @instance
|
|
* @returns {Object.<string,*>} JSON object
|
|
*/
|
|
LoginRes.prototype.toJSON = function toJSON() {
|
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
};
|
|
|
|
/**
|
|
* Gets the default type url for LoginRes
|
|
* @function getTypeUrl
|
|
* @memberof LoginRes
|
|
* @static
|
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
* @returns {string} The default type url
|
|
*/
|
|
LoginRes.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
if (typeUrlPrefix === undefined) {
|
|
typeUrlPrefix = "type.googleapis.com";
|
|
}
|
|
return typeUrlPrefix + "/LoginRes";
|
|
};
|
|
|
|
return LoginRes;
|
|
})();
|
|
|
|
$root.user = (function() {
|
|
|
|
/**
|
|
* Namespace user.
|
|
* @exports user
|
|
* @namespace
|
|
*/
|
|
var user = {};
|
|
|
|
user.UserInfo = (function() {
|
|
|
|
/**
|
|
* Properties of a UserInfo.
|
|
* @memberof user
|
|
* @interface IUserInfo
|
|
* @property {number|null} [id] UserInfo id
|
|
* @property {string|null} [nickname] UserInfo nickname
|
|
* @property {string|null} [email] UserInfo email
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new UserInfo.
|
|
* @memberof user
|
|
* @classdesc Represents a UserInfo.
|
|
* @implements IUserInfo
|
|
* @constructor
|
|
* @param {user.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 id.
|
|
* @member {number} id
|
|
* @memberof user.UserInfo
|
|
* @instance
|
|
*/
|
|
UserInfo.prototype.id = 0;
|
|
|
|
/**
|
|
* UserInfo nickname.
|
|
* @member {string} nickname
|
|
* @memberof user.UserInfo
|
|
* @instance
|
|
*/
|
|
UserInfo.prototype.nickname = "";
|
|
|
|
/**
|
|
* UserInfo email.
|
|
* @member {string} email
|
|
* @memberof user.UserInfo
|
|
* @instance
|
|
*/
|
|
UserInfo.prototype.email = "";
|
|
|
|
/**
|
|
* Creates a new UserInfo instance using the specified properties.
|
|
* @function create
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {user.IUserInfo=} [properties] Properties to set
|
|
* @returns {user.UserInfo} UserInfo instance
|
|
*/
|
|
UserInfo.create = function create(properties) {
|
|
return new UserInfo(properties);
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified UserInfo message. Does not implicitly {@link user.UserInfo.verify|verify} messages.
|
|
* @function encode
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {user.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.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id);
|
|
if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname"))
|
|
writer.uint32(/* id 2, wireType 2 =*/18).string(message.nickname);
|
|
if (message.email != null && Object.hasOwnProperty.call(message, "email"))
|
|
writer.uint32(/* id 3, wireType 2 =*/26).string(message.email);
|
|
return writer;
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified UserInfo message, length delimited. Does not implicitly {@link user.UserInfo.verify|verify} messages.
|
|
* @function encodeDelimited
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {user.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 user.UserInfo
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @param {number} [length] Message length if known beforehand
|
|
* @returns {user.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, error) {
|
|
if (!(reader instanceof $Reader))
|
|
reader = $Reader.create(reader);
|
|
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.user.UserInfo();
|
|
while (reader.pos < end) {
|
|
var tag = reader.uint32();
|
|
if (tag === error)
|
|
break;
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
message.id = reader.int32();
|
|
break;
|
|
}
|
|
case 2: {
|
|
message.nickname = reader.string();
|
|
break;
|
|
}
|
|
case 3: {
|
|
message.email = 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 user.UserInfo
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @returns {user.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 user.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.id != null && message.hasOwnProperty("id"))
|
|
if (!$util.isInteger(message.id))
|
|
return "id: integer expected";
|
|
if (message.nickname != null && message.hasOwnProperty("nickname"))
|
|
if (!$util.isString(message.nickname))
|
|
return "nickname: string expected";
|
|
if (message.email != null && message.hasOwnProperty("email"))
|
|
if (!$util.isString(message.email))
|
|
return "email: string expected";
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Creates a UserInfo message from a plain object. Also converts values to their respective internal types.
|
|
* @function fromObject
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {Object.<string,*>} object Plain object
|
|
* @returns {user.UserInfo} UserInfo
|
|
*/
|
|
UserInfo.fromObject = function fromObject(object) {
|
|
if (object instanceof $root.user.UserInfo)
|
|
return object;
|
|
var message = new $root.user.UserInfo();
|
|
if (object.id != null)
|
|
message.id = object.id | 0;
|
|
if (object.nickname != null)
|
|
message.nickname = String(object.nickname);
|
|
if (object.email != null)
|
|
message.email = String(object.email);
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Creates a plain object from a UserInfo message. Also converts values to other types if specified.
|
|
* @function toObject
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {user.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) {
|
|
object.id = 0;
|
|
object.nickname = "";
|
|
object.email = "";
|
|
}
|
|
if (message.id != null && message.hasOwnProperty("id"))
|
|
object.id = message.id;
|
|
if (message.nickname != null && message.hasOwnProperty("nickname"))
|
|
object.nickname = message.nickname;
|
|
if (message.email != null && message.hasOwnProperty("email"))
|
|
object.email = message.email;
|
|
return object;
|
|
};
|
|
|
|
/**
|
|
* Converts this UserInfo to JSON.
|
|
* @function toJSON
|
|
* @memberof user.UserInfo
|
|
* @instance
|
|
* @returns {Object.<string,*>} JSON object
|
|
*/
|
|
UserInfo.prototype.toJSON = function toJSON() {
|
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
};
|
|
|
|
/**
|
|
* Gets the default type url for UserInfo
|
|
* @function getTypeUrl
|
|
* @memberof user.UserInfo
|
|
* @static
|
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
* @returns {string} The default type url
|
|
*/
|
|
UserInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
if (typeUrlPrefix === undefined) {
|
|
typeUrlPrefix = "type.googleapis.com";
|
|
}
|
|
return typeUrlPrefix + "/user.UserInfo";
|
|
};
|
|
|
|
return UserInfo;
|
|
})();
|
|
|
|
user.GetUserReq = (function() {
|
|
|
|
/**
|
|
* Properties of a GetUserReq.
|
|
* @memberof user
|
|
* @interface IGetUserReq
|
|
* @property {number|null} [id] GetUserReq id
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new GetUserReq.
|
|
* @memberof user
|
|
* @classdesc Represents a GetUserReq.
|
|
* @implements IGetUserReq
|
|
* @constructor
|
|
* @param {user.IGetUserReq=} [properties] Properties to set
|
|
*/
|
|
function GetUserReq(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]];
|
|
}
|
|
|
|
/**
|
|
* GetUserReq id.
|
|
* @member {number} id
|
|
* @memberof user.GetUserReq
|
|
* @instance
|
|
*/
|
|
GetUserReq.prototype.id = 0;
|
|
|
|
/**
|
|
* Creates a new GetUserReq instance using the specified properties.
|
|
* @function create
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {user.IGetUserReq=} [properties] Properties to set
|
|
* @returns {user.GetUserReq} GetUserReq instance
|
|
*/
|
|
GetUserReq.create = function create(properties) {
|
|
return new GetUserReq(properties);
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified GetUserReq message. Does not implicitly {@link user.GetUserReq.verify|verify} messages.
|
|
* @function encode
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {user.IGetUserReq} message GetUserReq message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
GetUserReq.encode = function encode(message, writer) {
|
|
if (!writer)
|
|
writer = $Writer.create();
|
|
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id);
|
|
return writer;
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified GetUserReq message, length delimited. Does not implicitly {@link user.GetUserReq.verify|verify} messages.
|
|
* @function encodeDelimited
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {user.IGetUserReq} message GetUserReq message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
GetUserReq.encodeDelimited = function encodeDelimited(message, writer) {
|
|
return this.encode(message, writer).ldelim();
|
|
};
|
|
|
|
/**
|
|
* Decodes a GetUserReq message from the specified reader or buffer.
|
|
* @function decode
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @param {number} [length] Message length if known beforehand
|
|
* @returns {user.GetUserReq} GetUserReq
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
GetUserReq.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.user.GetUserReq();
|
|
while (reader.pos < end) {
|
|
var tag = reader.uint32();
|
|
if (tag === error)
|
|
break;
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
message.id = reader.int32();
|
|
break;
|
|
}
|
|
default:
|
|
reader.skipType(tag & 7);
|
|
break;
|
|
}
|
|
}
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Decodes a GetUserReq message from the specified reader or buffer, length delimited.
|
|
* @function decodeDelimited
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @returns {user.GetUserReq} GetUserReq
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
GetUserReq.decodeDelimited = function decodeDelimited(reader) {
|
|
if (!(reader instanceof $Reader))
|
|
reader = new $Reader(reader);
|
|
return this.decode(reader, reader.uint32());
|
|
};
|
|
|
|
/**
|
|
* Verifies a GetUserReq message.
|
|
* @function verify
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {Object.<string,*>} message Plain object to verify
|
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
*/
|
|
GetUserReq.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))
|
|
return "id: integer expected";
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Creates a GetUserReq message from a plain object. Also converts values to their respective internal types.
|
|
* @function fromObject
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {Object.<string,*>} object Plain object
|
|
* @returns {user.GetUserReq} GetUserReq
|
|
*/
|
|
GetUserReq.fromObject = function fromObject(object) {
|
|
if (object instanceof $root.user.GetUserReq)
|
|
return object;
|
|
var message = new $root.user.GetUserReq();
|
|
if (object.id != null)
|
|
message.id = object.id | 0;
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Creates a plain object from a GetUserReq message. Also converts values to other types if specified.
|
|
* @function toObject
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {user.GetUserReq} message GetUserReq
|
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
* @returns {Object.<string,*>} Plain object
|
|
*/
|
|
GetUserReq.toObject = function toObject(message, options) {
|
|
if (!options)
|
|
options = {};
|
|
var object = {};
|
|
if (options.defaults)
|
|
object.id = 0;
|
|
if (message.id != null && message.hasOwnProperty("id"))
|
|
object.id = message.id;
|
|
return object;
|
|
};
|
|
|
|
/**
|
|
* Converts this GetUserReq to JSON.
|
|
* @function toJSON
|
|
* @memberof user.GetUserReq
|
|
* @instance
|
|
* @returns {Object.<string,*>} JSON object
|
|
*/
|
|
GetUserReq.prototype.toJSON = function toJSON() {
|
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
};
|
|
|
|
/**
|
|
* Gets the default type url for GetUserReq
|
|
* @function getTypeUrl
|
|
* @memberof user.GetUserReq
|
|
* @static
|
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
* @returns {string} The default type url
|
|
*/
|
|
GetUserReq.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
if (typeUrlPrefix === undefined) {
|
|
typeUrlPrefix = "type.googleapis.com";
|
|
}
|
|
return typeUrlPrefix + "/user.GetUserReq";
|
|
};
|
|
|
|
return GetUserReq;
|
|
})();
|
|
|
|
user.GetUserRes = (function() {
|
|
|
|
/**
|
|
* Properties of a GetUserRes.
|
|
* @memberof user
|
|
* @interface IGetUserRes
|
|
* @property {boolean|null} [success] GetUserRes success
|
|
* @property {user.IUserInfo|null} [data] GetUserRes data
|
|
* @property {string|null} [message] GetUserRes message
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new GetUserRes.
|
|
* @memberof user
|
|
* @classdesc Represents a GetUserRes.
|
|
* @implements IGetUserRes
|
|
* @constructor
|
|
* @param {user.IGetUserRes=} [properties] Properties to set
|
|
*/
|
|
function GetUserRes(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]];
|
|
}
|
|
|
|
/**
|
|
* GetUserRes success.
|
|
* @member {boolean} success
|
|
* @memberof user.GetUserRes
|
|
* @instance
|
|
*/
|
|
GetUserRes.prototype.success = false;
|
|
|
|
/**
|
|
* GetUserRes data.
|
|
* @member {user.IUserInfo|null|undefined} data
|
|
* @memberof user.GetUserRes
|
|
* @instance
|
|
*/
|
|
GetUserRes.prototype.data = null;
|
|
|
|
/**
|
|
* GetUserRes message.
|
|
* @member {string} message
|
|
* @memberof user.GetUserRes
|
|
* @instance
|
|
*/
|
|
GetUserRes.prototype.message = "";
|
|
|
|
/**
|
|
* Creates a new GetUserRes instance using the specified properties.
|
|
* @function create
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {user.IGetUserRes=} [properties] Properties to set
|
|
* @returns {user.GetUserRes} GetUserRes instance
|
|
*/
|
|
GetUserRes.create = function create(properties) {
|
|
return new GetUserRes(properties);
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified GetUserRes message. Does not implicitly {@link user.GetUserRes.verify|verify} messages.
|
|
* @function encode
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {user.IGetUserRes} message GetUserRes message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
GetUserRes.encode = function encode(message, writer) {
|
|
if (!writer)
|
|
writer = $Writer.create();
|
|
if (message.success != null && Object.hasOwnProperty.call(message, "success"))
|
|
writer.uint32(/* id 1, wireType 0 =*/8).bool(message.success);
|
|
if (message.data != null && Object.hasOwnProperty.call(message, "data"))
|
|
$root.user.UserInfo.encode(message.data, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
if (message.message != null && Object.hasOwnProperty.call(message, "message"))
|
|
writer.uint32(/* id 3, wireType 2 =*/26).string(message.message);
|
|
return writer;
|
|
};
|
|
|
|
/**
|
|
* Encodes the specified GetUserRes message, length delimited. Does not implicitly {@link user.GetUserRes.verify|verify} messages.
|
|
* @function encodeDelimited
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {user.IGetUserRes} message GetUserRes message or plain object to encode
|
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
* @returns {$protobuf.Writer} Writer
|
|
*/
|
|
GetUserRes.encodeDelimited = function encodeDelimited(message, writer) {
|
|
return this.encode(message, writer).ldelim();
|
|
};
|
|
|
|
/**
|
|
* Decodes a GetUserRes message from the specified reader or buffer.
|
|
* @function decode
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @param {number} [length] Message length if known beforehand
|
|
* @returns {user.GetUserRes} GetUserRes
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
GetUserRes.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.user.GetUserRes();
|
|
while (reader.pos < end) {
|
|
var tag = reader.uint32();
|
|
if (tag === error)
|
|
break;
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
message.success = reader.bool();
|
|
break;
|
|
}
|
|
case 2: {
|
|
message.data = $root.user.UserInfo.decode(reader, reader.uint32());
|
|
break;
|
|
}
|
|
case 3: {
|
|
message.message = reader.string();
|
|
break;
|
|
}
|
|
default:
|
|
reader.skipType(tag & 7);
|
|
break;
|
|
}
|
|
}
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Decodes a GetUserRes message from the specified reader or buffer, length delimited.
|
|
* @function decodeDelimited
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
* @returns {user.GetUserRes} GetUserRes
|
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
*/
|
|
GetUserRes.decodeDelimited = function decodeDelimited(reader) {
|
|
if (!(reader instanceof $Reader))
|
|
reader = new $Reader(reader);
|
|
return this.decode(reader, reader.uint32());
|
|
};
|
|
|
|
/**
|
|
* Verifies a GetUserRes message.
|
|
* @function verify
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {Object.<string,*>} message Plain object to verify
|
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
*/
|
|
GetUserRes.verify = function verify(message) {
|
|
if (typeof message !== "object" || message === null)
|
|
return "object expected";
|
|
if (message.success != null && message.hasOwnProperty("success"))
|
|
if (typeof message.success !== "boolean")
|
|
return "success: boolean expected";
|
|
if (message.data != null && message.hasOwnProperty("data")) {
|
|
var error = $root.user.UserInfo.verify(message.data);
|
|
if (error)
|
|
return "data." + error;
|
|
}
|
|
if (message.message != null && message.hasOwnProperty("message"))
|
|
if (!$util.isString(message.message))
|
|
return "message: string expected";
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Creates a GetUserRes message from a plain object. Also converts values to their respective internal types.
|
|
* @function fromObject
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {Object.<string,*>} object Plain object
|
|
* @returns {user.GetUserRes} GetUserRes
|
|
*/
|
|
GetUserRes.fromObject = function fromObject(object) {
|
|
if (object instanceof $root.user.GetUserRes)
|
|
return object;
|
|
var message = new $root.user.GetUserRes();
|
|
if (object.success != null)
|
|
message.success = Boolean(object.success);
|
|
if (object.data != null) {
|
|
if (typeof object.data !== "object")
|
|
throw TypeError(".user.GetUserRes.data: object expected");
|
|
message.data = $root.user.UserInfo.fromObject(object.data);
|
|
}
|
|
if (object.message != null)
|
|
message.message = String(object.message);
|
|
return message;
|
|
};
|
|
|
|
/**
|
|
* Creates a plain object from a GetUserRes message. Also converts values to other types if specified.
|
|
* @function toObject
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {user.GetUserRes} message GetUserRes
|
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
* @returns {Object.<string,*>} Plain object
|
|
*/
|
|
GetUserRes.toObject = function toObject(message, options) {
|
|
if (!options)
|
|
options = {};
|
|
var object = {};
|
|
if (options.defaults) {
|
|
object.success = false;
|
|
object.data = null;
|
|
object.message = "";
|
|
}
|
|
if (message.success != null && message.hasOwnProperty("success"))
|
|
object.success = message.success;
|
|
if (message.data != null && message.hasOwnProperty("data"))
|
|
object.data = $root.user.UserInfo.toObject(message.data, options);
|
|
if (message.message != null && message.hasOwnProperty("message"))
|
|
object.message = message.message;
|
|
return object;
|
|
};
|
|
|
|
/**
|
|
* Converts this GetUserRes to JSON.
|
|
* @function toJSON
|
|
* @memberof user.GetUserRes
|
|
* @instance
|
|
* @returns {Object.<string,*>} JSON object
|
|
*/
|
|
GetUserRes.prototype.toJSON = function toJSON() {
|
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
};
|
|
|
|
/**
|
|
* Gets the default type url for GetUserRes
|
|
* @function getTypeUrl
|
|
* @memberof user.GetUserRes
|
|
* @static
|
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
* @returns {string} The default type url
|
|
*/
|
|
GetUserRes.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
if (typeUrlPrefix === undefined) {
|
|
typeUrlPrefix = "type.googleapis.com";
|
|
}
|
|
return typeUrlPrefix + "/user.GetUserRes";
|
|
};
|
|
|
|
return GetUserRes;
|
|
})();
|
|
|
|
return user;
|
|
})();
|
|
|
|
module.exports = $root;
|
|
|
|
module.exports.default = module.exports; |