@redseat/api 0.0.15 → 0.0.17
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/interfaces.d.ts +9 -0
- package/dist/interfaces.js +9 -0
- package/dist/library.d.ts +24 -5
- package/dist/library.js +66 -10
- package/libraries.md +30 -4
- package/package.json +1 -1
package/dist/interfaces.d.ts
CHANGED
|
@@ -324,6 +324,15 @@ export declare enum SqlOrder {
|
|
|
324
324
|
ASC = "ASC",
|
|
325
325
|
DESC = "DESC"
|
|
326
326
|
}
|
|
327
|
+
export declare enum RsSort {
|
|
328
|
+
Modified = "modified",
|
|
329
|
+
Added = "added",
|
|
330
|
+
Created = "created",
|
|
331
|
+
Rating = "rating",
|
|
332
|
+
Name = "name",
|
|
333
|
+
Size = "size"
|
|
334
|
+
}
|
|
335
|
+
export type MovieSort = 'modified' | 'added' | 'created' | 'name' | 'digitalairdate';
|
|
327
336
|
export interface DeletedQuery {
|
|
328
337
|
after?: number;
|
|
329
338
|
kind?: ElementType;
|
package/dist/interfaces.js
CHANGED
|
@@ -53,3 +53,12 @@ export var SqlOrder;
|
|
|
53
53
|
SqlOrder["ASC"] = "ASC";
|
|
54
54
|
SqlOrder["DESC"] = "DESC";
|
|
55
55
|
})(SqlOrder || (SqlOrder = {}));
|
|
56
|
+
export var RsSort;
|
|
57
|
+
(function (RsSort) {
|
|
58
|
+
RsSort["Modified"] = "modified";
|
|
59
|
+
RsSort["Added"] = "added";
|
|
60
|
+
RsSort["Created"] = "created";
|
|
61
|
+
RsSort["Rating"] = "rating";
|
|
62
|
+
RsSort["Name"] = "name";
|
|
63
|
+
RsSort["Size"] = "size";
|
|
64
|
+
})(RsSort || (RsSort = {}));
|
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 } from './interfaces.js';
|
|
1
|
+
import { IFile, ITag, IPerson, ISerie, IMovie, MediaRequest, IEpisode, ExternalImage, IBackupFile, ILibrary, SerieInMedia, DeletedQuery, RsDeleted, MovieSort, RsSort, SqlOrder } from './interfaces.js';
|
|
2
2
|
import { EncryptFileOptions, EncryptedFile } from './encryption.js';
|
|
3
3
|
export interface MediaForUpdate {
|
|
4
4
|
name?: string;
|
|
@@ -82,10 +82,29 @@ export declare class LibraryApi {
|
|
|
82
82
|
constructor(client: LibraryHttpClient, libraryId: string, library: ILibrary);
|
|
83
83
|
setKey(passPhrase: string): Promise<void>;
|
|
84
84
|
private getUrl;
|
|
85
|
-
getTags(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
getTags(query?: {
|
|
86
|
+
name?: string;
|
|
87
|
+
parent?: string;
|
|
88
|
+
path?: string;
|
|
89
|
+
after?: number;
|
|
90
|
+
}): Promise<ITag[]>;
|
|
91
|
+
getPeople(query?: {
|
|
92
|
+
name?: string;
|
|
93
|
+
after?: number;
|
|
94
|
+
}): Promise<IPerson[]>;
|
|
95
|
+
getSeries(query?: {
|
|
96
|
+
after?: number;
|
|
97
|
+
name?: string;
|
|
98
|
+
watched?: boolean;
|
|
99
|
+
sort?: RsSort;
|
|
100
|
+
order?: SqlOrder;
|
|
101
|
+
}): Promise<ISerie[]>;
|
|
102
|
+
getMovies(query?: {
|
|
103
|
+
after?: number;
|
|
104
|
+
inDigital?: boolean;
|
|
105
|
+
watched?: boolean;
|
|
106
|
+
sort?: MovieSort;
|
|
107
|
+
}): Promise<IMovie[]>;
|
|
89
108
|
getMedias(filter?: MediaRequest): Promise<IFile[]>;
|
|
90
109
|
countMedias(filter?: MediaRequest): Promise<{
|
|
91
110
|
count: number;
|
package/dist/library.js
CHANGED
|
@@ -63,22 +63,78 @@ export class LibraryApi {
|
|
|
63
63
|
getUrl(path) {
|
|
64
64
|
return `/libraries/${this.libraryId}${path}`;
|
|
65
65
|
}
|
|
66
|
-
async getTags() {
|
|
67
|
-
const
|
|
66
|
+
async getTags(query) {
|
|
67
|
+
const params = {};
|
|
68
|
+
if (query) {
|
|
69
|
+
if (query.name !== undefined) {
|
|
70
|
+
params.name = query.name;
|
|
71
|
+
}
|
|
72
|
+
if (query.parent !== undefined) {
|
|
73
|
+
params.parent = query.parent;
|
|
74
|
+
}
|
|
75
|
+
if (query.path !== undefined) {
|
|
76
|
+
params.path = query.path;
|
|
77
|
+
}
|
|
78
|
+
if (query.after !== undefined) {
|
|
79
|
+
params.after = query.after;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const res = await this.client.get(this.getUrl('/tags'), { params });
|
|
68
83
|
return res.data;
|
|
69
84
|
}
|
|
70
|
-
async getPeople() {
|
|
71
|
-
const
|
|
85
|
+
async getPeople(query) {
|
|
86
|
+
const params = {};
|
|
87
|
+
if (query) {
|
|
88
|
+
if (query.name !== undefined) {
|
|
89
|
+
params.name = query.name;
|
|
90
|
+
}
|
|
91
|
+
if (query.after !== undefined) {
|
|
92
|
+
params.after = query.after;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const res = await this.client.get(this.getUrl('/people'), { params });
|
|
72
96
|
return res.data;
|
|
73
97
|
}
|
|
74
|
-
async getSeries() {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
async getSeries(query) {
|
|
99
|
+
const params = {};
|
|
100
|
+
if (query) {
|
|
101
|
+
if (query.after !== undefined) {
|
|
102
|
+
params.after = query.after;
|
|
103
|
+
}
|
|
104
|
+
if (query.name !== undefined) {
|
|
105
|
+
params.name = query.name;
|
|
106
|
+
}
|
|
107
|
+
if (query.watched !== undefined) {
|
|
108
|
+
params.watched = query.watched;
|
|
109
|
+
}
|
|
110
|
+
if (query.sort !== undefined) {
|
|
111
|
+
params.sort = query.sort;
|
|
112
|
+
}
|
|
113
|
+
if (query.order !== undefined) {
|
|
114
|
+
params.order = query.order;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Defaults { sort: 'name', order: 'ASC' } have been removed
|
|
118
|
+
const res = await this.client.get(this.getUrl('/series'), { params });
|
|
78
119
|
return res.data;
|
|
79
120
|
}
|
|
80
|
-
async getMovies() {
|
|
81
|
-
const
|
|
121
|
+
async getMovies(query) {
|
|
122
|
+
const params = {};
|
|
123
|
+
if (query) {
|
|
124
|
+
if (query.after !== undefined) {
|
|
125
|
+
params.after = query.after;
|
|
126
|
+
}
|
|
127
|
+
if (query.inDigital !== undefined) {
|
|
128
|
+
params.inDigital = query.inDigital;
|
|
129
|
+
}
|
|
130
|
+
if (query.watched !== undefined) {
|
|
131
|
+
params.watched = query.watched;
|
|
132
|
+
}
|
|
133
|
+
if (query.sort !== undefined) {
|
|
134
|
+
params.sort = query.sort;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const res = await this.client.get(this.getUrl('/movies'), { params });
|
|
82
138
|
return res.data;
|
|
83
139
|
}
|
|
84
140
|
async getMedias(filter) {
|
package/libraries.md
CHANGED
|
@@ -63,16 +63,30 @@ if (library.crypt) {
|
|
|
63
63
|
|
|
64
64
|
## Tags
|
|
65
65
|
|
|
66
|
-
### `getTags(): Promise<ITag[]>`
|
|
66
|
+
### `getTags(query?: { name?: string; parent?: string; path?: string; after?: number }): Promise<ITag[]>`
|
|
67
67
|
|
|
68
|
-
Retrieves
|
|
68
|
+
Retrieves tags in the library with optional filtering.
|
|
69
|
+
|
|
70
|
+
**Parameters:**
|
|
71
|
+
- `query`: Optional query object with filtering parameters:
|
|
72
|
+
- `name`: Filter tags by name
|
|
73
|
+
- `parent`: Filter tags by parent tag ID
|
|
74
|
+
- `path`: Filter tags by path
|
|
75
|
+
- `after`: Filter tags modified after this timestamp (integer unix milliseconds)
|
|
69
76
|
|
|
70
77
|
**Returns:** Promise resolving to an array of `ITag` objects
|
|
71
78
|
|
|
72
79
|
**Example:**
|
|
73
80
|
```typescript
|
|
81
|
+
// Get all tags
|
|
74
82
|
const tags = await libraryApi.getTags();
|
|
75
83
|
tags.forEach(tag => console.log(tag.name));
|
|
84
|
+
|
|
85
|
+
// Get tags with filters
|
|
86
|
+
const filteredTags = await libraryApi.getTags({
|
|
87
|
+
name: 'Vacation',
|
|
88
|
+
after: Date.now() - 86400000 // Last 24 hours
|
|
89
|
+
});
|
|
76
90
|
```
|
|
77
91
|
|
|
78
92
|
### `createTag(tag: Partial<ITag>): Promise<ITag>`
|
|
@@ -184,15 +198,27 @@ await libraryApi.tagRemoveAlt('tag-id', 'alternative-name');
|
|
|
184
198
|
|
|
185
199
|
## People
|
|
186
200
|
|
|
187
|
-
### `getPeople(): Promise<IPerson[]>`
|
|
201
|
+
### `getPeople(query?: { name?: string; after?: number }): Promise<IPerson[]>`
|
|
188
202
|
|
|
189
|
-
Retrieves
|
|
203
|
+
Retrieves people in the library with optional filtering.
|
|
204
|
+
|
|
205
|
+
**Parameters:**
|
|
206
|
+
- `query`: Optional query object with filtering parameters:
|
|
207
|
+
- `name`: Filter people by name
|
|
208
|
+
- `after`: Filter people modified after this timestamp (integer unix milliseconds)
|
|
190
209
|
|
|
191
210
|
**Returns:** Promise resolving to an array of `IPerson` objects
|
|
192
211
|
|
|
193
212
|
**Example:**
|
|
194
213
|
```typescript
|
|
214
|
+
// Get all people
|
|
195
215
|
const people = await libraryApi.getPeople();
|
|
216
|
+
|
|
217
|
+
// Get people with filters
|
|
218
|
+
const filteredPeople = await libraryApi.getPeople({
|
|
219
|
+
name: 'John',
|
|
220
|
+
after: Date.now() - 86400000 // Last 24 hours
|
|
221
|
+
});
|
|
196
222
|
```
|
|
197
223
|
|
|
198
224
|
### `createPerson(person: Partial<IPerson>): Promise<IPerson>`
|