Source: proto/spine/core/response_pb.js

// source: spine/core/response.proto
/**
 * @fileoverview
 * @enhanceable
 * @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!

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

var spine_options_pb = require('../../spine/options_pb.js');
goog.object.extend(proto, spine_options_pb);
var google_protobuf_empty_pb = require('../../google/protobuf/empty_pb.js');
goog.object.extend(proto, google_protobuf_empty_pb);
var spine_base_error_pb = require('../../spine/base/error_pb.js');
goog.object.extend(proto, spine_base_error_pb);
var spine_core_event_pb = require('../../spine/core/event_pb.js');
goog.object.extend(proto, spine_core_event_pb);
goog.exportSymbol('proto.spine.core.Response', null, global);
goog.exportSymbol('proto.spine.core.Status', null, global);
goog.exportSymbol('proto.spine.core.Status.StatusCase', null, global);
/**
 * 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.spine.core.Response = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.spine.core.Response, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   */
  proto.spine.core.Response.displayName = 'proto.spine.core.Response';
}
/**
 * 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.spine.core.Status = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.spine.core.Status.oneofGroups_);
};
goog.inherits(proto.spine.core.Status, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   */
  proto.spine.core.Status.displayName = 'proto.spine.core.Status';
}



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.spine.core.Response.prototype.toObject = function(opt_includeInstance) {
  return proto.spine.core.Response.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.spine.core.Response} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.core.Response.toObject = function(includeInstance, msg) {
  var f, obj = {
    status: (f = msg.getStatus()) && proto.spine.core.Status.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.spine.core.Response}
 */
proto.spine.core.Response.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.spine.core.Response;
  return proto.spine.core.Response.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.spine.core.Response} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.spine.core.Response}
 */
proto.spine.core.Response.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = new proto.spine.core.Status;
      reader.readMessage(value,proto.spine.core.Status.deserializeBinaryFromReader);
      msg.setStatus(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.spine.core.Response.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  proto.spine.core.Response.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.spine.core.Response} message
 * @param {!jspb.BinaryWriter} writer
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.core.Response.serializeBinaryToWriter = function(message, writer) {
  var f = undefined;
  f = message.getStatus();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.spine.core.Status.serializeBinaryToWriter
    );
  }
};


/**
 * optional Status status = 1;
 * @return {?proto.spine.core.Status}
 */
proto.spine.core.Response.prototype.getStatus = function() {
  return /** @type{?proto.spine.core.Status} */ (
    jspb.Message.getWrapperField(this, proto.spine.core.Status, 1));
};


/**
 * @param {?proto.spine.core.Status|undefined} value
 * @return {!proto.spine.core.Response} returns this
*/
proto.spine.core.Response.prototype.setStatus = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.core.Response} returns this
 */
proto.spine.core.Response.prototype.clearStatus = function() {
  return this.setStatus(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.core.Response.prototype.hasStatus = function() {
  return jspb.Message.getField(this, 1) != null;
};



/**
 * 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.spine.core.Status.oneofGroups_ = [[1,2,3]];

/**
 * @enum {number}
 */
proto.spine.core.Status.StatusCase = {
  STATUS_NOT_SET: 0,
  OK: 1,
  ERROR: 2,
  REJECTION: 3
};

/**
 * @return {proto.spine.core.Status.StatusCase}
 */
proto.spine.core.Status.prototype.getStatusCase = function() {
  return /** @type {proto.spine.core.Status.StatusCase} */(jspb.Message.computeOneofCase(this, proto.spine.core.Status.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.spine.core.Status.prototype.toObject = function(opt_includeInstance) {
  return proto.spine.core.Status.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.spine.core.Status} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.core.Status.toObject = function(includeInstance, msg) {
  var f, obj = {
    ok: (f = msg.getOk()) && google_protobuf_empty_pb.Empty.toObject(includeInstance, f),
    error: (f = msg.getError()) && spine_base_error_pb.Error.toObject(includeInstance, f),
    rejection: (f = msg.getRejection()) && spine_core_event_pb.Event.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.spine.core.Status}
 */
proto.spine.core.Status.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.spine.core.Status;
  return proto.spine.core.Status.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.spine.core.Status} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.spine.core.Status}
 */
proto.spine.core.Status.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = new google_protobuf_empty_pb.Empty;
      reader.readMessage(value,google_protobuf_empty_pb.Empty.deserializeBinaryFromReader);
      msg.setOk(value);
      break;
    case 2:
      var value = new spine_base_error_pb.Error;
      reader.readMessage(value,spine_base_error_pb.Error.deserializeBinaryFromReader);
      msg.setError(value);
      break;
    case 3:
      var value = new spine_core_event_pb.Event;
      reader.readMessage(value,spine_core_event_pb.Event.deserializeBinaryFromReader);
      msg.setRejection(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.spine.core.Status.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  proto.spine.core.Status.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.spine.core.Status} message
 * @param {!jspb.BinaryWriter} writer
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.core.Status.serializeBinaryToWriter = function(message, writer) {
  var f = undefined;
  f = message.getOk();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      google_protobuf_empty_pb.Empty.serializeBinaryToWriter
    );
  }
  f = message.getError();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      spine_base_error_pb.Error.serializeBinaryToWriter
    );
  }
  f = message.getRejection();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      spine_core_event_pb.Event.serializeBinaryToWriter
    );
  }
};


