@redseat/api 0.2.4 → 0.2.6

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.
package/dist/client.d.ts CHANGED
@@ -47,4 +47,14 @@ export declare class RedseatClient {
47
47
  * @throws Error if not authenticated
48
48
  */
49
49
  getAuthToken(): string;
50
+ /**
51
+ * Fetches all servers for the authenticated user.
52
+ * Returns IServerPrivate for owned servers, IServer for shared servers.
53
+ */
54
+ getServers(): Promise<IServer[]>;
55
+ /**
56
+ * Fetches a single server by ID.
57
+ * Returns public server info (IServer).
58
+ */
59
+ getServer(serverId: string): Promise<IServer>;
50
60
  }
package/dist/client.js CHANGED
@@ -185,4 +185,32 @@ export class RedseatClient {
185
185
  }
186
186
  return this.tokenData.token;
187
187
  }
188
+ /**
189
+ * Fetches all servers for the authenticated user.
190
+ * Returns IServerPrivate for owned servers, IServer for shared servers.
191
+ */
192
+ async getServers() {
193
+ const idToken = await this.getIdToken();
194
+ const baseUrl = this.redseatUrl ?? 'https://www.redseat.cloud';
195
+ const response = await axios.get(`${baseUrl}/api/servers`, {
196
+ headers: {
197
+ Authorization: `Bearer ${idToken}`
198
+ }
199
+ });
200
+ return response.data;
201
+ }
202
+ /**
203
+ * Fetches a single server by ID.
204
+ * Returns public server info (IServer).
205
+ */
206
+ async getServer(serverId) {
207
+ const idToken = await this.getIdToken();
208
+ const baseUrl = this.redseatUrl ?? 'https://www.redseat.cloud';
209
+ const response = await axios.get(`${baseUrl}/api/servers/${serverId}`, {
210
+ headers: {
211
+ Authorization: `Bearer ${idToken}`
212
+ }
213
+ });
214
+ return response.data;
215
+ }
188
216
  }
@@ -390,11 +390,10 @@ export interface SplitClusterRequest {
390
390
  export interface SplitClusterResponse {
391
391
  newClusters: Cluster[];
392
392
  }
393
- export interface UnassignFaceRequest {
394
- reason?: string;
395
- }
396
393
  export interface UnassignFaceResponse {
397
- unassigned: number;
394
+ status: "unassigned";
395
+ faceIds: string[];
396
+ count: number;
398
397
  }
399
398
  export interface DeleteFaceResponse {
400
399
  deleted: number;
@@ -521,3 +520,39 @@ export interface RsRequest {
521
520
  quality?: number;
522
521
  ignoreOriginDuplicate: boolean;
523
522
  }
523
+ export interface MediaDownloadUrl {
524
+ url: string;
525
+ parse: boolean;
526
+ uploadId?: string;
527
+ ignoreOriginDuplicate?: boolean;
528
+ kind?: FileTypes;
529
+ filename?: string;
530
+ mime?: string;
531
+ description?: string;
532
+ length?: number;
533
+ thumbnailUrl?: string;
534
+ peopleLookup?: string[];
535
+ seriesLookup?: string[];
536
+ tagsLookup?: string[];
537
+ season?: number;
538
+ episode?: number;
539
+ }
540
+ export interface GroupMediaDownload<T> {
541
+ group?: boolean;
542
+ groupThumbnailUrl?: string;
543
+ groupFilename?: string;
544
+ groupMime?: string;
545
+ files: T[];
546
+ referer?: string;
547
+ headers?: string[];
548
+ cookies?: string[];
549
+ originUrl?: string;
550
+ title?: string;
551
+ ignoreOriginDuplicate?: boolean;
552
+ description?: string;
553
+ peopleLookup?: string[];
554
+ seriesLookup?: string[];
555
+ tagsLookup?: string[];
556
+ season?: number;
557
+ episode?: number;
558
+ }
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, RsRequest, DetectedFaceResult } from './interfaces.js';
1
+ import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia, DeletedQuery, RsDeleted, MovieSort, RsSort, SqlOrder, RsRequest, DetectedFaceResult, UnassignFaceResponse, MediaDownloadUrl, GroupMediaDownload } from './interfaces.js';
2
2
  import { EncryptFileOptions, EncryptedFile } from './encryption.js';
3
3
  export interface MediaForUpdate {
4
4
  name?: string;
@@ -245,7 +245,7 @@ export declare class LibraryApi {
245
245
  assignFaces(request: any): Promise<any>;
246
246
  createPersonFromCluster(request: any): Promise<any>;
247
247
  splitCluster(request: any): Promise<any>;
248
- unassignFace(faceIds: string[]): Promise<any>;
248
+ unassignFace(faceIds: string[]): Promise<UnassignFaceResponse>;
249
249
  deleteFace(faceId: string): Promise<any>;
250
250
  getAssignedFaces(personId: string): Promise<any>;
251
251
  faceClusterPerson(personId: string): Promise<void>;
@@ -331,4 +331,21 @@ export declare class LibraryApi {
331
331
  thumbMime?: string;
332
332
  progressCallback?: (loaded: number, total: number) => void;
333
333
  }): Promise<IFile>;
334
+ /**
335
+ * Upload a media from a request (URL-based download)
336
+ * @param request - The request containing URL and metadata for the media to download
337
+ * @returns The created media file entry
338
+ */
339
+ uploadRequest(request: RsRequest): Promise<IFile>;
340
+ /**
341
+ * Upload a group of media files from URLs
342
+ * @param download - The group download request containing multiple URLs and shared metadata
343
+ * @param options - Optional settings (spawn: true to run in background)
344
+ * @returns Array of created media files when spawn=false, or { downloading: true } when spawn=true
345
+ */
346
+ uploadGroup(download: GroupMediaDownload<MediaDownloadUrl>, options?: {
347
+ spawn?: boolean;
348
+ }): Promise<IFile[] | {
349
+ downloading: boolean;
350
+ }>;
334
351
  }
package/dist/library.js CHANGED
@@ -824,4 +824,27 @@ export class LibraryApi {
824
824
  const res = await this.client.postForm(this.getUrl('/medias'), formData, config);
825
825
  return res.data;
826
826
  }
827
+ /**
828
+ * Upload a media from a request (URL-based download)
829
+ * @param request - The request containing URL and metadata for the media to download
830
+ * @returns The created media file entry
831
+ */
832
+ async uploadRequest(request) {
833
+ const res = await this.client.post(this.getUrl('/medias/request'), request);
834
+ return res.data;
835
+ }
836
+ /**
837
+ * Upload a group of media files from URLs
838
+ * @param download - The group download request containing multiple URLs and shared metadata
839
+ * @param options - Optional settings (spawn: true to run in background)
840
+ * @returns Array of created media files when spawn=false, or { downloading: true } when spawn=true
841
+ */
842
+ async uploadGroup(download, options) {
843
+ const params = {};
844
+ if (options?.spawn) {
845
+ params.spawn = 'true';
846
+ }
847
+ const res = await this.client.post(this.getUrl('/medias/download'), download, { params });
848
+ return res.data;
849
+ }
827
850
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseat/api",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "TypeScript API client library for interacting with Redseat servers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",