@redseat/api 0.1.7 → 0.1.9

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.
@@ -435,3 +435,75 @@ export interface RsDeleted {
435
435
  date: number;
436
436
  type: ElementType;
437
437
  }
438
+ export declare enum RsRequestStatus {
439
+ Unprocessed = "unprocessed",
440
+ Processed = "processed",
441
+ NeedParsing = "needParsing",
442
+ RequireAdd = "requireAdd",
443
+ Intermediate = "intermediate",
444
+ NeedFileSelection = "needFileSelection",
445
+ FinalPrivate = "finalPrivate",
446
+ FinalPublic = "finalPublic"
447
+ }
448
+ export declare enum RsRequestMethod {
449
+ Get = "get",
450
+ Post = "post",
451
+ Patch = "patch",
452
+ Delete = "delete",
453
+ Head = "head"
454
+ }
455
+ export interface RsCookie {
456
+ domain: string;
457
+ httpOnly: boolean;
458
+ path: string;
459
+ secure: boolean;
460
+ expiration?: number;
461
+ name: string;
462
+ value: string;
463
+ }
464
+ export interface RsRequestFiles {
465
+ name: string;
466
+ size: number;
467
+ mime?: string;
468
+ description?: string;
469
+ tags?: string[];
470
+ people?: string[];
471
+ albums?: string[];
472
+ season?: number;
473
+ episode?: number;
474
+ language?: string;
475
+ resolution?: string;
476
+ videoFormat?: string;
477
+ videocodec?: string;
478
+ audio?: string[];
479
+ quality?: number;
480
+ }
481
+ export interface RsRequest {
482
+ uploadId?: string;
483
+ url: string;
484
+ mime?: string;
485
+ size?: number;
486
+ filename?: string;
487
+ status: RsRequestStatus;
488
+ permanent: boolean;
489
+ jsonBody?: any;
490
+ method: RsRequestMethod;
491
+ referer?: string;
492
+ headers?: [string, string][];
493
+ cookies?: RsCookie[];
494
+ files?: RsRequestFiles[];
495
+ selectedFile?: string;
496
+ description?: string;
497
+ tags?: string[];
498
+ people?: string[];
499
+ albums?: string[];
500
+ season?: number;
501
+ episode?: number;
502
+ language?: string;
503
+ resolution?: string;
504
+ videoFormat?: string;
505
+ videocodec?: string;
506
+ audio?: string[];
507
+ quality?: number;
508
+ ignoreOriginDuplicate: boolean;
509
+ }
@@ -71,3 +71,22 @@ export var RsSort;
71
71
  RsSort["Name"] = "name";
72
72
  RsSort["Size"] = "size";
73
73
  })(RsSort || (RsSort = {}));
74
+ export var RsRequestStatus;
75
+ (function (RsRequestStatus) {
76
+ RsRequestStatus["Unprocessed"] = "unprocessed";
77
+ RsRequestStatus["Processed"] = "processed";
78
+ RsRequestStatus["NeedParsing"] = "needParsing";
79
+ RsRequestStatus["RequireAdd"] = "requireAdd";
80
+ RsRequestStatus["Intermediate"] = "intermediate";
81
+ RsRequestStatus["NeedFileSelection"] = "needFileSelection";
82
+ RsRequestStatus["FinalPrivate"] = "finalPrivate";
83
+ RsRequestStatus["FinalPublic"] = "finalPublic";
84
+ })(RsRequestStatus || (RsRequestStatus = {}));
85
+ export var RsRequestMethod;
86
+ (function (RsRequestMethod) {
87
+ RsRequestMethod["Get"] = "get";
88
+ RsRequestMethod["Post"] = "post";
89
+ RsRequestMethod["Patch"] = "patch";
90
+ RsRequestMethod["Delete"] = "delete";
91
+ RsRequestMethod["Head"] = "head";
92
+ })(RsRequestMethod || (RsRequestMethod = {}));
package/dist/library.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia, DeletedQuery, RsDeleted, MovieSort, RsSort, SqlOrder } from './interfaces.js';
1
+ import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia, DeletedQuery, RsDeleted, MovieSort, RsSort, SqlOrder, RsRequest } from './interfaces.js';
2
2
  import { EncryptFileOptions, EncryptedFile } from './encryption.js';
