@redseat/api 0.1.2 → 0.1.4
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 +2 -0
- package/dist/client.js +2 -1
- package/dist/library.d.ts +13 -0
- package/dist/library.js +78 -16
- package/libraries.md +1939 -1709
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ export interface ClientOptions {
|
|
|
6
6
|
getIdToken: () => Promise<string>;
|
|
7
7
|
refreshThreshold?: number;
|
|
8
8
|
timeout?: number;
|
|
9
|
+
redseatUrl?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare class RedseatClient {
|
|
11
12
|
private readonly axios;
|
|
12
13
|
private readonly server;
|
|
14
|
+
private readonly redseatUrl?;
|
|
13
15
|
private readonly getIdToken;
|
|
14
16
|
private readonly refreshThreshold;
|
|
15
17
|
private baseUrl;
|
package/dist/client.js
CHANGED
|
@@ -3,6 +3,7 @@ import { fetchServerToken } from './auth.js';
|
|
|
3
3
|
export class RedseatClient {
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.server = options.server;
|
|
6
|
+
this.redseatUrl = options.redseatUrl;
|
|
6
7
|
this.getIdToken = options.getIdToken;
|
|
7
8
|
this.refreshThreshold = options.refreshThreshold ?? 5 * 60 * 1000; // 5 minutes default
|
|
8
9
|
// Initialize with regular URL, will be updated after local detection
|
|
@@ -102,7 +103,7 @@ export class RedseatClient {
|
|
|
102
103
|
const idToken = await this.getIdToken();
|
|
103
104
|
// Use fetchServerToken which uses the global axios instance
|
|
104
105
|
// The token endpoint is on the frontend server, not the backend server
|
|
105
|
-
const newToken = await fetchServerToken(this.serverId, idToken);
|
|
106
|
+
const newToken = await fetchServerToken(this.serverId, idToken, this.redseatUrl);
|
|
106
107
|
this.tokenData = newToken;
|
|
107
108
|
return newToken;
|
|
108
109
|
}
|
package/dist/library.d.ts
CHANGED
|
@@ -99,6 +99,19 @@ export declare class LibraryApi {
|
|
|
99
99
|
sort?: RsSort;
|
|
100
100
|
order?: SqlOrder;
|
|
101
101
|
}): Promise<ISerie[]>;
|
|
102
|
+
getEpisodes(query?: {
|
|
103
|
+
serieRef?: string;
|
|
104
|
+
season?: number;
|
|
105
|
+
notSeasons?: number[];
|
|
106
|
+
after?: number;
|
|
107
|
+
airedBefore?: number;
|
|
108
|
+
airedAfter?: number;
|
|
109
|
+
sorts?: {
|
|
110
|
+
sort: RsSort;
|
|
111
|
+
order: SqlOrder;
|
|
112
|
+
}[];
|
|
113
|
+
limit?: number;
|
|
114
|
+
}): Promise<IEpisode[]>;
|
|
102
115
|
getMovies(query?: {
|
|
103
116
|
after?: number;
|
|
104
117
|
inDigital?: boolean;
|
package/dist/library.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deriveKey, encryptText as encryptTextUtil, decryptText as decryptTextUtil, encryptBuffer, decryptBuffer, encryptFile as encryptFileUtil, decryptFile as decryptFileUtil, decryptFileThumb, encryptFilename as encryptFilenameUtil, getRandomIV as getRandomIVUtil
|
|
1
|
+
import { deriveKey, encryptText as encryptTextUtil, decryptText as decryptTextUtil, encryptBuffer, decryptBuffer, encryptFile as encryptFileUtil, decryptFile as decryptFileUtil, decryptFileThumb, encryptFilename as encryptFilenameUtil, getRandomIV as getRandomIVUtil } from './encryption.js';
|
|
2
2
|
import { uint8ArrayFromBase64 } from './crypto.js';
|
|
3
3
|
export class LibraryApi {
|
|
4
4
|
constructor(client, libraryId, library) {
|
|
@@ -118,6 +118,37 @@ export class LibraryApi {
|
|
|
118
118
|
const res = await this.client.get(this.getUrl('/series'), { params });
|
|
119
119
|
return res.data;
|
|
120
120
|
}
|
|
121
|
+
async getEpisodes(query) {
|
|
122
|
+
const params = {};
|
|
123
|
+
if (query) {
|
|
124
|
+
if (query.serieRef !== undefined) {
|
|
125
|
+
params.serieRef = query.serieRef;
|
|
126
|
+
}
|
|
127
|
+
if (query.season !== undefined) {
|
|
128
|
+
params.season = query.season;
|
|
129
|
+
}
|
|
130
|
+
if (query.notSeasons !== undefined && query.notSeasons.length > 0) {
|
|
131
|
+
params.notSeasons = query.notSeasons;
|
|
132
|
+
}
|
|
133
|
+
if (query.after !== undefined) {
|
|
134
|
+
params.after = query.after;
|
|
135
|
+
}
|
|
136
|
+
if (query.airedBefore !== undefined) {
|
|
137
|
+
params.airedBefore = query.airedBefore;
|
|
138
|
+
}
|
|
139
|
+
if (query.airedAfter !== undefined) {
|
|
140
|
+
params.airedAfter = query.airedAfter;
|
|
141
|
+
}
|
|
142
|
+
if (query.sorts !== undefined && query.sorts.length > 0) {
|
|
143
|
+
params.sorts = query.sorts;
|
|
144
|
+
}
|
|
145
|
+
if (query.limit !== undefined) {
|
|
146
|
+
params.limit = query.limit;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const res = await this.client.get(this.getUrl('/episodes'), { params });
|
|
150
|
+
return res.data;
|
|
151
|
+
}
|
|
121
152
|
async getMovies(query) {
|
|
122
153
|
const params = {};
|
|
123
154
|
if (query) {
|
|
@@ -186,7 +217,9 @@ export class LibraryApi {
|
|
|
186
217
|
return res.data;
|
|
187
218
|
}
|
|
188
219
|
async tagMerge(fromId, intoId) {
|
|
189
|
-
const res = await this.client.patch(this.getUrl(`/tags/${fromId}/merge`), {
|
|
220
|
+
const res = await this.client.patch(this.getUrl(`/tags/${fromId}/merge`), {
|
|
221
|
+
into: intoId
|
|
222
|
+
});
|
|
190
223
|
return res.data;
|
|
191
224
|
}
|
|
192
225
|
async tagAddAlt(tagId, alt) {
|
|
@@ -201,7 +234,10 @@ export class LibraryApi {
|
|
|
201
234
|
await this.client.put(this.getUrl('/medias/transfert'), formData);
|
|
202
235
|
}
|
|
203
236
|
async mediaTransferMany(medias, deleteOriginal, toLibraryId) {
|
|
204
|
-
await this.client.post(this.getUrl(`/medias/transfert/${toLibraryId}`), {
|
|
237
|
+
await this.client.post(this.getUrl(`/medias/transfert/${toLibraryId}`), {
|
|
238
|
+
ids: medias,
|
|
239
|
+
deleteOriginal
|
|
240
|
+
});
|
|
205
241
|
}
|
|
206
242
|
async mediaTransferSingle(mediaId, toLibraryId, formData, params) {
|
|
207
243
|
const queryParams = {};
|
|
@@ -210,7 +246,9 @@ export class LibraryApi {
|
|
|
210
246
|
queryParams[key] = value;
|
|
211
247
|
}
|
|
212
248
|
}
|
|
213
|
-
await this.client.put(this.getUrl(`/medias/${mediaId}/transfert/${toLibraryId}`), formData, {
|
|
249
|
+
await this.client.put(this.getUrl(`/medias/${mediaId}/transfert/${toLibraryId}`), formData, {
|
|
250
|
+
params: queryParams
|
|
251
|
+
});
|
|
214
252
|
}
|
|
215
253
|
async removeMedias(mediaIds) {
|
|
216
254
|
await this.client.delete(this.getUrl('/medias'), { data: { ids: mediaIds } });
|
|
@@ -300,7 +338,9 @@ export class LibraryApi {
|
|
|
300
338
|
return res.data;
|
|
301
339
|
}
|
|
302
340
|
async movieRename(movieId, newName) {
|
|
303
|
-
const res = await this.client.patch(this.getUrl(`/movies/${movieId}`), {
|
|
341
|
+
const res = await this.client.patch(this.getUrl(`/movies/${movieId}`), {
|
|
342
|
+
name: newName
|
|
343
|
+
});
|
|
304
344
|
return res.data;
|
|
305
345
|
}
|
|
306
346
|
async updateMoviePoster(movieId, poster, type) {
|
|
@@ -324,7 +364,9 @@ export class LibraryApi {
|
|
|
324
364
|
return res.data;
|
|
325
365
|
}
|
|
326
366
|
async personRename(personId, newName) {
|
|
327
|
-
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
367
|
+
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
368
|
+
name: newName
|
|
369
|
+
});
|
|
328
370
|
return res.data;
|
|
329
371
|
}
|
|
330
372
|
async personUpdate(personId, updates) {
|
|
@@ -332,31 +374,45 @@ export class LibraryApi {
|
|
|
332
374
|
return res.data;
|
|
333
375
|
}
|
|
334
376
|
async personAddAlt(personId, alt) {
|
|
335
|
-
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
377
|
+
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
378
|
+
addAlts: [alt]
|
|
379
|
+
});
|
|
336
380
|
return res.data;
|
|
337
381
|
}
|
|
338
382
|
async personRemoveAlt(personId, alt) {
|
|
339
|
-
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
383
|
+
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
384
|
+
removeAlts: [alt]
|
|
385
|
+
});
|
|
340
386
|
return res.data;
|
|
341
387
|
}
|
|
342
388
|
async personAddSocial(personId, social) {
|
|
343
|
-
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
389
|
+
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
390
|
+
addSocials: [social]
|
|
391
|
+
});
|
|
344
392
|
return res.data;
|
|
345
393
|
}
|
|
346
394
|
async personRemoveSocial(personId, social) {
|
|
347
|
-
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
395
|
+
const res = await this.client.patch(this.getUrl(`/people/${personId}`), {
|
|
396
|
+
removeSocials: [social]
|
|
397
|
+
});
|
|
348
398
|
return res.data;
|
|
349
399
|
}
|
|
350
400
|
async serieRename(serieId, newName) {
|
|
351
|
-
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
401
|
+
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
402
|
+
name: newName
|
|
403
|
+
});
|
|
352
404
|
return res.data;
|
|
353
405
|
}
|
|
354
406
|
async serieAddAlt(serieId, alt) {
|
|
355
|
-
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
407
|
+
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
408
|
+
addAlts: [alt]
|
|
409
|
+
});
|
|
356
410
|
return res.data;
|
|
357
411
|
}
|
|
358
412
|
async serieRemoveAlt(serieId, alt) {
|
|
359
|
-
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
413
|
+
const res = await this.client.patch(this.getUrl(`/series/${serieId}`), {
|
|
414
|
+
removeAlts: [alt]
|
|
415
|
+
});
|
|
360
416
|
return res.data;
|
|
361
417
|
}
|
|
362
418
|
async updatePersonPortrait(personId, portrait) {
|
|
@@ -376,7 +432,9 @@ export class LibraryApi {
|
|
|
376
432
|
queryParams[key] = value;
|
|
377
433
|
}
|
|
378
434
|
}
|
|
379
|
-
const res = await this.client.get(this.getUrl('/people/faces/unassigned'), {
|
|
435
|
+
const res = await this.client.get(this.getUrl('/people/faces/unassigned'), {
|
|
436
|
+
params: queryParams
|
|
437
|
+
});
|
|
380
438
|
return res.data;
|
|
381
439
|
}
|
|
382
440
|
async getClusters() {
|
|
@@ -447,11 +505,15 @@ export class LibraryApi {
|
|
|
447
505
|
return res.data;
|
|
448
506
|
}
|
|
449
507
|
async splitZip(mediaId, from, to) {
|
|
450
|
-
const res = await this.client.get(this.getUrl(`/medias/${mediaId}/split`), {
|
|
508
|
+
const res = await this.client.get(this.getUrl(`/medias/${mediaId}/split`), {
|
|
509
|
+
params: { from, to }
|
|
510
|
+
});
|
|
451
511
|
return res.data;
|
|
452
512
|
}
|
|
453
513
|
async deleteFromZip(mediaId, pages) {
|
|
454
|
-
const res = await this.client.get(this.getUrl(`/medias/${mediaId}/split`), {
|
|
514
|
+
const res = await this.client.get(this.getUrl(`/medias/${mediaId}/split`), {
|
|
515
|
+
params: { exclude: pages.join(','), replace: 'true' }
|
|
516
|
+
});
|
|
455
517
|
return res.data;
|
|
456
518
|
}
|
|
457
519
|
async updateMediaThumb(mediaId, thumb) {
|