textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
1,350 lines (1,250 loc) • 1.19 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*/
import * as $protobuf from "protobufjs/minimal";
// Common aliases
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
export const CafeChallenge = $root.CafeChallenge = (() => {
/**
* Properties of a CafeChallenge.
* @exports ICafeChallenge
* @interface ICafeChallenge
* @property {string} address CafeChallenge address
*/
/**
* Constructs a new CafeChallenge.
* @exports CafeChallenge
* @classdesc Represents a CafeChallenge.
* @implements ICafeChallenge
* @constructor
* @param {ICafeChallenge=} [properties] Properties to set
*/
function CafeChallenge(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeChallenge address.
* @member {string} address
* @memberof CafeChallenge
* @instance
*/
CafeChallenge.prototype.address = "";
/**
* Creates a new CafeChallenge instance using the specified properties.
* @function create
* @memberof CafeChallenge
* @static
* @param {ICafeChallenge=} [properties] Properties to set
* @returns {CafeChallenge} CafeChallenge instance
*/
CafeChallenge.create = function create(properties) {
return new CafeChallenge(properties);
};
/**
* Encodes the specified CafeChallenge message. Does not implicitly {@link CafeChallenge.verify|verify} messages.
* @function encode
* @memberof CafeChallenge
* @static
* @param {ICafeChallenge} message CafeChallenge message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeChallenge.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.address != null && message.hasOwnProperty("address"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.address);
return writer;
};
/**
* Encodes the specified CafeChallenge message, length delimited. Does not implicitly {@link CafeChallenge.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeChallenge
* @static
* @param {ICafeChallenge} message CafeChallenge message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeChallenge.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeChallenge message from the specified reader or buffer.
* @function decode
* @memberof CafeChallenge
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeChallenge} CafeChallenge
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeChallenge.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeChallenge();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeChallenge message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeChallenge
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeChallenge} CafeChallenge
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeChallenge.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeChallenge message.
* @function verify
* @memberof CafeChallenge
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeChallenge.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.address != null && message.hasOwnProperty("address"))
if (!$util.isString(message.address))
return "address: string expected";
return null;
};
/**
* Creates a CafeChallenge message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeChallenge
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeChallenge} CafeChallenge
*/
CafeChallenge.fromObject = function fromObject(object) {
if (object instanceof $root.CafeChallenge)
return object;
let message = new $root.CafeChallenge();
if (object.address != null)
message.address = String(object.address);
return message;
};
/**
* Creates a plain object from a CafeChallenge message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeChallenge
* @static
* @param {CafeChallenge} message CafeChallenge
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeChallenge.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.address = "";
if (message.address != null && message.hasOwnProperty("address"))
object.address = message.address;
return object;
};
/**
* Converts this CafeChallenge to JSON.
* @function toJSON
* @memberof CafeChallenge
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeChallenge.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeChallenge;
})();
export const CafeNonce = $root.CafeNonce = (() => {
/**
* Properties of a CafeNonce.
* @exports ICafeNonce
* @interface ICafeNonce
* @property {string} value CafeNonce value
*/
/**
* Constructs a new CafeNonce.
* @exports CafeNonce
* @classdesc Represents a CafeNonce.
* @implements ICafeNonce
* @constructor
* @param {ICafeNonce=} [properties] Properties to set
*/
function CafeNonce(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeNonce value.
* @member {string} value
* @memberof CafeNonce
* @instance
*/
CafeNonce.prototype.value = "";
/**
* Creates a new CafeNonce instance using the specified properties.
* @function create
* @memberof CafeNonce
* @static
* @param {ICafeNonce=} [properties] Properties to set
* @returns {CafeNonce} CafeNonce instance
*/
CafeNonce.create = function create(properties) {
return new CafeNonce(properties);
};
/**
* Encodes the specified CafeNonce message. Does not implicitly {@link CafeNonce.verify|verify} messages.
* @function encode
* @memberof CafeNonce
* @static
* @param {ICafeNonce} message CafeNonce message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeNonce.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.value != null && message.hasOwnProperty("value"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.value);
return writer;
};
/**
* Encodes the specified CafeNonce message, length delimited. Does not implicitly {@link CafeNonce.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeNonce
* @static
* @param {ICafeNonce} message CafeNonce message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeNonce.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeNonce message from the specified reader or buffer.
* @function decode
* @memberof CafeNonce
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeNonce} CafeNonce
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeNonce.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeNonce();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.value = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeNonce message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeNonce
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeNonce} CafeNonce
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeNonce.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeNonce message.
* @function verify
* @memberof CafeNonce
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeNonce.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.value != null && message.hasOwnProperty("value"))
if (!$util.isString(message.value))
return "value: string expected";
return null;
};
/**
* Creates a CafeNonce message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeNonce
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeNonce} CafeNonce
*/
CafeNonce.fromObject = function fromObject(object) {
if (object instanceof $root.CafeNonce)
return object;
let message = new $root.CafeNonce();
if (object.value != null)
message.value = String(object.value);
return message;
};
/**
* Creates a plain object from a CafeNonce message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeNonce
* @static
* @param {CafeNonce} message CafeNonce
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeNonce.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.value = "";
if (message.value != null && message.hasOwnProperty("value"))
object.value = message.value;
return object;
};
/**
* Converts this CafeNonce to JSON.
* @function toJSON
* @memberof CafeNonce
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeNonce.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeNonce;
})();
export const CafeRegistration = $root.CafeRegistration = (() => {
/**
* Properties of a CafeRegistration.
* @exports ICafeRegistration
* @interface ICafeRegistration
* @property {string} address CafeRegistration address
* @property {string} value CafeRegistration value
* @property {string} nonce CafeRegistration nonce
* @property {Uint8Array} sig CafeRegistration sig
* @property {string} token CafeRegistration token
*/
/**
* Constructs a new CafeRegistration.
* @exports CafeRegistration
* @classdesc Represents a CafeRegistration.
* @implements ICafeRegistration
* @constructor
* @param {ICafeRegistration=} [properties] Properties to set
*/
function CafeRegistration(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeRegistration address.
* @member {string} address
* @memberof CafeRegistration
* @instance
*/
CafeRegistration.prototype.address = "";
/**
* CafeRegistration value.
* @member {string} value
* @memberof CafeRegistration
* @instance
*/
CafeRegistration.prototype.value = "";
/**
* CafeRegistration nonce.
* @member {string} nonce
* @memberof CafeRegistration
* @instance
*/
CafeRegistration.prototype.nonce = "";
/**
* CafeRegistration sig.
* @member {Uint8Array} sig
* @memberof CafeRegistration
* @instance
*/
CafeRegistration.prototype.sig = $util.newBuffer([]);
/**
* CafeRegistration token.
* @member {string} token
* @memberof CafeRegistration
* @instance
*/
CafeRegistration.prototype.token = "";
/**
* Creates a new CafeRegistration instance using the specified properties.
* @function create
* @memberof CafeRegistration
* @static
* @param {ICafeRegistration=} [properties] Properties to set
* @returns {CafeRegistration} CafeRegistration instance
*/
CafeRegistration.create = function create(properties) {
return new CafeRegistration(properties);
};
/**
* Encodes the specified CafeRegistration message. Does not implicitly {@link CafeRegistration.verify|verify} messages.
* @function encode
* @memberof CafeRegistration
* @static
* @param {ICafeRegistration} message CafeRegistration message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeRegistration.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.address != null && message.hasOwnProperty("address"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.address);
if (message.value != null && message.hasOwnProperty("value"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.value);
if (message.nonce != null && message.hasOwnProperty("nonce"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.nonce);
if (message.sig != null && message.hasOwnProperty("sig"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.sig);
if (message.token != null && message.hasOwnProperty("token"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.token);
return writer;
};
/**
* Encodes the specified CafeRegistration message, length delimited. Does not implicitly {@link CafeRegistration.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeRegistration
* @static
* @param {ICafeRegistration} message CafeRegistration message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeRegistration.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeRegistration message from the specified reader or buffer.
* @function decode
* @memberof CafeRegistration
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeRegistration} CafeRegistration
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeRegistration.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeRegistration();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.value = reader.string();
break;
case 3:
message.nonce = reader.string();
break;
case 4:
message.sig = reader.bytes();
break;
case 5:
message.token = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeRegistration message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeRegistration
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeRegistration} CafeRegistration
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeRegistration.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeRegistration message.
* @function verify
* @memberof CafeRegistration
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeRegistration.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.address != null && message.hasOwnProperty("address"))
if (!$util.isString(message.address))
return "address: string expected";
if (message.value != null && message.hasOwnProperty("value"))
if (!$util.isString(message.value))
return "value: string expected";
if (message.nonce != null && message.hasOwnProperty("nonce"))
if (!$util.isString(message.nonce))
return "nonce: string expected";
if (message.sig != null && message.hasOwnProperty("sig"))
if (!(message.sig && typeof message.sig.length === "number" || $util.isString(message.sig)))
return "sig: buffer expected";
if (message.token != null && message.hasOwnProperty("token"))
if (!$util.isString(message.token))
return "token: string expected";
return null;
};
/**
* Creates a CafeRegistration message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeRegistration
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeRegistration} CafeRegistration
*/
CafeRegistration.fromObject = function fromObject(object) {
if (object instanceof $root.CafeRegistration)
return object;
let message = new $root.CafeRegistration();
if (object.address != null)
message.address = String(object.address);
if (object.value != null)
message.value = String(object.value);
if (object.nonce != null)
message.nonce = String(object.nonce);
if (object.sig != null)
if (typeof object.sig === "string")
$util.base64.decode(object.sig, message.sig = $util.newBuffer($util.base64.length(object.sig)), 0);
else if (object.sig.length)
message.sig = object.sig;
if (object.token != null)
message.token = String(object.token);
return message;
};
/**
* Creates a plain object from a CafeRegistration message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeRegistration
* @static
* @param {CafeRegistration} message CafeRegistration
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeRegistration.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.address = "";
object.value = "";
object.nonce = "";
if (options.bytes === String)
object.sig = "";
else {
object.sig = [];
if (options.bytes !== Array)
object.sig = $util.newBuffer(object.sig);
}
object.token = "";
}
if (message.address != null && message.hasOwnProperty("address"))
object.address = message.address;
if (message.value != null && message.hasOwnProperty("value"))
object.value = message.value;
if (message.nonce != null && message.hasOwnProperty("nonce"))
object.nonce = message.nonce;
if (message.sig != null && message.hasOwnProperty("sig"))
object.sig = options.bytes === String ? $util.base64.encode(message.sig, 0, message.sig.length) : options.bytes === Array ? Array.prototype.slice.call(message.sig) : message.sig;
if (message.token != null && message.hasOwnProperty("token"))
object.token = message.token;
return object;
};
/**
* Converts this CafeRegistration to JSON.
* @function toJSON
* @memberof CafeRegistration
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeRegistration.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeRegistration;
})();
export const CafeDeregistration = $root.CafeDeregistration = (() => {
/**
* Properties of a CafeDeregistration.
* @exports ICafeDeregistration
* @interface ICafeDeregistration
* @property {string} token CafeDeregistration token
*/
/**
* Constructs a new CafeDeregistration.
* @exports CafeDeregistration
* @classdesc Represents a CafeDeregistration.
* @implements ICafeDeregistration
* @constructor
* @param {ICafeDeregistration=} [properties] Properties to set
*/
function CafeDeregistration(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeDeregistration token.
* @member {string} token
* @memberof CafeDeregistration
* @instance
*/
CafeDeregistration.prototype.token = "";
/**
* Creates a new CafeDeregistration instance using the specified properties.
* @function create
* @memberof CafeDeregistration
* @static
* @param {ICafeDeregistration=} [properties] Properties to set
* @returns {CafeDeregistration} CafeDeregistration instance
*/
CafeDeregistration.create = function create(properties) {
return new CafeDeregistration(properties);
};
/**
* Encodes the specified CafeDeregistration message. Does not implicitly {@link CafeDeregistration.verify|verify} messages.
* @function encode
* @memberof CafeDeregistration
* @static
* @param {ICafeDeregistration} message CafeDeregistration message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeDeregistration.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.token != null && message.hasOwnProperty("token"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.token);
return writer;
};
/**
* Encodes the specified CafeDeregistration message, length delimited. Does not implicitly {@link CafeDeregistration.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeDeregistration
* @static
* @param {ICafeDeregistration} message CafeDeregistration message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeDeregistration.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeDeregistration message from the specified reader or buffer.
* @function decode
* @memberof CafeDeregistration
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeDeregistration} CafeDeregistration
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeDeregistration.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeDeregistration();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.token = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeDeregistration message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeDeregistration
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeDeregistration} CafeDeregistration
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeDeregistration.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeDeregistration message.
* @function verify
* @memberof CafeDeregistration
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeDeregistration.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.token != null && message.hasOwnProperty("token"))
if (!$util.isString(message.token))
return "token: string expected";
return null;
};
/**
* Creates a CafeDeregistration message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeDeregistration
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeDeregistration} CafeDeregistration
*/
CafeDeregistration.fromObject = function fromObject(object) {
if (object instanceof $root.CafeDeregistration)
return object;
let message = new $root.CafeDeregistration();
if (object.token != null)
message.token = String(object.token);
return message;
};
/**
* Creates a plain object from a CafeDeregistration message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeDeregistration
* @static
* @param {CafeDeregistration} message CafeDeregistration
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeDeregistration.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.token = "";
if (message.token != null && message.hasOwnProperty("token"))
object.token = message.token;
return object;
};
/**
* Converts this CafeDeregistration to JSON.
* @function toJSON
* @memberof CafeDeregistration
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeDeregistration.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeDeregistration;
})();
export const CafeDeregistrationAck = $root.CafeDeregistrationAck = (() => {
/**
* Properties of a CafeDeregistrationAck.
* @exports ICafeDeregistrationAck
* @interface ICafeDeregistrationAck
* @property {string} id CafeDeregistrationAck id
*/
/**
* Constructs a new CafeDeregistrationAck.
* @exports CafeDeregistrationAck
* @classdesc Represents a CafeDeregistrationAck.
* @implements ICafeDeregistrationAck
* @constructor
* @param {ICafeDeregistrationAck=} [properties] Properties to set
*/
function CafeDeregistrationAck(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeDeregistrationAck id.
* @member {string} id
* @memberof CafeDeregistrationAck
* @instance
*/
CafeDeregistrationAck.prototype.id = "";
/**
* Creates a new CafeDeregistrationAck instance using the specified properties.
* @function create
* @memberof CafeDeregistrationAck
* @static
* @param {ICafeDeregistrationAck=} [properties] Properties to set
* @returns {CafeDeregistrationAck} CafeDeregistrationAck instance
*/
CafeDeregistrationAck.create = function create(properties) {
return new CafeDeregistrationAck(properties);
};
/**
* Encodes the specified CafeDeregistrationAck message. Does not implicitly {@link CafeDeregistrationAck.verify|verify} messages.
* @function encode
* @memberof CafeDeregistrationAck
* @static
* @param {ICafeDeregistrationAck} message CafeDeregistrationAck message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeDeregistrationAck.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.id != null && message.hasOwnProperty("id"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.id);
return writer;
};
/**
* Encodes the specified CafeDeregistrationAck message, length delimited. Does not implicitly {@link CafeDeregistrationAck.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeDeregistrationAck
* @static
* @param {ICafeDeregistrationAck} message CafeDeregistrationAck message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeDeregistrationAck.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeDeregistrationAck message from the specified reader or buffer.
* @function decode
* @memberof CafeDeregistrationAck
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeDeregistrationAck} CafeDeregistrationAck
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeDeregistrationAck.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeDeregistrationAck();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeDeregistrationAck message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeDeregistrationAck
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeDeregistrationAck} CafeDeregistrationAck
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeDeregistrationAck.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeDeregistrationAck message.
* @function verify
* @memberof CafeDeregistrationAck
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeDeregistrationAck.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.id != null && message.hasOwnProperty("id"))
if (!$util.isString(message.id))
return "id: string expected";
return null;
};
/**
* Creates a CafeDeregistrationAck message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeDeregistrationAck
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeDeregistrationAck} CafeDeregistrationAck
*/
CafeDeregistrationAck.fromObject = function fromObject(object) {
if (object instanceof $root.CafeDeregistrationAck)
return object;
let message = new $root.CafeDeregistrationAck();
if (object.id != null)
message.id = String(object.id);
return message;
};
/**
* Creates a plain object from a CafeDeregistrationAck message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeDeregistrationAck
* @static
* @param {CafeDeregistrationAck} message CafeDeregistrationAck
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeDeregistrationAck.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.id = "";
if (message.id != null && message.hasOwnProperty("id"))
object.id = message.id;
return object;
};
/**
* Converts this CafeDeregistrationAck to JSON.
* @function toJSON
* @memberof CafeDeregistrationAck
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeDeregistrationAck.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeDeregistrationAck;
})();
export const CafeRefreshSession = $root.CafeRefreshSession = (() => {
/**
* Properties of a CafeRefreshSession.
* @exports ICafeRefreshSession
* @interface ICafeRefreshSession
* @property {string} access CafeRefreshSession access
* @property {string} refresh CafeRefreshSession refresh
*/
/**
* Constructs a new CafeRefreshSession.
* @exports CafeRefreshSession
* @classdesc Represents a CafeRefreshSession.
* @implements ICafeRefreshSession
* @constructor
* @param {ICafeRefreshSession=} [properties] Properties to set
*/
function CafeRefreshSession(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafeRefreshSession access.
* @member {string} access
* @memberof CafeRefreshSession
* @instance
*/
CafeRefreshSession.prototype.access = "";
/**
* CafeRefreshSession refresh.
* @member {string} refresh
* @memberof CafeRefreshSession
* @instance
*/
CafeRefreshSession.prototype.refresh = "";
/**
* Creates a new CafeRefreshSession instance using the specified properties.
* @function create
* @memberof CafeRefreshSession
* @static
* @param {ICafeRefreshSession=} [properties] Properties to set
* @returns {CafeRefreshSession} CafeRefreshSession instance
*/
CafeRefreshSession.create = function create(properties) {
return new CafeRefreshSession(properties);
};
/**
* Encodes the specified CafeRefreshSession message. Does not implicitly {@link CafeRefreshSession.verify|verify} messages.
* @function encode
* @memberof CafeRefreshSession
* @static
* @param {ICafeRefreshSession} message CafeRefreshSession message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeRefreshSession.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.access != null && message.hasOwnProperty("access"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.access);
if (message.refresh != null && message.hasOwnProperty("refresh"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.refresh);
return writer;
};
/**
* Encodes the specified CafeRefreshSession message, length delimited. Does not implicitly {@link CafeRefreshSession.verify|verify} messages.
* @function encodeDelimited
* @memberof CafeRefreshSession
* @static
* @param {ICafeRefreshSession} message CafeRefreshSession message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafeRefreshSession.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafeRefreshSession message from the specified reader or buffer.
* @function decode
* @memberof CafeRefreshSession
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafeRefreshSession} CafeRefreshSession
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeRefreshSession.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.CafeRefreshSession();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.access = reader.string();
break;
case 2:
message.refresh = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CafeRefreshSession message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CafeRefreshSession
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CafeRefreshSession} CafeRefreshSession
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafeRefreshSession.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CafeRefreshSession message.
* @function verify
* @memberof CafeRefreshSession
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CafeRefreshSession.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.access != null && message.hasOwnProperty("access"))
if (!$util.isString(message.access))
return "access: string expected";
if (message.refresh != null && message.hasOwnProperty("refresh"))
if (!$util.isString(message.refresh))
return "refresh: string expected";
return null;
};
/**
* Creates a CafeRefreshSession message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CafeRefreshSession
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CafeRefreshSession} CafeRefreshSession
*/
CafeRefreshSession.fromObject = function fromObject(object) {
if (object instanceof $root.CafeRefreshSession)
return object;
let message = new $root.CafeRefreshSession();
if (object.access != null)
message.access = String(object.access);
if (object.refresh != null)
message.refresh = String(object.refresh);
return message;
};
/**
* Creates a plain object from a CafeRefreshSession message. Also converts values to other types if specified.
* @function toObject
* @memberof CafeRefreshSession
* @static
* @param {CafeRefreshSession} message CafeRefreshSession
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CafeRefreshSession.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.access = "";
object.refresh = "";
}
if (message.access != null && message.hasOwnProperty("access"))
object.access = message.access;
if (message.refresh != null && message.hasOwnProperty("refresh"))
object.refresh = message.refresh;
return object;
};
/**
* Converts this CafeRefreshSession to JSON.
* @function toJSON
* @memberof CafeRefreshSession
* @instance
* @returns {Object.<string,*>} JSON object
*/
CafeRefreshSession.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CafeRefreshSession;
})();
export const CafePublishPeer = $root.CafePublishPeer = (() => {
/**
* Properties of a CafePublishPeer.
* @exports ICafePublishPeer
* @interface ICafePublishPeer
* @property {string} token CafePublishPeer token
* @property {IPeer} peer CafePublishPeer peer
*/
/**
* Constructs a new CafePublishPeer.
* @exports CafePublishPeer
* @classdesc Represents a CafePublishPeer.
* @implements ICafePublishPeer
* @constructor
* @param {ICafePublishPeer=} [properties] Properties to set
*/
function CafePublishPeer(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CafePublishPeer token.
* @member {string} token
* @memberof CafePublishPeer
* @instance
*/
CafePublishPeer.prototype.token = "";
/**
* CafePublishPeer peer.
* @member {IPeer} peer
* @memberof CafePublishPeer
* @instance
*/
CafePublishPeer.prototype.peer = null;
/**
* Creates a new CafePublishPeer instance using the specified properties.
* @function create
* @memberof CafePublishPeer
* @static
* @param {ICafePublishPeer=} [properties] Properties to set
* @returns {CafePublishPeer} CafePublishPeer instance
*/
CafePublishPeer.create = function create(properties) {
return new CafePublishPeer(properties);
};
/**
* Encodes the specified CafePublishPeer message. Does not implicitly {@link CafePublishPeer.verify|verify} messages.
* @function encode
* @memberof CafePublishPeer
* @static
* @param {ICafePublishPeer} message CafePublishPeer message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafePublishPeer.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.token != null && message.hasOwnProperty("token"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.token);
if (message.peer != null && message.hasOwnProperty("peer"))
$root.Peer.encode(message.peer, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified CafePublishPeer message, length delimited. Does not implicitly {@link CafePublishPeer.verify|verify} messages.
* @function encodeDelimited
* @memberof CafePublishPeer
* @static
* @param {ICafePublishPeer} message CafePublishPeer message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CafePublishPeer.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CafePublishPeer message from the specified reader or buffer.
* @function decode
* @memberof CafePublishPeer
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CafePublishPeer} CafePublishPeer
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CafePublishPeer.decode = function decode(reader, length) {
if (!(re