Source: proto/google/protobuf/struct_pb.js

  1. // source: google/protobuf/struct.proto
  2. /**
  3. * @fileoverview
  4. * @enhanceable
  5. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  6. * field starts with 'MSG_' and isn't a translatable message.
  7. * @public
  8. */
  9. // GENERATED CODE -- DO NOT EDIT!
  10. var jspb = require('google-protobuf');
  11. var goog = jspb;
  12. var global = Function('return this')();
  13. goog.exportSymbol('proto.google.protobuf.ListValue', null, global);
  14. goog.exportSymbol('proto.google.protobuf.NullValue', null, global);
  15. goog.exportSymbol('proto.google.protobuf.Struct', null, global);
  16. goog.exportSymbol('proto.google.protobuf.Value', null, global);
  17. goog.exportSymbol('proto.google.protobuf.Value.KindCase', null, global);
  18. /**
  19. * Generated by JsPbCodeGenerator.
  20. * @param {Array=} opt_data Optional initial data array, typically from a
  21. * server response, or constructed directly in Javascript. The array is used
  22. * in place and becomes part of the constructed object. It is not cloned.
  23. * If no data is provided, the constructed object will be empty, but still
  24. * valid.
  25. * @extends {jspb.Message}
  26. * @constructor
  27. */
  28. proto.google.protobuf.Struct = function(opt_data) {
  29. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  30. };
  31. goog.inherits(proto.google.protobuf.Struct, jspb.Message);
  32. if (goog.DEBUG && !COMPILED) {
  33. /**
  34. * @public
  35. * @override
  36. */
  37. proto.google.protobuf.Struct.displayName = 'proto.google.protobuf.Struct';
  38. }
  39. /**
  40. * Generated by JsPbCodeGenerator.
  41. * @param {Array=} opt_data Optional initial data array, typically from a
  42. * server response, or constructed directly in Javascript. The array is used
  43. * in place and becomes part of the constructed object. It is not cloned.
  44. * If no data is provided, the constructed object will be empty, but still
  45. * valid.
  46. * @extends {jspb.Message}
  47. * @constructor
  48. */
  49. proto.google.protobuf.Value = function(opt_data) {
  50. jspb.Message.initialize(this, opt_data, 0, -1, null, proto.google.protobuf.Value.oneofGroups_);
  51. };
  52. goog.inherits(proto.google.protobuf.Value, jspb.Message);
  53. if (goog.DEBUG && !COMPILED) {
  54. /**
  55. * @public
  56. * @override
  57. */
  58. proto.google.protobuf.Value.displayName = 'proto.google.protobuf.Value';
  59. }
  60. /**
  61. * Generated by JsPbCodeGenerator.
  62. * @param {Array=} opt_data Optional initial data array, typically from a
  63. * server response, or constructed directly in Javascript. The array is used
  64. * in place and becomes part of the constructed object. It is not cloned.
  65. * If no data is provided, the constructed object will be empty, but still
  66. * valid.
  67. * @extends {jspb.Message}
  68. * @constructor
  69. */
  70. proto.google.protobuf.ListValue = function(opt_data) {
  71. jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.ListValue.repeatedFields_, null);
  72. };
  73. goog.inherits(proto.google.protobuf.ListValue, jspb.Message);
  74. if (goog.DEBUG && !COMPILED) {
  75. /**
  76. * @public
  77. * @override
  78. */
  79. proto.google.protobuf.ListValue.displayName = 'proto.google.protobuf.ListValue';
  80. }
  81. if (jspb.Message.GENERATE_TO_OBJECT) {
  82. /**
  83. * Creates an object representation of this proto.
  84. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  85. * Optional fields that are not set will be set to undefined.
  86. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  87. * For the list of reserved names please see:
  88. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  89. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  90. * JSPB instance for transitional soy proto support:
  91. * http://goto/soy-param-migration
  92. * @return {!Object}
  93. */
  94. proto.google.protobuf.Struct.prototype.toObject = function(opt_includeInstance) {
  95. return proto.google.protobuf.Struct.toObject(opt_includeInstance, this);
  96. };
  97. /**
  98. * Static version of the {@see toObject} method.
  99. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  100. * the JSPB instance for transitional soy proto support:
  101. * http://goto/soy-param-migration
  102. * @param {!proto.google.protobuf.Struct} msg The msg instance to transform.
  103. * @return {!Object}
  104. * @suppress {unusedLocalVariables} f is only used for nested messages
  105. */
  106. proto.google.protobuf.Struct.toObject = function(includeInstance, msg) {
  107. var f, obj = {
  108. fieldsMap: (f = msg.getFieldsMap()) ? f.toObject(includeInstance, proto.google.protobuf.Value.toObject) : []
  109. };
  110. if (includeInstance) {
  111. obj.$jspbMessageInstance = msg;
  112. }
  113. return obj;
  114. };
  115. }
  116. /**
  117. * Deserializes binary data (in protobuf wire format).
  118. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  119. * @return {!proto.google.protobuf.Struct}
  120. */
  121. proto.google.protobuf.Struct.deserializeBinary = function(bytes) {
  122. var reader = new jspb.BinaryReader(bytes);
  123. var msg = new proto.google.protobuf.Struct;
  124. return proto.google.protobuf.Struct.deserializeBinaryFromReader(msg, reader);
  125. };
  126. /**
  127. * Deserializes binary data (in protobuf wire format) from the
  128. * given reader into the given message object.
  129. * @param {!proto.google.protobuf.Struct} msg The message object to deserialize into.
  130. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  131. * @return {!proto.google.protobuf.Struct}
  132. */
  133. proto.google.protobuf.Struct.deserializeBinaryFromReader = function(msg, reader) {
  134. while (reader.nextField()) {
  135. if (reader.isEndGroup()) {
  136. break;
  137. }
  138. var field = reader.getFieldNumber();
  139. switch (field) {
  140. case 1:
  141. var value = msg.getFieldsMap();
  142. reader.readMessage(value, function(message, reader) {
  143. jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.google.protobuf.Value.deserializeBinaryFromReader, "", new proto.google.protobuf.Value());
  144. });
  145. break;
  146. default:
  147. reader.skipField();
  148. break;
  149. }
  150. }
  151. return msg;
  152. };
  153. /**
  154. * Serializes the message to binary data (in protobuf wire format).
  155. * @return {!Uint8Array}
  156. */
  157. proto.google.protobuf.Struct.prototype.serializeBinary = function() {
  158. var writer = new jspb.BinaryWriter();
  159. proto.google.protobuf.Struct.serializeBinaryToWriter(this, writer);
  160. return writer.getResultBuffer();
  161. };
  162. /**
  163. * Serializes the given message to binary data (in protobuf wire
  164. * format), writing to the given BinaryWriter.
  165. * @param {!proto.google.protobuf.Struct} message
  166. * @param {!jspb.BinaryWriter} writer
  167. * @suppress {unusedLocalVariables} f is only used for nested messages
  168. */
  169. proto.google.protobuf.Struct.serializeBinaryToWriter = function(message, writer) {
  170. var f = undefined;
  171. f = message.getFieldsMap(true);
  172. if (f && f.getLength() > 0) {
  173. f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.google.protobuf.Value.serializeBinaryToWriter);
  174. }
  175. };
  176. /**
  177. * map<string, Value> fields = 1;
  178. * @param {boolean=} opt_noLazyCreate Do not create the map if
  179. * empty, instead returning `undefined`
  180. * @return {!jspb.Map<string,!proto.google.protobuf.Value>}
  181. */
  182. proto.google.protobuf.Struct.prototype.getFieldsMap = function(opt_noLazyCreate) {
  183. return /** @type {!jspb.Map<string,!proto.google.protobuf.Value>} */ (
  184. jspb.Message.getMapField(this, 1, opt_noLazyCreate,
  185. proto.google.protobuf.Value));
  186. };
  187. /**
  188. * Clears values from the map. The map will be non-null.
  189. * @return {!proto.google.protobuf.Struct} returns this
  190. */
  191. proto.google.protobuf.Struct.prototype.clearFieldsMap = function() {
  192. this.getFieldsMap().clear();
  193. return this;};
  194. /**
  195. * Oneof group definitions for this message. Each group defines the field
  196. * numbers belonging to that group. When of these fields' value is set, all
  197. * other fields in the group are cleared. During deserialization, if multiple
  198. * fields are encountered for a group, only the last value seen will be kept.
  199. * @private {!Array<!Array<number>>}
  200. * @const
  201. */
  202. proto.google.protobuf.Value.oneofGroups_ = [[1,2,3,4,5,6]];
  203. /**
  204. * @enum {number}
  205. */
  206. proto.google.protobuf.Value.KindCase = {
  207. KIND_NOT_SET: 0,
  208. NULL_VALUE: 1,
  209. NUMBER_VALUE: 2,
  210. STRING_VALUE: 3,
  211. BOOL_VALUE: 4,
  212. STRUCT_VALUE: 5,
  213. LIST_VALUE: 6
  214. };
  215. /**
  216. * @return {proto.google.protobuf.Value.KindCase}
  217. */
  218. proto.google.protobuf.Value.prototype.getKindCase = function() {
  219. return /** @type {proto.google.protobuf.Value.KindCase} */(jspb.Message.computeOneofCase(this, proto.google.protobuf.Value.oneofGroups_[0]));
  220. };
  221. if (jspb.Message.GENERATE_TO_OBJECT) {
  222. /**
  223. * Creates an object representation of this proto.
  224. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  225. * Optional fields that are not set will be set to undefined.
  226. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  227. * For the list of reserved names please see:
  228. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  229. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  230. * JSPB instance for transitional soy proto support:
  231. * http://goto/soy-param-migration
  232. * @return {!Object}
  233. */
  234. proto.google.protobuf.Value.prototype.toObject = function(opt_includeInstance) {
  235. return proto.google.protobuf.Value.toObject(opt_includeInstance, this);
  236. };
  237. /**
  238. * Static version of the {@see toObject} method.
  239. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  240. * the JSPB instance for transitional soy proto support:
  241. * http://goto/soy-param-migration
  242. * @param {!proto.google.protobuf.Value} msg The msg instance to transform.
  243. * @return {!Object}
  244. * @suppress {unusedLocalVariables} f is only used for nested messages
  245. */
  246. proto.google.protobuf.Value.toObject = function(includeInstance, msg) {
  247. var f, obj = {
  248. nullValue: jspb.Message.getFieldWithDefault(msg, 1, 0),
  249. numberValue: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
  250. stringValue: jspb.Message.getFieldWithDefault(msg, 3, ""),
  251. boolValue: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
  252. structValue: (f = msg.getStructValue()) && proto.google.protobuf.Struct.toObject(includeInstance, f),
  253. listValue: (f = msg.getListValue()) && proto.google.protobuf.ListValue.toObject(includeInstance, f)
  254. };
  255. if (includeInstance) {
  256. obj.$jspbMessageInstance = msg;
  257. }
  258. return obj;
  259. };
  260. }
  261. /**
  262. * Deserializes binary data (in protobuf wire format).
  263. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  264. * @return {!proto.google.protobuf.Value}
  265. */
  266. proto.google.protobuf.Value.deserializeBinary = function(bytes) {
  267. var reader = new jspb.BinaryReader(bytes);
  268. var msg = new proto.google.protobuf.Value;
  269. return proto.google.protobuf.Value.deserializeBinaryFromReader(msg, reader);
  270. };
  271. /**
  272. * Deserializes binary data (in protobuf wire format) from the
  273. * given reader into the given message object.
  274. * @param {!proto.google.protobuf.Value} msg The message object to deserialize into.
  275. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  276. * @return {!proto.google.protobuf.Value}
  277. */
  278. proto.google.protobuf.Value.deserializeBinaryFromReader = function(msg, reader) {
  279. while (reader.nextField()) {
  280. if (reader.isEndGroup()) {
  281. break;
  282. }
  283. var field = reader.getFieldNumber();
  284. switch (field) {
  285. case 1:
  286. var value = /** @type {!proto.google.protobuf.NullValue} */ (reader.readEnum());
  287. msg.setNullValue(value);
  288. break;
  289. case 2:
  290. var value = /** @type {number} */ (reader.readDouble());
  291. msg.setNumberValue(value);
  292. break;
  293. case 3:
  294. var value = /** @type {string} */ (reader.readString());
  295. msg.setStringValue(value);
  296. break;
  297. case 4:
  298. var value = /** @type {boolean} */ (reader.readBool());
  299. msg.setBoolValue(value);
  300. break;
  301. case 5:
  302. var value = new proto.google.protobuf.Struct;
  303. reader.readMessage(value,proto.google.protobuf.Struct.deserializeBinaryFromReader);
  304. msg.setStructValue(value);
  305. break;
  306. case 6:
  307. var value = new proto.google.protobuf.ListValue;
  308. reader.readMessage(value,proto.google.protobuf.ListValue.deserializeBinaryFromReader);
  309. msg.setListValue(value);
  310. break;
  311. default:
  312. reader.skipField();
  313. break;
  314. }
  315. }
  316. return msg;
  317. };
  318. /**
  319. * Serializes the message to binary data (in protobuf wire format).
  320. * @return {!Uint8Array}
  321. */
  322. proto.google.protobuf.Value.prototype.serializeBinary = function() {
  323. var writer = new jspb.BinaryWriter();
  324. proto.google.protobuf.Value.serializeBinaryToWriter(this, writer);
  325. return writer.getResultBuffer();
  326. };
  327. /**
  328. * Serializes the given message to binary data (in protobuf wire
  329. * format), writing to the given BinaryWriter.
  330. * @param {!proto.google.protobuf.Value} message
  331. * @param {!jspb.BinaryWriter} writer
  332. * @suppress {unusedLocalVariables} f is only used for nested messages
  333. */
  334. proto.google.protobuf.Value.serializeBinaryToWriter = function(message, writer) {
  335. var f = undefined;
  336. f = /** @type {!proto.google.protobuf.NullValue} */ (jspb.Message.getField(message, 1));
  337. if (f != null) {
  338. writer.writeEnum(
  339. 1,
  340. f
  341. );
  342. }
  343. f = /** @type {number} */ (jspb.Message.getField(message, 2));
  344. if (f != null) {
  345. writer.writeDouble(
  346. 2,
  347. f
  348. );
  349. }
  350. f = /** @type {string} */ (jspb.Message.getField(message, 3));
  351. if (f != null) {
  352. writer.writeString(
  353. 3,
  354. f
  355. );
  356. }
  357. f = /** @type {boolean} */ (jspb.Message.getField(message, 4));
  358. if (f != null) {
  359. writer.writeBool(
  360. 4,
  361. f
  362. );
  363. }
  364. f = message.getStructValue();
  365. if (f != null) {
  366. writer.writeMessage(
  367. 5,
  368. f,
  369. proto.google.protobuf.Struct.serializeBinaryToWriter
  370. );
  371. }
  372. f = message.getListValue();
  373. if (f != null) {
  374. writer.writeMessage(
  375. 6,
  376. f,
  377. proto.google.protobuf.ListValue.serializeBinaryToWriter
  378. );
  379. }
  380. };
  381. /**
  382. * optional NullValue null_value = 1;
  383. * @return {!proto.google.protobuf.NullValue}
  384. */
  385. proto.google.protobuf.Value.prototype.getNullValue = function() {
  386. return /** @type {!proto.google.protobuf.NullValue} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
  387. };
  388. /**
  389. * @param {!proto.google.protobuf.NullValue} value
  390. * @return {!proto.google.protobuf.Value} returns this
  391. */
  392. proto.google.protobuf.Value.prototype.setNullValue = function(value) {
  393. return jspb.Message.setOneofField(this, 1, proto.google.protobuf.Value.oneofGroups_[0], value);
  394. };
  395. /**
  396. * Clears the field making it undefined.
  397. * @return {!proto.google.protobuf.Value} returns this
  398. */
  399. proto.google.protobuf.Value.prototype.clearNullValue = function() {
  400. return jspb.Message.setOneofField(this, 1, proto.google.protobuf.Value.oneofGroups_[0], undefined);
  401. };
  402. /**
  403. * Returns whether this field is set.
  404. * @return {boolean}
  405. */
  406. proto.google.protobuf.Value.prototype.hasNullValue = function() {
  407. return jspb.Message.getField(this, 1) != null;
  408. };
  409. /**
  410. * optional double number_value = 2;
  411. * @return {number}
  412. */
  413. proto.google.protobuf.Value.prototype.getNumberValue = function() {
  414. return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
  415. };
  416. /**
  417. * @param {number} value
  418. * @return {!proto.google.protobuf.Value} returns this
  419. */
  420. proto.google.protobuf.Value.prototype.setNumberValue = function(value) {
  421. return jspb.Message.setOneofField(this, 2, proto.google.protobuf.Value.oneofGroups_[0], value);
  422. };
  423. /**
  424. * Clears the field making it undefined.
  425. * @return {!proto.google.protobuf.Value} returns this
  426. */
  427. proto.google.protobuf.Value.prototype.clearNumberValue = function() {
  428. return jspb.Message.setOneofField(this, 2, proto.google.protobuf.Value.oneofGroups_[0], undefined);
  429. };
  430. /**
  431. * Returns whether this field is set.
  432. * @return {boolean}
  433. */
  434. proto.google.protobuf.Value.prototype.hasNumberValue = function() {
  435. return jspb.Message.getField(this, 2) != null;
  436. };
  437. /**
  438. * optional string string_value = 3;
  439. * @return {string}
  440. */
  441. proto.google.protobuf.Value.prototype.getStringValue = function() {
  442. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
  443. };
  444. /**
  445. * @param {string} value
  446. * @return {!proto.google.protobuf.Value} returns this
  447. */
  448. proto.google.protobuf.Value.prototype.setStringValue = function(value) {
  449. return jspb.Message.setOneofField(this, 3, proto.google.protobuf.Value.oneofGroups_[0], value);
  450. };
  451. /**
  452. * Clears the field making it undefined.
  453. * @return {!proto.google.protobuf.Value} returns this
  454. */
  455. proto.google.protobuf.Value.prototype.clearStringValue = function() {
  456. return jspb.Message.setOneofField(this, 3, proto.google.protobuf.Value.oneofGroups_[0], undefined);
  457. };
  458. /**
  459. * Returns whether this field is set.
  460. * @return {boolean}
  461. */
  462. proto.google.protobuf.Value.prototype.hasStringValue = function() {
  463. return jspb.Message.getField(this, 3) != null;
  464. };
  465. /**
  466. * optional bool bool_value = 4;
  467. * @return {boolean}
  468. */
  469. proto.google.protobuf.Value.prototype.getBoolValue = function() {
  470. return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
  471. };
  472. /**
  473. * @param {boolean} value
  474. * @return {!proto.google.protobuf.Value} returns this
  475. */
  476. proto.google.protobuf.Value.prototype.setBoolValue = function(value) {
  477. return jspb.Message.setOneofField(this, 4, proto.google.protobuf.Value.oneofGroups_[0], value);
  478. };
  479. /**
  480. * Clears the field making it undefined.
  481. * @return {!proto.google.protobuf.Value} returns this
  482. */
  483. proto.google.protobuf.Value.prototype.clearBoolValue = function() {
  484. return jspb.Message.setOneofField(this, 4, proto.google.protobuf.Value.oneofGroups_[0], undefined);
  485. };
  486. /**
  487. * Returns whether this field is set.
  488. * @return {boolean}
  489. */
  490. proto.google.protobuf.Value.prototype.hasBoolValue = function() {
  491. return jspb.Message.getField(this, 4) != null;
  492. };
  493. /**
  494. * optional Struct struct_value = 5;
  495. * @return {?proto.google.protobuf.Struct}
  496. */
  497. proto.google.protobuf.Value.prototype.getStructValue = function() {
  498. return /** @type{?proto.google.protobuf.Struct} */ (
  499. jspb.Message.getWrapperField(this, proto.google.protobuf.Struct, 5));
  500. };
  501. /**
  502. * @param {?proto.google.protobuf.Struct|undefined} value
  503. * @return {!proto.google.protobuf.Value} returns this
  504. */
  505. proto.google.protobuf.Value.prototype.setStructValue = function(value) {
  506. return jspb.Message.setOneofWrapperField(this, 5, proto.google.protobuf.Value.oneofGroups_[0], value);
  507. };
  508. /**
  509. * Clears the message field making it undefined.
  510. * @return {!proto.google.protobuf.Value} returns this
  511. */
  512. proto.google.protobuf.Value.prototype.clearStructValue = function() {
  513. return this.setStructValue(undefined);
  514. };
  515. /**
  516. * Returns whether this field is set.
  517. * @return {boolean}
  518. */
  519. proto.google.protobuf.Value.prototype.hasStructValue = function() {
  520. return jspb.Message.getField(this, 5) != null;
  521. };
  522. /**
  523. * optional ListValue list_value = 6;
  524. * @return {?proto.google.protobuf.ListValue}
  525. */
  526. proto.google.protobuf.Value.prototype.getListValue = function() {
  527. return /** @type{?proto.google.protobuf.ListValue} */ (
  528. jspb.Message.getWrapperField(this, proto.google.protobuf.ListValue, 6));
  529. };
  530. /**
  531. * @param {?proto.google.protobuf.ListValue|undefined} value
  532. * @return {!proto.google.protobuf.Value} returns this
  533. */
  534. proto.google.protobuf.Value.prototype.setListValue = function(value) {
  535. return jspb.Message.setOneofWrapperField(this, 6, proto.google.protobuf.Value.oneofGroups_[0], value);
  536. };
  537. /**
  538. * Clears the message field making it undefined.
  539. * @return {!proto.google.protobuf.Value} returns this
  540. */
  541. proto.google.protobuf.Value.prototype.clearListValue = function() {
  542. return this.setListValue(undefined);
  543. };
  544. /**
  545. * Returns whether this field is set.
  546. * @return {boolean}
  547. */
  548. proto.google.protobuf.Value.prototype.hasListValue = function() {
  549. return jspb.Message.getField(this, 6) != null;
  550. };
  551. /**
  552. * List of repeated fields within this message type.
  553. * @private {!Array<number>}
  554. * @const
  555. */
  556. proto.google.protobuf.ListValue.repeatedFields_ = [1];
  557. if (jspb.Message.GENERATE_TO_OBJECT) {
  558. /**
  559. * Creates an object representation of this proto.
  560. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  561. * Optional fields that are not set will be set to undefined.
  562. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  563. * For the list of reserved names please see:
  564. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  565. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  566. * JSPB instance for transitional soy proto support:
  567. * http://goto/soy-param-migration
  568. * @return {!Object}
  569. */
  570. proto.google.protobuf.ListValue.prototype.toObject = function(opt_includeInstance) {
  571. return proto.google.protobuf.ListValue.toObject(opt_includeInstance, this);
  572. };
  573. /**
  574. * Static version of the {@see toObject} method.
  575. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  576. * the JSPB instance for transitional soy proto support:
  577. * http://goto/soy-param-migration
  578. * @param {!proto.google.protobuf.ListValue} msg The msg instance to transform.
  579. * @return {!Object}
  580. * @suppress {unusedLocalVariables} f is only used for nested messages
  581. */
  582. proto.google.protobuf.ListValue.toObject = function(includeInstance, msg) {
  583. var f, obj = {
  584. valuesList: jspb.Message.toObjectList(msg.getValuesList(),
  585. proto.google.protobuf.Value.toObject, includeInstance)
  586. };
  587. if (includeInstance) {
  588. obj.$jspbMessageInstance = msg;
  589. }
  590. return obj;
  591. };
  592. }
  593. /**
  594. * Deserializes binary data (in protobuf wire format).
  595. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  596. * @return {!proto.google.protobuf.ListValue}
  597. */
  598. proto.google.protobuf.ListValue.deserializeBinary = function(bytes) {
  599. var reader = new jspb.BinaryReader(bytes);
  600. var msg = new proto.google.protobuf.ListValue;
  601. return proto.google.protobuf.ListValue.deserializeBinaryFromReader(msg, reader);
  602. };
  603. /**
  604. * Deserializes binary data (in protobuf wire format) from the
  605. * given reader into the given message object.
  606. * @param {!proto.google.protobuf.ListValue} msg The message object to deserialize into.
  607. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  608. * @return {!proto.google.protobuf.ListValue}
  609. */
  610. proto.google.protobuf.ListValue.deserializeBinaryFromReader = function(msg, reader) {
  611. while (reader.nextField()) {
  612. if (reader.isEndGroup()) {
  613. break;
  614. }
  615. var field = reader.getFieldNumber();
  616. switch (field) {
  617. case 1:
  618. var value = new proto.google.protobuf.Value;
  619. reader.readMessage(value,proto.google.protobuf.Value.deserializeBinaryFromReader);
  620. msg.addValues(value);
  621. break;
  622. default:
  623. reader.skipField();
  624. break;
  625. }
  626. }
  627. return msg;
  628. };
  629. /**
  630. * Serializes the message to binary data (in protobuf wire format).
  631. * @return {!Uint8Array}
  632. */
  633. proto.google.protobuf.ListValue.prototype.serializeBinary = function() {
  634. var writer = new jspb.BinaryWriter();
  635. proto.google.protobuf.ListValue.serializeBinaryToWriter(this, writer);
  636. return writer.getResultBuffer();
  637. };
  638. /**
  639. * Serializes the given message to binary data (in protobuf wire
  640. * format), writing to the given BinaryWriter.
  641. * @param {!proto.google.protobuf.ListValue} message
  642. * @param {!jspb.BinaryWriter} writer
  643. * @suppress {unusedLocalVariables} f is only used for nested messages
  644. */
  645. proto.google.protobuf.ListValue.serializeBinaryToWriter = function(message, writer) {
  646. var f = undefined;
  647. f = message.getValuesList();
  648. if (f.length > 0) {
  649. writer.writeRepeatedMessage(
  650. 1,
  651. f,
  652. proto.google.protobuf.Value.serializeBinaryToWriter
  653. );
  654. }
  655. };
  656. /**
  657. * repeated Value values = 1;
  658. * @return {!Array<!proto.google.protobuf.Value>}
  659. */
  660. proto.google.protobuf.ListValue.prototype.getValuesList = function() {
  661. return /** @type{!Array<!proto.google.protobuf.Value>} */ (
  662. jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.Value, 1));
  663. };
  664. /**
  665. * @param {!Array<!proto.google.protobuf.Value>} value
  666. * @return {!proto.google.protobuf.ListValue} returns this
  667. */
  668. proto.google.protobuf.ListValue.prototype.setValuesList = function(value) {
  669. return jspb.Message.setRepeatedWrapperField(this, 1, value);
  670. };
  671. /**
  672. * @param {!proto.google.protobuf.Value=} opt_value
  673. * @param {number=} opt_index
  674. * @return {!proto.google.protobuf.Value}
  675. */
  676. proto.google.protobuf.ListValue.prototype.addValues = function(opt_value, opt_index) {
  677. return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.google.protobuf.Value, opt_index);
  678. };
  679. /**
  680. * Clears the list making it empty but non-null.
  681. * @return {!proto.google.protobuf.ListValue} returns this
  682. */
  683. proto.google.protobuf.ListValue.prototype.clearValuesList = function() {
  684. return this.setValuesList([]);
  685. };
  686. /**
  687. * @enum {number}
  688. */
  689. proto.google.protobuf.NullValue = {
  690. NULL_VALUE: 0
  691. };
  692. goog.object.extend(exports, proto.google.protobuf);
  693. /* This code will be inserted into generated code for
  694. * google/protobuf/struct.proto. */
  695. /**
  696. * Typedef representing plain JavaScript values that can go into a
  697. * Struct.
  698. * @typedef {null|number|string|boolean|Array|Object}
  699. */
  700. proto.google.protobuf.JavaScriptValue;
  701. /**
  702. * Converts this Value object to a plain JavaScript value.
  703. * @return {?proto.google.protobuf.JavaScriptValue} a plain JavaScript
  704. * value representing this Struct.
  705. */
  706. proto.google.protobuf.Value.prototype.toJavaScript = function() {
  707. var kindCase = proto.google.protobuf.Value.KindCase;
  708. switch (this.getKindCase()) {
  709. case kindCase.NULL_VALUE:
  710. return null;
  711. case kindCase.NUMBER_VALUE:
  712. return this.getNumberValue();
  713. case kindCase.STRING_VALUE:
  714. return this.getStringValue();
  715. case kindCase.BOOL_VALUE:
  716. return this.getBoolValue();
  717. case kindCase.STRUCT_VALUE:
  718. return this.getStructValue().toJavaScript();
  719. case kindCase.LIST_VALUE:
  720. return this.getListValue().toJavaScript();
  721. default:
  722. throw new Error('Unexpected struct type');
  723. }
  724. };
  725. /**
  726. * Converts this JavaScript value to a new Value proto.
  727. * @param {!proto.google.protobuf.JavaScriptValue} value The value to
  728. * convert.
  729. * @return {!proto.google.protobuf.Value} The newly constructed value.
  730. */
  731. proto.google.protobuf.Value.fromJavaScript = function(value) {
  732. var ret = new proto.google.protobuf.Value();
  733. switch (goog.typeOf(value)) {
  734. case 'string':
  735. ret.setStringValue(/** @type {string} */ (value));
  736. break;
  737. case 'number':
  738. ret.setNumberValue(/** @type {number} */ (value));
  739. break;
  740. case 'boolean':
  741. ret.setBoolValue(/** @type {boolean} */ (value));
  742. break;
  743. case 'null':
  744. ret.setNullValue(proto.google.protobuf.NullValue.NULL_VALUE);
  745. break;
  746. case 'array':
  747. ret.setListValue(proto.google.protobuf.ListValue.fromJavaScript(
  748. /** @type{!Array} */ (value)));
  749. break;
  750. case 'object':
  751. ret.setStructValue(proto.google.protobuf.Struct.fromJavaScript(
  752. /** @type{!Object} */ (value)));
  753. break;
  754. default:
  755. throw new Error('Unexpected struct type.');
  756. }
  757. return ret;
  758. };
  759. /**
  760. * Converts this ListValue object to a plain JavaScript array.
  761. * @return {!Array} a plain JavaScript array representing this List.
  762. */
  763. proto.google.protobuf.ListValue.prototype.toJavaScript = function() {
  764. var ret = [];
  765. var values = this.getValuesList();
  766. for (var i = 0; i < values.length; i++) {
  767. ret[i] = values[i].toJavaScript();
  768. }
  769. return ret;
  770. };
  771. /**
  772. * Constructs a ListValue protobuf from this plain JavaScript array.
  773. * @param {!Array} array a plain JavaScript array
  774. * @return {proto.google.protobuf.ListValue} a new ListValue object
  775. */
  776. proto.google.protobuf.ListValue.fromJavaScript = function(array) {
  777. var ret = new proto.google.protobuf.ListValue();
  778. for (var i = 0; i < array.length; i++) {
  779. ret.addValues(proto.google.protobuf.Value.fromJavaScript(array[i]));
  780. }
  781. return ret;
  782. };
  783. /**
  784. * Converts this Struct object to a plain JavaScript object.
  785. * @return {!Object<string, !proto.google.protobuf.JavaScriptValue>} a plain
  786. * JavaScript object representing this Struct.
  787. */
  788. proto.google.protobuf.Struct.prototype.toJavaScript = function() {
  789. var ret = {};
  790. this.getFieldsMap().forEach(function(value, key) {
  791. ret[key] = value.toJavaScript();
  792. });
  793. return ret;
  794. };
  795. /**
  796. * Constructs a Struct protobuf from this plain JavaScript object.
  797. * @param {!Object} obj a plain JavaScript object
  798. * @return {proto.google.protobuf.Struct} a new Struct object
  799. */
  800. proto.google.protobuf.Struct.fromJavaScript = function(obj) {
  801. var ret = new proto.google.protobuf.Struct();
  802. var map = ret.getFieldsMap();
  803. for (var property in obj) {
  804. var val = obj[property];
  805. map.set(property, proto.google.protobuf.Value.fromJavaScript(val));
  806. }
  807. return ret;
  808. };
  809. // Generated by Spine ProtoJs Plugin
  810. proto.google.protobuf.ListValue.typeUrl = function() {
  811. return 'type.googleapis.com/google.protobuf.ListValue';
  812. };
  813. // Generated by Spine ProtoJs Plugin
  814. proto.google.protobuf.Struct.typeUrl = function() {
  815. return 'type.googleapis.com/google.protobuf.Struct';
  816. };
  817. // Generated by Spine ProtoJs Plugin
  818. proto.google.protobuf.Value.typeUrl = function() {
  819. return 'type.googleapis.com/google.protobuf.Value';
  820. };
  821. // Generated by Spine ProtoJs Plugin
  822. proto.google.protobuf.NullValue.typeUrl = function() {
  823. return 'type.googleapis.com/google.protobuf.NullValue';
  824. };