123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949 |
- // source: google/protobuf/struct.proto
- /**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
- // GENERATED CODE -- DO NOT EDIT!
- /* eslint-disable */
- // @ts-nocheck
- goog.provide('proto.google.protobuf.ListValue');
- goog.provide('proto.google.protobuf.NullValue');
- goog.provide('proto.google.protobuf.Struct');
- goog.provide('proto.google.protobuf.Value');
- goog.provide('proto.google.protobuf.Value.KindCase');
- goog.require('jspb.BinaryReader');
- goog.require('jspb.BinaryWriter');
- goog.require('jspb.Map');
- goog.require('jspb.Message');
- /**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
- proto.google.protobuf.Struct = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
- };
- goog.inherits(proto.google.protobuf.Struct, jspb.Message);
- if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.google.protobuf.Struct.displayName = 'proto.google.protobuf.Struct';
- }
- /**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
- proto.google.protobuf.Value = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, proto.google.protobuf.Value.oneofGroups_);
- };
- goog.inherits(proto.google.protobuf.Value, jspb.Message);
- if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.google.protobuf.Value.displayName = 'proto.google.protobuf.Value';
- }
- /**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
- proto.google.protobuf.ListValue = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.ListValue.repeatedFields_, null);
- };
- goog.inherits(proto.google.protobuf.ListValue, jspb.Message);
- if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.google.protobuf.ListValue.displayName = 'proto.google.protobuf.ListValue';
- }
- if (jspb.Message.GENERATE_TO_OBJECT) {
- /**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
- proto.google.protobuf.Struct.prototype.toObject = function(opt_includeInstance) {
- return proto.google.protobuf.Struct.toObject(opt_includeInstance, this);
- };
- /**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.google.protobuf.Struct} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.Struct.toObject = function(includeInstance, msg) {
- var f, obj = {
- fieldsMap: (f = msg.getFieldsMap()) ? f.toObject(includeInstance, proto.google.protobuf.Value.toObject) : []
- };
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
- };
- }
- /**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.google.protobuf.Struct}
- */
- proto.google.protobuf.Struct.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.google.protobuf.Struct;
- return proto.google.protobuf.Struct.deserializeBinaryFromReader(msg, reader);
- };
- /**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.google.protobuf.Struct} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.google.protobuf.Struct}
- */
- proto.google.protobuf.Struct.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = msg.getFieldsMap();
- reader.readMessage(value, function(message, reader) {
- jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.google.protobuf.Value.deserializeBinaryFromReader, "", new proto.google.protobuf.Value());
- });
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
- };
- /**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
- proto.google.protobuf.Struct.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.google.protobuf.Struct.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
- };
- /**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.google.protobuf.Struct} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.Struct.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getFieldsMap(true);
- if (f && f.getLength() > 0) {
- f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.google.protobuf.Value.serializeBinaryToWriter);
- }
- };
- /**
- * map<string, Value> fields = 1;
- * @param {boolean=} opt_noLazyCreate Do not create the map if
- * empty, instead returning `undefined`
- * @return {!jspb.Map<string,!proto.google.protobuf.Value>}
- */
- proto.google.protobuf.Struct.prototype.getFieldsMap = function(opt_noLazyCreate) {
- return /** @type {!jspb.Map<string,!proto.google.protobuf.Value>} */ (
- jspb.Message.getMapField(this, 1, opt_noLazyCreate,
- proto.google.protobuf.Value));
- };
- /**
- * Clears values from the map. The map will be non-null.
- * @return {!proto.google.protobuf.Struct} returns this
- */
- proto.google.protobuf.Struct.prototype.clearFieldsMap = function() {
- this.getFieldsMap().clear();
- return this;
- };
- /**
- * Oneof group definitions for this message. Each group defines the field
- * numbers belonging to that group. When of these fields' value is set, all
- * other fields in the group are cleared. During deserialization, if multiple
- * fields are encountered for a group, only the last value seen will be kept.
- * @private {!Array<!Array<number>>}
- * @const
- */
- proto.google.protobuf.Value.oneofGroups_ = [[1,2,3,4,5,6]];
- /**
- * @enum {number}
- */
- proto.google.protobuf.Value.KindCase = {
- KIND_NOT_SET: 0,
- NULL_VALUE: 1,
- NUMBER_VALUE: 2,
- STRING_VALUE: 3,
- BOOL_VALUE: 4,
- STRUCT_VALUE: 5,
- LIST_VALUE: 6
- };
- /**
- * @return {proto.google.protobuf.Value.KindCase}
- */
- proto.google.protobuf.Value.prototype.getKindCase = function() {
- return /** @type {proto.google.protobuf.Value.KindCase} */(jspb.Message.computeOneofCase(this, proto.google.protobuf.Value.oneofGroups_[0]));
- };
- if (jspb.Message.GENERATE_TO_OBJECT) {
- /**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
- proto.google.protobuf.Value.prototype.toObject = function(opt_includeInstance) {
- return proto.google.protobuf.Value.toObject(opt_includeInstance, this);
- };
- /**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.google.protobuf.Value} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.Value.toObject = function(includeInstance, msg) {
- var f, obj = {
- nullValue: jspb.Message.getFieldWithDefault(msg, 1, 0),
- numberValue: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
- stringValue: jspb.Message.getFieldWithDefault(msg, 3, ""),
- boolValue: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
- structValue: (f = msg.getStructValue()) && proto.google.protobuf.Struct.toObject(includeInstance, f),
- listValue: (f = msg.getListValue()) && proto.google.protobuf.ListValue.toObject(includeInstance, f)
- };
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
- };
- }
- /**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.google.protobuf.Value}
- */
- proto.google.protobuf.Value.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.google.protobuf.Value;
- return proto.google.protobuf.Value.deserializeBinaryFromReader(msg, reader);
- };
- /**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.google.protobuf.Value} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.google.protobuf.Value}
- */
- proto.google.protobuf.Value.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.google.protobuf.NullValue} */ (reader.readEnum());
- msg.setNullValue(value);
- break;
- case 2:
- var value = /** @type {number} */ (reader.readDouble());
- msg.setNumberValue(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setStringValue(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setBoolValue(value);
- break;
- case 5:
- var value = new proto.google.protobuf.Struct;
- reader.readMessage(value,proto.google.protobuf.Struct.deserializeBinaryFromReader);
- msg.setStructValue(value);
- break;
- case 6:
- var value = new proto.google.protobuf.ListValue;
- reader.readMessage(value,proto.google.protobuf.ListValue.deserializeBinaryFromReader);
- msg.setListValue(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
- };
- /**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
- proto.google.protobuf.Value.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.google.protobuf.Value.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
- };
- /**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.google.protobuf.Value} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.Value.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = /** @type {!proto.google.protobuf.NullValue} */ (jspb.Message.getField(message, 1));
- if (f != null) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = /** @type {number} */ (jspb.Message.getField(message, 2));
- if (f != null) {
- writer.writeDouble(
- 2,
- f
- );
- }
- f = /** @type {string} */ (jspb.Message.getField(message, 3));
- if (f != null) {
- writer.writeString(
- 3,
- f
- );
- }
- f = /** @type {boolean} */ (jspb.Message.getField(message, 4));
- if (f != null) {
- writer.writeBool(
- 4,
- f
- );
- }
- f = message.getStructValue();
- if (f != null) {
- writer.writeMessage(
- 5,
- f,
- proto.google.protobuf.Struct.serializeBinaryToWriter
- );
- }
- f = message.getListValue();
- if (f != null) {
- writer.writeMessage(
- 6,
- f,
- proto.google.protobuf.ListValue.serializeBinaryToWriter
- );
- }
- };
- /**
- * optional NullValue null_value = 1;
- * @return {!proto.google.protobuf.NullValue}
- */
- proto.google.protobuf.Value.prototype.getNullValue = function() {
- return /** @type {!proto.google.protobuf.NullValue} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
- };
- /**
- * @param {!proto.google.protobuf.NullValue} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setNullValue = function(value) {
- return jspb.Message.setOneofField(this, 1, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearNullValue = function() {
- return jspb.Message.setOneofField(this, 1, proto.google.protobuf.Value.oneofGroups_[0], undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasNullValue = function() {
- return jspb.Message.getField(this, 1) != null;
- };
- /**
- * optional double number_value = 2;
- * @return {number}
- */
- proto.google.protobuf.Value.prototype.getNumberValue = function() {
- return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
- };
- /**
- * @param {number} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setNumberValue = function(value) {
- return jspb.Message.setOneofField(this, 2, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearNumberValue = function() {
- return jspb.Message.setOneofField(this, 2, proto.google.protobuf.Value.oneofGroups_[0], undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasNumberValue = function() {
- return jspb.Message.getField(this, 2) != null;
- };
- /**
- * optional string string_value = 3;
- * @return {string}
- */
- proto.google.protobuf.Value.prototype.getStringValue = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
- };
- /**
- * @param {string} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setStringValue = function(value) {
- return jspb.Message.setOneofField(this, 3, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearStringValue = function() {
- return jspb.Message.setOneofField(this, 3, proto.google.protobuf.Value.oneofGroups_[0], undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasStringValue = function() {
- return jspb.Message.getField(this, 3) != null;
- };
- /**
- * optional bool bool_value = 4;
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.getBoolValue = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
- };
- /**
- * @param {boolean} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setBoolValue = function(value) {
- return jspb.Message.setOneofField(this, 4, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearBoolValue = function() {
- return jspb.Message.setOneofField(this, 4, proto.google.protobuf.Value.oneofGroups_[0], undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasBoolValue = function() {
- return jspb.Message.getField(this, 4) != null;
- };
- /**
- * optional Struct struct_value = 5;
- * @return {?proto.google.protobuf.Struct}
- */
- proto.google.protobuf.Value.prototype.getStructValue = function() {
- return /** @type{?proto.google.protobuf.Struct} */ (
- jspb.Message.getWrapperField(this, proto.google.protobuf.Struct, 5));
- };
- /**
- * @param {?proto.google.protobuf.Struct|undefined} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setStructValue = function(value) {
- return jspb.Message.setOneofWrapperField(this, 5, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the message field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearStructValue = function() {
- return this.setStructValue(undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasStructValue = function() {
- return jspb.Message.getField(this, 5) != null;
- };
- /**
- * optional ListValue list_value = 6;
- * @return {?proto.google.protobuf.ListValue}
- */
- proto.google.protobuf.Value.prototype.getListValue = function() {
- return /** @type{?proto.google.protobuf.ListValue} */ (
- jspb.Message.getWrapperField(this, proto.google.protobuf.ListValue, 6));
- };
- /**
- * @param {?proto.google.protobuf.ListValue|undefined} value
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.setListValue = function(value) {
- return jspb.Message.setOneofWrapperField(this, 6, proto.google.protobuf.Value.oneofGroups_[0], value);
- };
- /**
- * Clears the message field making it undefined.
- * @return {!proto.google.protobuf.Value} returns this
- */
- proto.google.protobuf.Value.prototype.clearListValue = function() {
- return this.setListValue(undefined);
- };
- /**
- * Returns whether this field is set.
- * @return {boolean}
- */
- proto.google.protobuf.Value.prototype.hasListValue = function() {
- return jspb.Message.getField(this, 6) != null;
- };
- /**
- * List of repeated fields within this message type.
- * @private {!Array<number>}
- * @const
- */
- proto.google.protobuf.ListValue.repeatedFields_ = [1];
- if (jspb.Message.GENERATE_TO_OBJECT) {
- /**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
- proto.google.protobuf.ListValue.prototype.toObject = function(opt_includeInstance) {
- return proto.google.protobuf.ListValue.toObject(opt_includeInstance, this);
- };
- /**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.google.protobuf.ListValue} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.ListValue.toObject = function(includeInstance, msg) {
- var f, obj = {
- valuesList: jspb.Message.toObjectList(msg.getValuesList(),
- proto.google.protobuf.Value.toObject, includeInstance)
- };
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
- };
- }
- /**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.google.protobuf.ListValue}
- */
- proto.google.protobuf.ListValue.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.google.protobuf.ListValue;
- return proto.google.protobuf.ListValue.deserializeBinaryFromReader(msg, reader);
- };
- /**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.google.protobuf.ListValue} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.google.protobuf.ListValue}
- */
- proto.google.protobuf.ListValue.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.google.protobuf.Value;
- reader.readMessage(value,proto.google.protobuf.Value.deserializeBinaryFromReader);
- msg.addValues(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
- };
- /**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
- proto.google.protobuf.ListValue.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.google.protobuf.ListValue.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
- };
- /**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.google.protobuf.ListValue} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
- proto.google.protobuf.ListValue.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getValuesList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 1,
- f,
- proto.google.protobuf.Value.serializeBinaryToWriter
- );
- }
- };
- /**
- * repeated Value values = 1;
- * @return {!Array<!proto.google.protobuf.Value>}
- */
- proto.google.protobuf.ListValue.prototype.getValuesList = function() {
- return /** @type{!Array<!proto.google.protobuf.Value>} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.Value, 1));
- };
- /**
- * @param {!Array<!proto.google.protobuf.Value>} value
- * @return {!proto.google.protobuf.ListValue} returns this
- */
- proto.google.protobuf.ListValue.prototype.setValuesList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
- };
- /**
- * @param {!proto.google.protobuf.Value=} opt_value
- * @param {number=} opt_index
- * @return {!proto.google.protobuf.Value}
- */
- proto.google.protobuf.ListValue.prototype.addValues = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.google.protobuf.Value, opt_index);
- };
- /**
- * Clears the list making it empty but non-null.
- * @return {!proto.google.protobuf.ListValue} returns this
- */
- proto.google.protobuf.ListValue.prototype.clearValuesList = function() {
- return this.setValuesList([]);
- };
- /**
- * @enum {number}
- */
- proto.google.protobuf.NullValue = {
- NULL_VALUE: 0
- };
- /* This code will be inserted into generated code for
- * google/protobuf/struct.proto. */
- /**
- * Typedef representing plain JavaScript values that can go into a
- * Struct.
- * @typedef {null|number|string|boolean|Array|Object}
- */
- proto.google.protobuf.JavaScriptValue;
- /**
- * Converts this Value object to a plain JavaScript value.
- * @return {?proto.google.protobuf.JavaScriptValue} a plain JavaScript
- * value representing this Struct.
- */
- proto.google.protobuf.Value.prototype.toJavaScript = function() {
- var kindCase = proto.google.protobuf.Value.KindCase;
- switch (this.getKindCase()) {
- case kindCase.NULL_VALUE:
- return null;
- case kindCase.NUMBER_VALUE:
- return this.getNumberValue();
- case kindCase.STRING_VALUE:
- return this.getStringValue();
- case kindCase.BOOL_VALUE:
- return this.getBoolValue();
- case kindCase.STRUCT_VALUE:
- return this.getStructValue().toJavaScript();
- case kindCase.LIST_VALUE:
- return this.getListValue().toJavaScript();
- default:
- throw new Error('Unexpected struct type');
- }
- };
- /**
- * Converts this JavaScript value to a new Value proto.
- * @param {!proto.google.protobuf.JavaScriptValue} value The value to
- * convert.
- * @return {!proto.google.protobuf.Value} The newly constructed value.
- */
- proto.google.protobuf.Value.fromJavaScript = function(value) {
- var ret = new proto.google.protobuf.Value();
- switch (goog.typeOf(value)) {
- case 'string':
- ret.setStringValue(/** @type {string} */ (value));
- break;
- case 'number':
- ret.setNumberValue(/** @type {number} */ (value));
- break;
- case 'boolean':
- ret.setBoolValue(/** @type {boolean} */ (value));
- break;
- case 'null':
- ret.setNullValue(proto.google.protobuf.NullValue.NULL_VALUE);
- break;
- case 'array':
- ret.setListValue(proto.google.protobuf.ListValue.fromJavaScript(
- /** @type{!Array} */ (value)));
- break;
- case 'object':
- ret.setStructValue(proto.google.protobuf.Struct.fromJavaScript(
- /** @type{!Object} */ (value)));
- break;
- default:
- throw new Error('Unexpected struct type.');
- }
- return ret;
- };
- /**
- * Converts this ListValue object to a plain JavaScript array.
- * @return {!Array} a plain JavaScript array representing this List.
- */
- proto.google.protobuf.ListValue.prototype.toJavaScript = function() {
- var ret = [];
- var values = this.getValuesList();
- for (var i = 0; i < values.length; i++) {
- ret[i] = values[i].toJavaScript();
- }
- return ret;
- };
- /**
- * Constructs a ListValue protobuf from this plain JavaScript array.
- * @param {!Array} array a plain JavaScript array
- * @return {proto.google.protobuf.ListValue} a new ListValue object
- */
- proto.google.protobuf.ListValue.fromJavaScript = function(array) {
- var ret = new proto.google.protobuf.ListValue();
- for (var i = 0; i < array.length; i++) {
- ret.addValues(proto.google.protobuf.Value.fromJavaScript(array[i]));
- }
- return ret;
- };
- /**
- * Converts this Struct object to a plain JavaScript object.
- * @return {!Object<string, !proto.google.protobuf.JavaScriptValue>} a plain
- * JavaScript object representing this Struct.
- */
- proto.google.protobuf.Struct.prototype.toJavaScript = function() {
- var ret = {};
- this.getFieldsMap().forEach(function(value, key) {
- ret[key] = value.toJavaScript();
- });
- return ret;
- };
- /**
- * Constructs a Struct protobuf from this plain JavaScript object.
- * @param {!Object} obj a plain JavaScript object
- * @return {proto.google.protobuf.Struct} a new Struct object
- */
- proto.google.protobuf.Struct.fromJavaScript = function(obj) {
- var ret = new proto.google.protobuf.Struct();
- var map = ret.getFieldsMap();
- for (var property in obj) {
- var val = obj[property];
- map.set(property, proto.google.protobuf.Value.fromJavaScript(val));
- }
- return ret;
- };
|