skywalking-backend-js-netease
Version:
The NodeJS agent for Apache SkyWalking
1,022 lines (881 loc) • 27.7 kB
JavaScript
// source: tunnel/http.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @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!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.Bytes', null, global);
goog.exportSymbol('proto.HttpReqObject', null, global);
goog.exportSymbol('proto.HttpRespObject', null, global);
goog.exportSymbol('proto.PairObject', 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.HttpReqObject = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.HttpReqObject.repeatedFields_, null);
};
goog.inherits(proto.HttpReqObject, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.HttpReqObject.displayName = 'proto.HttpReqObject';
}
/**
* 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.HttpRespObject = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.HttpRespObject.repeatedFields_, null);
};
goog.inherits(proto.HttpRespObject, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.HttpRespObject.displayName = 'proto.HttpRespObject';
}
/**
* 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.PairObject = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.PairObject, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.PairObject.displayName = 'proto.PairObject';
}
/**
* 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.Bytes = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.Bytes, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.Bytes.displayName = 'proto.Bytes';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.HttpReqObject.repeatedFields_ = [3,4];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.HttpReqObject.prototype.toObject = function(opt_includeInstance) {
return proto.HttpReqObject.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.HttpReqObject} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.HttpReqObject.toObject = function(includeInstance, msg) {
var f, obj = {
url: jspb.Message.getFieldWithDefault(msg, 1, ""),
method: jspb.Message.getFieldWithDefault(msg, 2, ""),
querysList: jspb.Message.toObjectList(msg.getQuerysList(),
proto.PairObject.toObject, includeInstance),
headersList: jspb.Message.toObjectList(msg.getHeadersList(),
proto.PairObject.toObject, includeInstance),
body: msg.getBody_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.HttpReqObject}
*/
proto.HttpReqObject.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.HttpReqObject;
return proto.HttpReqObject.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.HttpReqObject} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.HttpReqObject}
*/
proto.HttpReqObject.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setUrl(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setMethod(value);
break;
case 3:
var value = new proto.PairObject;
reader.readMessage(value,proto.PairObject.deserializeBinaryFromReader);
msg.addQuerys(value);
break;
case 4:
var value = new proto.PairObject;
reader.readMessage(value,proto.PairObject.deserializeBinaryFromReader);
msg.addHeaders(value);
break;
case 5:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setBody(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.HttpReqObject.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.HttpReqObject.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.HttpReqObject} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.HttpReqObject.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getUrl();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getMethod();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getQuerysList();
if (f.length > 0) {
writer.writeRepeatedMessage(
3,
f,
proto.PairObject.serializeBinaryToWriter
);
}
f = message.getHeadersList();
if (f.length > 0) {
writer.writeRepeatedMessage(
4,
f,
proto.PairObject.serializeBinaryToWriter
);
}
f = message.getBody_asU8();
if (f.length > 0) {
writer.writeBytes(
5,
f
);
}
};
/**
* optional string url = 1;
* @return {string}
*/
proto.HttpReqObject.prototype.getUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.setUrl = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string method = 2;
* @return {string}
*/
proto.HttpReqObject.prototype.getMethod = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.setMethod = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* repeated PairObject querys = 3;
* @return {!Array<!proto.PairObject>}
*/
proto.HttpReqObject.prototype.getQuerysList = function() {
return /** @type{!Array<!proto.PairObject>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.PairObject, 3));
};
/**
* @param {!Array<!proto.PairObject>} value
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.setQuerysList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 3, value);
};
/**
* @param {!proto.PairObject=} opt_value
* @param {number=} opt_index
* @return {!proto.PairObject}
*/
proto.HttpReqObject.prototype.addQuerys = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.PairObject, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.clearQuerysList = function() {
return this.setQuerysList([]);
};
/**
* repeated PairObject headers = 4;
* @return {!Array<!proto.PairObject>}
*/
proto.HttpReqObject.prototype.getHeadersList = function() {
return /** @type{!Array<!proto.PairObject>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.PairObject, 4));
};
/**
* @param {!Array<!proto.PairObject>} value
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.setHeadersList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 4, value);
};
/**
* @param {!proto.PairObject=} opt_value
* @param {number=} opt_index
* @return {!proto.PairObject}
*/
proto.HttpReqObject.prototype.addHeaders = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.PairObject, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.clearHeadersList = function() {
return this.setHeadersList([]);
};
/**
* optional bytes body = 5;
* @return {!(string|Uint8Array)}
*/
proto.HttpReqObject.prototype.getBody = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* optional bytes body = 5;
* This is a type-conversion wrapper around `getBody()`
* @return {string}
*/
proto.HttpReqObject.prototype.getBody_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getBody()));
};
/**
* optional bytes body = 5;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getBody()`
* @return {!Uint8Array}
*/
proto.HttpReqObject.prototype.getBody_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getBody()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.HttpReqObject} returns this
*/
proto.HttpReqObject.prototype.setBody = function(value) {
return jspb.Message.setProto3BytesField(this, 5, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.HttpRespObject.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.HttpRespObject.prototype.toObject = function(opt_includeInstance) {
return proto.HttpRespObject.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.HttpRespObject} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.HttpRespObject.toObject = function(includeInstance, msg) {
var f, obj = {
code: jspb.Message.getFieldWithDefault(msg, 1, 0),
headersList: jspb.Message.toObjectList(msg.getHeadersList(),
proto.PairObject.toObject, includeInstance),
body: msg.getBody_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.HttpRespObject}
*/
proto.HttpRespObject.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.HttpRespObject;
return proto.HttpRespObject.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.HttpRespObject} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.HttpRespObject}
*/
proto.HttpRespObject.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt32());
msg.setCode(value);
break;
case 2:
var value = new proto.PairObject;
reader.readMessage(value,proto.PairObject.deserializeBinaryFromReader);
msg.addHeaders(value);
break;
case 3:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setBody(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.HttpRespObject.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.HttpRespObject.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.HttpRespObject} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.HttpRespObject.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getCode();
if (f !== 0) {
writer.writeInt32(
1,
f
);
}
f = message.getHeadersList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
proto.PairObject.serializeBinaryToWriter
);
}
f = message.getBody_asU8();
if (f.length > 0) {
writer.writeBytes(
3,
f
);
}
};
/**
* optional int32 code = 1;
* @return {number}
*/
proto.HttpRespObject.prototype.getCode = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.HttpRespObject} returns this
*/
proto.HttpRespObject.prototype.setCode = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* repeated PairObject headers = 2;
* @return {!Array<!proto.PairObject>}
*/
proto.HttpRespObject.prototype.getHeadersList = function() {
return /** @type{!Array<!proto.PairObject>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.PairObject, 2));
};
/**
* @param {!Array<!proto.PairObject>} value
* @return {!proto.HttpRespObject} returns this
*/
proto.HttpRespObject.prototype.setHeadersList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.PairObject=} opt_value
* @param {number=} opt_index
* @return {!proto.PairObject}
*/
proto.HttpRespObject.prototype.addHeaders = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.PairObject, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.HttpRespObject} returns this
*/
proto.HttpRespObject.prototype.clearHeadersList = function() {
return this.setHeadersList([]);
};
/**
* optional bytes body = 3;
* @return {!(string|Uint8Array)}
*/
proto.HttpRespObject.prototype.getBody = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* optional bytes body = 3;
* This is a type-conversion wrapper around `getBody()`
* @return {string}
*/
proto.HttpRespObject.prototype.getBody_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getBody()));
};
/**
* optional bytes body = 3;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getBody()`
* @return {!Uint8Array}
*/
proto.HttpRespObject.prototype.getBody_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getBody()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.HttpRespObject} returns this
*/
proto.HttpRespObject.prototype.setBody = function(value) {
return jspb.Message.setProto3BytesField(this, 3, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.PairObject.prototype.toObject = function(opt_includeInstance) {
return proto.PairObject.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.PairObject} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.PairObject.toObject = function(includeInstance, msg) {
var f, obj = {
key: jspb.Message.getFieldWithDefault(msg, 1, ""),
value: jspb.Message.getFieldWithDefault(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.PairObject}
*/
proto.PairObject.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.PairObject;
return proto.PairObject.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.PairObject} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.PairObject}
*/
proto.PairObject.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setKey(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setValue(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.PairObject.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.PairObject.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.PairObject} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.PairObject.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getKey();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getValue();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional string key = 1;
* @return {string}
*/
proto.PairObject.prototype.getKey = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.PairObject} returns this
*/
proto.PairObject.prototype.setKey = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string value = 2;
* @return {string}
*/
proto.PairObject.prototype.getValue = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.PairObject} returns this
*/
proto.PairObject.prototype.setValue = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.Bytes.prototype.toObject = function(opt_includeInstance) {
return proto.Bytes.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.Bytes} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Bytes.toObject = function(includeInstance, msg) {
var f, obj = {
instance: jspb.Message.getFieldWithDefault(msg, 1, ""),
data: msg.getData_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.Bytes}
*/
proto.Bytes.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.Bytes;
return proto.Bytes.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.Bytes} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.Bytes}
*/
proto.Bytes.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setInstance(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.Bytes.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.Bytes.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.Bytes} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Bytes.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getInstance();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getData_asU8();
if (f.length > 0) {
writer.writeBytes(
2,
f
);
}
};
/**
* optional string instance = 1;
* @return {string}
*/
proto.Bytes.prototype.getInstance = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.Bytes} returns this
*/
proto.Bytes.prototype.setInstance = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional bytes data = 2;
* @return {!(string|Uint8Array)}
*/
proto.Bytes.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes data = 2;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.Bytes.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};
/**
* optional bytes data = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.Bytes.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.Bytes} returns this
*/
proto.Bytes.prototype.setData = function(value) {
return jspb.Message.setProto3BytesField(this, 2, value);
};
goog.object.extend(exports, proto);