@redseat/api 0.0.14 → 0.0.16
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 +1 -0
- package/dist/client.js +3 -0
- package/dist/library.d.ts +13 -2
- package/dist/library.js +29 -5
- package/libraries.md +30 -4
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare class RedseatClient {
|
|
|
25
25
|
setToken(token: string | IToken): void;
|
|
26
26
|
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
|
27
27
|
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
|
28
|
+
postForm<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
|
28
29
|
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
|
29
30
|
patch<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
|
30
31
|
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<T, any>>;
|
package/dist/client.js
CHANGED
|
@@ -137,6 +137,9 @@ export class RedseatClient {
|
|
|
137
137
|
async post(url, data, config) {
|
|
138
138
|
return this.axios.post(url, data, config);
|
|
139
139
|
}
|
|
140
|
+
async postForm(url, data, config) {
|
|
141
|
+
return this.axios.postForm(url, data, config);
|
|
142
|
+
}
|
|
140
143
|
async put(url, data, config) {
|
|
141
144
|
return this.axios.put(url, data, config);
|
|
142
145
|
}
|
package/dist/library.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export interface LibraryHttpClient {
|
|
|
60
60
|
post<T = unknown>(url: string, data?: unknown, config?: any): Promise<{
|
|
61
61
|
data: T;
|
|
62
62
|
}>;
|
|
63
|
+
postForm<T = unknown>(url: string, data?: unknown, config?: any): Promise<{
|
|
64
|
+
data: T;
|
|
65
|
+
}>;
|
|
63
66
|
put<T = unknown>(url: string, data?: unknown, config?: any): Promise<{
|
|
64
67
|
data: T;
|
|
65
68
|
}>;
|
|
@@ -79,8 +82,16 @@ export declare class LibraryApi {
|
|
|
79
82
|
constructor(client: LibraryHttpClient, libraryId: string, library: ILibrary);
|
|
80
83
|
setKey(passPhrase: string): Promise<void>;
|
|
81
84
|
private getUrl;
|
|
82
|
-
getTags(
|
|
83
|
-
|
|
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[]>;
|
|
84
95
|
getSeries(): Promise<ISerie[]>;
|
|
85
96
|
getMovies(): Promise<IMovie[]>;
|
|
86
97
|
getMedias(filter?: MediaRequest): Promise<IFile[]>;
|
package/dist/library.js
CHANGED
|
@@ -63,12 +63,36 @@ 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
98
|
async getSeries() {
|
|
@@ -605,7 +629,7 @@ export class LibraryApi {
|
|
|
605
629
|
}
|
|
606
630
|
};
|
|
607
631
|
}
|
|
608
|
-
const res = await this.client.
|
|
632
|
+
const res = await this.client.postForm(this.getUrl('/medias'), formData, config);
|
|
609
633
|
return res.data;
|
|
610
634
|
}
|
|
611
635
|
}
|
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>`
|