cloudku-baileys
Version:
WhatsApp API Modification By AlfiDev
1,158 lines (1,076 loc) • 5.52 MB
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");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.Web = (function() {
/**
* Namespace Web.
* @exports Web
* @namespace
*/
var Web = {};
Web.Citation = (function() {
/**
* Properties of a Citation.
* @memberof Web
* @interface ICitation
* @property {string} title Citation title
* @property {string} subtitle Citation subtitle
* @property {string} cmsId Citation cmsId
* @property {string} imageUrl Citation imageUrl
*/
/**
* Constructs a new Citation.
* @memberof Web
* @classdesc Represents a Citation.
* @implements ICitation
* @constructor
* @param {Web.ICitation=} [properties] Properties to set
*/
function Citation(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]];
}
/**
* Citation title.
* @member {string} title
* @memberof Web.Citation
* @instance
*/
Citation.prototype.title = "";
/**
* Citation subtitle.
* @member {string} subtitle
* @memberof Web.Citation
* @instance
*/
Citation.prototype.subtitle = "";
/**
* Citation cmsId.
* @member {string} cmsId
* @memberof Web.Citation
* @instance
*/
Citation.prototype.cmsId = "";
/**
* Citation imageUrl.
* @member {string} imageUrl
* @memberof Web.Citation
* @instance
*/
Citation.prototype.imageUrl = "";
/**
* Creates a new Citation instance using the specified properties.
* @function create
* @memberof Web.Citation
* @static
* @param {Web.ICitation=} [properties] Properties to set
* @returns {Web.Citation} Citation instance
*/
Citation.create = function create(properties) {
return new Citation(properties);
};
/**
* Encodes the specified Citation message. Does not implicitly {@link Web.Citation.verify|verify} messages.
* @function encode
* @memberof Web.Citation
* @static
* @param {Web.ICitation} message Citation message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Citation.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
writer.uint32(/* id 1, wireType 2 =*/10).string(message.title);
writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle);
writer.uint32(/* id 3, wireType 2 =*/26).string(message.cmsId);
writer.uint32(/* id 4, wireType 2 =*/34).string(message.imageUrl);
return writer;
};
/**
* Encodes the specified Citation message, length delimited. Does not implicitly {@link Web.Citation.verify|verify} messages.
* @function encodeDelimited
* @memberof Web.Citation
* @static
* @param {Web.ICitation} message Citation message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Citation.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Citation message from the specified reader or buffer.
* @function decode
* @memberof Web.Citation
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Web.Citation} Citation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Citation.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.Web.Citation();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.title = reader.string();
break;
}
case 2: {
message.subtitle = reader.string();
break;
}
case 3: {
message.cmsId = reader.string();
break;
}
case 4: {
message.imageUrl = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
if (!message.hasOwnProperty("title"))
throw $util.ProtocolError("missing required 'title'", { instance: message });
if (!message.hasOwnProperty("subtitle"))
throw $util.ProtocolError("missing required 'subtitle'", { instance: message });
if (!message.hasOwnProperty("cmsId"))
throw $util.ProtocolError("missing required 'cmsId'", { instance: message });
if (!message.hasOwnProperty("imageUrl"))
throw $util.ProtocolError("missing required 'imageUrl'", { instance: message });
return message;
};
/**
* Decodes a Citation message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Web.Citation
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Web.Citation} Citation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Citation.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Citation message.
* @function verify
* @memberof Web.Citation
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Citation.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (!$util.isString(message.title))
return "title: string expected";
if (!$util.isString(message.subtitle))
return "subtitle: string expected";
if (!$util.isString(message.cmsId))
return "cmsId: string expected";
if (!$util.isString(message.imageUrl))
return "imageUrl: string expected";
return null;
};
/**
* Creates a Citation message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Web.Citation
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Web.Citation} Citation
*/
Citation.fromObject = function fromObject(object) {
if (object instanceof $root.Web.Citation)
return object;
var message = new $root.Web.Citation();
if (object.title != null)
message.title = String(object.title);
if (object.subtitle != null)
message.subtitle = String(object.subtitle);
if (object.cmsId != null)
message.cmsId = String(object.cmsId);
if (object.imageUrl != null)
message.imageUrl = String(object.imageUrl);
return message;
};
/**
* Creates a plain object from a Citation message. Also converts values to other types if specified.
* @function toObject
* @memberof Web.Citation
* @static
* @param {Web.Citation} message Citation
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Citation.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.title = "";
object.subtitle = "";
object.cmsId = "";
object.imageUrl = "";
}
if (message.title != null && message.hasOwnProperty("title"))
object.title = message.title;
if (message.subtitle != null && message.hasOwnProperty("subtitle"))
object.subtitle = message.subtitle;
if (message.cmsId != null && message.hasOwnProperty("cmsId"))
object.cmsId = message.cmsId;
if (message.imageUrl != null && message.hasOwnProperty("imageUrl"))
object.imageUrl = message.imageUrl;
return object;
};
/**
* Converts this Citation to JSON.
* @function toJSON
* @memberof Web.Citation
* @instance
* @returns {Object.<string,*>} JSON object
*/
Citation.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for Citation
* @function getTypeUrl
* @memberof Web.Citation
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
Citation.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/Web.Citation";
};
return Citation;
})();
Web.StatusMentionMessage = (function() {
/**
* Properties of a StatusMentionMessage.
* @memberof Web
* @interface IStatusMentionMessage
* @property {E2E.IMessage|null} [quotedStatus] StatusMentionMessage quotedStatus
*/
/**
* Constructs a new StatusMentionMessage.
* @memberof Web
* @classdesc Represents a StatusMentionMessage.
* @implements IStatusMentionMessage
* @constructor
* @param {Web.IStatusMentionMessage=} [properties] Properties to set
*/
function StatusMentionMessage(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]];
}
/**
* StatusMentionMessage quotedStatus.
* @member {E2E.IMessage|null|undefined} quotedStatus
* @memberof Web.StatusMentionMessage
* @instance
*/
StatusMentionMessage.prototype.quotedStatus = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
// Virtual OneOf for proto3 optional field
Object.defineProperty(StatusMentionMessage.prototype, "_quotedStatus", {
get: $util.oneOfGetter($oneOfFields = ["quotedStatus"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new StatusMentionMessage instance using the specified properties.
* @function create
* @memberof Web.StatusMentionMessage
* @static
* @param {Web.IStatusMentionMessage=} [properties] Properties to set
* @returns {Web.StatusMentionMessage} StatusMentionMessage instance
*/
StatusMentionMessage.create = function create(properties) {
return new StatusMentionMessage(properties);
};
/**
* Encodes the specified StatusMentionMessage message. Does not implicitly {@link Web.StatusMentionMessage.verify|verify} messages.
* @function encode
* @memberof Web.StatusMentionMessage
* @static
* @param {Web.IStatusMentionMessage} message StatusMentionMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
StatusMentionMessage.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.quotedStatus != null && Object.hasOwnProperty.call(message, "quotedStatus"))
$root.E2E.Message.encode(message.quotedStatus, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified StatusMentionMessage message, length delimited. Does not implicitly {@link Web.StatusMentionMessage.verify|verify} messages.
* @function encodeDelimited
* @memberof Web.StatusMentionMessage
* @static
* @param {Web.IStatusMentionMessage} message StatusMentionMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
StatusMentionMessage.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a StatusMentionMessage message from the specified reader or buffer.
* @function decode
* @memberof Web.StatusMentionMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Web.StatusMentionMessage} StatusMentionMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
StatusMentionMessage.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.Web.StatusMentionMessage();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.quotedStatus = $root.E2E.Message.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a StatusMentionMessage message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Web.StatusMentionMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Web.StatusMentionMessage} StatusMentionMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
StatusMentionMessage.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a StatusMentionMessage message.
* @function verify
* @memberof Web.StatusMentionMessage
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
StatusMentionMessage.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.quotedStatus != null && message.hasOwnProperty("quotedStatus")) {
properties._quotedStatus = 1;
{
var error = $root.E2E.Message.verify(message.quotedStatus);
if (error)
return "quotedStatus." + error;
}
}
return null;
};
/**
* Creates a StatusMentionMessage message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Web.StatusMentionMessage
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Web.StatusMentionMessage} StatusMentionMessage
*/
StatusMentionMessage.fromObject = function fromObject(object) {
if (object instanceof $root.Web.StatusMentionMessage)
return object;
var message = new $root.Web.StatusMentionMessage();
if (object.quotedStatus != null) {
if (typeof object.quotedStatus !== "object")
throw TypeError(".Web.StatusMentionMessage.quotedStatus: object expected");
message.quotedStatus = $root.E2E.Message.fromObject(object.quotedStatus);
}
return message;
};
/**
* Creates a plain object from a StatusMentionMessage message. Also converts values to other types if specified.
* @function toObject
* @memberof Web.StatusMentionMessage
* @static
* @param {Web.StatusMentionMessage} message StatusMentionMessage
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
StatusMentionMessage.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.quotedStatus != null && message.hasOwnProperty("quotedStatus")) {
object.quotedStatus = $root.E2E.Message.toObject(message.quotedStatus, options);
if (options.oneofs)
object._quotedStatus = "quotedStatus";
}
return object;
};
/**
* Converts this StatusMentionMessage to JSON.
* @function toJSON
* @memberof Web.StatusMentionMessage
* @instance
* @returns {Object.<string,*>} JSON object
*/
StatusMentionMessage.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for StatusMentionMessage
* @function getTypeUrl
* @memberof Web.StatusMentionMessage
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
StatusMentionMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/Web.StatusMentionMessage";
};
return StatusMentionMessage;
})();
Web.MessageAddOn = (function() {
/**
* Properties of a MessageAddOn.
* @memberof Web
* @interface IMessageAddOn
* @property {Web.MessageAddOn.MessageAddOnType|null} [messageAddOnType] MessageAddOn messageAddOnType
* @property {E2E.IMessage|null} [messageAddOn] MessageAddOn messageAddOn
* @property {number|Long|null} [senderTimestampMs] MessageAddOn senderTimestampMs
* @property {number|Long|null} [serverTimestampMs] MessageAddOn serverTimestampMs
* @property {Web.WebMessageInfo.Status|null} [status] MessageAddOn status
* @property {Web.IMessageAddOnContextInfo|null} [addOnContextInfo] MessageAddOn addOnContextInfo
* @property {Protocol.IMessageKey|null} [messageAddOnKey] MessageAddOn messageAddOnKey
* @property {Web.ILegacyMessage|null} [legacyMessage] MessageAddOn legacyMessage
*/
/**
* Constructs a new MessageAddOn.
* @memberof Web
* @classdesc Represents a MessageAddOn.
* @implements IMessageAddOn
* @constructor
* @param {Web.IMessageAddOn=} [properties] Properties to set
*/
function MessageAddOn(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]];
}
/**
* MessageAddOn messageAddOnType.
* @member {Web.MessageAddOn.MessageAddOnType|null|undefined} messageAddOnType
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.messageAddOnType = null;
/**
* MessageAddOn messageAddOn.
* @member {E2E.IMessage|null|undefined} messageAddOn
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.messageAddOn = null;
/**
* MessageAddOn senderTimestampMs.
* @member {number|Long|null|undefined} senderTimestampMs
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.senderTimestampMs = null;
/**
* MessageAddOn serverTimestampMs.
* @member {number|Long|null|undefined} serverTimestampMs
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.serverTimestampMs = null;
/**
* MessageAddOn status.
* @member {Web.WebMessageInfo.Status|null|undefined} status
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.status = null;
/**
* MessageAddOn addOnContextInfo.
* @member {Web.IMessageAddOnContextInfo|null|undefined} addOnContextInfo
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.addOnContextInfo = null;
/**
* MessageAddOn messageAddOnKey.
* @member {Protocol.IMessageKey|null|undefined} messageAddOnKey
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.messageAddOnKey = null;
/**
* MessageAddOn legacyMessage.
* @member {Web.ILegacyMessage|null|undefined} legacyMessage
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.legacyMessage = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_messageAddOnType", {
get: $util.oneOfGetter($oneOfFields = ["messageAddOnType"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_messageAddOn", {
get: $util.oneOfGetter($oneOfFields = ["messageAddOn"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_senderTimestampMs", {
get: $util.oneOfGetter($oneOfFields = ["senderTimestampMs"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_serverTimestampMs", {
get: $util.oneOfGetter($oneOfFields = ["serverTimestampMs"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_status", {
get: $util.oneOfGetter($oneOfFields = ["status"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_addOnContextInfo", {
get: $util.oneOfGetter($oneOfFields = ["addOnContextInfo"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_messageAddOnKey", {
get: $util.oneOfGetter($oneOfFields = ["messageAddOnKey"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(MessageAddOn.prototype, "_legacyMessage", {
get: $util.oneOfGetter($oneOfFields = ["legacyMessage"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new MessageAddOn instance using the specified properties.
* @function create
* @memberof Web.MessageAddOn
* @static
* @param {Web.IMessageAddOn=} [properties] Properties to set
* @returns {Web.MessageAddOn} MessageAddOn instance
*/
MessageAddOn.create = function create(properties) {
return new MessageAddOn(properties);
};
/**
* Encodes the specified MessageAddOn message. Does not implicitly {@link Web.MessageAddOn.verify|verify} messages.
* @function encode
* @memberof Web.MessageAddOn
* @static
* @param {Web.IMessageAddOn} message MessageAddOn message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
MessageAddOn.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.messageAddOnType != null && Object.hasOwnProperty.call(message, "messageAddOnType"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.messageAddOnType);
if (message.messageAddOn != null && Object.hasOwnProperty.call(message, "messageAddOn"))
$root.E2E.Message.encode(message.messageAddOn, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs"))
writer.uint32(/* id 3, wireType 0 =*/24).int64(message.senderTimestampMs);
if (message.serverTimestampMs != null && Object.hasOwnProperty.call(message, "serverTimestampMs"))
writer.uint32(/* id 4, wireType 0 =*/32).int64(message.serverTimestampMs);
if (message.status != null && Object.hasOwnProperty.call(message, "status"))
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.status);
if (message.addOnContextInfo != null && Object.hasOwnProperty.call(message, "addOnContextInfo"))
$root.Web.MessageAddOnContextInfo.encode(message.addOnContextInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.messageAddOnKey != null && Object.hasOwnProperty.call(message, "messageAddOnKey"))
$root.Protocol.MessageKey.encode(message.messageAddOnKey, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.legacyMessage != null && Object.hasOwnProperty.call(message, "legacyMessage"))
$root.Web.LegacyMessage.encode(message.legacyMessage, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
return writer;
};
/**
* Encodes the specified MessageAddOn message, length delimited. Does not implicitly {@link Web.MessageAddOn.verify|verify} messages.
* @function encodeDelimited
* @memberof Web.MessageAddOn
* @static
* @param {Web.IMessageAddOn} message MessageAddOn message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
MessageAddOn.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a MessageAddOn message from the specified reader or buffer.
* @function decode
* @memberof Web.MessageAddOn
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Web.MessageAddOn} MessageAddOn
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
MessageAddOn.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.Web.MessageAddOn();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.messageAddOnType = reader.int32();
break;
}
case 2: {
message.messageAddOn = $root.E2E.Message.decode(reader, reader.uint32());
break;
}
case 3: {
message.senderTimestampMs = reader.int64();
break;
}
case 4: {
message.serverTimestampMs = reader.int64();
break;
}
case 5: {
message.status = reader.int32();
break;
}
case 6: {
message.addOnContextInfo = $root.Web.MessageAddOnContextInfo.decode(reader, reader.uint32());
break;
}
case 7: {
message.messageAddOnKey = $root.Protocol.MessageKey.decode(reader, reader.uint32());
break;
}
case 8: {
message.legacyMessage = $root.Web.LegacyMessage.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a MessageAddOn message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Web.MessageAddOn
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Web.MessageAddOn} MessageAddOn
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
MessageAddOn.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a MessageAddOn message.
* @function verify
* @memberof Web.MessageAddOn
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
MessageAddOn.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.messageAddOnType != null && message.hasOwnProperty("messageAddOnType")) {
properties._messageAddOnType = 1;
switch (message.messageAddOnType) {
default:
return "messageAddOnType: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
break;
}
}
if (message.messageAddOn != null && message.hasOwnProperty("messageAddOn")) {
properties._messageAddOn = 1;
{
var error = $root.E2E.Message.verify(message.messageAddOn);
if (error)
return "messageAddOn." + error;
}
}
if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) {
properties._senderTimestampMs = 1;
if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high)))
return "senderTimestampMs: integer|Long expected";
}
if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) {
properties._serverTimestampMs = 1;
if (!$util.isInteger(message.serverTimestampMs) && !(message.serverTimestampMs && $util.isInteger(message.serverTimestampMs.low) && $util.isInteger(message.serverTimestampMs.high)))
return "serverTimestampMs: integer|Long expected";
}
if (message.status != null && message.hasOwnProperty("status")) {
properties._status = 1;
switch (message.status) {
default:
return "status: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
break;
}
}
if (message.addOnContextInfo != null && message.hasOwnProperty("addOnContextInfo")) {
properties._addOnContextInfo = 1;
{
var error = $root.Web.MessageAddOnContextInfo.verify(message.addOnContextInfo);
if (error)
return "addOnContextInfo." + error;
}
}
if (message.messageAddOnKey != null && message.hasOwnProperty("messageAddOnKey")) {
properties._messageAddOnKey = 1;
{
var error = $root.Protocol.MessageKey.verify(message.messageAddOnKey);
if (error)
return "messageAddOnKey." + error;
}
}
if (message.legacyMessage != null && message.hasOwnProperty("legacyMessage")) {
properties._legacyMessage = 1;
{
var error = $root.Web.LegacyMessage.verify(message.legacyMessage);
if (error)
return "legacyMessage." + error;
}
}
return null;
};
/**
* Creates a MessageAddOn message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Web.MessageAddOn
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Web.MessageAddOn} MessageAddOn
*/
MessageAddOn.fromObject = function fromObject(object) {
if (object instanceof $root.Web.MessageAddOn)
return object;
var message = new $root.Web.MessageAddOn();
switch (object.messageAddOnType) {
default:
if (typeof object.messageAddOnType === "number") {
message.messageAddOnType = object.messageAddOnType;
break;
}
break;
case "UNDEFINED":
case 0:
message.messageAddOnType = 0;
break;
case "REACTION":
case 1:
message.messageAddOnType = 1;
break;
case "EVENT_RESPONSE":
case 2:
message.messageAddOnType = 2;
break;
case "POLL_UPDATE":
case 3:
message.messageAddOnType = 3;
break;
case "PIN_IN_CHAT":
case 4:
message.messageAddOnType = 4;
break;
}
if (object.messageAddOn != null) {
if (typeof object.messageAddOn !== "object")
throw TypeError(".Web.MessageAddOn.messageAddOn: object expected");
message.messageAddOn = $root.E2E.Message.fromObject(object.messageAddOn);
}
if (object.senderTimestampMs != null)
if ($util.Long)
(message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false;
else if (typeof object.senderTimestampMs === "string")
message.senderTimestampMs = parseInt(object.senderTimestampMs, 10);
else if (typeof object.senderTimestampMs === "number")
message.senderTimestampMs = object.senderTimestampMs;
else if (typeof object.senderTimestampMs === "object")
message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber();
if (object.serverTimestampMs != null)
if ($util.Long)
(message.serverTimestampMs = $util.Long.fromValue(object.serverTimestampMs)).unsigned = false;
else if (typeof object.serverTimestampMs === "string")
message.serverTimestampMs = parseInt(object.serverTimestampMs, 10);
else if (typeof object.serverTimestampMs === "number")
message.serverTimestampMs = object.serverTimestampMs;
else if (typeof object.serverTimestampMs === "object")
message.serverTimestampMs = new $util.LongBits(object.serverTimestampMs.low >>> 0, object.serverTimestampMs.high >>> 0).toNumber();
switch (object.status) {
default:
if (typeof object.status === "number") {
message.status = object.status;
break;
}
break;
case "ERROR":
case 0:
message.status = 0;
break;
case "PENDING":
case 1:
message.status = 1;
break;
case "SERVER_ACK":
case 2:
message.status = 2;
break;
case "DELIVERY_ACK":
case 3:
message.status = 3;
break;
case "READ":
case 4:
message.status = 4;
break;
case "PLAYED":
case 5:
message.status = 5;
break;
}
if (object.addOnContextInfo != null) {
if (typeof object.addOnContextInfo !== "object")
throw TypeError(".Web.MessageAddOn.addOnContextInfo: object expected");
message.addOnContextInfo = $root.Web.MessageAddOnContextInfo.fromObject(object.addOnContextInfo);
}
if (object.messageAddOnKey != null) {
if (typeof object.messageAddOnKey !== "object")
throw TypeError(".Web.MessageAddOn.messageAddOnKey: object expected");
message.messageAddOnKey = $root.Protocol.MessageKey.fromObject(object.messageAddOnKey);
}
if (object.legacyMessage != null) {
if (typeof object.legacyMessage !== "object")
throw TypeError(".Web.MessageAddOn.legacyMessage: object expected");
message.legacyMessage = $root.Web.LegacyMessage.fromObject(object.legacyMessage);
}
return message;
};
/**
* Creates a plain object from a MessageAddOn message. Also converts values to other types if specified.
* @function toObject
* @memberof Web.MessageAddOn
* @static
* @param {Web.MessageAddOn} message MessageAddOn
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
MessageAddOn.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.messageAddOnType != null && message.hasOwnProperty("messageAddOnType")) {
object.messageAddOnType = options.enums === String ? $root.Web.MessageAddOn.MessageAddOnType[message.messageAddOnType] === undefined ? message.messageAddOnType : $root.Web.MessageAddOn.MessageAddOnType[message.messageAddOnType] : message.messageAddOnType;
if (options.oneofs)
object._messageAddOnType = "messageAddOnType";
}
if (message.messageAddOn != null && message.hasOwnProperty("messageAddOn")) {
object.messageAddOn = $root.E2E.Message.toObject(message.messageAddOn, options);
if (options.oneofs)
object._messageAddOn = "messageAddOn";
}
if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) {
if (typeof message.senderTimestampMs === "number")
object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs;
else
object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs;
if (options.oneofs)
object._senderTimestampMs = "senderTimestampMs";
}
if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) {
if (typeof message.serverTimestampMs === "number")
object.serverTimestampMs = options.longs === String ? String(message.serverTimestampMs) : message.serverTimestampMs;
else
object.serverTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.serverTimestampMs) : options.longs === Number ? new $util.LongBits(message.serverTimestampMs.low >>> 0, message.serverTimestampMs.high >>> 0).toNumber() : message.serverTimestampMs;
if (options.oneofs)
object._serverTimestampMs = "serverTimestampMs";
}
if (message.status != null && message.hasOwnProperty("status")) {
object.status = options.enums === String ? $root.Web.WebMessageInfo.Status[message.status] === undefined ? message.status : $root.Web.WebMessageInfo.Status[message.status] : message.status;
if (options.oneofs)
object._status = "status";
}
if (message.addOnContextInfo != null && message.hasOwnProperty("addOnContextInfo")) {
object.addOnContextInfo = $root.Web.MessageAddOnContextInfo.toObject(message.addOnContextInfo, options);
if (options.oneofs)
object._addOnContextInfo = "addOnContextInfo";
}
if (message.messageAddOnKey != null && message.hasOwnProperty("messageAddOnKey")) {
object.messageAddOnKey = $root.Protocol.MessageKey.toObject(message.messageAddOnKey, options);
if (options.oneofs)
object._messageAddOnKey = "messageAddOnKey";
}
if (message.legacyMessage != null && message.hasOwnProperty("legacyMessage")) {
object.legacyMessage = $root.Web.LegacyMessage.toObject(message.legacyMessage, options);
if (options.oneofs)
object._legacyMessage = "legacyMessage";
}
return object;
};
/**
* Converts this MessageAddOn to JSON.
* @function toJSON
* @memberof Web.MessageAddOn
* @instance
* @returns {Object.<string,*>} JSON object
*/
MessageAddOn.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for MessageAddOn
* @function getTypeUrl
* @memberof Web.MessageAddOn
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
MessageAddOn.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/Web.MessageAddOn";
};
/**
* MessageAddOnType enum.
* @name Web.MessageAddOn.MessageAddOnType
* @enum {number}
* @property {number} UNDEFINED=0 UNDEFINED value
* @property {number} REACTION=1 REACTION value
* @property {number} EVENT_RESPONSE=2 EVENT_RESPONSE value
* @property {number} POLL_UPDATE=3 POLL_UPDATE value
* @property {number} PIN_IN_CHAT=4 PIN_IN_CHAT value
*/
MessageAddOn.MessageAddOnType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "UNDEFINED"] = 0;
values[valuesById[1] = "REACTION"] = 1;
values[valuesById[2] = "EVENT_RESPONSE"] = 2;
values[valuesById[3] = "POLL_UPDATE"] = 3;
values[valuesById[4] = "PIN_IN_CHAT"] = 4;
return values;
})();
return MessageAddOn;
})();
Web.LegacyMessage = (function() {
/**
* Properties of a LegacyMessage.
* @memberof Web
* @interface ILegacyMessage
* @property {E2E.Message.IEventResponseMessage|null} [eventResponseMessage] LegacyMessage eventResponseMessage
* @property {E2E.Message.IPollVoteMessage|null} [pollVote] LegacyMessage pollVote
*/
/**
* Constructs a new LegacyMessage.
* @memberof Web
* @classdesc Represents a LegacyMessage.
* @implements ILegacyMessage
* @constructor
* @param {Web.ILegacyMessage=} [properties] Properties to set
*/
function LegacyMessage(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]];
}
/**
* LegacyMessage eventResponseMessage.
* @member {E2E.Message.IEventResponseMessage|null|undefined} eventResponseMessage
* @memberof Web.LegacyMessage
* @instance
*/
LegacyMessage.prototype.eventResponseMessage = null;
/**
* LegacyMessage pollVote.
* @member {E2E.Message.IPollVoteMessage|null|undefined} pollVote
* @memberof Web.LegacyMessage
* @instance
*/
LegacyMessage.prototype.pollVote = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
// Virtual OneOf for proto3 optional field
Object.defineProperty(LegacyMessage.prototype, "_eventResponseMessage", {
get: $util.oneOfGetter($oneOfFields = ["eventResponseMessage"]),
set: $util.oneOfSetter($oneOfFields)
});
// Virtual OneOf for proto3 optional field
Object.defineProperty(LegacyMessage.prototype, "_pollVote", {
get: $util.oneOfGetter($oneOfFields = ["pollVote"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new LegacyMessage instance using the specified properties.