echo_pb.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /**
  2. * @fileoverview
  3. * @enhanceable
  4. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  5. * field starts with 'MSG_' and isn't a translatable message.
  6. * @public
  7. */
  8. // GENERATED CODE -- DO NOT EDIT!
  9. var jspb = require('google-protobuf');
  10. var goog = jspb;
  11. var global = Function('return this')();
  12. goog.exportSymbol('proto.echo.EchoRequest', null, global);
  13. goog.exportSymbol('proto.echo.EchoResponse', null, global);
  14. /**
  15. * Generated by JsPbCodeGenerator.
  16. * @param {Array=} opt_data Optional initial data array, typically from a
  17. * server response, or constructed directly in Javascript. The array is used
  18. * in place and becomes part of the constructed object. It is not cloned.
  19. * If no data is provided, the constructed object will be empty, but still
  20. * valid.
  21. * @extends {jspb.Message}
  22. * @constructor
  23. */
  24. proto.echo.EchoRequest = function(opt_data) {
  25. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  26. };
  27. goog.inherits(proto.echo.EchoRequest, jspb.Message);
  28. if (goog.DEBUG && !COMPILED) {
  29. proto.echo.EchoRequest.displayName = 'proto.echo.EchoRequest';
  30. }
  31. if (jspb.Message.GENERATE_TO_OBJECT) {
  32. /**
  33. * Creates an object representation of this proto suitable for use in Soy templates.
  34. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  35. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  36. * For the list of reserved names please see:
  37. * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
  38. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
  39. * for transitional soy proto support: http://goto/soy-param-migration
  40. * @return {!Object}
  41. */
  42. proto.echo.EchoRequest.prototype.toObject = function(opt_includeInstance) {
  43. return proto.echo.EchoRequest.toObject(opt_includeInstance, this);
  44. };
  45. /**
  46. * Static version of the {@see toObject} method.
  47. * @param {boolean|undefined} includeInstance Whether to include the JSPB
  48. * instance for transitional soy proto support:
  49. * http://goto/soy-param-migration
  50. * @param {!proto.echo.EchoRequest} msg The msg instance to transform.
  51. * @return {!Object}
  52. * @suppress {unusedLocalVariables} f is only used for nested messages
  53. */
  54. proto.echo.EchoRequest.toObject = function(includeInstance, msg) {
  55. var f, obj = {
  56. text: jspb.Message.getFieldWithDefault(msg, 1, "")
  57. };
  58. if (includeInstance) {
  59. obj.$jspbMessageInstance = msg;
  60. }
  61. return obj;
  62. };
  63. }
  64. /**
  65. * Deserializes binary data (in protobuf wire format).
  66. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  67. * @return {!proto.echo.EchoRequest}
  68. */
  69. proto.echo.EchoRequest.deserializeBinary = function(bytes) {
  70. var reader = new jspb.BinaryReader(bytes);
  71. var msg = new proto.echo.EchoRequest;
  72. return proto.echo.EchoRequest.deserializeBinaryFromReader(msg, reader);
  73. };
  74. /**
  75. * Deserializes binary data (in protobuf wire format) from the
  76. * given reader into the given message object.
  77. * @param {!proto.echo.EchoRequest} msg The message object to deserialize into.
  78. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  79. * @return {!proto.echo.EchoRequest}
  80. */
  81. proto.echo.EchoRequest.deserializeBinaryFromReader = function(msg, reader) {
  82. while (reader.nextField()) {
  83. if (reader.isEndGroup()) {
  84. break;
  85. }
  86. var field = reader.getFieldNumber();
  87. switch (field) {
  88. case 1:
  89. var value = /** @type {string} */ (reader.readString());
  90. msg.setText(value);
  91. break;
  92. default:
  93. reader.skipField();
  94. break;
  95. }
  96. }
  97. return msg;
  98. };
  99. /**
  100. * Serializes the message to binary data (in protobuf wire format).
  101. * @return {!Uint8Array}
  102. */
  103. proto.echo.EchoRequest.prototype.serializeBinary = function() {
  104. var writer = new jspb.BinaryWriter();
  105. proto.echo.EchoRequest.serializeBinaryToWriter(this, writer);
  106. return writer.getResultBuffer();
  107. };
  108. /**
  109. * Serializes the given message to binary data (in protobuf wire
  110. * format), writing to the given BinaryWriter.
  111. * @param {!proto.echo.EchoRequest} message
  112. * @param {!jspb.BinaryWriter} writer
  113. * @suppress {unusedLocalVariables} f is only used for nested messages
  114. */
  115. proto.echo.EchoRequest.serializeBinaryToWriter = function(message, writer) {
  116. var f = undefined;
  117. f = message.getText();
  118. if (f.length > 0) {
  119. writer.writeString(
  120. 1,
  121. f
  122. );
  123. }
  124. };
  125. /**
  126. * optional string text = 1;
  127. * @return {string}
  128. */
  129. proto.echo.EchoRequest.prototype.getText = function() {
  130. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  131. };
  132. /** @param {string} value */
  133. proto.echo.EchoRequest.prototype.setText = function(value) {
  134. jspb.Message.setProto3StringField(this, 1, value);
  135. };
  136. /**
  137. * Generated by JsPbCodeGenerator.
  138. * @param {Array=} opt_data Optional initial data array, typically from a
  139. * server response, or constructed directly in Javascript. The array is used
  140. * in place and becomes part of the constructed object. It is not cloned.
  141. * If no data is provided, the constructed object will be empty, but still
  142. * valid.
  143. * @extends {jspb.Message}
  144. * @constructor
  145. */
  146. proto.echo.EchoResponse = function(opt_data) {
  147. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  148. };
  149. goog.inherits(proto.echo.EchoResponse, jspb.Message);
  150. if (goog.DEBUG && !COMPILED) {
  151. proto.echo.EchoResponse.displayName = 'proto.echo.EchoResponse';
  152. }
  153. if (jspb.Message.GENERATE_TO_OBJECT) {
  154. /**
  155. * Creates an object representation of this proto suitable for use in Soy templates.
  156. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  157. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  158. * For the list of reserved names please see:
  159. * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
  160. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
  161. * for transitional soy proto support: http://goto/soy-param-migration
  162. * @return {!Object}
  163. */
  164. proto.echo.EchoResponse.prototype.toObject = function(opt_includeInstance) {
  165. return proto.echo.EchoResponse.toObject(opt_includeInstance, this);
  166. };
  167. /**
  168. * Static version of the {@see toObject} method.
  169. * @param {boolean|undefined} includeInstance Whether to include the JSPB
  170. * instance for transitional soy proto support:
  171. * http://goto/soy-param-migration
  172. * @param {!proto.echo.EchoResponse} msg The msg instance to transform.
  173. * @return {!Object}
  174. * @suppress {unusedLocalVariables} f is only used for nested messages
  175. */
  176. proto.echo.EchoResponse.toObject = function(includeInstance, msg) {
  177. var f, obj = {
  178. text: jspb.Message.getFieldWithDefault(msg, 1, "")
  179. };
  180. if (includeInstance) {
  181. obj.$jspbMessageInstance = msg;
  182. }
  183. return obj;
  184. };
  185. }
  186. /**
  187. * Deserializes binary data (in protobuf wire format).
  188. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  189. * @return {!proto.echo.EchoResponse}
  190. */
  191. proto.echo.EchoResponse.deserializeBinary = function(bytes) {
  192. var reader = new jspb.BinaryReader(bytes);
  193. var msg = new proto.echo.EchoResponse;
  194. return proto.echo.EchoResponse.deserializeBinaryFromReader(msg, reader);
  195. };
  196. /**
  197. * Deserializes binary data (in protobuf wire format) from the
  198. * given reader into the given message object.
  199. * @param {!proto.echo.EchoResponse} msg The message object to deserialize into.
  200. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  201. * @return {!proto.echo.EchoResponse}
  202. */
  203. proto.echo.EchoResponse.deserializeBinaryFromReader = function(msg, reader) {
  204. while (reader.nextField()) {
  205. if (reader.isEndGroup()) {
  206. break;
  207. }
  208. var field = reader.getFieldNumber();
  209. switch (field) {
  210. case 1:
  211. var value = /** @type {string} */ (reader.readString());
  212. msg.setText(value);
  213. break;
  214. default:
  215. reader.skipField();
  216. break;
  217. }
  218. }
  219. return msg;
  220. };
  221. /**
  222. * Serializes the message to binary data (in protobuf wire format).
  223. * @return {!Uint8Array}
  224. */
  225. proto.echo.EchoResponse.prototype.serializeBinary = function() {
  226. var writer = new jspb.BinaryWriter();
  227. proto.echo.EchoResponse.serializeBinaryToWriter(this, writer);
  228. return writer.getResultBuffer();
  229. };
  230. /**
  231. * Serializes the given message to binary data (in protobuf wire
  232. * format), writing to the given BinaryWriter.
  233. * @param {!proto.echo.EchoResponse} message
  234. * @param {!jspb.BinaryWriter} writer
  235. * @suppress {unusedLocalVariables} f is only used for nested messages
  236. */
  237. proto.echo.EchoResponse.serializeBinaryToWriter = function(message, writer) {
  238. var f = undefined;
  239. f = message.getText();
  240. if (f.length > 0) {
  241. writer.writeString(
  242. 1,
  243. f
  244. );
  245. }
  246. };
  247. /**
  248. * optional string text = 1;
  249. * @return {string}
  250. */
  251. proto.echo.EchoResponse.prototype.getText = function() {
  252. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  253. };
  254. /** @param {string} value */
  255. proto.echo.EchoResponse.prototype.setText = function(value) {
  256. jspb.Message.setProto3StringField(this, 1, value);
  257. };
  258. goog.object.extend(exports, proto.echo);