UNPKG

hyperdrive-daemon-client

Version:

A client library and CLI tool for interacting with the Hyperdrive daemon.

1,002 lines (857 loc) 29.4 kB
/** * @fileoverview * @enhanceable * @suppress {messageConventions} JS Compiler reports an error if a variable or * field starts with 'MSG_' and isn't a translatable message. * @public */ // GENERATED CODE -- DO NOT EDIT! var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); goog.exportSymbol('proto.GetAliasRequest', null, global); goog.exportSymbol('proto.GetAliasResponse', null, global); goog.exportSymbol('proto.GetKeyRequest', null, global); goog.exportSymbol('proto.GetKeyResponse', null, global); goog.exportSymbol('proto.WatchPeersRequest', null, global); goog.exportSymbol('proto.WatchPeersResponse', null, global); goog.exportSymbol('proto.WatchPeersResponse.Type', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.GetKeyRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetKeyRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetKeyRequest.displayName = 'proto.GetKeyRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.GetKeyRequest.prototype.toObject = function(opt_includeInstance) { return proto.GetKeyRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.GetKeyRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetKeyRequest.toObject = function(includeInstance, msg) { var f, obj = { alias: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.GetKeyRequest} */ proto.GetKeyRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetKeyRequest; return proto.GetKeyRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetKeyRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetKeyRequest} */ proto.GetKeyRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint32()); msg.setAlias(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetKeyRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetKeyRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetKeyRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetKeyRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAlias(); if (f !== 0) { writer.writeUint32( 1, f ); } }; /** * optional uint32 alias = 1; * @return {number} */ proto.GetKeyRequest.prototype.getAlias = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.GetKeyRequest.prototype.setAlias = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.GetKeyResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetKeyResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetKeyResponse.displayName = 'proto.GetKeyResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.GetKeyResponse.prototype.toObject = function(opt_includeInstance) { return proto.GetKeyResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.GetKeyResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetKeyResponse.toObject = function(includeInstance, msg) { var f, obj = { key: msg.getKey_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.GetKeyResponse} */ proto.GetKeyResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetKeyResponse; return proto.GetKeyResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetKeyResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetKeyResponse} */ proto.GetKeyResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setKey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetKeyResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetKeyResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetKeyResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetKeyResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKey_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes key = 1; * @return {!(string|Uint8Array)} */ proto.GetKeyResponse.prototype.getKey = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes key = 1; * This is a type-conversion wrapper around `getKey()` * @return {string} */ proto.GetKeyResponse.prototype.getKey_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getKey())); }; /** * optional bytes key = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getKey()` * @return {!Uint8Array} */ proto.GetKeyResponse.prototype.getKey_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getKey())); }; /** @param {!(string|Uint8Array)} value */ proto.GetKeyResponse.prototype.setKey = function(value) { jspb.Message.setProto3BytesField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.GetAliasRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetAliasRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetAliasRequest.displayName = 'proto.GetAliasRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.GetAliasRequest.prototype.toObject = function(opt_includeInstance) { return proto.GetAliasRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.GetAliasRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetAliasRequest.toObject = function(includeInstance, msg) { var f, obj = { key: msg.getKey_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.GetAliasRequest} */ proto.GetAliasRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetAliasRequest; return proto.GetAliasRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetAliasRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetAliasRequest} */ proto.GetAliasRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setKey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetAliasRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetAliasRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetAliasRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetAliasRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKey_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes key = 1; * @return {!(string|Uint8Array)} */ proto.GetAliasRequest.prototype.getKey = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes key = 1; * This is a type-conversion wrapper around `getKey()` * @return {string} */ proto.GetAliasRequest.prototype.getKey_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getKey())); }; /** * optional bytes key = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getKey()` * @return {!Uint8Array} */ proto.GetAliasRequest.prototype.getKey_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getKey())); }; /** @param {!(string|Uint8Array)} value */ proto.GetAliasRequest.prototype.setKey = function(value) { jspb.Message.setProto3BytesField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.GetAliasResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetAliasResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetAliasResponse.displayName = 'proto.GetAliasResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.GetAliasResponse.prototype.toObject = function(opt_includeInstance) { return proto.GetAliasResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.GetAliasResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetAliasResponse.toObject = function(includeInstance, msg) { var f, obj = { alias: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.GetAliasResponse} */ proto.GetAliasResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetAliasResponse; return proto.GetAliasResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetAliasResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetAliasResponse} */ proto.GetAliasResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint32()); msg.setAlias(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetAliasResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetAliasResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetAliasResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetAliasResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAlias(); if (f !== 0) { writer.writeUint32( 1, f ); } }; /** * optional uint32 alias = 1; * @return {number} */ proto.GetAliasResponse.prototype.getAlias = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.GetAliasResponse.prototype.setAlias = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.WatchPeersRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.WatchPeersRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.WatchPeersRequest.displayName = 'proto.WatchPeersRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.WatchPeersRequest.prototype.toObject = function(opt_includeInstance) { return proto.WatchPeersRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.WatchPeersRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.WatchPeersRequest.toObject = function(includeInstance, msg) { var f, obj = { discoverykey: msg.getDiscoverykey_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.WatchPeersRequest} */ proto.WatchPeersRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.WatchPeersRequest; return proto.WatchPeersRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.WatchPeersRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.WatchPeersRequest} */ proto.WatchPeersRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setDiscoverykey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.WatchPeersRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.WatchPeersRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.WatchPeersRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.WatchPeersRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscoverykey_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes discoveryKey = 1; * @return {!(string|Uint8Array)} */ proto.WatchPeersRequest.prototype.getDiscoverykey = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes discoveryKey = 1; * This is a type-conversion wrapper around `getDiscoverykey()` * @return {string} */ proto.WatchPeersRequest.prototype.getDiscoverykey_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getDiscoverykey())); }; /** * optional bytes discoveryKey = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getDiscoverykey()` * @return {!Uint8Array} */ proto.WatchPeersRequest.prototype.getDiscoverykey_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getDiscoverykey())); }; /** @param {!(string|Uint8Array)} value */ proto.WatchPeersRequest.prototype.setDiscoverykey = function(value) { jspb.Message.setProto3BytesField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.WatchPeersResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.WatchPeersResponse.repeatedFields_, null); }; goog.inherits(proto.WatchPeersResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.WatchPeersResponse.displayName = 'proto.WatchPeersResponse'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.WatchPeersResponse.repeatedFields_ = [2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.WatchPeersResponse.prototype.toObject = function(opt_includeInstance) { return proto.WatchPeersResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.WatchPeersResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.WatchPeersResponse.toObject = function(includeInstance, msg) { var f, obj = { type: jspb.Message.getFieldWithDefault(msg, 1, 0), peersList: jspb.Message.getRepeatedField(msg, 2) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.WatchPeersResponse} */ proto.WatchPeersResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.WatchPeersResponse; return proto.WatchPeersResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.WatchPeersResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.WatchPeersResponse} */ proto.WatchPeersResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!proto.WatchPeersResponse.Type} */ (reader.readEnum()); msg.setType(value); break; case 2: var value = /** @type {!Array<number>} */ (reader.readPackedUint32()); msg.setPeersList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.WatchPeersResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.WatchPeersResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.WatchPeersResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.WatchPeersResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getType(); if (f !== 0.0) { writer.writeEnum( 1, f ); } f = message.getPeersList(); if (f.length > 0) { writer.writePackedUint32( 2, f ); } }; /** * @enum {number} */ proto.WatchPeersResponse.Type = { JOINED: 0, LEFT: 1 }; /** * optional Type type = 1; * @return {!proto.WatchPeersResponse.Type} */ proto.WatchPeersResponse.prototype.getType = function() { return /** @type {!proto.WatchPeersResponse.Type} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {!proto.WatchPeersResponse.Type} value */ proto.WatchPeersResponse.prototype.setType = function(value) { jspb.Message.setProto3EnumField(this, 1, value); }; /** * repeated uint32 peers = 2; * @return {!Array<number>} */ proto.WatchPeersResponse.prototype.getPeersList = function() { return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 2)); }; /** @param {!Array<number>} value */ proto.WatchPeersResponse.prototype.setPeersList = function(value) { jspb.Message.setField(this, 2, value || []); }; /** * @param {number} value * @param {number=} opt_index */ proto.WatchPeersResponse.prototype.addPeers = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; proto.WatchPeersResponse.prototype.clearPeersList = function() { this.setPeersList([]); }; goog.object.extend(exports, proto);