@redseat/api 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,3 +36,20 @@ export var LinkType;
36
36
  LinkType["post"] = "post";
37
37
  LinkType["other"] = "other";
38
38
  })(LinkType || (LinkType = {}));
39
+ export var ElementType;
40
+ (function (ElementType) {
41
+ ElementType["Tag"] = "tag";
42
+ ElementType["Person"] = "person";
43
+ ElementType["Media"] = "media";
44
+ ElementType["Movie"] = "movie";
45
+ ElementType["Serie"] = "serie";
46
+ ElementType["Episode"] = "episode";
47
+ ElementType["Book"] = "book";
48
+ ElementType["Song"] = "song";
49
+ ElementType["Unknown"] = "unknown";
50
+ })(ElementType || (ElementType = {}));
51
+ export var SqlOrder;
52
+ (function (SqlOrder) {
53
+ SqlOrder["ASC"] = "ASC";
54
+ SqlOrder["DESC"] = "DESC";
55
+ })(SqlOrder || (SqlOrder = {}));
package/dist/library.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia } from './interfaces.js';
1
+ import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia, DeletedQuery, RsDeleted } from './interfaces.js';
2
2
  import { EncryptFileOptions, EncryptedFile } from './encryption.js';
3
3
  export interface MediaForUpdate {
4
4
  name?: string;
@@ -90,6 +90,7 @@ export declare class LibraryApi {
90
90
  countMedias(filter?: MediaRequest): Promise<{
91
91
  count: number;
92
92
  }>;
93
+ getDeleted(query?: DeletedQuery): Promise<RsDeleted[]>;
93
94
  createTag(tag: Partial<ITag>): Promise<ITag>;
94
95
  removeTag(tagId: string): Promise<void>;
95
96
  renameTag(tagId: string, newName: string): Promise<ITag>;
package/dist/library.js CHANGED
@@ -97,6 +97,23 @@ export class LibraryApi {
97
97
  const res = await this.client.get(this.getUrl('/medias/count'), { params });
98
98
  return res.data;
99
99
  }
100
+ async getDeleted(query) {
101
+ const params = {};
102
+ if (query) {
103
+ if (query.after !== undefined) {
104
+ params.after = query.after;
105
+ }
106
+ if (query.kind !== undefined) {
107
+ // Map 'kind' to 'type' for query param (Rust expects 'type' but TypeScript uses 'kind' to avoid reserved keyword)
108
+ params.type = query.kind;
109
+ }
110
+ if (query.order !== undefined) {
111
+ params.order = query.order;
112
+ }
113
+ }
114
+ const res = await this.client.get(this.getUrl('/deleted'), { params });
115
+ return res.data;
116
+ }
100
117
  async createTag(tag) {
101
118
  const res = await this.client.post(this.getUrl('/tags'), tag);
102
119
  return res.data;
@@ -509,7 +526,6 @@ export class LibraryApi {
509
526
  */
510
527
  async uploadMedia(data, options) {
511
528
  // Validate: thumbnails can only be specified for encrypted libraries
512
- console.log('uploadMedia', data.byteLength, options);
513
529
  // Check library configuration
514
530
  if (this.library.crypt === true) {
515
531
  if (!this.key) {
@@ -517,7 +533,6 @@ export class LibraryApi {
517
533
  }
518
534
  }
519
535
  // Normalize inputs to ArrayBuffer
520
- console.log('normalize inputs');
521
536
  let dataBuffer;
522
537
  if (data instanceof Uint8Array) {
523
538
  // Create a new ArrayBuffer and copy the data
@@ -528,7 +543,6 @@ export class LibraryApi {
528
543
  const view = new Uint8Array(data);
529
544
  dataBuffer = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
530
545
  }
531
- console.log('dataBuffer', dataBuffer.byteLength);
532
546
  let fileBlob;
533
547
  let metadata = { ...options.metadata };
534
548
  let filename;
@@ -575,7 +589,6 @@ export class LibraryApi {
575
589
  // No encryption - use original filename
576
590
  filename = options.metadata.name || 'file';
577
591
  fileBlob = new Blob([dataBuffer], { type: options.fileMime });
578
- console.log('fileBlob', fileBlob.size);
579
592
  }
580
593
  // Create FormData
581
594
  const formData = new FormData();
@@ -583,7 +596,6 @@ export class LibraryApi {
583
596
  formData.append('info', JSON.stringify({ ...metadata, size: fileBlob.size }));
584
597
  // File should always be last in the FormData
585
598
  formData.append('file', fileBlob, filename);
586
- console.log('formData');
587
599
  // Send POST request with progress tracking
588
600
  const config = {};
589
601
  if (options.progressCallback) {
@@ -593,9 +605,7 @@ export class LibraryApi {
593
605
  }
594
606
  };
595
607
  }
596
- console.log('postForm');
597
608
  const res = await this.client.postForm(this.getUrl('/medias'), formData, config);
598
- console.log('res', res.data);
599
609
  return res.data;
600
610
  }
601
611
  }