UNPKG

protoc-gen-ts-alt

Version:

Generate d.ts definitions for generated js files from grpc_tools_node_protoc

907 lines (779 loc) 25.6 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.Enum2Sample', null, global); goog.exportSymbol('proto.GetMusicRequest', null, global); goog.exportSymbol('proto.GetMusicViaAuthor', null, global); goog.exportSymbol('proto.Music', null, global); goog.exportSymbol('proto.MusicStore', null, global); goog.exportSymbol('proto.Special2Cases', 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.Music = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.Music, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.Music.displayName = 'proto.Music'; } 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.Music.prototype.toObject = function(opt_includeInstance) { return proto.Music.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.Music} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Music.toObject = function(includeInstance, msg) { var f, obj = { isbn: jspb.Message.getFieldWithDefault(msg, 1, 0), title: jspb.Message.getFieldWithDefault(msg, 2, ""), author: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.Music} */ proto.Music.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.Music; return proto.Music.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.Music} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.Music} */ proto.Music.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setIsbn(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setTitle(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setAuthor(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.Music.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.Music.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.Music} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Music.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIsbn(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getTitle(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getAuthor(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional int64 isbn = 1; * @return {number} */ proto.Music.prototype.getIsbn = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.Music.prototype.setIsbn = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string title = 2; * @return {string} */ proto.Music.prototype.getTitle = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.Music.prototype.setTitle = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string author = 3; * @return {string} */ proto.Music.prototype.getAuthor = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.Music.prototype.setAuthor = function(value) { jspb.Message.setProto3StringField(this, 3, 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.GetMusicRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetMusicRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetMusicRequest.displayName = 'proto.GetMusicRequest'; } 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.GetMusicRequest.prototype.toObject = function(opt_includeInstance) { return proto.GetMusicRequest.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.GetMusicRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetMusicRequest.toObject = function(includeInstance, msg) { var f, obj = { isbn: 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.GetMusicRequest} */ proto.GetMusicRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetMusicRequest; return proto.GetMusicRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetMusicRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetMusicRequest} */ proto.GetMusicRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setIsbn(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetMusicRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetMusicRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetMusicRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetMusicRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIsbn(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 isbn = 1; * @return {number} */ proto.GetMusicRequest.prototype.getIsbn = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.GetMusicRequest.prototype.setIsbn = 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.GetMusicViaAuthor = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetMusicViaAuthor, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetMusicViaAuthor.displayName = 'proto.GetMusicViaAuthor'; } 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.GetMusicViaAuthor.prototype.toObject = function(opt_includeInstance) { return proto.GetMusicViaAuthor.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.GetMusicViaAuthor} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetMusicViaAuthor.toObject = function(includeInstance, msg) { var f, obj = { author: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.GetMusicViaAuthor} */ proto.GetMusicViaAuthor.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetMusicViaAuthor; return proto.GetMusicViaAuthor.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetMusicViaAuthor} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetMusicViaAuthor} */ proto.GetMusicViaAuthor.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.setAuthor(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.GetMusicViaAuthor.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetMusicViaAuthor.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetMusicViaAuthor} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetMusicViaAuthor.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAuthor(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string author = 1; * @return {string} */ proto.GetMusicViaAuthor.prototype.getAuthor = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.GetMusicViaAuthor.prototype.setAuthor = function(value) { jspb.Message.setProto3StringField(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.MusicStore = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.MusicStore, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.MusicStore.displayName = 'proto.MusicStore'; } 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.MusicStore.prototype.toObject = function(opt_includeInstance) { return proto.MusicStore.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.MusicStore} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.MusicStore.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), musicsMap: (f = msg.getMusicsMap()) ? f.toObject(includeInstance, undefined) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.MusicStore} */ proto.MusicStore.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.MusicStore; return proto.MusicStore.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.MusicStore} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.MusicStore} */ proto.MusicStore.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.setName(value); break; case 2: var value = msg.getMusicsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.MusicStore.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.MusicStore.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.MusicStore} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.MusicStore.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getMusicsMap(true); if (f && f.getLength() > 0) { f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); } }; /** * optional string name = 1; * @return {string} */ proto.MusicStore.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.MusicStore.prototype.setName = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * map<int64, string> musics = 2; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<number,string>} */ proto.MusicStore.prototype.getMusicsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<number,string>} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, null)); }; proto.MusicStore.prototype.clearMusicsMap = function() { this.getMusicsMap().clear(); }; /** * 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.Special2Cases = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.Special2Cases, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.Special2Cases.displayName = 'proto.Special2Cases'; } 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.Special2Cases.prototype.toObject = function(opt_includeInstance) { return proto.Special2Cases.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.Special2Cases} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Special2Cases.toObject = function(includeInstance, msg) { var f, obj = { normal: jspb.Message.getFieldWithDefault(msg, 1, ""), pb_default: jspb.Message.getFieldWithDefault(msg, 2, ""), pb_function: jspb.Message.getFieldWithDefault(msg, 3, ""), pb_var: jspb.Message.getFieldWithDefault(msg, 4, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.Special2Cases} */ proto.Special2Cases.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.Special2Cases; return proto.Special2Cases.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.Special2Cases} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.Special2Cases} */ proto.Special2Cases.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.setNormal(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setDefault(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setFunction(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setVar(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.Special2Cases.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.Special2Cases.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.Special2Cases} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Special2Cases.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNormal(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getDefault(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getFunction(); if (f.length > 0) { writer.writeString( 3, f ); } f = message.getVar(); if (f.length > 0) { writer.writeString( 4, f ); } }; /** * optional string normal = 1; * @return {string} */ proto.Special2Cases.prototype.getNormal = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.Special2Cases.prototype.setNormal = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string default = 2; * @return {string} */ proto.Special2Cases.prototype.getDefault = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.Special2Cases.prototype.setDefault = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string function = 3; * @return {string} */ proto.Special2Cases.prototype.getFunction = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.Special2Cases.prototype.setFunction = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * optional string var = 4; * @return {string} */ proto.Special2Cases.prototype.getVar = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** @param {string} value */ proto.Special2Cases.prototype.setVar = function(value) { jspb.Message.setProto3StringField(this, 4, value); }; /** * @enum {number} */ proto.Enum2Sample = { UNKNOWN2: 0, STARTED2: 1, RUNNING2: 1, CASETEST2: 2, HOW_ABOUT_THIS2: 3, ALLLOWERCASE2: 4 }; goog.object.extend(exports, proto);