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