@vreden/meta
Version:
Baileys is a lightweight JavaScript library for interacting with the WhatsApp Web API using WebSocket.
1,146 lines (1,061 loc) • 5.7 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.GroupHistoryBundleMessage = (function() {
/**
* Properties of a GroupHistoryBundleMessage.
* @memberof Web
* @interface IGroupHistoryBundleMessage
* @property {E2E.Message.IMessageHistoryBundle|null} [messageHistoryBundle] GroupHistoryBundleMessage messageHistoryBundle
* @property {Web.GroupHistoryBundleMessage.ProcessState|null} [processState] GroupHistoryBundleMessage processState
*/
/**
* Constructs a new GroupHistoryBundleMessage.
* @memberof Web
* @classdesc Represents a GroupHistoryBundleMessage.
* @implements IGroupHistoryBundleMessage
* @constructor
* @param {Web.IGroupHistoryBundleMessage=} [properties] Properties to set
*/
function GroupHistoryBundleMessage(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]];
}
/**
* GroupHistoryBundleMessage messageHistoryBundle.
* @member {E2E.Message.IMessageHistoryBundle|null|undefined} messageHistoryBundle
* @memberof Web.GroupHistoryBundleMessage
* @instance
*/
GroupHistoryBundleMessage.prototype.messageHistoryBundle = null;
/**
* GroupHistoryBundleMessage processState.
* @member {Web.GroupHistoryBundleMessage.ProcessState} processState
* @memberof Web.GroupHistoryBundleMessage
* @instance
*/
GroupHistoryBundleMessage.prototype.processState = 0;
/**
* Creates a new GroupHistoryBundleMessage instance using the specified properties.
* @function create
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Web.IGroupHistoryBundleMessage=} [properties] Properties to set
* @returns {Web.GroupHistoryBundleMessage} GroupHistoryBundleMessage instance
*/
GroupHistoryBundleMessage.create = function create(properties) {
return new GroupHistoryBundleMessage(properties);
};
/**
* Encodes the specified GroupHistoryBundleMessage message. Does not implicitly {@link Web.GroupHistoryBundleMessage.verify|verify} messages.
* @function encode
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Web.IGroupHistoryBundleMessage} message GroupHistoryBundleMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GroupHistoryBundleMessage.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.messageHistoryBundle != null && Object.hasOwnProperty.call(message, "messageHistoryBundle"))
$root.E2E.Message.MessageHistoryBundle.encode(message.messageHistoryBundle, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.processState != null && Object.hasOwnProperty.call(message, "processState"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.processState);
return writer;
};
/**
* Encodes the specified GroupHistoryBundleMessage message, length delimited. Does not implicitly {@link Web.GroupHistoryBundleMessage.verify|verify} messages.
* @function encodeDelimited
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Web.IGroupHistoryBundleMessage} message GroupHistoryBundleMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GroupHistoryBundleMessage.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a GroupHistoryBundleMessage message from the specified reader or buffer.
* @function decode
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Web.GroupHistoryBundleMessage} GroupHistoryBundleMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GroupHistoryBundleMessage.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.Web.GroupHistoryBundleMessage();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.messageHistoryBundle = $root.E2E.Message.MessageHistoryBundle.decode(reader, reader.uint32());
break;
}
case 2: {
message.processState = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a GroupHistoryBundleMessage message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Web.GroupHistoryBundleMessage} GroupHistoryBundleMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GroupHistoryBundleMessage.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a GroupHistoryBundleMessage message.
* @function verify
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
GroupHistoryBundleMessage.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.messageHistoryBundle != null && message.hasOwnProperty("messageHistoryBundle")) {
var error = $root.E2E.Message.MessageHistoryBundle.verify(message.messageHistoryBundle);
if (error)
return "messageHistoryBundle." + error;
}
if (message.processState != null && message.hasOwnProperty("processState"))
switch (message.processState) {
default:
return "processState: enum value expected";
case 0:
case 1:
case 2:
break;
}
return null;
};
/**
* Creates a GroupHistoryBundleMessage message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Web.GroupHistoryBundleMessage} GroupHistoryBundleMessage
*/
GroupHistoryBundleMessage.fromObject = function fromObject(object) {
if (object instanceof $root.Web.GroupHistoryBundleMessage)
return object;
var message = new $root.Web.GroupHistoryBundleMessage();
if (object.messageHistoryBundle != null) {
if (typeof object.messageHistoryBundle !== "object")
throw TypeError(".Web.GroupHistoryBundleMessage.messageHistoryBundle: object expected");
message.messageHistoryBundle = $root.E2E.Message.MessageHistoryBundle.fromObject(object.messageHistoryBundle);
}
switch (object.processState) {
default:
if (typeof object.processState === "number") {
message.processState = object.processState;
break;
}
break;
case "NOT_DOWNLOADED":
case 0:
message.processState = 0;
break;
case "DOWNLOADED":
case 1:
message.processState = 1;
break;
case "DOWNLOAD_FAILED":
case 2:
message.processState = 2;
break;
}
return message;
};
/**
* Creates a plain object from a GroupHistoryBundleMessage message. Also converts values to other types if specified.
* @function toObject
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {Web.GroupHistoryBundleMessage} message GroupHistoryBundleMessage
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
GroupHistoryBundleMessage.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.messageHistoryBundle = null;
object.processState = options.enums === String ? "NOT_DOWNLOADED" : 0;
}
if (message.messageHistoryBundle != null && message.hasOwnProperty("messageHistoryBundle"))
object.messageHistoryBundle = $root.E2E.Message.MessageHistoryBundle.toObject(message.messageHistoryBundle, options);
if (message.processState != null && message.hasOwnProperty("processState"))
object.processState = options.enums === String ? $root.Web.GroupHistoryBundleMessage.ProcessState[message.processState] === undefined ? message.processState : $root.Web.GroupHistoryBundleMessage.ProcessState[message.processState] : message.processState;
return object;
};
/**
* Converts this GroupHistoryBundleMessage to JSON.
* @function toJSON
* @memberof Web.GroupHistoryBundleMessage
* @instance
* @returns {Object.<string,*>} JSON object
*/
GroupHistoryBundleMessage.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for GroupHistoryBundleMessage
* @function getTypeUrl
* @memberof Web.GroupHistoryBundleMessage
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
GroupHistoryBundleMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/Web.GroupHistoryBundleMessage";
};
/**
* ProcessState enum.
* @name Web.GroupHistoryBundleMessage.ProcessState
* @enum {number}
* @property {number} NOT_DOWNLOADED=0 NOT_DOWNLOADED value
* @property {number} DOWNLOADED=1 DOWNLOADED value
* @property {number} DOWNLOAD_FAILED=2 DOWNLOAD_FAILED value
*/
GroupHistoryBundleMessage.ProcessState = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "NOT_DOWNLOADED"] = 0;
values[valuesById[1] = "DOWNLOADED"] = 1;
values[valuesById[2] = "DOWNLOAD_FAILED"] = 2;
return values;
})();
return GroupHistoryBundleMessage;
})();
Web.GroupHistoryIndividualMessageInfo = (function() {
/**
* Properties of a GroupHistoryIndividualMessageInfo.
* @memberof Web
* @interface IGroupHistoryIndividualMessageInfo
* @property {Protocol.IMessageKey|null} [bundleMessageKey] GroupHistoryIndividualMessageInfo bundleMessageKey
*/
/**
* Constructs a new GroupHistoryIndividualMessageInfo.
* @memberof Web
* @classdesc Represents a GroupHistoryIndividualMessageInfo.
* @implements IGroupHistoryIndividualMessageInfo
* @constructor
* @param {Web.IGroupHistoryIndividualMessageInfo=} [properties] Properties to set
*/
function GroupHistoryIndividualMessageInfo(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]];
}
/**
* GroupHistoryIndividualMessageInfo bundleMessageKey.
* @member {Protocol.IMessageKey|null|undefined} bundleMessageKey
* @memberof Web.GroupHistoryIndividualMessageInfo
* @instance
*/
GroupHistoryIndividualMessageInfo.prototype.bundleMessageKey = null;
/**
* Creates a new GroupHistoryIndividualMessageInfo instance using the specified properties.
* @function create
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Web.IGroupHistoryIndividualMessageInfo=} [properties] Properties to set
* @returns {Web.GroupHistoryIndividualMessageInfo} GroupHistoryIndividualMessageInfo instance
*/
GroupHistoryIndividualMessageInfo.create = function create(properties) {
return new GroupHistoryIndividualMessageInfo(properties);
};
/**
* Encodes the specified GroupHistoryIndividualMessageInfo message. Does not implicitly {@link Web.GroupHistoryIndividualMessageInfo.verify|verify} messages.
* @function encode
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Web.IGroupHistoryIndividualMessageInfo} message GroupHistoryIndividualMessageInfo message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GroupHistoryIndividualMessageInfo.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.bundleMessageKey != null && Object.hasOwnProperty.call(message, "bundleMessageKey"))
$root.Protocol.MessageKey.encode(message.bundleMessageKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified GroupHistoryIndividualMessageInfo message, length delimited. Does not implicitly {@link Web.GroupHistoryIndividualMessageInfo.verify|verify} messages.
* @function encodeDelimited
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Web.IGroupHistoryIndividualMessageInfo} message GroupHistoryIndividualMessageInfo message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GroupHistoryIndividualMessageInfo.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a GroupHistoryIndividualMessageInfo message from the specified reader or buffer.
* @function decode
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Web.GroupHistoryIndividualMessageInfo} GroupHistoryIndividualMessageInfo
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GroupHistoryIndividualMessageInfo.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.Web.GroupHistoryIndividualMessageInfo();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.bundleMessageKey = $root.Protocol.MessageKey.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a GroupHistoryIndividualMessageInfo message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Web.GroupHistoryIndividualMessageInfo} GroupHistoryIndividualMessageInfo
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GroupHistoryIndividualMessageInfo.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a GroupHistoryIndividualMessageInfo message.
* @function verify
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
GroupHistoryIndividualMessageInfo.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.bundleMessageKey != null && message.hasOwnProperty("bundleMessageKey")) {
var error = $root.Protocol.MessageKey.verify(message.bundleMessageKey);
if (error)
return "bundleMessageKey." + error;
}
return null;
};
/**
* Creates a GroupHistoryIndividualMessageInfo message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Web.GroupHistoryIndividualMessageInfo} GroupHistoryIndividualMessageInfo
*/
GroupHistoryIndividualMessageInfo.fromObject = function fromObject(object) {
if (object instanceof $root.Web.GroupHistoryIndividualMessageInfo)
return object;
var message = new $root.Web.GroupHistoryIndividualMessageInfo();
if (object.bundleMessageKey != null) {
if (typeof object.bundleMessageKey !== "object")
throw TypeError(".Web.GroupHistoryIndividualMessageInfo.bundleMessageKey: object expected");
message.bundleMessageKey = $root.Protocol.MessageKey.fromObject(object.bundleMessageKey);
}
return message;
};
/**
* Creates a plain object from a GroupHistoryIndividualMessageInfo message. Also converts values to other types if specified.
* @function toObject
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {Web.GroupHistoryIndividualMessageInfo} message GroupHistoryIndividualMessageInfo
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
GroupHistoryIndividualMessageInfo.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.bundleMessageKey = null;
if (message.bundleMessageKey != null && message.hasOwnProperty("bundleMessageKey"))
object.bundleMessageKey = $root.Protocol.MessageKey.toObject(message.bundleMessageKey, options);
return object;
};
/**
* Converts this GroupHistoryIndividualMessageInfo to JSON.
* @function toJSON
* @memberof Web.GroupHistoryIndividualMessageInfo
* @instance
* @returns {Object.<string,*>} JSON object
*/
GroupHistoryIndividualMessageInfo.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for GroupHistoryIndividualMessageInfo
* @function getTypeUrl
* @memberof Web.GroupHistoryIndividualMessageInfo
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
GroupHistoryIndividualMessageInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/Web.GroupHistoryIndividualMessageInfo";
};
return GroupHistoryIndividualMessageInfo;
})();
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, error) {
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();
if (tag === error)
break;
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;
/**
* 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, error) {
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();
if (tag === error)
break;
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";
if (message.quotedStatus != null && message.hasOwnProperty("quotedStatus")) {
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 (options.defaults)
object.quotedStatus = null;
if (message.quotedStatus != null && message.hasOwnProperty("quotedStatus"))
object.quotedStatus = $root.E2E.Message.toObject(message.quotedStatus, options);
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} messageAddOnType
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.messageAddOnType = 0;
/**
* MessageAddOn messageAddOn.
* @member {E2E.IMessage|null|undefined} messageAddOn
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.messageAddOn = null;
/**
* MessageAddOn senderTimestampMs.
* @member {number|Long} senderTimestampMs
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* MessageAddOn serverTimestampMs.
* @member {number|Long} serverTimestampMs
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.serverTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* MessageAddOn status.
* @member {Web.WebMessageInfo.Status} status
* @memberof Web.MessageAddOn
* @instance
*/
MessageAddOn.prototype.status = 0;
/**
* 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;
/**
* 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 {$p