/**
 * optional google.protobuf.Empty ok = 1;
 * @return {?proto.google.protobuf.Empty}
 */
proto.spine.core.Status.prototype.getOk = function() {
  return /** @type{?proto.google.protobuf.Empty} */ (
    jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 1));
};


/**
 * @param {?proto.google.protobuf.Empty|undefined} value
 * @return {!proto.spine.core.Status} returns this
*/
proto.spine.core.Status.prototype.setOk = function(value) {
  return jspb.Message.setOneofWrapperField(this, 1, proto.spine.core.Status.oneofGroups_[0], value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.core.Status} returns this
 */
proto.spine.core.Status.prototype.clearOk = function() {
  return this.setOk(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.core.Status.prototype.hasOk = function() {
  return jspb.Message.getField(this, 1) != null;
};


/**
 * optional spine.base.Error error = 2;
 * @return {?proto.spine.base.Error}
 */
proto.spine.core.Status.prototype.getError = function() {
  return /** @type{?proto.spine.base.Error} */ (
    jspb.Message.getWrapperField(this, spine_base_error_pb.Error, 2));
};


/**
 * @param {?proto.spine.base.Error|undefined} value
 * @return {!proto.spine.core.Status} returns this
*/
proto.spine.core.Status.prototype.setError = function(value) {
  return jspb.Message.setOneofWrapperField(this, 2, proto.spine.core.Status.oneofGroups_[0], value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.core.Status} returns this
 */
proto.spine.core.Status.prototype.clearError = function() {
  return this.setError(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.core.Status.prototype.hasError = function() {
  return jspb.Message.getField(this, 2) != null;
};


/**
 * optional Event rejection = 3;
 * @return {?proto.spine.core.Event}
 */
proto.spine.core.Status.prototype.getRejection = function() {
  return /** @type{?proto.spine.core.Event} */ (
    jspb.Message.getWrapperField(this, spine_core_event_pb.Event, 3));
};


/**
 * @param {?proto.spine.core.Event|undefined} value
 * @return {!proto.spine.core.Status} returns this
*/
proto.spine.core.Status.prototype.setRejection = function(value) {
  return jspb.Message.setOneofWrapperField(this, 3, proto.spine.core.Status.oneofGroups_[0], value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.core.Status} returns this
 */
proto.spine.core.Status.prototype.clearRejection = function() {
  return this.setRejection(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.core.Status.prototype.hasRejection = function() {
  return jspb.Message.getField(this, 3) != null;
};


goog.object.extend(exports, proto.spine.core);

// Generated by Spine ProtoJs Plugin

let ObjectParser = require('../../../client/parser/object-parser.js').default;
let TypeParsers = require('../../../client/parser/type-parsers.js').default;

proto.spine.core.Response.Parser = function() {
  ObjectParser.call(this);
};
proto.spine.core.Response.Parser.prototype = Object.create(ObjectParser.prototype);
proto.spine.core.Response.Parser.prototype.constructor = proto.spine.core.Response.Parser;
proto.spine.core.Response.Parser.prototype.fromObject = function(obj) {
  if (obj === null) {
    return null;
  }
  
  let msg = new proto.spine.core.Response();
  
  if (obj.status !== undefined) {
    if (obj.status === null) {
      msg.setStatus(null);
    } else {
      let value = TypeParsers.parserFor('type.spine.io/spine.core.Status').fromObject(obj.status);
      msg.setStatus(value);
    }
  }
  return msg;
};

proto.spine.core.Status.Parser = function() {
  ObjectParser.call(this);
};
proto.spine.core.Status.Parser.prototype = Object.create(ObjectParser.prototype);
proto.spine.core.Status.Parser.prototype.constructor = proto.spine.core.Status.Parser;
proto.spine.core.Status.Parser.prototype.fromObject = function(obj) {
  if (obj === null) {
    return null;
  }
  
  let msg = new proto.spine.core.Status();
  
  if (obj.ok !== undefined) {
    if (obj.ok === null) {
      msg.setOk(null);
    } else {
      let value = TypeParsers.parserFor('type.googleapis.com/google.protobuf.Empty').fromObject(obj.ok);
      msg.setOk(value);
    }
  }
  
  if (obj.error !== undefined) {
    if (obj.error === null) {
      msg.setError(null);
    } else {
      let value = TypeParsers.parserFor('type.spine.io/spine.base.Error').fromObject(obj.error);
      msg.setError(value);
    }
  }
  
  if (obj.rejection !== undefined) {
    if (obj.rejection === null) {
      msg.setRejection(null);
    } else {
      let value = TypeParsers.parserFor('type.spine.io/spine.core.Event').fromObject(obj.rejection);
      msg.setRejection(value);
    }
  }
  return msg;
};

// Generated by Spine ProtoJs Plugin
proto.spine.core.Response.typeUrl = function() {
  return 'type.spine.io/spine.core.Response';
};

// Generated by Spine ProtoJs Plugin
proto.spine.core.Status.typeUrl = function() {
  return 'type.spine.io/spine.core.Status';
};