Playlist_pb.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /**
  2. * @fileoverview
  3. * @enhanceable
  4. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  5. * field starts with 'MSG_' and isn't a translatable message.
  6. * @public
  7. */
  8. // GENERATED CODE -- DO NOT EDIT!
  9. var jspb = require('google-protobuf');
  10. var goog = jspb;
  11. var global = Function('return this')();
  12. goog.exportSymbol('proto.PlaylistMetadata', null, global);
  13. /**
  14. * Generated by JsPbCodeGenerator.
  15. * @param {Array=} opt_data Optional initial data array, typically from a
  16. * server response, or constructed directly in Javascript. The array is used
  17. * in place and becomes part of the constructed object. It is not cloned.
  18. * If no data is provided, the constructed object will be empty, but still
  19. * valid.
  20. * @extends {jspb.Message}
  21. * @constructor
  22. */
  23. proto.PlaylistMetadata = function(opt_data) {
  24. jspb.Message.initialize(this, opt_data, 0, -1, proto.PlaylistMetadata.repeatedFields_, null);
  25. };
  26. goog.inherits(proto.PlaylistMetadata, jspb.Message);
  27. if (goog.DEBUG && !COMPILED) {
  28. proto.PlaylistMetadata.displayName = 'proto.PlaylistMetadata';
  29. }
  30. /**
  31. * List of repeated fields within this message type.
  32. * @private {!Array<number>}
  33. * @const
  34. */
  35. proto.PlaylistMetadata.repeatedFields_ = [2];
  36. if (jspb.Message.GENERATE_TO_OBJECT) {
  37. /**
  38. * Creates an object representation of this proto suitable for use in Soy templates.
  39. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  40. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  41. * For the list of reserved names please see:
  42. * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
  43. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
  44. * for transitional soy proto support: http://goto/soy-param-migration
  45. * @return {!Object}
  46. */
  47. proto.PlaylistMetadata.prototype.toObject = function(opt_includeInstance) {
  48. return proto.PlaylistMetadata.toObject(opt_includeInstance, this);
  49. };
  50. /**
  51. * Static version of the {@see toObject} method.
  52. * @param {boolean|undefined} includeInstance Whether to include the JSPB
  53. * instance for transitional soy proto support:
  54. * http://goto/soy-param-migration
  55. * @param {!proto.PlaylistMetadata} msg The msg instance to transform.
  56. * @return {!Object}
  57. * @suppress {unusedLocalVariables} f is only used for nested messages
  58. */
  59. proto.PlaylistMetadata.toObject = function(includeInstance, msg) {
  60. var f, obj = {
  61. title: jspb.Message.getField(msg, 1),
  62. videosList: jspb.Message.getRepeatedField(msg, 2)
  63. };
  64. if (includeInstance) {
  65. obj.$jspbMessageInstance = msg;
  66. }
  67. return obj;
  68. };
  69. }
  70. /**
  71. * Deserializes binary data (in protobuf wire format).
  72. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  73. * @return {!proto.PlaylistMetadata}
  74. */
  75. proto.PlaylistMetadata.deserializeBinary = function(bytes) {
  76. var reader = new jspb.BinaryReader(bytes);
  77. var msg = new proto.PlaylistMetadata;
  78. return proto.PlaylistMetadata.deserializeBinaryFromReader(msg, reader);
  79. };
  80. /**
  81. * Deserializes binary data (in protobuf wire format) from the
  82. * given reader into the given message object.
  83. * @param {!proto.PlaylistMetadata} msg The message object to deserialize into.
  84. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  85. * @return {!proto.PlaylistMetadata}
  86. */
  87. proto.PlaylistMetadata.deserializeBinaryFromReader = function(msg, reader) {
  88. while (reader.nextField()) {
  89. if (reader.isEndGroup()) {
  90. break;
  91. }
  92. var field = reader.getFieldNumber();
  93. switch (field) {
  94. case 1:
  95. var value = /** @type {string} */ (reader.readString());
  96. msg.setTitle(value);
  97. break;
  98. case 2:
  99. var value = /** @type {number} */ (reader.readUint64());
  100. msg.addVideos(value);
  101. break;
  102. default:
  103. reader.skipField();
  104. break;
  105. }
  106. }
  107. return msg;
  108. };
  109. /**
  110. * Serializes the message to binary data (in protobuf wire format).
  111. * @return {!Uint8Array}
  112. */
  113. proto.PlaylistMetadata.prototype.serializeBinary = function() {
  114. var writer = new jspb.BinaryWriter();
  115. proto.PlaylistMetadata.serializeBinaryToWriter(this, writer);
  116. return writer.getResultBuffer();
  117. };
  118. /**
  119. * Serializes the given message to binary data (in protobuf wire
  120. * format), writing to the given BinaryWriter.
  121. * @param {!proto.PlaylistMetadata} message
  122. * @param {!jspb.BinaryWriter} writer
  123. * @suppress {unusedLocalVariables} f is only used for nested messages
  124. */
  125. proto.PlaylistMetadata.serializeBinaryToWriter = function(message, writer) {
  126. var f = undefined;
  127. f = /** @type {string} */ (jspb.Message.getField(message, 1));
  128. if (f != null) {
  129. writer.writeString(
  130. 1,
  131. f
  132. );
  133. }
  134. f = message.getVideosList();
  135. if (f.length > 0) {
  136. writer.writeRepeatedUint64(
  137. 2,
  138. f
  139. );
  140. }
  141. };
  142. /**
  143. * optional string title = 1;
  144. * @return {string}
  145. */
  146. proto.PlaylistMetadata.prototype.getTitle = function() {
  147. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  148. };
  149. /** @param {string} value */
  150. proto.PlaylistMetadata.prototype.setTitle = function(value) {
  151. jspb.Message.setField(this, 1, value);
  152. };
  153. proto.PlaylistMetadata.prototype.clearTitle = function() {
  154. jspb.Message.setField(this, 1, undefined);
  155. };
  156. /**
  157. * Returns whether this field is set.
  158. * @return {!boolean}
  159. */
  160. proto.PlaylistMetadata.prototype.hasTitle = function() {
  161. return jspb.Message.getField(this, 1) != null;
  162. };
  163. /**
  164. * repeated uint64 videos = 2;
  165. * @return {!Array<number>}
  166. */
  167. proto.PlaylistMetadata.prototype.getVideosList = function() {
  168. return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 2));
  169. };
  170. /** @param {!Array<number>} value */
  171. proto.PlaylistMetadata.prototype.setVideosList = function(value) {
  172. jspb.Message.setField(this, 2, value || []);
  173. };
  174. /**
  175. * @param {!number} value
  176. * @param {number=} opt_index
  177. */
  178. proto.PlaylistMetadata.prototype.addVideos = function(value, opt_index) {
  179. jspb.Message.addToRepeatedField(this, 2, value, opt_index);
  180. };
  181. proto.PlaylistMetadata.prototype.clearVideosList = function() {
  182. this.setVideosList([]);
  183. };
  184. goog.object.extend(exports, proto);