user vor 6 Jahren
Ursprung
Commit
139868ad63
8 geänderte Dateien mit 16 neuen und 12 gelöschten Zeilen
  1. 2 1
      lib/content-item.d.ts
  2. 2 1
      lib/content-item.js
  3. 1 1
      lib/content-item.js.map
  4. 1 1
      lib/index.d.ts
  5. 3 3
      lib/index.js
  6. 1 1
      lib/index.js.map
  7. 3 1
      src/content-item.ts
  8. 3 3
      src/index.ts

+ 2 - 1
lib/content-item.d.ts

@@ -3,6 +3,7 @@ import { ContentParams } from "./content-params";
 export declare class ContentItem {
     readonly data: ContentParams;
     readonly hash: string;
+    readonly hashInPlaylist: string;
     readonly type: string;
     readonly date: Date;
     readonly myTagsWithoutAll: string[];
@@ -21,6 +22,6 @@ export declare class ContentItem {
     readonly toContactId?: string;
     readonly media?: string;
     readonly relTarget: any;
-    constructor(hash: string, props: ContentParams);
+    constructor(hashInPlaylist: string, hash: string, props: ContentParams);
     private formatCents;
 }

+ 2 - 1
lib/content-item.js

@@ -1,9 +1,10 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 class ContentItem {
-    constructor(hash, props) {
+    constructor(hashInPlaylist, hash, props) {
         this.data = props;
         this.hash = hash;
+        this.hashInPlaylist = hashInPlaylist;
         this.type = props.type;
         this.title = props.title;
         this.text = props.text;

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
lib/content-item.js.map


+ 1 - 1
lib/index.d.ts

@@ -34,7 +34,7 @@ export declare class BankClient {
     getAllContacts(peerId: string): Promise<ContactItem[]>;
     getContactBook(peerId: string): Promise<ContactBook>;
     updateContact(peerId: string, contactId: string, newProperties: any): Promise<ContactItem>;
-    getContentItemByHash(hash: string): Promise<ContentItem>;
+    getContentItemByHash(hashInPlaylist: string): Promise<ContentItem>;
     getItemsForCommaList(commaList: string): Promise<any[]>;
     parseItemHash(itemHash: string): {
         type: string;

+ 3 - 3
lib/index.js

@@ -297,14 +297,14 @@ class BankClient {
             return (yield contactBook2.lookupById(contactId));
         });
     }
-    getContentItemByHash(hash) {
+    getContentItemByHash(hashInPlaylist) {
         return __awaiter(this, void 0, void 0, function* () {
-            hash = this.parseItemHash(hash).hash;
+            const hash = this.parseItemHash(hashInPlaylist).hash;
             const contentParams = (yield this.webClient.requestJSON({
                 method: 'get',
                 url: this.ipfsUrlBase + '/ipfs/' + hash + '/content.json'
             }));
-            return new content_item_1.ContentItem(hash, contentParams);
+            return new content_item_1.ContentItem(hashInPlaylist, hash, contentParams);
         });
     }
     getItemsForCommaList(commaList) {

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
lib/index.js.map


+ 3 - 1
src/content-item.ts

@@ -5,6 +5,7 @@ export class ContentItem {
 
   public readonly data: ContentParams;
   public readonly hash: string;
+  public readonly hashInPlaylist: string;
   public readonly type: string;
   public readonly date: Date;
   
@@ -26,9 +27,10 @@ export class ContentItem {
   public readonly media?: string;
   public readonly relTarget: any;
   
-  constructor(hash: string, props: ContentParams) {
+  constructor(hashInPlaylist: string, hash: string, props: ContentParams) {
     this.data = props;
     this.hash = hash;
+    this.hashInPlaylist = hashInPlaylist;
     this.type = props.type;
     this.title = props.title;
     this.text = props.text;

+ 3 - 3
src/index.ts

@@ -288,13 +288,13 @@ export class BankClient {
       return (await contactBook2.lookupById(contactId)) as ContactItem;
     }
 
-    public async getContentItemByHash(hash: string): Promise<ContentItem> {
-      hash = this.parseItemHash(hash).hash;
+    public async getContentItemByHash(hashInPlaylist: string): Promise<ContentItem> {
+      const hash = this.parseItemHash(hashInPlaylist).hash;
       const contentParams = (await this.webClient.requestJSON({
         method: 'get',
         url: this.ipfsUrlBase + '/ipfs/' + hash + '/content.json'
       })) as ContentParams;
-      return new ContentItem(hash, contentParams);
+      return new ContentItem(hashInPlaylist, hash, contentParams);
     }
 
     public async getItemsForCommaList(commaList: string): Promise<any[]> {