UNPKG

@vreden/meta

Version:

Baileys is a lightweight JavaScript library for interacting with the WhatsApp Web API using WebSocket.

949 lines (898 loc) 1.17 MB
/*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.SyncAction = (function() { /** * Namespace SyncAction. * @exports SyncAction * @namespace */ var SyncAction = {}; SyncAction.PatchDebugData = (function() { /** * Properties of a PatchDebugData. * @memberof SyncAction * @interface IPatchDebugData * @property {Uint8Array|null} [currentLthash] PatchDebugData currentLthash * @property {Uint8Array|null} [newLthash] PatchDebugData newLthash * @property {Uint8Array|null} [patchVersion] PatchDebugData patchVersion * @property {Uint8Array|null} [collectionName] PatchDebugData collectionName * @property {Uint8Array|null} [firstFourBytesFromAHashOfSnapshotMacKey] PatchDebugData firstFourBytesFromAHashOfSnapshotMacKey * @property {Uint8Array|null} [newLthashSubtract] PatchDebugData newLthashSubtract * @property {number|null} [numberAdd] PatchDebugData numberAdd * @property {number|null} [numberRemove] PatchDebugData numberRemove * @property {number|null} [numberOverride] PatchDebugData numberOverride * @property {SyncAction.PatchDebugData.Platform|null} [senderPlatform] PatchDebugData senderPlatform * @property {boolean|null} [isSenderPrimary] PatchDebugData isSenderPrimary */ /** * Constructs a new PatchDebugData. * @memberof SyncAction * @classdesc Represents a PatchDebugData. * @implements IPatchDebugData * @constructor * @param {SyncAction.IPatchDebugData=} [properties] Properties to set */ function PatchDebugData(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]]; } /** * PatchDebugData currentLthash. * @member {Uint8Array} currentLthash * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.currentLthash = $util.newBuffer([]); /** * PatchDebugData newLthash. * @member {Uint8Array} newLthash * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.newLthash = $util.newBuffer([]); /** * PatchDebugData patchVersion. * @member {Uint8Array} patchVersion * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.patchVersion = $util.newBuffer([]); /** * PatchDebugData collectionName. * @member {Uint8Array} collectionName * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.collectionName = $util.newBuffer([]); /** * PatchDebugData firstFourBytesFromAHashOfSnapshotMacKey. * @member {Uint8Array} firstFourBytesFromAHashOfSnapshotMacKey * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.firstFourBytesFromAHashOfSnapshotMacKey = $util.newBuffer([]); /** * PatchDebugData newLthashSubtract. * @member {Uint8Array} newLthashSubtract * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.newLthashSubtract = $util.newBuffer([]); /** * PatchDebugData numberAdd. * @member {number} numberAdd * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.numberAdd = 0; /** * PatchDebugData numberRemove. * @member {number} numberRemove * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.numberRemove = 0; /** * PatchDebugData numberOverride. * @member {number} numberOverride * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.numberOverride = 0; /** * PatchDebugData senderPlatform. * @member {SyncAction.PatchDebugData.Platform} senderPlatform * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.senderPlatform = 0; /** * PatchDebugData isSenderPrimary. * @member {boolean} isSenderPrimary * @memberof SyncAction.PatchDebugData * @instance */ PatchDebugData.prototype.isSenderPrimary = false; /** * Creates a new PatchDebugData instance using the specified properties. * @function create * @memberof SyncAction.PatchDebugData * @static * @param {SyncAction.IPatchDebugData=} [properties] Properties to set * @returns {SyncAction.PatchDebugData} PatchDebugData instance */ PatchDebugData.create = function create(properties) { return new PatchDebugData(properties); }; /** * Encodes the specified PatchDebugData message. Does not implicitly {@link SyncAction.PatchDebugData.verify|verify} messages. * @function encode * @memberof SyncAction.PatchDebugData * @static * @param {SyncAction.IPatchDebugData} message PatchDebugData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ PatchDebugData.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.currentLthash != null && Object.hasOwnProperty.call(message, "currentLthash")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.currentLthash); if (message.newLthash != null && Object.hasOwnProperty.call(message, "newLthash")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.newLthash); if (message.patchVersion != null && Object.hasOwnProperty.call(message, "patchVersion")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.patchVersion); if (message.collectionName != null && Object.hasOwnProperty.call(message, "collectionName")) writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.collectionName); if (message.firstFourBytesFromAHashOfSnapshotMacKey != null && Object.hasOwnProperty.call(message, "firstFourBytesFromAHashOfSnapshotMacKey")) writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.firstFourBytesFromAHashOfSnapshotMacKey); if (message.newLthashSubtract != null && Object.hasOwnProperty.call(message, "newLthashSubtract")) writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.newLthashSubtract); if (message.numberAdd != null && Object.hasOwnProperty.call(message, "numberAdd")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.numberAdd); if (message.numberRemove != null && Object.hasOwnProperty.call(message, "numberRemove")) writer.uint32(/* id 8, wireType 0 =*/64).int32(message.numberRemove); if (message.numberOverride != null && Object.hasOwnProperty.call(message, "numberOverride")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.numberOverride); if (message.senderPlatform != null && Object.hasOwnProperty.call(message, "senderPlatform")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.senderPlatform); if (message.isSenderPrimary != null && Object.hasOwnProperty.call(message, "isSenderPrimary")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.isSenderPrimary); return writer; }; /** * Encodes the specified PatchDebugData message, length delimited. Does not implicitly {@link SyncAction.PatchDebugData.verify|verify} messages. * @function encodeDelimited * @memberof SyncAction.PatchDebugData * @static * @param {SyncAction.IPatchDebugData} message PatchDebugData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ PatchDebugData.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a PatchDebugData message from the specified reader or buffer. * @function decode * @memberof SyncAction.PatchDebugData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {SyncAction.PatchDebugData} PatchDebugData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ PatchDebugData.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.SyncAction.PatchDebugData(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.currentLthash = reader.bytes(); break; } case 2: { message.newLthash = reader.bytes(); break; } case 3: { message.patchVersion = reader.bytes(); break; } case 4: { message.collectionName = reader.bytes(); break; } case 5: { message.firstFourBytesFromAHashOfSnapshotMacKey = reader.bytes(); break; } case 6: { message.newLthashSubtract = reader.bytes(); break; } case 7: { message.numberAdd = reader.int32(); break; } case 8: { message.numberRemove = reader.int32(); break; } case 9: { message.numberOverride = reader.int32(); break; } case 10: { message.senderPlatform = reader.int32(); break; } case 11: { message.isSenderPrimary = reader.bool(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a PatchDebugData message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof SyncAction.PatchDebugData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {SyncAction.PatchDebugData} PatchDebugData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ PatchDebugData.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a PatchDebugData message. * @function verify * @memberof SyncAction.PatchDebugData * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ PatchDebugData.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.currentLthash != null && message.hasOwnProperty("currentLthash")) if (!(message.currentLthash && typeof message.currentLthash.length === "number" || $util.isString(message.currentLthash))) return "currentLthash: buffer expected"; if (message.newLthash != null && message.hasOwnProperty("newLthash")) if (!(message.newLthash && typeof message.newLthash.length === "number" || $util.isString(message.newLthash))) return "newLthash: buffer expected"; if (message.patchVersion != null && message.hasOwnProperty("patchVersion")) if (!(message.patchVersion && typeof message.patchVersion.length === "number" || $util.isString(message.patchVersion))) return "patchVersion: buffer expected"; if (message.collectionName != null && message.hasOwnProperty("collectionName")) if (!(message.collectionName && typeof message.collectionName.length === "number" || $util.isString(message.collectionName))) return "collectionName: buffer expected"; if (message.firstFourBytesFromAHashOfSnapshotMacKey != null && message.hasOwnProperty("firstFourBytesFromAHashOfSnapshotMacKey")) if (!(message.firstFourBytesFromAHashOfSnapshotMacKey && typeof message.firstFourBytesFromAHashOfSnapshotMacKey.length === "number" || $util.isString(message.firstFourBytesFromAHashOfSnapshotMacKey))) return "firstFourBytesFromAHashOfSnapshotMacKey: buffer expected"; if (message.newLthashSubtract != null && message.hasOwnProperty("newLthashSubtract")) if (!(message.newLthashSubtract && typeof message.newLthashSubtract.length === "number" || $util.isString(message.newLthashSubtract))) return "newLthashSubtract: buffer expected"; if (message.numberAdd != null && message.hasOwnProperty("numberAdd")) if (!$util.isInteger(message.numberAdd)) return "numberAdd: integer expected"; if (message.numberRemove != null && message.hasOwnProperty("numberRemove")) if (!$util.isInteger(message.numberRemove)) return "numberRemove: integer expected"; if (message.numberOverride != null && message.hasOwnProperty("numberOverride")) if (!$util.isInteger(message.numberOverride)) return "numberOverride: integer expected"; if (message.senderPlatform != null && message.hasOwnProperty("senderPlatform")) switch (message.senderPlatform) { default: return "senderPlatform: enum value expected"; case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: break; } if (message.isSenderPrimary != null && message.hasOwnProperty("isSenderPrimary")) if (typeof message.isSenderPrimary !== "boolean") return "isSenderPrimary: boolean expected"; return null; }; /** * Creates a PatchDebugData message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof SyncAction.PatchDebugData * @static * @param {Object.<string,*>} object Plain object * @returns {SyncAction.PatchDebugData} PatchDebugData */ PatchDebugData.fromObject = function fromObject(object) { if (object instanceof $root.SyncAction.PatchDebugData) return object; var message = new $root.SyncAction.PatchDebugData(); if (object.currentLthash != null) if (typeof object.currentLthash === "string") $util.base64.decode(object.currentLthash, message.currentLthash = $util.newBuffer($util.base64.length(object.currentLthash)), 0); else if (object.currentLthash.length >= 0) message.currentLthash = object.currentLthash; if (object.newLthash != null) if (typeof object.newLthash === "string") $util.base64.decode(object.newLthash, message.newLthash = $util.newBuffer($util.base64.length(object.newLthash)), 0); else if (object.newLthash.length >= 0) message.newLthash = object.newLthash; if (object.patchVersion != null) if (typeof object.patchVersion === "string") $util.base64.decode(object.patchVersion, message.patchVersion = $util.newBuffer($util.base64.length(object.patchVersion)), 0); else if (object.patchVersion.length >= 0) message.patchVersion = object.patchVersion; if (object.collectionName != null) if (typeof object.collectionName === "string") $util.base64.decode(object.collectionName, message.collectionName = $util.newBuffer($util.base64.length(object.collectionName)), 0); else if (object.collectionName.length >= 0) message.collectionName = object.collectionName; if (object.firstFourBytesFromAHashOfSnapshotMacKey != null) if (typeof object.firstFourBytesFromAHashOfSnapshotMacKey === "string") $util.base64.decode(object.firstFourBytesFromAHashOfSnapshotMacKey, message.firstFourBytesFromAHashOfSnapshotMacKey = $util.newBuffer($util.base64.length(object.firstFourBytesFromAHashOfSnapshotMacKey)), 0); else if (object.firstFourBytesFromAHashOfSnapshotMacKey.length >= 0) message.firstFourBytesFromAHashOfSnapshotMacKey = object.firstFourBytesFromAHashOfSnapshotMacKey; if (object.newLthashSubtract != null) if (typeof object.newLthashSubtract === "string") $util.base64.decode(object.newLthashSubtract, message.newLthashSubtract = $util.newBuffer($util.base64.length(object.newLthashSubtract)), 0); else if (object.newLthashSubtract.length >= 0) message.newLthashSubtract = object.newLthashSubtract; if (object.numberAdd != null) message.numberAdd = object.numberAdd | 0; if (object.numberRemove != null) message.numberRemove = object.numberRemove | 0; if (object.numberOverride != null) message.numberOverride = object.numberOverride | 0; switch (object.senderPlatform) { default: if (typeof object.senderPlatform === "number") { message.senderPlatform = object.senderPlatform; break; } break; case "ANDROID": case 0: message.senderPlatform = 0; break; case "SMBA": case 1: message.senderPlatform = 1; break; case "IPHONE": case 2: message.senderPlatform = 2; break; case "SMBI": case 3: message.senderPlatform = 3; break; case "WEB": case 4: message.senderPlatform = 4; break; case "UWP": case 5: message.senderPlatform = 5; break; case "DARWIN": case 6: message.senderPlatform = 6; break; case "IPAD": case 7: message.senderPlatform = 7; break; case "WEAROS": case 8: message.senderPlatform = 8; break; } if (object.isSenderPrimary != null) message.isSenderPrimary = Boolean(object.isSenderPrimary); return message; }; /** * Creates a plain object from a PatchDebugData message. Also converts values to other types if specified. * @function toObject * @memberof SyncAction.PatchDebugData * @static * @param {SyncAction.PatchDebugData} message PatchDebugData * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ PatchDebugData.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) object.currentLthash = ""; else { object.currentLthash = []; if (options.bytes !== Array) object.currentLthash = $util.newBuffer(object.currentLthash); } if (options.bytes === String) object.newLthash = ""; else { object.newLthash = []; if (options.bytes !== Array) object.newLthash = $util.newBuffer(object.newLthash); } if (options.bytes === String) object.patchVersion = ""; else { object.patchVersion = []; if (options.bytes !== Array) object.patchVersion = $util.newBuffer(object.patchVersion); } if (options.bytes === String) object.collectionName = ""; else { object.collectionName = []; if (options.bytes !== Array) object.collectionName = $util.newBuffer(object.collectionName); } if (options.bytes === String) object.firstFourBytesFromAHashOfSnapshotMacKey = ""; else { object.firstFourBytesFromAHashOfSnapshotMacKey = []; if (options.bytes !== Array) object.firstFourBytesFromAHashOfSnapshotMacKey = $util.newBuffer(object.firstFourBytesFromAHashOfSnapshotMacKey); } if (options.bytes === String) object.newLthashSubtract = ""; else { object.newLthashSubtract = []; if (options.bytes !== Array) object.newLthashSubtract = $util.newBuffer(object.newLthashSubtract); } object.numberAdd = 0; object.numberRemove = 0; object.numberOverride = 0; object.senderPlatform = options.enums === String ? "ANDROID" : 0; object.isSenderPrimary = false; } if (message.currentLthash != null && message.hasOwnProperty("currentLthash")) object.currentLthash = options.bytes === String ? $util.base64.encode(message.currentLthash, 0, message.currentLthash.length) : options.bytes === Array ? Array.prototype.slice.call(message.currentLthash) : message.currentLthash; if (message.newLthash != null && message.hasOwnProperty("newLthash")) object.newLthash = options.bytes === String ? $util.base64.encode(message.newLthash, 0, message.newLthash.length) : options.bytes === Array ? Array.prototype.slice.call(message.newLthash) : message.newLthash; if (message.patchVersion != null && message.hasOwnProperty("patchVersion")) object.patchVersion = options.bytes === String ? $util.base64.encode(message.patchVersion, 0, message.patchVersion.length) : options.bytes === Array ? Array.prototype.slice.call(message.patchVersion) : message.patchVersion; if (message.collectionName != null && message.hasOwnProperty("collectionName")) object.collectionName = options.bytes === String ? $util.base64.encode(message.collectionName, 0, message.collectionName.length) : options.bytes === Array ? Array.prototype.slice.call(message.collectionName) : message.collectionName; if (message.firstFourBytesFromAHashOfSnapshotMacKey != null && message.hasOwnProperty("firstFourBytesFromAHashOfSnapshotMacKey")) object.firstFourBytesFromAHashOfSnapshotMacKey = options.bytes === String ? $util.base64.encode(message.firstFourBytesFromAHashOfSnapshotMacKey, 0, message.firstFourBytesFromAHashOfSnapshotMacKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.firstFourBytesFromAHashOfSnapshotMacKey) : message.firstFourBytesFromAHashOfSnapshotMacKey; if (message.newLthashSubtract != null && message.hasOwnProperty("newLthashSubtract")) object.newLthashSubtract = options.bytes === String ? $util.base64.encode(message.newLthashSubtract, 0, message.newLthashSubtract.length) : options.bytes === Array ? Array.prototype.slice.call(message.newLthashSubtract) : message.newLthashSubtract; if (message.numberAdd != null && message.hasOwnProperty("numberAdd")) object.numberAdd = message.numberAdd; if (message.numberRemove != null && message.hasOwnProperty("numberRemove")) object.numberRemove = message.numberRemove; if (message.numberOverride != null && message.hasOwnProperty("numberOverride")) object.numberOverride = message.numberOverride; if (message.senderPlatform != null && message.hasOwnProperty("senderPlatform")) object.senderPlatform = options.enums === String ? $root.SyncAction.PatchDebugData.Platform[message.senderPlatform] === undefined ? message.senderPlatform : $root.SyncAction.PatchDebugData.Platform[message.senderPlatform] : message.senderPlatform; if (message.isSenderPrimary != null && message.hasOwnProperty("isSenderPrimary")) object.isSenderPrimary = message.isSenderPrimary; return object; }; /** * Converts this PatchDebugData to JSON. * @function toJSON * @memberof SyncAction.PatchDebugData * @instance * @returns {Object.<string,*>} JSON object */ PatchDebugData.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for PatchDebugData * @function getTypeUrl * @memberof SyncAction.PatchDebugData * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ PatchDebugData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/SyncAction.PatchDebugData"; }; /** * Platform enum. * @name SyncAction.PatchDebugData.Platform * @enum {number} * @property {number} ANDROID=0 ANDROID value * @property {number} SMBA=1 SMBA value * @property {number} IPHONE=2 IPHONE value * @property {number} SMBI=3 SMBI value * @property {number} WEB=4 WEB value * @property {number} UWP=5 UWP value * @property {number} DARWIN=6 DARWIN value * @property {number} IPAD=7 IPAD value * @property {number} WEAROS=8 WEAROS value */ PatchDebugData.Platform = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "ANDROID"] = 0; values[valuesById[1] = "SMBA"] = 1; values[valuesById[2] = "IPHONE"] = 2; values[valuesById[3] = "SMBI"] = 3; values[valuesById[4] = "WEB"] = 4; values[valuesById[5] = "UWP"] = 5; values[valuesById[6] = "DARWIN"] = 6; values[valuesById[7] = "IPAD"] = 7; values[valuesById[8] = "WEAROS"] = 8; return values; })(); return PatchDebugData; })(); SyncAction.SyncActionData = (function() { /** * Properties of a SyncActionData. * @memberof SyncAction * @interface ISyncActionData * @property {Uint8Array|null} [index] SyncActionData index * @property {SyncAction.ISyncActionValue|null} [value] SyncActionData value * @property {Uint8Array|null} [padding] SyncActionData padding * @property {number|null} [version] SyncActionData version */ /** * Constructs a new SyncActionData. * @memberof SyncAction * @classdesc Represents a SyncActionData. * @implements ISyncActionData * @constructor * @param {SyncAction.ISyncActionData=} [properties] Properties to set */ function SyncActionData(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]]; } /** * SyncActionData index. * @member {Uint8Array} index * @memberof SyncAction.SyncActionData * @instance */ SyncActionData.prototype.index = $util.newBuffer([]); /** * SyncActionData value. * @member {SyncAction.ISyncActionValue|null|undefined} value * @memberof SyncAction.SyncActionData * @instance */ SyncActionData.prototype.value = null; /** * SyncActionData padding. * @member {Uint8Array} padding * @memberof SyncAction.SyncActionData * @instance */ SyncActionData.prototype.padding = $util.newBuffer([]); /** * SyncActionData version. * @member {number} version * @memberof SyncAction.SyncActionData * @instance */ SyncActionData.prototype.version = 0; /** * Creates a new SyncActionData instance using the specified properties. * @function create * @memberof SyncAction.SyncActionData * @static * @param {SyncAction.ISyncActionData=} [properties] Properties to set * @returns {SyncAction.SyncActionData} SyncActionData instance */ SyncActionData.create = function create(properties) { return new SyncActionData(properties); }; /** * Encodes the specified SyncActionData message. Does not implicitly {@link SyncAction.SyncActionData.verify|verify} messages. * @function encode * @memberof SyncAction.SyncActionData * @static * @param {SyncAction.ISyncActionData} message SyncActionData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ SyncActionData.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.index != null && Object.hasOwnProperty.call(message, "index")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.index); if (message.value != null && Object.hasOwnProperty.call(message, "value")) $root.SyncAction.SyncActionValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.padding != null && Object.hasOwnProperty.call(message, "padding")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.padding); if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.version); return writer; }; /** * Encodes the specified SyncActionData message, length delimited. Does not implicitly {@link SyncAction.SyncActionData.verify|verify} messages. * @function encodeDelimited * @memberof SyncAction.SyncActionData * @static * @param {SyncAction.ISyncActionData} message SyncActionData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ SyncActionData.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a SyncActionData message from the specified reader or buffer. * @function decode * @memberof SyncAction.SyncActionData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {SyncAction.SyncActionData} SyncActionData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ SyncActionData.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.SyncAction.SyncActionData(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.index = reader.bytes(); break; } case 2: { message.value = $root.SyncAction.SyncActionValue.decode(reader, reader.uint32()); break; } case 3: { message.padding = reader.bytes(); break; } case 4: { message.version = reader.int32(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a SyncActionData message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof SyncAction.SyncActionData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {SyncAction.SyncActionData} SyncActionData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ SyncActionData.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a SyncActionData message. * @function verify * @memberof SyncAction.SyncActionData * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ SyncActionData.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.index != null && message.hasOwnProperty("index")) if (!(message.index && typeof message.index.length === "number" || $util.isString(message.index))) return "index: buffer expected"; if (message.value != null && message.hasOwnProperty("value")) { var error = $root.SyncAction.SyncActionValue.verify(message.value); if (error) return "value." + error; } if (message.padding != null && message.hasOwnProperty("padding")) if (!(message.padding && typeof message.padding.length === "number" || $util.isString(message.padding))) return "padding: buffer expected"; if (message.version != null && message.hasOwnProperty("version")) if (!$util.isInteger(message.version)) return "version: integer expected"; return null; }; /** * Creates a SyncActionData message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof SyncAction.SyncActionData * @static * @param {Object.<string,*>} object Plain object * @returns {SyncAction.SyncActionData} SyncActionData */ SyncActionData.fromObject = function fromObject(object) { if (object instanceof $root.SyncAction.SyncActionData) return object; var message = new $root.SyncAction.SyncActionData(); if (object.index != null) if (typeof object.index === "string") $util.base64.decode(object.index, message.index = $util.newBuffer($util.base64.length(object.index)), 0); else if (object.index.length >= 0) message.index = object.index; if (object.value != null) { if (typeof object.value !== "object") throw TypeError(".SyncAction.SyncActionData.value: object expected"); message.value = $root.SyncAction.SyncActionValue.fromObject(object.value); } if (object.padding != null) if (typeof object.padding === "string") $util.base64.decode(object.padding, message.padding = $util.newBuffer($util.base64.length(object.padding)), 0); else if (object.padding.length >= 0) message.padding = object.padding; if (object.version != null) message.version = object.version | 0; return message; }; /** * Creates a plain object from a SyncActionData message. Also converts values to other types if specified. * @function toObject * @memberof SyncAction.SyncActionData * @static * @param {SyncAction.SyncActionData} message SyncActionData * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ SyncActionData.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) object.index = ""; else { object.index = []; if (options.bytes !== Array) object.index = $util.newBuffer(object.index); } object.value = null; if (options.bytes === String) object.padding = ""; else { object.padding = []; if (options.bytes !== Array) object.padding = $util.newBuffer(object.padding); } object.version = 0; } if (message.index != null && message.hasOwnProperty("index")) object.index = options.bytes === String ? $util.base64.encode(message.index, 0, message.index.length) : options.bytes === Array ? Array.prototype.slice.call(message.index) : message.index; if (message.value != null && message.hasOwnProperty("value")) object.value = $root.SyncAction.SyncActionValue.toObject(message.value, options); if (message.padding != null && message.hasOwnProperty("padding")) object.padding = options.bytes === String ? $util.base64.encode(message.padding, 0, message.padding.length) : options.bytes === Array ? Array.prototype.slice.call(message.padding) : message.padding; if (message.version != null && message.hasOwnProperty("version")) object.version = message.version; return object; }; /** * Converts this SyncActionData to JSON. * @function toJSON * @memberof SyncAction.SyncActionData * @instance * @returns {Object.<string,*>} JSON object */ SyncActionData.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for SyncActionData * @function getTypeUrl * @memberof SyncAction.SyncActionData * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ SyncActionData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/SyncAction.SyncActionData"; }; return SyncActionData; })(); SyncAction.SyncActionValue = (function() { /** * Properties of a SyncActionValue. * @memberof SyncAction * @interface ISyncActionValue * @property {number|Long|null} [timestamp] SyncActionValue timestamp * @property {SyncAction.SyncActionValue.IStarAction|null} [starAction] SyncActionValue starAction * @property {SyncAction.SyncActionValue.IContactAction|null} [contactAction] SyncActionValue contactAction * @property {SyncAction.SyncActionValue.IMuteAction|null} [muteAction] SyncActionValue muteAction * @property {SyncAction.SyncActionValue.IPinAction|null} [pinAction] SyncActionValue pinAction * @property {SyncAction.SyncActionValue.ISecurityNotificationSetting|null} [securityNotificationSetting] SyncActionValue securityNotificationSetting * @property {SyncAction.SyncActionValue.IPushNameSetting|null} [pushNameSetting] SyncActionValue pushNameSetting * @property {SyncAction.SyncActionValue.IQuickReplyAction|null} [quickReplyAction] SyncActionValue quickReplyAction * @property {SyncAction.SyncActionValue.IRecentEmojiWeightsAction|null} [recentEmojiWeightsAction] SyncActionValue recentEmojiWeightsAction * @property {SyncAction.SyncActionValue.ILabelEditAction|null} [labelEditAction] SyncActionValue labelEditAction * @property {SyncAction.SyncActionValue.ILabelAssociationAction|null} [labelAssociationAction] SyncActionValue labelAssociationAction * @property {SyncAction.SyncActionValue.ILocaleSetting|null} [localeSetting] SyncActionValue localeSetting * @property {SyncAction.SyncActionValue.IArchiveChatAction|null} [archiveChatAction] SyncActionValue archiveChatAction * @property {SyncAction.SyncActionValue.IDeleteMessageForMeAction|null} [deleteMessageForMeAction] SyncActionValue deleteMessageForMeAction * @property {SyncAction.SyncActionValue.IKeyExpiration|null} [keyExpiration] SyncActionValue keyExpiration * @property {SyncAction.SyncActionValue.IMarkChatAsReadAction|null} [markChatAsReadAction] SyncActionValue markChatAsReadAction * @property {SyncAction.SyncActionValue.IClearChatAction|null} [clearChatAction] SyncActionValue clearChatAction * @property {SyncAction.SyncActionValue.IDeleteChatAction|null} [deleteChatAction] SyncActionValue deleteChatAction * @property {SyncAction.SyncActionValue.IUnarchiveChatsSetting|null} [unarchiveChatsSetting] SyncActionValue unarchiveChatsSetting * @property {SyncAction.SyncActionValue.IPrimaryFeature|null} [primaryFeature] SyncActionValue primaryFeature * @property {SyncAction.SyncActionValue.IAndroidUnsupportedActions|null} [androidUnsupportedActions] SyncActionValue androidUnsupportedActions * @property {SyncAction.SyncActionValue.IAgentAction|null} [agentAction] SyncActionValue agentAction * @property {SyncAction.SyncActionValue.ISubscriptionAction|null} [subscriptionAction] SyncActionValue subscriptionAction * @property {SyncAction.SyncActionValue.IUserStatusMuteAction|null} [userStatusMuteAction] SyncActionValue userStatusMuteAction * @property {SyncAction.SyncActionValue.ITimeFormatAction|null} [timeFormatAction] SyncActionValue timeFormatAction * @property {SyncAction.SyncActionValue.INuxAction|null} [nuxAction] SyncActionValue nuxAction * @property {SyncAction.SyncActionValue.IPrimaryVersionAction|null} [primaryVersionAction] SyncActionValue primaryVersionAction * @property {SyncAction.SyncActionValue.IStickerAction|null} [stickerAction] SyncActionValue stickerAction * @property {SyncAction.SyncActionValue.IRemoveRecentStickerAction|null} [removeRecentStickerAction] SyncActionValue removeRecentStickerAction * @property {SyncAction.SyncActionValue.IChatAssignmentAction|null} [chatAssignment] SyncActionValue chatAssignment * @property {SyncAction.SyncActionValue.IChatAssignmentOpenedStatusAction|null} [chatAssignmentOpenedStatus] SyncActionValue chatAssignmentOpenedStatus * @property {SyncAction.SyncActionValue.IPnForLidChatAction|null} [pnForLidChatAction] SyncActionValue pnForLidChatAction * @property {SyncAction.SyncActionValue.IMarketingMessageAction|null} [marketingMessageAction] SyncActionValue marketingMessageAction * @property {SyncAction.SyncActionValue.IMarketingMessageBroadcastAction|null} [marketingMessageBroadcastAction] SyncActionValue marketingMessageBroadcastAction * @property {SyncAction.SyncActionValue.IExternalWebBetaAction|null} [externalWebBetaAction] SyncActionValue externalWebBetaAction * @property {SyncAction.SyncActionValue.IPrivacySettingRelayAllCalls|null} [privacySettingRelayAllCalls] SyncActionValue privacySettingRelayAllCalls * @property {SyncAction.SyncActionValue.ICallLogAction|null} [callLogAction] SyncActionValue callLogAction * @property {SyncAction.SyncActionValue.IStatusPrivacyAction|null} [statusPrivacy] SyncActionValue statusPrivacy * @property {SyncAction.SyncActionValue.IBotWelcomeRequestAction|null} [botWelcomeRequestAction] SyncActionValue botWelcomeRequestAction * @property {SyncAction.SyncActionValue.IDeleteIndividualCallLogAction|null} [deleteIndividualCallLog] SyncActionValue deleteIndividualCallLog * @property {SyncAction.SyncActionValue.ILabelReorderingAction|null} [labelReorderingAction] SyncActionValue labelReorderingAction * @property {SyncAction.SyncActionValue.IPaymentInfoAction|null} [paymentInfoAction] SyncActionValue paymentInfoAction * @property {SyncAction.SyncActionValue.ICustomPaymentMethodsAction|null} [customPaymentMethodsAction] SyncActionValue customPaymentMethodsAction * @property {SyncAction.SyncActionValue.ILockChatAction|null} [lockChatAction] SyncActionValue lockChatAction * @property {ChatLockSettings.IChatLockSettings|null} [chatLockSettings] SyncActionValue chatLockSettings * @property {SyncAction.SyncActionValue.IWamoUserIdentifierAction|null} [wamoUserIdentifierAction] SyncActionValue wamoUserIdentifierAction * @property {SyncAction.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction|null} [privacySettingDisableLinkPreviewsAction] SyncActionValue privacySettingDisableLinkPreviewsAction * @property {DeviceCapabilities.IDeviceCapabilities|null} [deviceCapabilities] SyncActionValue deviceCapabilities * @property {SyncAction.SyncActionValue.INoteEditAction|null} [noteEditAction] SyncActionValue noteEditAction * @property {SyncAction.SyncActionValue.IFavoritesAction|null} [favoritesAction] SyncActionValue favoritesAction * @property {SyncAction.SyncActionValue.IMerchantPaymentPartnerAction|null} [merchantPaymentPartnerAction] SyncActionValue merchantPaymentPartnerAction * @property {SyncAction.SyncActionValue.IWaffleAccountLinkStateAction|null} [waffleAccountLinkStateAction] SyncActionValue waffleAccountLinkStateAction * @property {SyncAction.SyncActionVa