struct.js 28 KB

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