@vreden/meta
Version:
Baileys is a lightweight JavaScript library for interacting with the WhatsApp Web API using WebSocket.
1,036 lines (970 loc) • 134 kB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"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.StatusAttributions = (function() {
/**
* Namespace StatusAttributions.
* @exports StatusAttributions
* @namespace
*/
var StatusAttributions = {};
StatusAttributions.StatusAttribution = (function() {
/**
* Properties of a StatusAttribution.
* @memberof StatusAttributions
* @interface IStatusAttribution
* @property {StatusAttributions.StatusAttribution.Type|null} [type] StatusAttribution type
* @property {string|null} [actionUrl] StatusAttribution actionUrl
* @property {StatusAttributions.StatusAttribution.IStatusReshare|null} [statusReshare] StatusAttribution statusReshare
* @property {StatusAttributions.StatusAttribution.IExternalShare|null} [externalShare] StatusAttribution externalShare
* @property {StatusAttributions.StatusAttribution.IMusic|null} [music] StatusAttribution music
* @property {StatusAttributions.StatusAttribution.IGroupStatus|null} [groupStatus] StatusAttribution groupStatus
* @property {StatusAttributions.StatusAttribution.IRLAttribution|null} [rlAttribution] StatusAttribution rlAttribution
* @property {StatusAttributions.StatusAttribution.IAiCreatedAttribution|null} [aiCreatedAttribution] StatusAttribution aiCreatedAttribution
*/
/**
* Constructs a new StatusAttribution.
* @memberof StatusAttributions
* @classdesc Represents a StatusAttribution.
* @implements IStatusAttribution
* @constructor
* @param {StatusAttributions.IStatusAttribution=} [properties] Properties to set
*/
function StatusAttribution(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]];
}
/**
* StatusAttribution type.
* @member {StatusAttributions.StatusAttribution.Type|null|undefined} type
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.type = null;
/**
* StatusAttribution actionUrl.
* @member {string|null|undefined} actionUrl
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.actionUrl = null;
/**
* StatusAttribution statusReshare.
* @member {StatusAttributions.StatusAttribution.IStatusReshare|null|undefined} statusReshare
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.statusReshare = null;
/**
* StatusAttribution externalShare.
* @member {StatusAttributions.StatusAttribution.IExternalShare|null|undefined} externalShare
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.externalShare = null;
/**
* StatusAttribution music.
* @member {StatusAttributions.StatusAttribution.IMusic|null|undefined} music
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.music = null;
/**
* StatusAttribution groupStatus.
* @member {StatusAttributions.StatusAttribution.IGroupStatus|null|undefined} groupStatus
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.groupStatus = null;
/**
* StatusAttribution rlAttribution.
* @member {StatusAttributions.StatusAttribution.IRLAttribution|null|undefined} rlAttribution
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.rlAttribution = null;
/**
* StatusAttribution aiCreatedAttribution.
* @member {StatusAttributions.StatusAttribution.IAiCreatedAttribution|null|undefined} aiCreatedAttribution
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
StatusAttribution.prototype.aiCreatedAttribution = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* StatusAttribution _type.
* @member {"type"|undefined} _type
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
Object.defineProperty(StatusAttribution.prototype, "_type", {
get: $util.oneOfGetter($oneOfFields = ["type"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* StatusAttribution _actionUrl.
* @member {"actionUrl"|undefined} _actionUrl
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
Object.defineProperty(StatusAttribution.prototype, "_actionUrl", {
get: $util.oneOfGetter($oneOfFields = ["actionUrl"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* StatusAttribution attributionData.
* @member {"statusReshare"|"externalShare"|"music"|"groupStatus"|"rlAttribution"|"aiCreatedAttribution"|undefined} attributionData
* @memberof StatusAttributions.StatusAttribution
* @instance
*/
Object.defineProperty(StatusAttribution.prototype, "attributionData", {
get: $util.oneOfGetter($oneOfFields = ["statusReshare", "externalShare", "music", "groupStatus", "rlAttribution", "aiCreatedAttribution"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new StatusAttribution instance using the specified properties.
* @function create
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {StatusAttributions.IStatusAttribution=} [properties] Properties to set
* @returns {StatusAttributions.StatusAttribution} StatusAttribution instance
*/
StatusAttribution.create = function create(properties) {
return new StatusAttribution(properties);
};
/**
* Encodes the specified StatusAttribution message. Does not implicitly {@link StatusAttributions.StatusAttribution.verify|verify} messages.
* @function encode
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {StatusAttributions.IStatusAttribution} message StatusAttribution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
StatusAttribution.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
if (message.actionUrl != null && Object.hasOwnProperty.call(message, "actionUrl"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.actionUrl);
if (message.statusReshare != null && Object.hasOwnProperty.call(message, "statusReshare"))
$root.StatusAttributions.StatusAttribution.StatusReshare.encode(message.statusReshare, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.externalShare != null && Object.hasOwnProperty.call(message, "externalShare"))
$root.StatusAttributions.StatusAttribution.ExternalShare.encode(message.externalShare, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.music != null && Object.hasOwnProperty.call(message, "music"))
$root.StatusAttributions.StatusAttribution.Music.encode(message.music, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
if (message.groupStatus != null && Object.hasOwnProperty.call(message, "groupStatus"))
$root.StatusAttributions.StatusAttribution.GroupStatus.encode(message.groupStatus, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.rlAttribution != null && Object.hasOwnProperty.call(message, "rlAttribution"))
$root.StatusAttributions.StatusAttribution.RLAttribution.encode(message.rlAttribution, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.aiCreatedAttribution != null && Object.hasOwnProperty.call(message, "aiCreatedAttribution"))
$root.StatusAttributions.StatusAttribution.AiCreatedAttribution.encode(message.aiCreatedAttribution, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
return writer;
};
/**
* Encodes the specified StatusAttribution message, length delimited. Does not implicitly {@link StatusAttributions.StatusAttribution.verify|verify} messages.
* @function encodeDelimited
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {StatusAttributions.IStatusAttribution} message StatusAttribution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
StatusAttribution.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a StatusAttribution message from the specified reader or buffer.
* @function decode
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {StatusAttributions.StatusAttribution} StatusAttribution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
StatusAttribution.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.StatusAttributions.StatusAttribution();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.type = reader.int32();
break;
}
case 2: {
message.actionUrl = reader.string();
break;
}
case 3: {
message.statusReshare = $root.StatusAttributions.StatusAttribution.StatusReshare.decode(reader, reader.uint32());
break;
}
case 4: {
message.externalShare = $root.StatusAttributions.StatusAttribution.ExternalShare.decode(reader, reader.uint32());
break;
}
case 5: {
message.music = $root.StatusAttributions.StatusAttribution.Music.decode(reader, reader.uint32());
break;
}
case 6: {
message.groupStatus = $root.StatusAttributions.StatusAttribution.GroupStatus.decode(reader, reader.uint32());
break;
}
case 7: {
message.rlAttribution = $root.StatusAttributions.StatusAttribution.RLAttribution.decode(reader, reader.uint32());
break;
}
case 8: {
message.aiCreatedAttribution = $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a StatusAttribution message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {StatusAttributions.StatusAttribution} StatusAttribution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
StatusAttribution.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a StatusAttribution message.
* @function verify
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
StatusAttribution.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.type != null && message.hasOwnProperty("type")) {
properties._type = 1;
switch (message.type) {
default:
return "type: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
break;
}
}
if (message.actionUrl != null && message.hasOwnProperty("actionUrl")) {
properties._actionUrl = 1;
if (!$util.isString(message.actionUrl))
return "actionUrl: string expected";
}
if (message.statusReshare != null && message.hasOwnProperty("statusReshare")) {
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.StatusReshare.verify(message.statusReshare);
if (error)
return "statusReshare." + error;
}
}
if (message.externalShare != null && message.hasOwnProperty("externalShare")) {
if (properties.attributionData === 1)
return "attributionData: multiple values";
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.ExternalShare.verify(message.externalShare);
if (error)
return "externalShare." + error;
}
}
if (message.music != null && message.hasOwnProperty("music")) {
if (properties.attributionData === 1)
return "attributionData: multiple values";
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.Music.verify(message.music);
if (error)
return "music." + error;
}
}
if (message.groupStatus != null && message.hasOwnProperty("groupStatus")) {
if (properties.attributionData === 1)
return "attributionData: multiple values";
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.GroupStatus.verify(message.groupStatus);
if (error)
return "groupStatus." + error;
}
}
if (message.rlAttribution != null && message.hasOwnProperty("rlAttribution")) {
if (properties.attributionData === 1)
return "attributionData: multiple values";
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.RLAttribution.verify(message.rlAttribution);
if (error)
return "rlAttribution." + error;
}
}
if (message.aiCreatedAttribution != null && message.hasOwnProperty("aiCreatedAttribution")) {
if (properties.attributionData === 1)
return "attributionData: multiple values";
properties.attributionData = 1;
{
var error = $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.verify(message.aiCreatedAttribution);
if (error)
return "aiCreatedAttribution." + error;
}
}
return null;
};
/**
* Creates a StatusAttribution message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {Object.<string,*>} object Plain object
* @returns {StatusAttributions.StatusAttribution} StatusAttribution
*/
StatusAttribution.fromObject = function fromObject(object) {
if (object instanceof $root.StatusAttributions.StatusAttribution)
return object;
var message = new $root.StatusAttributions.StatusAttribution();
switch (object.type) {
default:
if (typeof object.type === "number") {
message.type = object.type;
break;
}
break;
case "UNKNOWN":
case 0:
message.type = 0;
break;
case "RESHARE":
case 1:
message.type = 1;
break;
case "EXTERNAL_SHARE":
case 2:
message.type = 2;
break;
case "MUSIC":
case 3:
message.type = 3;
break;
case "STATUS_MENTION":
case 4:
message.type = 4;
break;
case "GROUP_STATUS":
case 5:
message.type = 5;
break;
case "RL_ATTRIBUTION":
case 6:
message.type = 6;
break;
case "AI_CREATED":
case 7:
message.type = 7;
break;
}
if (object.actionUrl != null)
message.actionUrl = String(object.actionUrl);
if (object.statusReshare != null) {
if (typeof object.statusReshare !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.statusReshare: object expected");
message.statusReshare = $root.StatusAttributions.StatusAttribution.StatusReshare.fromObject(object.statusReshare);
}
if (object.externalShare != null) {
if (typeof object.externalShare !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.externalShare: object expected");
message.externalShare = $root.StatusAttributions.StatusAttribution.ExternalShare.fromObject(object.externalShare);
}
if (object.music != null) {
if (typeof object.music !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.music: object expected");
message.music = $root.StatusAttributions.StatusAttribution.Music.fromObject(object.music);
}
if (object.groupStatus != null) {
if (typeof object.groupStatus !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.groupStatus: object expected");
message.groupStatus = $root.StatusAttributions.StatusAttribution.GroupStatus.fromObject(object.groupStatus);
}
if (object.rlAttribution != null) {
if (typeof object.rlAttribution !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.rlAttribution: object expected");
message.rlAttribution = $root.StatusAttributions.StatusAttribution.RLAttribution.fromObject(object.rlAttribution);
}
if (object.aiCreatedAttribution != null) {
if (typeof object.aiCreatedAttribution !== "object")
throw TypeError(".StatusAttributions.StatusAttribution.aiCreatedAttribution: object expected");
message.aiCreatedAttribution = $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.fromObject(object.aiCreatedAttribution);
}
return message;
};
/**
* Creates a plain object from a StatusAttribution message. Also converts values to other types if specified.
* @function toObject
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {StatusAttributions.StatusAttribution} message StatusAttribution
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
StatusAttribution.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.type != null && message.hasOwnProperty("type")) {
object.type = options.enums === String ? $root.StatusAttributions.StatusAttribution.Type[message.type] === undefined ? message.type : $root.StatusAttributions.StatusAttribution.Type[message.type] : message.type;
if (options.oneofs)
object._type = "type";
}
if (message.actionUrl != null && message.hasOwnProperty("actionUrl")) {
object.actionUrl = message.actionUrl;
if (options.oneofs)
object._actionUrl = "actionUrl";
}
if (message.statusReshare != null && message.hasOwnProperty("statusReshare")) {
object.statusReshare = $root.StatusAttributions.StatusAttribution.StatusReshare.toObject(message.statusReshare, options);
if (options.oneofs)
object.attributionData = "statusReshare";
}
if (message.externalShare != null && message.hasOwnProperty("externalShare")) {
object.externalShare = $root.StatusAttributions.StatusAttribution.ExternalShare.toObject(message.externalShare, options);
if (options.oneofs)
object.attributionData = "externalShare";
}
if (message.music != null && message.hasOwnProperty("music")) {
object.music = $root.StatusAttributions.StatusAttribution.Music.toObject(message.music, options);
if (options.oneofs)
object.attributionData = "music";
}
if (message.groupStatus != null && message.hasOwnProperty("groupStatus")) {
object.groupStatus = $root.StatusAttributions.StatusAttribution.GroupStatus.toObject(message.groupStatus, options);
if (options.oneofs)
object.attributionData = "groupStatus";
}
if (message.rlAttribution != null && message.hasOwnProperty("rlAttribution")) {
object.rlAttribution = $root.StatusAttributions.StatusAttribution.RLAttribution.toObject(message.rlAttribution, options);
if (options.oneofs)
object.attributionData = "rlAttribution";
}
if (message.aiCreatedAttribution != null && message.hasOwnProperty("aiCreatedAttribution")) {
object.aiCreatedAttribution = $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.toObject(message.aiCreatedAttribution, options);
if (options.oneofs)
object.attributionData = "aiCreatedAttribution";
}
return object;
};
/**
* Converts this StatusAttribution to JSON.
* @function toJSON
* @memberof StatusAttributions.StatusAttribution
* @instance
* @returns {Object.<string,*>} JSON object
*/
StatusAttribution.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for StatusAttribution
* @function getTypeUrl
* @memberof StatusAttributions.StatusAttribution
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
StatusAttribution.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/StatusAttributions.StatusAttribution";
};
StatusAttribution.AiCreatedAttribution = (function() {
/**
* Properties of an AiCreatedAttribution.
* @memberof StatusAttributions.StatusAttribution
* @interface IAiCreatedAttribution
* @property {StatusAttributions.StatusAttribution.AiCreatedAttribution.Source|null} [source] AiCreatedAttribution source
*/
/**
* Constructs a new AiCreatedAttribution.
* @memberof StatusAttributions.StatusAttribution
* @classdesc Represents an AiCreatedAttribution.
* @implements IAiCreatedAttribution
* @constructor
* @param {StatusAttributions.StatusAttribution.IAiCreatedAttribution=} [properties] Properties to set
*/
function AiCreatedAttribution(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]];
}
/**
* AiCreatedAttribution source.
* @member {StatusAttributions.StatusAttribution.AiCreatedAttribution.Source|null|undefined} source
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @instance
*/
AiCreatedAttribution.prototype.source = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* AiCreatedAttribution _source.
* @member {"source"|undefined} _source
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @instance
*/
Object.defineProperty(AiCreatedAttribution.prototype, "_source", {
get: $util.oneOfGetter($oneOfFields = ["source"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new AiCreatedAttribution instance using the specified properties.
* @function create
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {StatusAttributions.StatusAttribution.IAiCreatedAttribution=} [properties] Properties to set
* @returns {StatusAttributions.StatusAttribution.AiCreatedAttribution} AiCreatedAttribution instance
*/
AiCreatedAttribution.create = function create(properties) {
return new AiCreatedAttribution(properties);
};
/**
* Encodes the specified AiCreatedAttribution message. Does not implicitly {@link StatusAttributions.StatusAttribution.AiCreatedAttribution.verify|verify} messages.
* @function encode
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {StatusAttributions.StatusAttribution.IAiCreatedAttribution} message AiCreatedAttribution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AiCreatedAttribution.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.source != null && Object.hasOwnProperty.call(message, "source"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.source);
return writer;
};
/**
* Encodes the specified AiCreatedAttribution message, length delimited. Does not implicitly {@link StatusAttributions.StatusAttribution.AiCreatedAttribution.verify|verify} messages.
* @function encodeDelimited
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {StatusAttributions.StatusAttribution.IAiCreatedAttribution} message AiCreatedAttribution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AiCreatedAttribution.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AiCreatedAttribution message from the specified reader or buffer.
* @function decode
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {StatusAttributions.StatusAttribution.AiCreatedAttribution} AiCreatedAttribution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AiCreatedAttribution.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.StatusAttributions.StatusAttribution.AiCreatedAttribution();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.source = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AiCreatedAttribution message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {StatusAttributions.StatusAttribution.AiCreatedAttribution} AiCreatedAttribution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AiCreatedAttribution.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AiCreatedAttribution message.
* @function verify
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AiCreatedAttribution.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.source != null && message.hasOwnProperty("source")) {
properties._source = 1;
switch (message.source) {
default:
return "source: enum value expected";
case 0:
case 1:
break;
}
}
return null;
};
/**
* Creates an AiCreatedAttribution message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {Object.<string,*>} object Plain object
* @returns {StatusAttributions.StatusAttribution.AiCreatedAttribution} AiCreatedAttribution
*/
AiCreatedAttribution.fromObject = function fromObject(object) {
if (object instanceof $root.StatusAttributions.StatusAttribution.AiCreatedAttribution)
return object;
var message = new $root.StatusAttributions.StatusAttribution.AiCreatedAttribution();
switch (object.source) {
default:
if (typeof object.source === "number") {
message.source = object.source;
break;
}
break;
case "UNKNOWN":
case 0:
message.source = 0;
break;
case "STATUS_MIMICRY":
case 1:
message.source = 1;
break;
}
return message;
};
/**
* Creates a plain object from an AiCreatedAttribution message. Also converts values to other types if specified.
* @function toObject
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {StatusAttributions.StatusAttribution.AiCreatedAttribution} message AiCreatedAttribution
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AiCreatedAttribution.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.source != null && message.hasOwnProperty("source")) {
object.source = options.enums === String ? $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.Source[message.source] === undefined ? message.source : $root.StatusAttributions.StatusAttribution.AiCreatedAttribution.Source[message.source] : message.source;
if (options.oneofs)
object._source = "source";
}
return object;
};
/**
* Converts this AiCreatedAttribution to JSON.
* @function toJSON
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @instance
* @returns {Object.<string,*>} JSON object
*/
AiCreatedAttribution.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for AiCreatedAttribution
* @function getTypeUrl
* @memberof StatusAttributions.StatusAttribution.AiCreatedAttribution
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
AiCreatedAttribution.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/StatusAttributions.StatusAttribution.AiCreatedAttribution";
};
/**
* Source enum.
* @name StatusAttributions.StatusAttribution.AiCreatedAttribution.Source
* @enum {number}
* @property {number} UNKNOWN=0 UNKNOWN value
* @property {number} STATUS_MIMICRY=1 STATUS_MIMICRY value
*/
AiCreatedAttribution.Source = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "UNKNOWN"] = 0;
values[valuesById[1] = "STATUS_MIMICRY"] = 1;
return values;
})();
return AiCreatedAttribution;
})();
StatusAttribution.ExternalShare = (function() {
/**
* Properties of an ExternalShare.
* @memberof StatusAttributions.StatusAttribution
* @interface IExternalShare
* @property {string|null} [actionUrl] ExternalShare actionUrl
* @property {StatusAttributions.StatusAttribution.ExternalShare.Source|null} [source] ExternalShare source
* @property {number|null} [duration] ExternalShare duration
* @property {string|null} [actionFallbackUrl] ExternalShare actionFallbackUrl
*/
/**
* Constructs a new ExternalShare.
* @memberof StatusAttributions.StatusAttribution
* @classdesc Represents an ExternalShare.
* @implements IExternalShare
* @constructor
* @param {StatusAttributions.StatusAttribution.IExternalShare=} [properties] Properties to set
*/
function ExternalShare(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]];
}
/**
* ExternalShare actionUrl.
* @member {string|null|undefined} actionUrl
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
ExternalShare.prototype.actionUrl = null;
/**
* ExternalShare source.
* @member {StatusAttributions.StatusAttribution.ExternalShare.Source|null|undefined} source
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
ExternalShare.prototype.source = null;
/**
* ExternalShare duration.
* @member {number|null|undefined} duration
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
ExternalShare.prototype.duration = null;
/**
* ExternalShare actionFallbackUrl.
* @member {string|null|undefined} actionFallbackUrl
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
ExternalShare.prototype.actionFallbackUrl = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* ExternalShare _actionUrl.
* @member {"actionUrl"|undefined} _actionUrl
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
Object.defineProperty(ExternalShare.prototype, "_actionUrl", {
get: $util.oneOfGetter($oneOfFields = ["actionUrl"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* ExternalShare _source.
* @member {"source"|undefined} _source
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
Object.defineProperty(ExternalShare.prototype, "_source", {
get: $util.oneOfGetter($oneOfFields = ["source"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* ExternalShare _duration.
* @member {"duration"|undefined} _duration
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
Object.defineProperty(ExternalShare.prototype, "_duration", {
get: $util.oneOfGetter($oneOfFields = ["duration"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* ExternalShare _actionFallbackUrl.
* @member {"actionFallbackUrl"|undefined} _actionFallbackUrl
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @instance
*/
Object.defineProperty(ExternalShare.prototype, "_actionFallbackUrl", {
get: $util.oneOfGetter($oneOfFields = ["actionFallbackUrl"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new ExternalShare instance using the specified properties.
* @function create
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {StatusAttributions.StatusAttribution.IExternalShare=} [properties] Properties to set
* @returns {StatusAttributions.StatusAttribution.ExternalShare} ExternalShare instance
*/
ExternalShare.create = function create(properties) {
return new ExternalShare(properties);
};
/**
* Encodes the specified ExternalShare message. Does not implicitly {@link StatusAttributions.StatusAttribution.ExternalShare.verify|verify} messages.
* @function encode
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {StatusAttributions.StatusAttribution.IExternalShare} message ExternalShare message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ExternalShare.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.actionUrl != null && Object.hasOwnProperty.call(message, "actionUrl"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.actionUrl);
if (message.source != null && Object.hasOwnProperty.call(message, "source"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.source);
if (message.duration != null && Object.hasOwnProperty.call(message, "duration"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.duration);
if (message.actionFallbackUrl != null && Object.hasOwnProperty.call(message, "actionFallbackUrl"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.actionFallbackUrl);
return writer;
};
/**
* Encodes the specified ExternalShare message, length delimited. Does not implicitly {@link StatusAttributions.StatusAttribution.ExternalShare.verify|verify} messages.
* @function encodeDelimited
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {StatusAttributions.StatusAttribution.IExternalShare} message ExternalShare message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ExternalShare.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an ExternalShare message from the specified reader or buffer.
* @function decode
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {StatusAttributions.StatusAttribution.ExternalShare} ExternalShare
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ExternalShare.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.StatusAttributions.StatusAttribution.ExternalShare();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.actionUrl = reader.string();
break;
}
case 2: {
message.source = reader.int32();
break;
}
case 3: {
message.duration = reader.int32();
break;
}
case 4: {
message.actionFallbackUrl = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an ExternalShare message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {StatusAttributions.StatusAttribution.ExternalShare} ExternalShare
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ExternalShare.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an ExternalShare message.
* @function verify
* @memberof StatusAttributions.StatusAttribution.ExternalShare
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ExternalShare.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.actionUrl != null && message.hasOwnProperty("actionUrl")) {
properties._actionUrl = 1;
if (!$util.isString(message.actionUrl))
return "actionUrl: string expected";
}
if (message.source != null && message.hasOwnProperty("source")) {
properties._source = 1;
switch (message.sou