3
3
  export interface MediaForUpdate {
4
4
  name?: string;
@@ -176,6 +176,31 @@ export declare class LibraryApi {
176
176
  updatePersonPortrait(personId: string, portrait: FormData): Promise<void>;
177
177
  searchSeries(name: string): Promise<ISerie[]>;
178
178
  setEpisodeWatched(serieId: string, season: number, number: number, date: number): Promise<void>;
179
+ /**
180
+ * Searches for available media sources for a specific episode.
181
+ * @param serieId - The series identifier
182
+ * @param season - The season number
183
+ * @param episode - The episode number
184
+ * @returns Array of available media requests that can be used to download/stream the episode
185
+ */
186
+ searchEpisodeMedias(serieId: string, season: number, episode: number): Promise<RsRequest[]>;
187
+ /**
188
+ * Adds a searched episode media to the database for download/storage.
189
+ * @param serieId - The series identifier
190
+ * @param season - The season number
191
+ * @param episode - The episode number
192
+ * @param request - The media request to add (typically from searchEpisodeMedias results)
193
+ * @returns The created media file entry
194
+ */
195
+ addSearchedEpisodeMedia(serieId: string, season: number, episode: number, request: RsRequest): Promise<IFile>;
196
+ /**
197
+ * Checks if a request can be made permanent (saved for later use).
198
+ * Tests the availability of the URL and returns a permanent version if valid.
199
+ * @param request - The request to check for permanence
200
+ * @returns The request with `permanent: true` if the URL is valid and can be saved
201
+ * @throws Error if the URL is not available or cannot be made permanent
202
+ */
203
+ checkRequestPermanent(request: RsRequest): Promise<RsRequest>;
179
204
  getUnassignedFaces(params?: Map<string, string>): Promise<any>;
180
205
  getClusters(): Promise<any>;
181
206
  assignFaces(request: any): Promise<any>;
package/dist/library.js CHANGED
@@ -425,6 +425,40 @@ export class LibraryApi {
425
425
  async setEpisodeWatched(serieId, season, number, date) {
426
426
  await this.client.post(this.getUrl(`/series/${serieId}/seasons/${season}/episodes/${number}/watched`), { date });
427
427
  }
428
+ /**
429
+ * Searches for available media sources for a specific episode.
430
+ * @param serieId - The series identifier
431
+ * @param season - The season number
432
+ * @param episode - The episode number
433
+ * @returns Array of available media requests that can be used to download/stream the episode
434
+ */
435
+ async searchEpisodeMedias(serieId, season, episode) {
436
+ const res = await this.client.get(this.getUrl(`/series/${serieId}/seasons/${season}/episodes/${episode}/search`));
437
+ return res.data;
438
+ }
439
+ /**
440
+ * Adds a searched episode media to the database for download/storage.
441
+ * @param serieId - The series identifier
442
+ * @param season - The season number
443
+ * @param episode - The episode number
444
+ * @param request - The media request to add (typically from searchEpisodeMedias results)
445
+ * @returns The created media file entry
446
+ */
447
+ async addSearchedEpisodeMedia(serieId, season, episode, request) {
448
+ const res = await this.client.post(this.getUrl(`/series/${serieId}/seasons/${season}/episodes/${episode}/search`), request);
449
+ return res.data;
450
+ }
451
+ /**
452
+ * Checks if a request can be made permanent (saved for later use).
453
+ * Tests the availability of the URL and returns a permanent version if valid.
454
+ * @param request - The request to check for permanence
455
+ * @returns The request with `permanent: true` if the URL is valid and can be saved
456
+ * @throws Error if the URL is not available or cannot be made permanent
457
+ */
458
+ async checkRequestPermanent(request) {
459
+ const res = await this.client.post(this.getUrl('/plugins/requests/permanent'), request);
460
+ return res.data;
461
+ }
428
462
  async getUnassignedFaces(params) {
429
463
  const queryParams = {};
430
464
  if (params) {