UNPKG

protoc-gen-ts-alt

Version:

Generate d.ts definitions for generated js files from grpc_tools_node_protoc

1,468 lines (1,247 loc) 40.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')(); var test_music_pb = require('./test/music_pb.js'); goog.object.extend(proto, test_music_pb); goog.exportSymbol('proto.Book', null, global); goog.exportSymbol('proto.BookStore', null, global); goog.exportSymbol('proto.EnumSample', null, global); goog.exportSymbol('proto.GetBookRequest', null, global); goog.exportSymbol('proto.GetBookViaAuthor', null, global); goog.exportSymbol('proto.SpecialCases', null, global); goog.exportSymbol('proto.Test', 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.Test = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.Test.repeatedFields_, null); }; goog.inherits(proto.Test, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.Test.displayName = 'proto.Test'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.Test.repeatedFields_ = [3,4,5,6,7]; 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.Test.prototype.toObject = function(opt_includeInstance) { return proto.Test.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.Test} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Test.toObject = function(includeInstance, msg) { var f, obj = { book: (f = msg.getBook()) && proto.Book.toObject(includeInstance, f), music: (f = msg.getMusic()) && test_music_pb.Music.toObject(includeInstance, f), booksList: jspb.Message.toObjectList(msg.getBooksList(), proto.Book.toObject, includeInstance), musicsList: jspb.Message.toObjectList(msg.getMusicsList(), test_music_pb.Music.toObject, includeInstance), strsList: jspb.Message.getRepeatedField(msg, 5), int32sList: jspb.Message.getRepeatedField(msg, 6), bytesarrList: msg.getBytesarrList_asB64(), mapMap: (f = msg.getMapMap()) ? f.toObject(includeInstance, proto.Music.toObject) : [], bytesmapMap: (f = msg.getBytesmapMap()) ? f.toObject(includeInstance, undefined) : [], bytes: msg.getBytes_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.Test} */ proto.Test.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.Test; return proto.Test.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.Test} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.Test} */ proto.Test.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.Book; reader.readMessage(value,proto.Book.deserializeBinaryFromReader); msg.setBook(value); break; case 2: var value = new test_music_pb.Music; reader.readMessage(value,test_music_pb.Music.deserializeBinaryFromReader); msg.setMusic(value); break; case 3: var value = new proto.Book; reader.readMessage(value,proto.Book.deserializeBinaryFromReader); msg.addBooks(value); break; case 4: var value = new test_music_pb.Music; reader.readMessage(value,test_music_pb.Music.deserializeBinaryFromReader); msg.addMusics(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.addStrs(value); break; case 6: var value = /** @type {!Array<number>} */ (reader.readPackedInt32()); msg.setInt32sList(value); break; case 7: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.addBytesarr(value); break; case 8: var value = msg.getMapMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readMessage, proto.Music.deserializeBinaryFromReader, 0); }); break; case 9: var value = msg.getBytesmapMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readBytes, null, 0); }); break; case 11: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setBytes(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.Test.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.Test.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.Test} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Test.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getBook(); if (f != null) { writer.writeMessage( 1, f, proto.Book.serializeBinaryToWriter ); } f = message.getMusic(); if (f != null) { writer.writeMessage( 2, f, test_music_pb.Music.serializeBinaryToWriter ); } f = message.getBooksList(); if (f.length > 0) { writer.writeRepeatedMessage( 3, f, proto.Book.serializeBinaryToWriter ); } f = message.getMusicsList(); if (f.length > 0) { writer.writeRepeatedMessage( 4, f, test_music_pb.Music.serializeBinaryToWriter ); } f = message.getStrsList(); if (f.length > 0) { writer.writeRepeatedString( 5, f ); } f = message.getInt32sList(); if (f.length > 0) { writer.writePackedInt32( 6, f ); } f = message.getBytesarrList_asU8(); if (f.length > 0) { writer.writeRepeatedBytes( 7, f ); } f = message.getMapMap(true); if (f && f.getLength() > 0) { f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeMessage, proto.Music.serializeBinaryToWriter); } f = message.getBytesmapMap(true); if (f && f.getLength() > 0) { f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeBytes); } f = message.getBytes_asU8(); if (f.length > 0) { writer.writeBytes( 11, f ); } }; /** * optional Book book = 1; * @return {?proto.Book} */ proto.Test.prototype.getBook = function() { return /** @type{?proto.Book} */ ( jspb.Message.getWrapperField(this, proto.Book, 1)); }; /** @param {?proto.Book|undefined} value */ proto.Test.prototype.setBook = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.Test.prototype.clearBook = function() { this.setBook(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.Test.prototype.hasBook = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional Music music = 2; * @return {?proto.Music} */ proto.Test.prototype.getMusic = function() { return /** @type{?proto.Music} */ ( jspb.Message.getWrapperField(this, test_music_pb.Music, 2)); }; /** @param {?proto.Music|undefined} value */ proto.Test.prototype.setMusic = function(value) { jspb.Message.setWrapperField(this, 2, value); }; proto.Test.prototype.clearMusic = function() { this.setMusic(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.Test.prototype.hasMusic = function() { return jspb.Message.getField(this, 2) != null; }; /** * repeated Book books = 3; * @return {!Array<!proto.Book>} */ proto.Test.prototype.getBooksList = function() { return /** @type{!Array<!proto.Book>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.Book, 3)); }; /** @param {!Array<!proto.Book>} value */ proto.Test.prototype.setBooksList = function(value) { jspb.Message.setRepeatedWrapperField(this, 3, value); }; /** * @param {!proto.Book=} opt_value * @param {number=} opt_index * @return {!proto.Book} */ proto.Test.prototype.addBooks = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.Book, opt_index); }; proto.Test.prototype.clearBooksList = function() { this.setBooksList([]); }; /** * repeated Music musics = 4; * @return {!Array<!proto.Music>} */ proto.Test.prototype.getMusicsList = function() { return /** @type{!Array<!proto.Music>} */ ( jspb.Message.getRepeatedWrapperField(this, test_music_pb.Music, 4)); }; /** @param {!Array<!proto.Music>} value */ proto.Test.prototype.setMusicsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 4, value); }; /** * @param {!proto.Music=} opt_value * @param {number=} opt_index * @return {!proto.Music} */ proto.Test.prototype.addMusics = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.Music, opt_index); }; proto.Test.prototype.clearMusicsList = function() { this.setMusicsList([]); }; /** * repeated string strs = 5; * @return {!Array<string>} */ proto.Test.prototype.getStrsList = function() { return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 5)); }; /** @param {!Array<string>} value */ proto.Test.prototype.setStrsList = function(value) { jspb.Message.setField(this, 5, value || []); }; /** * @param {string} value * @param {number=} opt_index */ proto.Test.prototype.addStrs = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 5, value, opt_index); }; proto.Test.prototype.clearStrsList = function() { this.setStrsList([]); }; /** * repeated int32 int32s = 6; * @return {!Array<number>} */ proto.Test.prototype.getInt32sList = function() { return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 6)); }; /** @param {!Array<number>} value */ proto.Test.prototype.setInt32sList = function(value) { jspb.Message.setField(this, 6, value || []); }; /** * @param {number} value * @param {number=} opt_index */ proto.Test.prototype.addInt32s = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 6, value, opt_index); }; proto.Test.prototype.clearInt32sList = function() { this.setInt32sList([]); }; /** * repeated bytes bytesArr = 7; * @return {!(Array<!Uint8Array>|Array<string>)} */ proto.Test.prototype.getBytesarrList = function() { return /** @type {!(Array<!Uint8Array>|Array<string>)} */ (jspb.Message.getRepeatedField(this, 7)); }; /** * repeated bytes bytesArr = 7; * This is a type-conversion wrapper around `getBytesarrList()` * @return {!Array<string>} */ proto.Test.prototype.getBytesarrList_asB64 = function() { return /** @type {!Array<string>} */ (jspb.Message.bytesListAsB64( this.getBytesarrList())); }; /** * repeated bytes bytesArr = 7; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getBytesarrList()` * @return {!Array<!Uint8Array>} */ proto.Test.prototype.getBytesarrList_asU8 = function() { return /** @type {!Array<!Uint8Array>} */ (jspb.Message.bytesListAsU8( this.getBytesarrList())); }; /** @param {!(Array<!Uint8Array>|Array<string>)} value */ proto.Test.prototype.setBytesarrList = function(value) { jspb.Message.setField(this, 7, value || []); }; /** * @param {!(string|Uint8Array)} value * @param {number=} opt_index */ proto.Test.prototype.addBytesarr = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 7, value, opt_index); }; proto.Test.prototype.clearBytesarrList = function() { this.setBytesarrList([]); }; /** * map<int64, Music> map = 8; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<number,!proto.Music>} */ proto.Test.prototype.getMapMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<number,!proto.Music>} */ ( jspb.Message.getMapField(this, 8, opt_noLazyCreate, proto.Music)); }; proto.Test.prototype.clearMapMap = function() { this.getMapMap().clear(); }; /** * map<int64, bytes> bytesMap = 9; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<number,!(string|Uint8Array)>} */ proto.Test.prototype.getBytesmapMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<number,!(string|Uint8Array)>} */ ( jspb.Message.getMapField(this, 9, opt_noLazyCreate, null)); }; proto.Test.prototype.clearBytesmapMap = function() { this.getBytesmapMap().clear(); }; /** * optional bytes bytes = 11; * @return {!(string|Uint8Array)} */ proto.Test.prototype.getBytes = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 11, "")); }; /** * optional bytes bytes = 11; * This is a type-conversion wrapper around `getBytes()` * @return {string} */ proto.Test.prototype.getBytes_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBytes())); }; /** * optional bytes bytes = 11; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getBytes()` * @return {!Uint8Array} */ proto.Test.prototype.getBytes_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBytes())); }; /** @param {!(string|Uint8Array)} value */ proto.Test.prototype.setBytes = function(value) { jspb.Message.setProto3BytesField(this, 11, 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.Book = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.Book, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.Book.displayName = 'proto.Book'; } 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.Book.prototype.toObject = function(opt_includeInstance) { return proto.Book.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.Book} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Book.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.Book} */ proto.Book.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.Book; return proto.Book.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.Book} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.Book} */ proto.Book.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.Book.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.Book.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.Book} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Book.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.Book.prototype.getIsbn = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.Book.prototype.setIsbn = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string title = 2; * @return {string} */ proto.Book.prototype.getTitle = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.Book.prototype.setTitle = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string author = 3; * @return {string} */ proto.Book.prototype.getAuthor = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.Book.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.GetBookRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetBookRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetBookRequest.displayName = 'proto.GetBookRequest'; } 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.GetBookRequest.prototype.toObject = function(opt_includeInstance) { return proto.GetBookRequest.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.GetBookRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetBookRequest.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.GetBookRequest} */ proto.GetBookRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetBookRequest; return proto.GetBookRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetBookRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetBookRequest} */ proto.GetBookRequest.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.GetBookRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetBookRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetBookRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetBookRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIsbn(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 isbn = 1; * @return {number} */ proto.GetBookRequest.prototype.getIsbn = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.GetBookRequest.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.GetBookViaAuthor = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.GetBookViaAuthor, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.GetBookViaAuthor.displayName = 'proto.GetBookViaAuthor'; } 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.GetBookViaAuthor.prototype.toObject = function(opt_includeInstance) { return proto.GetBookViaAuthor.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.GetBookViaAuthor} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetBookViaAuthor.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.GetBookViaAuthor} */ proto.GetBookViaAuthor.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.GetBookViaAuthor; return proto.GetBookViaAuthor.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.GetBookViaAuthor} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.GetBookViaAuthor} */ proto.GetBookViaAuthor.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.GetBookViaAuthor.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.GetBookViaAuthor.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.GetBookViaAuthor} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.GetBookViaAuthor.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.GetBookViaAuthor.prototype.getAuthor = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.GetBookViaAuthor.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.BookStore = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.BookStore, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.BookStore.displayName = 'proto.BookStore'; } 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.BookStore.prototype.toObject = function(opt_includeInstance) { return proto.BookStore.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.BookStore} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.BookStore.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), booksMap: (f = msg.getBooksMap()) ? 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.BookStore} */ proto.BookStore.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.BookStore; return proto.BookStore.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.BookStore} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.BookStore} */ proto.BookStore.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.getBooksMap(); 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.BookStore.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.BookStore.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.BookStore} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.BookStore.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getBooksMap(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.BookStore.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.BookStore.prototype.setName = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * map<int64, string> books = 2; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<number,string>} */ proto.BookStore.prototype.getBooksMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<number,string>} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, null)); }; proto.BookStore.prototype.clearBooksMap = function() { this.getBooksMap().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.SpecialCases = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.SpecialCases, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.SpecialCases.displayName = 'proto.SpecialCases'; } 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.SpecialCases.prototype.toObject = function(opt_includeInstance) { return proto.SpecialCases.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.SpecialCases} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.SpecialCases.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.SpecialCases} */ proto.SpecialCases.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.SpecialCases; return proto.SpecialCases.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.SpecialCases} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.SpecialCases} */ proto.SpecialCases.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.SpecialCases.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.SpecialCases.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.SpecialCases} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.SpecialCases.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.SpecialCases.prototype.getNormal = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.SpecialCases.prototype.setNormal = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string default = 2; * @return {string} */ proto.SpecialCases.prototype.getDefault = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.SpecialCases.prototype.setDefault = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string function = 3; * @return {string} */ proto.SpecialCases.prototype.getFunction = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.SpecialCases.prototype.setFunction = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * optional string var = 4; * @return {string} */ proto.SpecialCases.prototype.getVar = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** @param {string} value */ proto.SpecialCases.prototype.setVar = function(value) { jspb.Message.setProto3StringField(this, 4, value); }; /** * @enum {number} */ proto.EnumSample = { UNKNOWN: 0, STARTED: 1, RUNNING: 1, CASETEST: 2, HOW_ABOUT_THIS: 3, ALLLOWERCASE: 4 }; goog.object.extend(exports, proto);