Browse Source

protobuf messages: use date for published before joystream, improve docs re oob array

Mokhtar Naamani 4 years ago
parent
commit
ee49f91d3e

+ 0 - 5
content-metadata-protobuf/compile.sh

@@ -7,14 +7,9 @@ PROTOC_GEN_TS_PATH="./node_modules/.bin/protoc-gen-ts"
 OUT_DIR="./compiled"
 mkdir -p ${OUT_DIR}
 
-# Directory to write generated documentation to
-OUT_DIR_DOC="./doc"
-mkdir -p ${OUT_DIR_DOC}
-
 # Compile proto files and also generate html docs
 protoc \
     --plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" \
     --js_out="import_style=commonjs,binary:${OUT_DIR}" \
     --ts_out="${OUT_DIR}" \
-    --doc_out="${OUT_DIR_DOC}" \
     proto/*.proto

+ 6 - 0
content-metadata-protobuf/compiled/proto/Series_pb.d.ts

@@ -48,6 +48,11 @@ export class SeasonMetadata extends jspb.Message {
   getDescription(): string | undefined;
   setDescription(value: string): void;
 
+  hasCoverPhoto(): boolean;
+  clearCoverPhoto(): void;
+  getCoverPhoto(): number | undefined;
+  setCoverPhoto(value: number): void;
+
   serializeBinary(): Uint8Array;
   toObject(includeInstance?: boolean): SeasonMetadata.AsObject;
   static toObject(includeInstance: boolean, msg: SeasonMetadata): SeasonMetadata.AsObject;
@@ -62,6 +67,7 @@ export namespace SeasonMetadata {
   export type AsObject = {
     title?: string,
     description?: string,
+    coverPhoto?: number,
   }
 }
 

+ 49 - 1
content-metadata-protobuf/compiled/proto/Series_pb.js

@@ -335,7 +335,8 @@ proto.SeasonMetadata.prototype.toObject = function(opt_includeInstance) {
 proto.SeasonMetadata.toObject = function(includeInstance, msg) {
   var f, obj = {
     title: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
-    description: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
+    description: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
+    coverPhoto: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
   };
 
   if (includeInstance) {
@@ -380,6 +381,10 @@ proto.SeasonMetadata.deserializeBinaryFromReader = function(msg, reader) {
       var value = /** @type {string} */ (reader.readString());
       msg.setDescription(value);
       break;
+    case 3:
+      var value = /** @type {number} */ (reader.readUint32());
+      msg.setCoverPhoto(value);
+      break;
     default:
       reader.skipField();
       break;
@@ -423,6 +428,13 @@ proto.SeasonMetadata.serializeBinaryToWriter = function(message, writer) {
       f
     );
   }
+  f = /** @type {number} */ (jspb.Message.getField(message, 3));
+  if (f != null) {
+    writer.writeUint32(
+      3,
+      f
+    );
+  }
 };
 
 
@@ -498,4 +510,40 @@ proto.SeasonMetadata.prototype.hasDescription = function() {
 };
 
 
+/**
+ * optional uint32 cover_photo = 3;
+ * @return {number}
+ */
+proto.SeasonMetadata.prototype.getCoverPhoto = function() {
+  return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
+};
+
+
+/**
+ * @param {number} value
+ * @return {!proto.SeasonMetadata} returns this
+ */
+proto.SeasonMetadata.prototype.setCoverPhoto = function(value) {
+  return jspb.Message.setField(this, 3, value);
+};
+
+
+/**
+ * Clears the field making it undefined.
+ * @return {!proto.SeasonMetadata} returns this
+ */
+proto.SeasonMetadata.prototype.clearCoverPhoto = function() {
+  return jspb.Message.setField(this, 3, undefined);
+};
+
+
+/**
+ * Returns whether this field is set.
+ * @return {boolean}
+ */
+proto.SeasonMetadata.prototype.hasCoverPhoto = function() {
+  return jspb.Message.getField(this, 3) != null;
+};
+
+
 goog.object.extend(exports, proto);

+ 5 - 5
content-metadata-protobuf/compiled/proto/Video_pb.d.ts

@@ -9,10 +9,10 @@ export class PublishedBeforeJoystream extends jspb.Message {
   getIsPublished(): boolean | undefined;
   setIsPublished(value: boolean): void;
 
-  hasTimestamp(): boolean;
-  clearTimestamp(): void;
-  getTimestamp(): number | undefined;
-  setTimestamp(value: number): void;
+  hasDate(): boolean;
+  clearDate(): void;
+  getDate(): string | undefined;
+  setDate(value: string): void;
 
   serializeBinary(): Uint8Array;
   toObject(includeInstance?: boolean): PublishedBeforeJoystream.AsObject;
@@ -27,7 +27,7 @@ export class PublishedBeforeJoystream extends jspb.Message {
 export namespace PublishedBeforeJoystream {
   export type AsObject = {
     isPublished?: boolean,
-    timestamp?: number,
+    date?: string,
   }
 }
 

+ 13 - 13
content-metadata-protobuf/compiled/proto/Video_pb.js

@@ -157,7 +157,7 @@ proto.PublishedBeforeJoystream.prototype.toObject = function(opt_includeInstance
 proto.PublishedBeforeJoystream.toObject = function(includeInstance, msg) {
   var f, obj = {
     isPublished: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f,
-    timestamp: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
+    date: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
   };
 
   if (includeInstance) {
@@ -199,8 +199,8 @@ proto.PublishedBeforeJoystream.deserializeBinaryFromReader = function(msg, reade
       msg.setIsPublished(value);
       break;
     case 2:
-      var value = /** @type {number} */ (reader.readUint32());
-      msg.setTimestamp(value);
+      var value = /** @type {string} */ (reader.readString());
+      msg.setDate(value);
       break;
     default:
       reader.skipField();
@@ -238,9 +238,9 @@ proto.PublishedBeforeJoystream.serializeBinaryToWriter = function(message, write
       f
     );
   }
-  f = /** @type {number} */ (jspb.Message.getField(message, 2));
+  f = /** @type {string} */ (jspb.Message.getField(message, 2));
   if (f != null) {
-    writer.writeUint32(
+    writer.writeString(
       2,
       f
     );
@@ -285,19 +285,19 @@ proto.PublishedBeforeJoystream.prototype.hasIsPublished = function() {
 
 
 /**
- * optional uint32 timestamp = 2;
- * @return {number}
+ * optional string date = 2;
+ * @return {string}
  */
-proto.PublishedBeforeJoystream.prototype.getTimestamp = function() {
-  return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
+proto.PublishedBeforeJoystream.prototype.getDate = function() {
+  return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
 };
 
 
 /**
- * @param {number} value
+ * @param {string} value
  * @return {!proto.PublishedBeforeJoystream} returns this
  */
-proto.PublishedBeforeJoystream.prototype.setTimestamp = function(value) {
+proto.PublishedBeforeJoystream.prototype.setDate = function(value) {
   return jspb.Message.setField(this, 2, value);
 };
 
@@ -306,7 +306,7 @@ proto.PublishedBeforeJoystream.prototype.setTimestamp = function(value) {
  * Clears the field making it undefined.
  * @return {!proto.PublishedBeforeJoystream} returns this
  */
-proto.PublishedBeforeJoystream.prototype.clearTimestamp = function() {
+proto.PublishedBeforeJoystream.prototype.clearDate = function() {
   return jspb.Message.setField(this, 2, undefined);
 };
 
@@ -315,7 +315,7 @@ proto.PublishedBeforeJoystream.prototype.clearTimestamp = function() {
  * Returns whether this field is set.
  * @return {boolean}
  */
-proto.PublishedBeforeJoystream.prototype.hasTimestamp = function() {
+proto.PublishedBeforeJoystream.prototype.hasDate = function() {
   return jspb.Message.getField(this, 2) != null;
 };
 

+ 41 - 0
content-metadata-protobuf/doc-appendix.md

@@ -0,0 +1,41 @@
+<!-- 
+    This extra documentation will be appended to the generated docs.
+-->
+
+## Referencing Assets
+<a name=".Assets"></a>
+
+Applications that process messages that contain a `uint32` field that references an asset such as a cover photo or video, should interpret this value as a zero based index into an array/vector that is received external (out of band) to the protobuf message.
+
+Example in context of query-node processing the runtime event `VideoCreated`
+
+```rust
+// Runtime event associated with creating a Video
+VideoCreated(video_id: VideoId, video: Video, assets: Vec<NewAsset>, params: VideoCreationParameters)
+
+struct VideoCreationParameters {
+  in_category: VideoCategoryId,
+  // binary serialized VideoMetadata protobuf message
+  meta: Vec<u8>,
+}
+
+// suppose assets is a vector of two elements. Thi is the "out of band" array being referenced by the VideoMetadata message
+assets = [
+    NewAsset::Uri("https://mydomain.net/thumbnail.png"),
+    NewAsset::Upload({
+       content_id,
+       ipfs_hash,
+       size,
+       ...
+    }),
+];
+
+metat = VideoMetadata {
+    ...
+    // refers to second element: assets[1] which is being uploaded to the storage system
+    video: 1,
+    // refers to the first element assets[0] which is being referneced by a url string.
+    thumbnail_photo: 0,
+    ...
+};
+```

+ 0 - 1023
content-metadata-protobuf/doc/index.html

@@ -1,1023 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-  <head>
-    <title>Protocol Documentation</title>
-    <meta charset="UTF-8">
-    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>
-    <style>
-      body {
-        width: 60em;
-        margin: 1em auto;
-        color: #222;
-        font-family: "Ubuntu", sans-serif;
-        padding-bottom: 4em;
-      }
-
-      h1 {
-        font-weight: normal;
-        border-bottom: 1px solid #aaa;
-        padding-bottom: 0.5ex;
-      }
-
-      h2 {
-        border-bottom: 1px solid #aaa;
-        padding-bottom: 0.5ex;
-        margin: 1.5em 0;
-      }
-
-      h3 {
-        font-weight: normal;
-        border-bottom: 1px solid #aaa;
-        padding-bottom: 0.5ex;
-      }
-
-      a {
-        text-decoration: none;
-        color: #567e25;
-      }
-
-      table {
-        width: 100%;
-        font-size: 80%;
-        border-collapse: collapse;
-      }
-
-      thead {
-        font-weight: 700;
-        background-color: #dcdcdc;
-      }
-
-      tbody tr:nth-child(even) {
-        background-color: #fbfbfb;
-      }
-
-      td {
-        border: 1px solid #ccc;
-        padding: 0.5ex 2ex;
-      }
-
-      td p {
-        text-indent: 1em;
-        margin: 0;
-      }
-
-      td p:nth-child(1) {
-        text-indent: 0;  
-      }
-
-       
-      .field-table td:nth-child(1) {  
-        width: 10em;
-      }
-      .field-table td:nth-child(2) {  
-        width: 10em;
-      }
-      .field-table td:nth-child(3) {  
-        width: 6em;
-      }
-      .field-table td:nth-child(4) {  
-        width: auto;
-      }
-
-       
-      .extension-table td:nth-child(1) {  
-        width: 10em;
-      }
-      .extension-table td:nth-child(2) {  
-        width: 10em;
-      }
-      .extension-table td:nth-child(3) {  
-        width: 10em;
-      }
-      .extension-table td:nth-child(4) {  
-        width: 5em;
-      }
-      .extension-table td:nth-child(5) {  
-        width: auto;
-      }
-
-       
-      .enum-table td:nth-child(1) {  
-        width: 10em;
-      }
-      .enum-table td:nth-child(2) {  
-        width: 10em;
-      }
-      .enum-table td:nth-child(3) {  
-        width: auto;
-      }
-
-       
-      .scalar-value-types-table tr {
-        height: 3em;
-      }
-
-       
-      #toc-container ul {
-        list-style-type: none;
-        padding-left: 1em;
-        line-height: 180%;
-        margin: 0;
-      }
-      #toc > li > a {
-        font-weight: bold;
-      }
-
-       
-      .file-heading {
-        width: 100%;
-        display: table;
-        border-bottom: 1px solid #aaa;
-        margin: 4em 0 1.5em 0;
-      }
-      .file-heading h2 {
-        border: none;
-        display: table-cell;
-      }
-      .file-heading a {
-        text-align: right;
-        display: table-cell;
-      }
-
-       
-      .badge {
-        width: 1.6em;
-        height: 1.6em;
-        display: inline-block;
-
-        line-height: 1.6em;
-        text-align: center;
-        font-weight: bold;
-        font-size: 60%;
-
-        color: #89ba48;
-        background-color: #dff0c8;
-
-        margin: 0.5ex 1em 0.5ex -1em;
-        border: 1px solid #fbfbfb;
-        border-radius: 1ex;
-      }
-    </style>
-
-    
-    <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
-  </head>
-
-  <body>
-
-    <h1 id="title">Protocol Documentation</h1>
-
-    <h2>Table of Contents</h2>
-
-    <div id="toc-container">
-      <ul id="toc">
-        
-          
-          <li>
-            <a href="#proto%2fChannel.proto">proto/Channel.proto</a>
-            <ul>
-              
-                <li>
-                  <a href="#.ChannelCategoryMetadata"><span class="badge">M</span>ChannelCategoryMetadata</a>
-                </li>
-              
-                <li>
-                  <a href="#.ChannelMetadata"><span class="badge">M</span>ChannelMetadata</a>
-                </li>
-              
-              
-              
-              
-            </ul>
-          </li>
-        
-          
-          <li>
-            <a href="#proto%2fPerson.proto">proto/Person.proto</a>
-            <ul>
-              
-                <li>
-                  <a href="#.PersonMetadata"><span class="badge">M</span>PersonMetadata</a>
-                </li>
-              
-              
-              
-              
-            </ul>
-          </li>
-        
-          
-          <li>
-            <a href="#proto%2fPlaylist.proto">proto/Playlist.proto</a>
-            <ul>
-              
-                <li>
-                  <a href="#.PlaylistMetadata"><span class="badge">M</span>PlaylistMetadata</a>
-                </li>
-              
-              
-              
-              
-            </ul>
-          </li>
-        
-          
-          <li>
-            <a href="#proto%2fSeries.proto">proto/Series.proto</a>
-            <ul>
-              
-                <li>
-                  <a href="#.SeasonMetadata"><span class="badge">M</span>SeasonMetadata</a>
-                </li>
-              
-                <li>
-                  <a href="#.SeriesMetadata"><span class="badge">M</span>SeriesMetadata</a>
-                </li>
-              
-              
-              
-              
-            </ul>
-          </li>
-        
-          
-          <li>
-            <a href="#proto%2fVideo.proto">proto/Video.proto</a>
-            <ul>
-              
-                <li>
-                  <a href="#.License"><span class="badge">M</span>License</a>
-                </li>
-              
-                <li>
-                  <a href="#.MediaType"><span class="badge">M</span>MediaType</a>
-                </li>
-              
-                <li>
-                  <a href="#.PublishedBeforeJoystream"><span class="badge">M</span>PublishedBeforeJoystream</a>
-                </li>
-              
-                <li>
-                  <a href="#.VideoCategoryMetadata"><span class="badge">M</span>VideoCategoryMetadata</a>
-                </li>
-              
-                <li>
-                  <a href="#.VideoMetadata"><span class="badge">M</span>VideoMetadata</a>
-                </li>
-              
-              
-              
-              
-            </ul>
-          </li>
-        
-        <li><a href="#scalar-value-types">Scalar Value Types</a></li>
-      </ul>
-    </div>
-
-    
-      
-      <div class="file-heading">
-        <h2 id="proto/Channel.proto">proto/Channel.proto</h2><a href="#title">Top</a>
-      </div>
-      <p></p>
-
-      
-        <h3 id=".ChannelCategoryMetadata">ChannelCategoryMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Category Name </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".ChannelMetadata">ChannelMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>title</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Channel Title </p></td>
-                </tr>
-              
-                <tr>
-                  <td>description</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Channel Description </p></td>
-                </tr>
-              
-                <tr>
-                  <td>is_public</td>
-                  <td><a href="#bool">bool</a></td>
-                  <td>optional</td>
-                  <td><p>Wether to display channel to the public </p></td>
-                </tr>
-              
-                <tr>
-                  <td>language</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>ISO_639-1 Language [Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>cover_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>index into OOB array </p></td>
-                </tr>
-              
-                <tr>
-                  <td>avatar_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>index into OOB array </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-
-      
-
-      
-
-      
-    
-      
-      <div class="file-heading">
-        <h2 id="proto/Person.proto">proto/Person.proto</h2><a href="#title">Top</a>
-      </div>
-      <p></p>
-
-      
-        <h3 id=".PersonMetadata">PersonMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>first_name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>middle_name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>last_name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>about</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>cover_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>index into OOB array </p></td>
-                </tr>
-              
-                <tr>
-                  <td>avatar_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>index into OOB array </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-
-      
-
-      
-
-      
-    
-      
-      <div class="file-heading">
-        <h2 id="proto/Playlist.proto">proto/Playlist.proto</h2><a href="#title">Top</a>
-      </div>
-      <p></p>
-
-      
-        <h3 id=".PlaylistMetadata">PlaylistMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>title</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-
-      
-
-      
-
-      
-    
-      
-      <div class="file-heading">
-        <h2 id="proto/Series.proto">proto/Series.proto</h2><a href="#title">Top</a>
-      </div>
-      <p></p>
-
-      
-        <h3 id=".SeasonMetadata">SeasonMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>title</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>description</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".SeriesMetadata">SeriesMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>title</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>description</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p> </p></td>
-                </tr>
-              
-                <tr>
-                  <td>cover_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>index into OOB array </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-
-      
-
-      
-
-      
-    
-      
-      <div class="file-heading">
-        <h2 id="proto/Video.proto">proto/Video.proto</h2><a href="#title">Top</a>
-      </div>
-      <p></p>
-
-      
-        <h3 id=".License">License</h3>
-        <p>License types defined by Joystream</p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>code</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>License code defined by Joystream. [reference](../src/KnownLicenses.json) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>attribution</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Text for licenses that require an attribution </p></td>
-                </tr>
-              
-                <tr>
-                  <td>custom_text</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Text for custom license type </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".MediaType">MediaType</h3>
-        <p>Codec, Container, MIME media-type information</p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>codec_name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Codec corresponding to `name` field from [FFmpeg](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/codec_desc.c) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>container</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Video container format, eg. &#39;MP4&#39;, &#39;WebM&#39;, &#39;Ogg&#39; [ref](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>mime_media_type</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>MIME Media Type, eg. &#39;video/mp4&#39; [ref](https://www.iana.org/assignments/media-types/media-types.xhtml#video) </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".PublishedBeforeJoystream">PublishedBeforeJoystream</h3>
-        <p>Publication status before joystream</p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>is_published</td>
-                  <td><a href="#bool">bool</a></td>
-                  <td>optional</td>
-                  <td><p>Was video published before joystream platform </p></td>
-                </tr>
-              
-                <tr>
-                  <td>timestamp</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Unix timestamp in milli-seconds </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".VideoCategoryMetadata">VideoCategoryMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>name</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Category name </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-        <h3 id=".VideoMetadata">VideoMetadata</h3>
-        <p></p>
-
-        
-          <table class="field-table">
-            <thead>
-              <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
-            </thead>
-            <tbody>
-              
-                <tr>
-                  <td>title</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Video Title </p></td>
-                </tr>
-              
-                <tr>
-                  <td>description</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>Video Description </p></td>
-                </tr>
-              
-                <tr>
-                  <td>video</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Index into OOB array </p></td>
-                </tr>
-              
-                <tr>
-                  <td>thumbnail_photo</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Index into OOB array </p></td>
-                </tr>
-              
-                <tr>
-                  <td>duration</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Lengths of video in seconds </p></td>
-                </tr>
-              
-                <tr>
-                  <td>media_pixel_height</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Resolution of the video (Height) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>media_pixel_width</td>
-                  <td><a href="#uint32">uint32</a></td>
-                  <td>optional</td>
-                  <td><p>Resolution of the video (Width) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>media_type</td>
-                  <td><a href="#MediaType">MediaType</a></td>
-                  <td>optional</td>
-                  <td><p>Encoding and Container format used </p></td>
-                </tr>
-              
-                <tr>
-                  <td>language</td>
-                  <td><a href="#string">string</a></td>
-                  <td>optional</td>
-                  <td><p>ISO_639-1 Language [Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) </p></td>
-                </tr>
-              
-                <tr>
-                  <td>license</td>
-                  <td><a href="#License">License</a></td>
-                  <td>optional</td>
-                  <td><p>License type for the media </p></td>
-                </tr>
-              
-                <tr>
-                  <td>published_before_joystream</td>
-                  <td><a href="#PublishedBeforeJoystream">PublishedBeforeJoystream</a></td>
-                  <td>optional</td>
-                  <td><p>Date of publication </p></td>
-                </tr>
-              
-                <tr>
-                  <td>has_marketing</td>
-                  <td><a href="#bool">bool</a></td>
-                  <td>optional</td>
-                  <td><p>Does video have marketing or advertising in the stream </p></td>
-                </tr>
-              
-                <tr>
-                  <td>is_public</td>
-                  <td><a href="#bool">bool</a></td>
-                  <td>optional</td>
-                  <td><p>Should video be publicy visible yet </p></td>
-                </tr>
-              
-                <tr>
-                  <td>is_explicit</td>
-                  <td><a href="#bool">bool</a></td>
-                  <td>optional</td>
-                  <td><p>Does Video have explicit language or scenes </p></td>
-                </tr>
-              
-            </tbody>
-          </table>
-
-          
-
-        
-      
-
-      
-
-      
-
-      
-    
-
-    <h2 id="scalar-value-types">Scalar Value Types</h2>
-    <table class="scalar-value-types-table">
-      <thead>
-        <tr><td>.proto Type</td><td>Notes</td><td>C++</td><td>Java</td><td>Python</td><td>Go</td><td>C#</td><td>PHP</td><td>Ruby</td></tr>
-      </thead>
-      <tbody>
-        
-          <tr id="double">
-            <td>double</td>
-            <td></td>
-            <td>double</td>
-            <td>double</td>
-            <td>float</td>
-            <td>float64</td>
-            <td>double</td>
-            <td>float</td>
-            <td>Float</td>
-          </tr>
-        
-          <tr id="float">
-            <td>float</td>
-            <td></td>
-            <td>float</td>
-            <td>float</td>
-            <td>float</td>
-            <td>float32</td>
-            <td>float</td>
-            <td>float</td>
-            <td>Float</td>
-          </tr>
-        
-          <tr id="int32">
-            <td>int32</td>
-            <td>Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>int</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>integer</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="int64">
-            <td>int64</td>
-            <td>Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>int/long</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>integer/string</td>
-            <td>Bignum</td>
-          </tr>
-        
-          <tr id="uint32">
-            <td>uint32</td>
-            <td>Uses variable-length encoding.</td>
-            <td>uint32</td>
-            <td>int</td>
-            <td>int/long</td>
-            <td>uint32</td>
-            <td>uint</td>
-            <td>integer</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="uint64">
-            <td>uint64</td>
-            <td>Uses variable-length encoding.</td>
-            <td>uint64</td>
-            <td>long</td>
-            <td>int/long</td>
-            <td>uint64</td>
-            <td>ulong</td>
-            <td>integer/string</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="sint32">
-            <td>sint32</td>
-            <td>Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>int</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>integer</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="sint64">
-            <td>sint64</td>
-            <td>Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>int/long</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>integer/string</td>
-            <td>Bignum</td>
-          </tr>
-        
-          <tr id="fixed32">
-            <td>fixed32</td>
-            <td>Always four bytes. More efficient than uint32 if values are often greater than 2^28.</td>
-            <td>uint32</td>
-            <td>int</td>
-            <td>int</td>
-            <td>uint32</td>
-            <td>uint</td>
-            <td>integer</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="fixed64">
-            <td>fixed64</td>
-            <td>Always eight bytes. More efficient than uint64 if values are often greater than 2^56.</td>
-            <td>uint64</td>
-            <td>long</td>
-            <td>int/long</td>
-            <td>uint64</td>
-            <td>ulong</td>
-            <td>integer/string</td>
-            <td>Bignum</td>
-          </tr>
-        
-          <tr id="sfixed32">
-            <td>sfixed32</td>
-            <td>Always four bytes.</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>int</td>
-            <td>int32</td>
-            <td>int</td>
-            <td>integer</td>
-            <td>Bignum or Fixnum (as required)</td>
-          </tr>
-        
-          <tr id="sfixed64">
-            <td>sfixed64</td>
-            <td>Always eight bytes.</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>int/long</td>
-            <td>int64</td>
-            <td>long</td>
-            <td>integer/string</td>
-            <td>Bignum</td>
-          </tr>
-        
-          <tr id="bool">
-            <td>bool</td>
-            <td></td>
-            <td>bool</td>
-            <td>boolean</td>
-            <td>boolean</td>
-            <td>bool</td>
-            <td>bool</td>
-            <td>boolean</td>
-            <td>TrueClass/FalseClass</td>
-          </tr>
-        
-          <tr id="string">
-            <td>string</td>
-            <td>A string must always contain UTF-8 encoded or 7-bit ASCII text.</td>
-            <td>string</td>
-            <td>String</td>
-            <td>str/unicode</td>
-            <td>string</td>
-            <td>string</td>
-            <td>string</td>
-            <td>String (UTF-8)</td>
-          </tr>
-        
-          <tr id="bytes">
-            <td>bytes</td>
-            <td>May contain any arbitrary sequence of bytes.</td>
-            <td>string</td>
-            <td>ByteString</td>
-            <td>str</td>
-            <td>[]byte</td>
-            <td>ByteString</td>
-            <td>string</td>
-            <td>String (ASCII-8BIT)</td>
-          </tr>
-        
-      </tbody>
-    </table>
-  </body>
-</html>
-

+ 50 - 8
content-metadata-protobuf/doc/index.md

@@ -62,8 +62,8 @@
 | description | [string](#string) | optional | Channel Description |
 | is_public | [bool](#bool) | optional | Wether to display channel to the public |
 | language | [string](#string) | optional | ISO_639-1 Language [Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) |
-| cover_photo | [uint32](#uint32) | optional | index into OOB array |
-| avatar_photo | [uint32](#uint32) | optional | index into OOB array |
+| cover_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
+| avatar_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
 
 
 
@@ -98,8 +98,8 @@
 | middle_name | [string](#string) | optional |  |
 | last_name | [string](#string) | optional |  |
 | about | [string](#string) | optional |  |
-| cover_photo | [uint32](#uint32) | optional | index into OOB array |
-| avatar_photo | [uint32](#uint32) | optional | index into OOB array |
+| cover_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
+| avatar_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
 
 
 
@@ -163,6 +163,7 @@
 | ----- | ---- | ----- | ----------- |
 | title | [string](#string) | optional |  |
 | description | [string](#string) | optional |  |
+| cover_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
 
 
 
@@ -179,7 +180,7 @@
 | ----- | ---- | ----- | ----------- |
 | title | [string](#string) | optional |  |
 | description | [string](#string) | optional |  |
-| cover_photo | [uint32](#uint32) | optional | index into OOB array |
+| cover_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
 
 
 
@@ -245,7 +246,7 @@ Publication status before joystream
 | Field | Type | Label | Description |
 | ----- | ---- | ----- | ----------- |
 | is_published | [bool](#bool) | optional | Was video published before joystream platform |
-| timestamp | [uint32](#uint32) | optional | Unix timestamp in milli-seconds |
+| date | [string](#string) | optional | Date of publication: &#39;YYYY-MM-DD&#39; [ISO-8601](https://www.iso.org/iso-8601-date-and-time-format.html) |
 
 
 
@@ -277,8 +278,8 @@ Publication status before joystream
 | ----- | ---- | ----- | ----------- |
 | title | [string](#string) | optional | Video Title |
 | description | [string](#string) | optional | Video Description |
-| video | [uint32](#uint32) | optional | Index into OOB array |
-| thumbnail_photo | [uint32](#uint32) | optional | Index into OOB array |
+| video | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
+| thumbnail_photo | [uint32](#uint32) | optional | index into external [assets array](#.Assets) |
 | duration | [uint32](#uint32) | optional | Lengths of video in seconds |
 | media_pixel_height | [uint32](#uint32) | optional | Resolution of the video (Height) |
 | media_pixel_width | [uint32](#uint32) | optional | Resolution of the video (Width) |
@@ -324,3 +325,44 @@ Publication status before joystream
 | <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
 | <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |
 
+<!-- 
+    This extra documentation will be appended to the generated docs.
+-->
+
+## Referencing Assets
+<a name=".Assets"></a>
+
+Applications that process messages that contain a `uint32` field that references an asset such as a cover photo or video, should interpret this value as a zero based index into an array/vector that is received external (out of band) to the protobuf message.
+
+Example in context of query-node processing the runtime event `VideoCreated`
+
+```rust
+// Runtime event associated with creating a Video
+VideoCreated(video_id: VideoId, video: Video, assets: Vec<NewAsset>, params: VideoCreationParameters)
+
+struct VideoCreationParameters {
+  in_category: VideoCategoryId,
+  // binary serialized VideoMetadata protobuf message
+  meta: Vec<u8>,
+}
+
+// suppose assets is a vector of two elements. Thi is the "out of band" array being referenced by the VideoMetadata message
+assets = [
+    NewAsset::Uri("https://mydomain.net/thumbnail.png"),
+    NewAsset::Upload({
+       content_id,
+       ipfs_hash,
+       size,
+       ...
+    }),
+];
+
+metat = VideoMetadata {
+    ...
+    // refers to second element: assets[1] which is being uploaded to the storage system
+    video: 1,
+    // refers to the first element assets[0] which is being referneced by a url string.
+    thumbnail_photo: 0,
+    ...
+};
+```

+ 4 - 1
content-metadata-protobuf/generate-md-doc.sh

@@ -7,4 +7,7 @@ mkdir -p ${OUT_DIR_DOC}
 # Gernerate Markdown docs
 protoc \
     --doc_out="${OUT_DIR_DOC}" --doc_opt=markdown,index.md \
-    proto/*.proto
+    proto/*.proto
+
+# Append some custom docs to generated protocol docs
+cat doc-appendix.md >> ${OUT_DIR_DOC}/index.md

+ 2 - 2
content-metadata-protobuf/proto/Channel.proto

@@ -13,9 +13,9 @@ message ChannelMetadata {
     // ISO_639-1 Language [Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
     optional string language = 4;
 
-    // index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 cover_photo = 5;
-    // index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 avatar_photo  = 6;
 }
 

+ 2 - 2
content-metadata-protobuf/proto/Person.proto

@@ -6,8 +6,8 @@ message PersonMetadata {
     optional string last_name = 3;
     optional string about = 4;
     
-    // index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 cover_photo = 5;
-    // index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 avatar_photo = 6;
 }

+ 3 - 1
content-metadata-protobuf/proto/Series.proto

@@ -3,11 +3,13 @@ syntax = "proto2";
 message SeriesMetadata {
     optional string title = 1;
     optional string description = 2;
-    // index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 cover_photo = 3;
 }
 
 message SeasonMetadata {
     optional string title = 1;
     optional string description = 2; 
+    // index into external [assets array](#.Assets)
+    optional uint32 cover_photo = 3;
 }

+ 4 - 4
content-metadata-protobuf/proto/Video.proto

@@ -4,8 +4,8 @@ syntax = "proto2";
 message PublishedBeforeJoystream {
     // Was video published before joystream platform
     optional bool is_published = 1;
-    // Unix timestamp in milli-seconds
-    optional uint32 timestamp = 2;
+    // Date of publication: 'YYYY-MM-DD' [ISO-8601](https://www.iso.org/iso-8601-date-and-time-format.html)
+    optional string date = 2;
 }
 
 // License types defined by Joystream
@@ -39,10 +39,10 @@ message VideoMetadata {
 
     // Assets
     
-    // Index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 video = 3;
 
-    // Index into OOB array
+    // index into external [assets array](#.Assets)
     optional uint32 thumbnail_photo = 4;
 
     // Lengths of video in seconds

+ 4 - 4
content-metadata-protobuf/test/video.ts

@@ -41,7 +41,7 @@ describe('Video Metadata', () => {
         attribution: undefined,
         customText: undefined,
       },
-      publishedBeforeJoystream: { isPublished: undefined, timestamp: undefined },
+      publishedBeforeJoystream: { isPublished: undefined, date: undefined },
       hasMarketing: true,
       isPublic: true,
       isExplicit: false,
@@ -60,9 +60,9 @@ describe('Video Metadata', () => {
 
     const published = new PublishedBeforeJoystream()
     const isPublished = true
-    const timestamp = 10000
+    const date = '1950-12-24'
     published.setIsPublished(isPublished)
-    published.setTimestamp(timestamp)
+    published.setDate(date)
 
     meta.setPublishedBeforeJoystream(published)
 
@@ -71,7 +71,7 @@ describe('Video Metadata', () => {
 
     assert.deepEqual(published.toObject(), {
       isPublished,
-      timestamp,
+      date,
     })
   })