types/js/source_pb.js
2017-12-14 14:39:53 -05:00

336 lines
8.5 KiB
JavaScript

/**
* @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')();
goog.exportSymbol('proto.pb.Source', null, global);
goog.exportSymbol('proto.pb.Source.SourceTypes', null, global);
goog.exportSymbol('proto.pb.Source.Version', 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.pb.Source = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.pb.Source, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.pb.Source.displayName = 'proto.pb.Source';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.pb.Source.prototype.toObject = function(opt_includeInstance) {
return proto.pb.Source.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.pb.Source} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.pb.Source.toObject = function(includeInstance, msg) {
var f, obj = {
version: jspb.Message.getField(msg, 1),
sourcetype: jspb.Message.getField(msg, 2),
source: msg.getSource_asB64(),
contenttype: jspb.Message.getField(msg, 4)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.pb.Source}
*/
proto.pb.Source.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.pb.Source;
return proto.pb.Source.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.pb.Source} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.pb.Source}
*/
proto.pb.Source.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.pb.Source.Version} */ (reader.readEnum());
msg.setVersion(value);
break;
case 2:
var value = /** @type {!proto.pb.Source.SourceTypes} */ (reader.readEnum());
msg.setSourcetype(value);
break;
case 3:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setSource(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setContenttype(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.pb.Source.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.pb.Source.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.pb.Source} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.pb.Source.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = /** @type {!proto.pb.Source.Version} */ (jspb.Message.getField(message, 1));
if (f != null) {
writer.writeEnum(
1,
f
);
}
f = /** @type {!proto.pb.Source.SourceTypes} */ (jspb.Message.getField(message, 2));
if (f != null) {
writer.writeEnum(
2,
f
);
}
f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 3));
if (f != null) {
writer.writeBytes(
3,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 4));
if (f != null) {
writer.writeString(
4,
f
);
}
};
/**
* @enum {number}
*/
proto.pb.Source.Version = {
UNKNOWN_VERSION: 0,
_0_0_1: 1
};
/**
* @enum {number}
*/
proto.pb.Source.SourceTypes = {
UNKNOWN_SOURCE_TYPE: 0,
LBRY_SD_HASH: 1
};
/**
* required Version version = 1;
* @return {!proto.pb.Source.Version}
*/
proto.pb.Source.prototype.getVersion = function() {
return /** @type {!proto.pb.Source.Version} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/** @param {!proto.pb.Source.Version} value */
proto.pb.Source.prototype.setVersion = function(value) {
jspb.Message.setField(this, 1, value);
};
proto.pb.Source.prototype.clearVersion = function() {
jspb.Message.setField(this, 1, undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
*/
proto.pb.Source.prototype.hasVersion = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* required SourceTypes sourceType = 2;
* @return {!proto.pb.Source.SourceTypes}
*/
proto.pb.Source.prototype.getSourcetype = function() {
return /** @type {!proto.pb.Source.SourceTypes} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/** @param {!proto.pb.Source.SourceTypes} value */
proto.pb.Source.prototype.setSourcetype = function(value) {
jspb.Message.setField(this, 2, value);
};
proto.pb.Source.prototype.clearSourcetype = function() {
jspb.Message.setField(this, 2, undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
*/
proto.pb.Source.prototype.hasSourcetype = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* required bytes source = 3;
* @return {!(string|Uint8Array)}
*/
proto.pb.Source.prototype.getSource = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* required bytes source = 3;
* This is a type-conversion wrapper around `getSource()`
* @return {string}
*/
proto.pb.Source.prototype.getSource_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getSource()));
};
/**
* required bytes source = 3;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getSource()`
* @return {!Uint8Array}
*/
proto.pb.Source.prototype.getSource_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getSource()));
};
/** @param {!(string|Uint8Array)} value */
proto.pb.Source.prototype.setSource = function(value) {
jspb.Message.setField(this, 3, value);
};
proto.pb.Source.prototype.clearSource = function() {
jspb.Message.setField(this, 3, undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
*/
proto.pb.Source.prototype.hasSource = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* required string contentType = 4;
* @return {string}
*/
proto.pb.Source.prototype.getContenttype = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/** @param {string} value */
proto.pb.Source.prototype.setContenttype = function(value) {
jspb.Message.setField(this, 4, value);
};
proto.pb.Source.prototype.clearContenttype = function() {
jspb.Message.setField(this, 4, undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
*/
proto.pb.Source.prototype.hasContenttype = function() {
return jspb.Message.getField(this, 4) != null;
};
goog.object.extend(exports, proto.pb);