struct_pb.js 28 KB

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