@redseat/api 0.1.11 → 0.1.12
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 +6 -0
- package/dist/client.js +11 -0
- package/dist/interfaces.d.ts +3 -11
- package/dist/interfaces.js +0 -9
- package/dist/library.d.ts +9 -0
- package/dist/library.js +13 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -41,4 +41,10 @@ export declare class RedseatClient {
|
|
|
41
41
|
* @returns The full absolute URL
|
|
42
42
|
*/
|
|
43
43
|
getFullUrl(path: string, params?: Record<string, string>): string;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the current auth token.
|
|
46
|
+
* @returns The current auth token string
|
|
47
|
+
* @throws Error if not authenticated
|
|
48
|
+
*/
|
|
49
|
+
getAuthToken(): string;
|
|
44
50
|
}
|
package/dist/client.js
CHANGED
|
@@ -174,4 +174,15 @@ export class RedseatClient {
|
|
|
174
174
|
}
|
|
175
175
|
return url;
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Gets the current auth token.
|
|
179
|
+
* @returns The current auth token string
|
|
180
|
+
* @throws Error if not authenticated
|
|
181
|
+
*/
|
|
182
|
+
getAuthToken() {
|
|
183
|
+
if (!this.tokenData?.token) {
|
|
184
|
+
throw new Error('Not authenticated. No auth token available.');
|
|
185
|
+
}
|
|
186
|
+
return this.tokenData.token;
|
|
187
|
+
}
|
|
177
188
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -13,14 +13,6 @@ export interface SerieInMedia {
|
|
|
13
13
|
episode?: number;
|
|
14
14
|
episodeTo?: number;
|
|
15
15
|
}
|
|
16
|
-
export declare enum FileType {
|
|
17
|
-
Directory = "Directory",
|
|
18
|
-
Photo = "Photo",
|
|
19
|
-
Video = "Video",
|
|
20
|
-
Archive = "Archive",
|
|
21
|
-
Album = "Album",
|
|
22
|
-
Other = "Other"
|
|
23
|
-
}
|
|
24
16
|
export interface MediaItemReference {
|
|
25
17
|
id: string;
|
|
26
18
|
conf?: number;
|
|
@@ -55,12 +47,12 @@ export interface IFile {
|
|
|
55
47
|
name: string;
|
|
56
48
|
source?: string;
|
|
57
49
|
description?: string;
|
|
58
|
-
type:
|
|
50
|
+
type: FileTypes;
|
|
59
51
|
mimetype: string;
|
|
60
52
|
size?: number;
|
|
61
53
|
params?: any;
|
|
62
|
-
added
|
|
63
|
-
modified
|
|
54
|
+
added: number;
|
|
55
|
+
modified: number;
|
|
64
56
|
created?: number;
|
|
65
57
|
rating?: number;
|
|
66
58
|
avgRating?: number;
|
package/dist/interfaces.js
CHANGED
|
@@ -8,15 +8,6 @@ export var FileTypes;
|
|
|
8
8
|
FileTypes["channel"] = "channel";
|
|
9
9
|
FileTypes["other"] = "other";
|
|
10
10
|
})(FileTypes || (FileTypes = {}));
|
|
11
|
-
export var FileType;
|
|
12
|
-
(function (FileType) {
|
|
13
|
-
FileType["Directory"] = "Directory";
|
|
14
|
-
FileType["Photo"] = "Photo";
|
|
15
|
-
FileType["Video"] = "Video";
|
|
16
|
-
FileType["Archive"] = "Archive";
|
|
17
|
-
FileType["Album"] = "Album";
|
|
18
|
-
FileType["Other"] = "Other";
|
|
19
|
-
})(FileType || (FileType = {}));
|
|
20
11
|
export var LibraryTypes;
|
|
21
12
|
(function (LibraryTypes) {
|
|
22
13
|
LibraryTypes["Photos"] = "photos";
|
package/dist/library.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export interface LibraryHttpClient {
|
|
|
73
73
|
data: T;
|
|
74
74
|
}>;
|
|
75
75
|
getFullUrl(path: string, params?: Record<string, string>): string;
|
|
76
|
+
getAuthToken(): string;
|
|
76
77
|
}
|
|
77
78
|
export declare class LibraryApi {
|
|
78
79
|
private client;
|
|
@@ -230,6 +231,14 @@ export declare class LibraryApi {
|
|
|
230
231
|
* @returns A complete URL with sharetoken that can be used to access the media
|
|
231
232
|
*/
|
|
232
233
|
getMediaShareUrl(mediaId: string): Promise<string>;
|
|
234
|
+
/**
|
|
235
|
+
* Get a streaming URL for a media file using the current auth token.
|
|
236
|
+
* This is synchronous and doesn't require an API call, making it suitable for video playback.
|
|
237
|
+
* @param mediaId - The media ID to stream
|
|
238
|
+
* @returns A complete URL with auth token for streaming
|
|
239
|
+
* @throws Error if not authenticated
|
|
240
|
+
*/
|
|
241
|
+
getMediaStreamingUrl(mediaId: string): string;
|
|
233
242
|
getUnassignedFaces(params?: Map<string, string>): Promise<any>;
|
|
234
243
|
getClusters(): Promise<any>;
|
|
235
244
|
assignFaces(request: any): Promise<any>;
|
package/dist/library.js
CHANGED
|
@@ -506,6 +506,19 @@ export class LibraryApi {
|
|
|
506
506
|
sharetoken: shareToken
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* Get a streaming URL for a media file using the current auth token.
|
|
511
|
+
* This is synchronous and doesn't require an API call, making it suitable for video playback.
|
|
512
|
+
* @param mediaId - The media ID to stream
|
|
513
|
+
* @returns A complete URL with auth token for streaming
|
|
514
|
+
* @throws Error if not authenticated
|
|
515
|
+
*/
|
|
516
|
+
getMediaStreamingUrl(mediaId) {
|
|
517
|
+
const token = this.client.getAuthToken();
|
|
518
|
+
return this.client.getFullUrl(this.getUrl(`/medias/${mediaId}`), {
|
|
519
|
+
token
|
|
520
|
+
});
|
|
521
|
+
}
|
|
509
522
|
async getUnassignedFaces(params) {
|
|
510
523
|
const queryParams = {};
|
|
511
524
|
if (params) {
|