tsarr 2.9.0 → 2.10.0
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/README.md +7 -5
- package/dist/cli/commands/bazarr.d.ts +2 -0
- package/dist/cli/commands/bazarr.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/lidarr.d.ts +2 -0
- package/dist/cli/commands/lidarr.d.ts.map +1 -1
- package/dist/cli/commands/radarr.d.ts.map +1 -1
- package/dist/cli/commands/readarr.d.ts +2 -0
- package/dist/cli/commands/readarr.d.ts.map +1 -1
- package/dist/cli/commands/sonarr.d.ts.map +1 -1
- package/dist/cli/index.js +2138 -2405
- package/dist/clients/base.d.ts +136 -0
- package/dist/clients/base.d.ts.map +1 -0
- package/dist/clients/bazarr.d.ts +1 -1
- package/dist/clients/bazarr.d.ts.map +1 -1
- package/dist/clients/bazarr.js +100 -3
- package/dist/clients/lidarr.d.ts +24 -681
- package/dist/clients/lidarr.d.ts.map +1 -1
- package/dist/clients/lidarr.js +323 -196
- package/dist/clients/prowlarr.d.ts +25 -638
- package/dist/clients/prowlarr.d.ts.map +1 -1
- package/dist/clients/prowlarr.js +331 -175
- package/dist/clients/qbittorrent.d.ts +1 -17
- package/dist/clients/qbittorrent.d.ts.map +1 -1
- package/dist/clients/qbittorrent.js +97 -2
- package/dist/clients/radarr.d.ts +4 -657
- package/dist/clients/radarr.d.ts.map +1 -1
- package/dist/clients/radarr.js +323 -164
- package/dist/clients/readarr.d.ts +4 -635
- package/dist/clients/readarr.d.ts.map +1 -1
- package/dist/clients/readarr.js +323 -164
- package/dist/clients/seerr.d.ts +1 -1
- package/dist/clients/seerr.d.ts.map +1 -1
- package/dist/clients/seerr.js +100 -3
- package/dist/clients/sonarr.d.ts +181 -772
- package/dist/clients/sonarr.d.ts.map +1 -1
- package/dist/clients/sonarr.js +346 -157
- package/dist/core/client.d.ts +3 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/fetch.d.ts +23 -0
- package/dist/core/fetch.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tsarr-2.10.0.tgz +0 -0
- package/package.json +2 -4
- package/dist/tsarr-2.9.0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prowlarr.d.ts","sourceRoot":"","sources":["../../src/clients/prowlarr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prowlarr.d.ts","sourceRoot":"","sources":["../../src/clients/prowlarr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAmEhC;gBAEU,MAAM,EAAE,mBAAmB;IAQvC;;OAEG;IACG,eAAe;;;;;;;;;;IAMrB;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE;;;;;;;;;;IAWjD;;OAEG;IACG,eAAe;;;;;;;;;;IAIrB;;OAEG;IACG,cAAc,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAI/B;;OAEG;IACG,cAAc,CAAC,WAAW,EAAE,mBAAmB;;;;;;;;;;IAIrD;;OAEG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB;;;;;;;;;;IAIpE;;OAEG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIlC;;OAEG;IACG,eAAe,CAAC,WAAW,EAAE,mBAAmB;;;;;;;;;;IAItD;;OAEG;IACG,mBAAmB;;;;;;;;;;IAIzB;;OAEG;IACG,oBAAoB;;;;;;;;;;IAM1B;;OAEG;IACG,oBAAoB;;;;;;;;;;IAI1B;;OAEG;IACG,wBAAwB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIzC;;OAEG;IACG,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB;;;;;;;;;;IAM3E;;OAEG;IACG,aAAa;;;;;;;;;;CAGpB;AAGD,cAAc,qBAAqB,CAAC"}
|
package/dist/clients/prowlarr.js
CHANGED
|
@@ -26,7 +26,95 @@ class ConnectionError extends TsarrError {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// src/core/fetch.ts
|
|
30
|
+
var DEFAULT_TIMEOUT = 30000;
|
|
31
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
32
|
+
var DEFAULT_INITIAL_DELAY = 1000;
|
|
33
|
+
var DEFAULT_MAX_DELAY = 1e4;
|
|
34
|
+
var RETRYABLE_STATUS_CODES = new Set([408, 429, 502, 503, 504]);
|
|
35
|
+
function isRetryable(error) {
|
|
36
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (error instanceof TypeError) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function getRetryDelay(attempt, initialDelayMs, maxDelayMs) {
|
|
45
|
+
const delay = initialDelayMs * 2 ** attempt;
|
|
46
|
+
const jitter = delay * 0.2 * Math.random();
|
|
47
|
+
return Math.min(delay + jitter, maxDelayMs);
|
|
48
|
+
}
|
|
49
|
+
function createResilientFetch(options = {}) {
|
|
50
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
51
|
+
const maxRetries = options.retry ? options.retry.maxRetries ?? DEFAULT_MAX_RETRIES : 0;
|
|
52
|
+
const initialDelayMs = options.retry?.initialDelayMs ?? DEFAULT_INITIAL_DELAY;
|
|
53
|
+
const maxDelayMs = options.retry?.maxDelayMs ?? DEFAULT_MAX_DELAY;
|
|
54
|
+
const resilientFetch = async (input, init) => {
|
|
55
|
+
let lastError;
|
|
56
|
+
const template = createRequestTemplate(input, init);
|
|
57
|
+
for (let attempt = 0;attempt <= maxRetries; attempt++) {
|
|
58
|
+
const controller = new AbortController;
|
|
59
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
60
|
+
const callerSignal = init?.signal;
|
|
61
|
+
if (callerSignal?.aborted) {
|
|
62
|
+
clearTimeout(timeoutId);
|
|
63
|
+
throw callerSignal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
64
|
+
}
|
|
65
|
+
const onCallerAbort = () => controller.abort(callerSignal.reason);
|
|
66
|
+
callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
67
|
+
try {
|
|
68
|
+
const response = await globalThis.fetch(new Request(template.clone(), { signal: controller.signal }));
|
|
69
|
+
clearTimeout(timeoutId);
|
|
70
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
71
|
+
if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < maxRetries) {
|
|
72
|
+
lastError = new ConnectionError(`Request failed with status ${response.status}`);
|
|
73
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
return response;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
clearTimeout(timeoutId);
|
|
80
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
81
|
+
if (callerSignal?.aborted) {
|
|
82
|
+
throw callerSignal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
83
|
+
}
|
|
84
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
85
|
+
lastError = new ConnectionError(`Request timed out after ${timeout}ms`);
|
|
86
|
+
if (attempt < maxRetries) {
|
|
87
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
88
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
throw lastError;
|
|
92
|
+
}
|
|
93
|
+
if (isRetryable(error) && attempt < maxRetries) {
|
|
94
|
+
lastError = error;
|
|
95
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
96
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
throw lastError;
|
|
103
|
+
};
|
|
104
|
+
return Object.assign(resilientFetch, {
|
|
105
|
+
preconnect: globalThis.fetch.preconnect?.bind(globalThis.fetch)
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function createRequestTemplate(input, init) {
|
|
109
|
+
const { signal: _signal, ...requestInit } = init ?? {};
|
|
110
|
+
if (input instanceof Request) {
|
|
111
|
+
return init ? new Request(input.clone(), requestInit) : input.clone();
|
|
112
|
+
}
|
|
113
|
+
return new Request(input, requestInit);
|
|
114
|
+
}
|
|
115
|
+
|
|
29
116
|
// src/core/client.ts
|
|
117
|
+
var DEFAULT_TIMEOUT_MS = 30000;
|
|
30
118
|
function createServarrClient(config) {
|
|
31
119
|
if (!config.apiKey) {
|
|
32
120
|
throw new ApiKeyError;
|
|
@@ -38,6 +126,11 @@ function createServarrClient(config) {
|
|
|
38
126
|
...config,
|
|
39
127
|
baseUrl: config.baseUrl.replace(/\/$/, "")
|
|
40
128
|
};
|
|
129
|
+
const timeoutMs = validatedConfig.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
130
|
+
const resilientFetch = createResilientFetch({
|
|
131
|
+
timeout: timeoutMs,
|
|
132
|
+
retry: validatedConfig.retry
|
|
133
|
+
});
|
|
41
134
|
return {
|
|
42
135
|
config: validatedConfig,
|
|
43
136
|
getHeaders: () => ({
|
|
@@ -45,10 +138,186 @@ function createServarrClient(config) {
|
|
|
45
138
|
"Content-Type": "application/json",
|
|
46
139
|
...validatedConfig.headers
|
|
47
140
|
}),
|
|
48
|
-
getBaseUrl: () => validatedConfig.baseUrl
|
|
141
|
+
getBaseUrl: () => validatedConfig.baseUrl,
|
|
142
|
+
getTimeout: () => timeoutMs,
|
|
143
|
+
getFetch: () => resilientFetch
|
|
49
144
|
};
|
|
50
145
|
}
|
|
51
146
|
|
|
147
|
+
// src/clients/base.ts
|
|
148
|
+
class ServarrBaseClient {
|
|
149
|
+
clientConfig;
|
|
150
|
+
rawClient;
|
|
151
|
+
constructor(config, rawClient) {
|
|
152
|
+
this.rawClient = rawClient;
|
|
153
|
+
this.clientConfig = createServarrClient(config);
|
|
154
|
+
this.configureRawClient();
|
|
155
|
+
}
|
|
156
|
+
configureRawClient() {
|
|
157
|
+
this.rawClient.setConfig(this.getClientConfig());
|
|
158
|
+
}
|
|
159
|
+
getClientConfig() {
|
|
160
|
+
return {
|
|
161
|
+
baseUrl: this.clientConfig.getBaseUrl(),
|
|
162
|
+
headers: this.clientConfig.getHeaders(),
|
|
163
|
+
fetch: this.clientConfig.getFetch()
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async getSystemStatus() {
|
|
167
|
+
return this.ops.getSystemStatus();
|
|
168
|
+
}
|
|
169
|
+
async getHealth() {
|
|
170
|
+
return this.ops.getHealth();
|
|
171
|
+
}
|
|
172
|
+
async getTags() {
|
|
173
|
+
return this.ops.getTags();
|
|
174
|
+
}
|
|
175
|
+
async addTag(tag) {
|
|
176
|
+
return this.ops.createTag({ body: tag });
|
|
177
|
+
}
|
|
178
|
+
async getTag(id) {
|
|
179
|
+
return this.ops.getTagById({ path: { id } });
|
|
180
|
+
}
|
|
181
|
+
async updateTag(id, tag) {
|
|
182
|
+
return this.ops.updateTagById({ path: { id: String(id) }, body: tag });
|
|
183
|
+
}
|
|
184
|
+
async deleteTag(id) {
|
|
185
|
+
return this.ops.deleteTagById({ path: { id } });
|
|
186
|
+
}
|
|
187
|
+
async getTagDetails() {
|
|
188
|
+
return this.ops.getTagDetails();
|
|
189
|
+
}
|
|
190
|
+
async getTagDetailById(id) {
|
|
191
|
+
return this.ops.getTagDetailById({ path: { id } });
|
|
192
|
+
}
|
|
193
|
+
async getNotifications() {
|
|
194
|
+
return this.ops.getNotifications();
|
|
195
|
+
}
|
|
196
|
+
async getNotification(id) {
|
|
197
|
+
return this.ops.getNotificationById({ path: { id } });
|
|
198
|
+
}
|
|
199
|
+
async addNotification(notification) {
|
|
200
|
+
return this.ops.createNotification({ body: notification });
|
|
201
|
+
}
|
|
202
|
+
async updateNotification(id, notification) {
|
|
203
|
+
return this.ops.updateNotificationById({ path: { id: String(id) }, body: notification });
|
|
204
|
+
}
|
|
205
|
+
async deleteNotification(id) {
|
|
206
|
+
return this.ops.deleteNotificationById({ path: { id } });
|
|
207
|
+
}
|
|
208
|
+
async getNotificationSchema() {
|
|
209
|
+
return this.ops.getNotificationSchema();
|
|
210
|
+
}
|
|
211
|
+
async testNotification(notification) {
|
|
212
|
+
return this.ops.testNotification({ body: notification });
|
|
213
|
+
}
|
|
214
|
+
async testAllNotifications() {
|
|
215
|
+
return this.ops.testAllNotifications();
|
|
216
|
+
}
|
|
217
|
+
async getDownloadClients() {
|
|
218
|
+
return this.ops.getDownloadClients();
|
|
219
|
+
}
|
|
220
|
+
async getDownloadClient(id) {
|
|
221
|
+
return this.ops.getDownloadClientById({ path: { id } });
|
|
222
|
+
}
|
|
223
|
+
async addDownloadClient(client) {
|
|
224
|
+
return this.ops.createDownloadClient({ body: client });
|
|
225
|
+
}
|
|
226
|
+
async updateDownloadClient(id, client) {
|
|
227
|
+
return this.ops.updateDownloadClientById({ path: { id: String(id) }, body: client });
|
|
228
|
+
}
|
|
229
|
+
async deleteDownloadClient(id) {
|
|
230
|
+
return this.ops.deleteDownloadClientById({ path: { id } });
|
|
231
|
+
}
|
|
232
|
+
async getDownloadClientSchema() {
|
|
233
|
+
return this.ops.getDownloadClientSchema();
|
|
234
|
+
}
|
|
235
|
+
async testDownloadClient(client) {
|
|
236
|
+
return this.ops.testDownloadClient({ body: client });
|
|
237
|
+
}
|
|
238
|
+
async testAllDownloadClients() {
|
|
239
|
+
return this.ops.testAllDownloadClients();
|
|
240
|
+
}
|
|
241
|
+
async getIndexers() {
|
|
242
|
+
return this.ops.getIndexers();
|
|
243
|
+
}
|
|
244
|
+
async getIndexer(id) {
|
|
245
|
+
return this.ops.getIndexerById({ path: { id } });
|
|
246
|
+
}
|
|
247
|
+
async addIndexer(indexer) {
|
|
248
|
+
return this.ops.createIndexer({ body: indexer });
|
|
249
|
+
}
|
|
250
|
+
async updateIndexer(id, indexer) {
|
|
251
|
+
return this.ops.updateIndexerById({ path: { id: String(id) }, body: indexer });
|
|
252
|
+
}
|
|
253
|
+
async deleteIndexer(id) {
|
|
254
|
+
return this.ops.deleteIndexerById({ path: { id } });
|
|
255
|
+
}
|
|
256
|
+
async getIndexerSchema() {
|
|
257
|
+
return this.ops.getIndexerSchema();
|
|
258
|
+
}
|
|
259
|
+
async testIndexer(indexer) {
|
|
260
|
+
return this.ops.testIndexer({ body: indexer });
|
|
261
|
+
}
|
|
262
|
+
async testAllIndexers() {
|
|
263
|
+
return this.ops.testAllIndexers();
|
|
264
|
+
}
|
|
265
|
+
async restartSystem() {
|
|
266
|
+
return this.ops.restartSystem();
|
|
267
|
+
}
|
|
268
|
+
async shutdownSystem() {
|
|
269
|
+
return this.ops.shutdownSystem();
|
|
270
|
+
}
|
|
271
|
+
async getSystemBackups() {
|
|
272
|
+
return this.ops.getBackups();
|
|
273
|
+
}
|
|
274
|
+
async deleteSystemBackup(id) {
|
|
275
|
+
return this.ops.deleteBackup({ path: { id } });
|
|
276
|
+
}
|
|
277
|
+
async restoreSystemBackup(id) {
|
|
278
|
+
return this.ops.restoreBackup({ path: { id } });
|
|
279
|
+
}
|
|
280
|
+
async uploadSystemBackup() {
|
|
281
|
+
return this.ops.uploadBackup();
|
|
282
|
+
}
|
|
283
|
+
async getLogFiles() {
|
|
284
|
+
return this.ops.getLogFiles();
|
|
285
|
+
}
|
|
286
|
+
async getLogFileByName(filename) {
|
|
287
|
+
return this.ops.getLogFileByName({ path: { filename } });
|
|
288
|
+
}
|
|
289
|
+
async runCommand(command) {
|
|
290
|
+
return this.ops.runCommand({ body: command });
|
|
291
|
+
}
|
|
292
|
+
async getCommands() {
|
|
293
|
+
return this.ops.getCommands();
|
|
294
|
+
}
|
|
295
|
+
async getHostConfig() {
|
|
296
|
+
return this.ops.getHostConfig();
|
|
297
|
+
}
|
|
298
|
+
async getHostConfigById(id) {
|
|
299
|
+
return this.ops.getHostConfigById({ path: { id } });
|
|
300
|
+
}
|
|
301
|
+
async updateHostConfig(id, config) {
|
|
302
|
+
return this.ops.updateHostConfig({ path: { id: String(id) }, body: config });
|
|
303
|
+
}
|
|
304
|
+
async getUiConfig() {
|
|
305
|
+
return this.ops.getUiConfig();
|
|
306
|
+
}
|
|
307
|
+
async getUiConfigById(id) {
|
|
308
|
+
return this.ops.getUiConfigById({ path: { id } });
|
|
309
|
+
}
|
|
310
|
+
async updateUiConfig(id, config) {
|
|
311
|
+
return this.ops.updateUiConfig({ path: { id: String(id) }, body: config });
|
|
312
|
+
}
|
|
313
|
+
updateConfig(newConfig) {
|
|
314
|
+
const updatedConfig = { ...this.clientConfig.config, ...newConfig };
|
|
315
|
+
this.clientConfig = createServarrClient(updatedConfig);
|
|
316
|
+
this.configureRawClient();
|
|
317
|
+
return this.clientConfig.config;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
52
321
|
// src/generated/prowlarr/core/bodySerializer.gen.ts
|
|
53
322
|
var jsonBodySerializer = {
|
|
54
323
|
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
@@ -1481,66 +1750,64 @@ var getApiV1ConfigUi = (options) => (options?.client ?? client).get({
|
|
|
1481
1750
|
...options
|
|
1482
1751
|
});
|
|
1483
1752
|
// src/clients/prowlarr.ts
|
|
1484
|
-
class ProwlarrClient {
|
|
1485
|
-
|
|
1753
|
+
class ProwlarrClient extends ServarrBaseClient {
|
|
1754
|
+
ops = {
|
|
1755
|
+
getSystemStatus: getApiV1SystemStatus,
|
|
1756
|
+
getHealth: getApiV1Health,
|
|
1757
|
+
getTags: getApiV1Tag,
|
|
1758
|
+
createTag: postApiV1Tag,
|
|
1759
|
+
getTagById: getApiV1TagById,
|
|
1760
|
+
updateTagById: putApiV1TagById,
|
|
1761
|
+
deleteTagById: deleteApiV1TagById,
|
|
1762
|
+
getTagDetails: getApiV1TagDetail,
|
|
1763
|
+
getTagDetailById: getApiV1TagDetailById,
|
|
1764
|
+
getNotifications: getApiV1Notification,
|
|
1765
|
+
createNotification: postApiV1Notification,
|
|
1766
|
+
getNotificationById: getApiV1NotificationById,
|
|
1767
|
+
updateNotificationById: putApiV1NotificationById,
|
|
1768
|
+
deleteNotificationById: deleteApiV1NotificationById,
|
|
1769
|
+
getNotificationSchema: getApiV1NotificationSchema,
|
|
1770
|
+
testNotification: postApiV1NotificationTest,
|
|
1771
|
+
testAllNotifications: postApiV1NotificationTestall,
|
|
1772
|
+
getDownloadClients: getApiV1Downloadclient,
|
|
1773
|
+
createDownloadClient: postApiV1Downloadclient,
|
|
1774
|
+
getDownloadClientById: getApiV1DownloadclientById,
|
|
1775
|
+
updateDownloadClientById: putApiV1DownloadclientById,
|
|
1776
|
+
deleteDownloadClientById: deleteApiV1DownloadclientById,
|
|
1777
|
+
getDownloadClientSchema: getApiV1DownloadclientSchema,
|
|
1778
|
+
testDownloadClient: postApiV1DownloadclientTest,
|
|
1779
|
+
testAllDownloadClients: postApiV1DownloadclientTestall,
|
|
1780
|
+
getIndexers: getApiV1Indexer,
|
|
1781
|
+
createIndexer: postApiV1Indexer,
|
|
1782
|
+
getIndexerById: getApiV1IndexerById,
|
|
1783
|
+
updateIndexerById: putApiV1IndexerById,
|
|
1784
|
+
deleteIndexerById: deleteApiV1IndexerById,
|
|
1785
|
+
getIndexerSchema: getApiV1IndexerSchema,
|
|
1786
|
+
testIndexer: postApiV1IndexerTest,
|
|
1787
|
+
testAllIndexers: postApiV1IndexerTestall,
|
|
1788
|
+
restartSystem: postApiV1SystemRestart,
|
|
1789
|
+
shutdownSystem: postApiV1SystemShutdown,
|
|
1790
|
+
getBackups: getApiV1SystemBackup,
|
|
1791
|
+
deleteBackup: deleteApiV1SystemBackupById,
|
|
1792
|
+
restoreBackup: postApiV1SystemBackupRestoreById,
|
|
1793
|
+
uploadBackup: postApiV1SystemBackupRestoreUpload,
|
|
1794
|
+
getLogFiles: getApiV1LogFile,
|
|
1795
|
+
getLogFileByName: getApiV1LogFileByFilename,
|
|
1796
|
+
runCommand: postApiV1Command,
|
|
1797
|
+
getCommands: getApiV1Command,
|
|
1798
|
+
getHostConfig: getApiV1ConfigHost,
|
|
1799
|
+
getHostConfigById: getApiV1ConfigHostById,
|
|
1800
|
+
updateHostConfig: putApiV1ConfigHostById,
|
|
1801
|
+
getUiConfig: getApiV1ConfigUi,
|
|
1802
|
+
getUiConfigById: getApiV1ConfigUiById,
|
|
1803
|
+
updateUiConfig: putApiV1ConfigUiById
|
|
1804
|
+
};
|
|
1486
1805
|
constructor(config) {
|
|
1487
|
-
|
|
1488
|
-
client.setConfig({
|
|
1489
|
-
baseUrl: this.clientConfig.getBaseUrl(),
|
|
1490
|
-
headers: this.clientConfig.getHeaders()
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
async getSystemStatus() {
|
|
1494
|
-
return getApiV1SystemStatus();
|
|
1495
|
-
}
|
|
1496
|
-
async getHealth() {
|
|
1497
|
-
return getApiV1Health();
|
|
1498
|
-
}
|
|
1499
|
-
async getIndexers() {
|
|
1500
|
-
return getApiV1Indexer();
|
|
1501
|
-
}
|
|
1502
|
-
async getIndexer(id) {
|
|
1503
|
-
return getApiV1IndexerById({ path: { id } });
|
|
1504
|
-
}
|
|
1505
|
-
async addIndexer(indexer) {
|
|
1506
|
-
return postApiV1Indexer({ body: indexer });
|
|
1507
|
-
}
|
|
1508
|
-
async updateIndexer(id, indexer) {
|
|
1509
|
-
return putApiV1IndexerById({ path: { id: String(id) }, body: indexer });
|
|
1510
|
-
}
|
|
1511
|
-
async deleteIndexer(id) {
|
|
1512
|
-
return deleteApiV1IndexerById({ path: { id } });
|
|
1806
|
+
super(config, client);
|
|
1513
1807
|
}
|
|
1514
1808
|
async getIndexerStats() {
|
|
1515
1809
|
return getApiV1Indexerstats();
|
|
1516
1810
|
}
|
|
1517
|
-
async getDownloadClients() {
|
|
1518
|
-
return getApiV1Downloadclient();
|
|
1519
|
-
}
|
|
1520
|
-
async getDownloadClient(id) {
|
|
1521
|
-
return getApiV1DownloadclientById({ path: { id } });
|
|
1522
|
-
}
|
|
1523
|
-
async addDownloadClient(downloadClient) {
|
|
1524
|
-
return postApiV1Downloadclient({ body: downloadClient });
|
|
1525
|
-
}
|
|
1526
|
-
async updateDownloadClient(id, downloadClient) {
|
|
1527
|
-
return putApiV1DownloadclientById({
|
|
1528
|
-
path: { id: String(id) },
|
|
1529
|
-
body: downloadClient
|
|
1530
|
-
});
|
|
1531
|
-
}
|
|
1532
|
-
async deleteDownloadClient(id) {
|
|
1533
|
-
return deleteApiV1DownloadclientById({ path: { id } });
|
|
1534
|
-
}
|
|
1535
|
-
async testDownloadClient(downloadClient) {
|
|
1536
|
-
return postApiV1DownloadclientTest({ body: downloadClient });
|
|
1537
|
-
}
|
|
1538
|
-
async testAllDownloadClients() {
|
|
1539
|
-
return postApiV1DownloadclientTestall();
|
|
1540
|
-
}
|
|
1541
|
-
async getDownloadClientSchema() {
|
|
1542
|
-
return getApiV1DownloadclientSchema();
|
|
1543
|
-
}
|
|
1544
1811
|
async search(query, indexerIds) {
|
|
1545
1812
|
return getApiV1Search({
|
|
1546
1813
|
query: {
|
|
@@ -1552,87 +1819,6 @@ class ProwlarrClient {
|
|
|
1552
1819
|
async getApplications() {
|
|
1553
1820
|
return getApiV1Applications();
|
|
1554
1821
|
}
|
|
1555
|
-
async runCommand(command) {
|
|
1556
|
-
return postApiV1Command({ body: command });
|
|
1557
|
-
}
|
|
1558
|
-
async getCommands() {
|
|
1559
|
-
return getApiV1Command();
|
|
1560
|
-
}
|
|
1561
|
-
async getHostConfig() {
|
|
1562
|
-
return getApiV1ConfigHost();
|
|
1563
|
-
}
|
|
1564
|
-
async getHostConfigById(id) {
|
|
1565
|
-
return getApiV1ConfigHostById({ path: { id } });
|
|
1566
|
-
}
|
|
1567
|
-
async updateHostConfig(id, config) {
|
|
1568
|
-
return putApiV1ConfigHostById({ path: { id: String(id) }, body: config });
|
|
1569
|
-
}
|
|
1570
|
-
async getUiConfig() {
|
|
1571
|
-
return getApiV1ConfigUi();
|
|
1572
|
-
}
|
|
1573
|
-
async getUiConfigById(id) {
|
|
1574
|
-
return getApiV1ConfigUiById({ path: { id } });
|
|
1575
|
-
}
|
|
1576
|
-
async updateUiConfig(id, config) {
|
|
1577
|
-
return putApiV1ConfigUiById({ path: { id: String(id) }, body: config });
|
|
1578
|
-
}
|
|
1579
|
-
async getDevelopmentConfig() {
|
|
1580
|
-
return getApiV1ConfigDevelopment();
|
|
1581
|
-
}
|
|
1582
|
-
async getDevelopmentConfigById(id) {
|
|
1583
|
-
return getApiV1ConfigDevelopmentById({ path: { id } });
|
|
1584
|
-
}
|
|
1585
|
-
async updateDevelopmentConfig(id, config) {
|
|
1586
|
-
return putApiV1ConfigDevelopmentById({ path: { id: String(id) }, body: config });
|
|
1587
|
-
}
|
|
1588
|
-
async restartSystem() {
|
|
1589
|
-
return postApiV1SystemRestart();
|
|
1590
|
-
}
|
|
1591
|
-
async shutdownSystem() {
|
|
1592
|
-
return postApiV1SystemShutdown();
|
|
1593
|
-
}
|
|
1594
|
-
async getSystemBackups() {
|
|
1595
|
-
return getApiV1SystemBackup();
|
|
1596
|
-
}
|
|
1597
|
-
async deleteSystemBackup(id) {
|
|
1598
|
-
return deleteApiV1SystemBackupById({ path: { id } });
|
|
1599
|
-
}
|
|
1600
|
-
async restoreSystemBackup(id) {
|
|
1601
|
-
return postApiV1SystemBackupRestoreById({ path: { id } });
|
|
1602
|
-
}
|
|
1603
|
-
async uploadSystemBackup() {
|
|
1604
|
-
return postApiV1SystemBackupRestoreUpload();
|
|
1605
|
-
}
|
|
1606
|
-
async getSystemLogs() {
|
|
1607
|
-
return getApiV1Log();
|
|
1608
|
-
}
|
|
1609
|
-
async getLogFiles() {
|
|
1610
|
-
return getApiV1LogFile();
|
|
1611
|
-
}
|
|
1612
|
-
async getLogFileByName(filename) {
|
|
1613
|
-
return getApiV1LogFileByFilename({ path: { filename } });
|
|
1614
|
-
}
|
|
1615
|
-
async getTags() {
|
|
1616
|
-
return getApiV1Tag();
|
|
1617
|
-
}
|
|
1618
|
-
async addTag(tag) {
|
|
1619
|
-
return postApiV1Tag({ body: tag });
|
|
1620
|
-
}
|
|
1621
|
-
async getTag(id) {
|
|
1622
|
-
return getApiV1TagById({ path: { id } });
|
|
1623
|
-
}
|
|
1624
|
-
async updateTag(id, tag) {
|
|
1625
|
-
return putApiV1TagById({ path: { id: String(id) }, body: tag });
|
|
1626
|
-
}
|
|
1627
|
-
async deleteTag(id) {
|
|
1628
|
-
return deleteApiV1TagById({ path: { id } });
|
|
1629
|
-
}
|
|
1630
|
-
async getTagDetails() {
|
|
1631
|
-
return getApiV1TagDetail();
|
|
1632
|
-
}
|
|
1633
|
-
async getTagDetailById(id) {
|
|
1634
|
-
return getApiV1TagDetailById({ path: { id } });
|
|
1635
|
-
}
|
|
1636
1822
|
async getApplication(id) {
|
|
1637
1823
|
return getApiV1ApplicationsById({ path: { id } });
|
|
1638
1824
|
}
|
|
@@ -1654,47 +1840,17 @@ class ProwlarrClient {
|
|
|
1654
1840
|
async getApplicationSchema() {
|
|
1655
1841
|
return getApiV1ApplicationsSchema();
|
|
1656
1842
|
}
|
|
1657
|
-
async
|
|
1658
|
-
return
|
|
1659
|
-
}
|
|
1660
|
-
async testIndexer(indexer) {
|
|
1661
|
-
return postApiV1IndexerTest({ body: indexer });
|
|
1662
|
-
}
|
|
1663
|
-
async testAllIndexers() {
|
|
1664
|
-
return postApiV1IndexerTestall();
|
|
1665
|
-
}
|
|
1666
|
-
async getNotifications() {
|
|
1667
|
-
return getApiV1Notification();
|
|
1668
|
-
}
|
|
1669
|
-
async getNotification(id) {
|
|
1670
|
-
return getApiV1NotificationById({ path: { id } });
|
|
1671
|
-
}
|
|
1672
|
-
async addNotification(notification) {
|
|
1673
|
-
return postApiV1Notification({ body: notification });
|
|
1674
|
-
}
|
|
1675
|
-
async updateNotification(id, notification) {
|
|
1676
|
-
return putApiV1NotificationById({ path: { id: String(id) }, body: notification });
|
|
1677
|
-
}
|
|
1678
|
-
async deleteNotification(id) {
|
|
1679
|
-
return deleteApiV1NotificationById({ path: { id } });
|
|
1680
|
-
}
|
|
1681
|
-
async getNotificationSchema() {
|
|
1682
|
-
return getApiV1NotificationSchema();
|
|
1843
|
+
async getDevelopmentConfig() {
|
|
1844
|
+
return getApiV1ConfigDevelopment();
|
|
1683
1845
|
}
|
|
1684
|
-
async
|
|
1685
|
-
return
|
|
1846
|
+
async getDevelopmentConfigById(id) {
|
|
1847
|
+
return getApiV1ConfigDevelopmentById({ path: { id } });
|
|
1686
1848
|
}
|
|
1687
|
-
async
|
|
1688
|
-
return
|
|
1849
|
+
async updateDevelopmentConfig(id, config) {
|
|
1850
|
+
return putApiV1ConfigDevelopmentById({ path: { id: String(id) }, body: config });
|
|
1689
1851
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
this.clientConfig = createServarrClient(updatedConfig);
|
|
1693
|
-
client.setConfig({
|
|
1694
|
-
baseUrl: this.clientConfig.getBaseUrl(),
|
|
1695
|
-
headers: this.clientConfig.getHeaders()
|
|
1696
|
-
});
|
|
1697
|
-
return this.clientConfig.config;
|
|
1852
|
+
async getSystemLogs() {
|
|
1853
|
+
return getApiV1Log();
|
|
1698
1854
|
}
|
|
1699
1855
|
}
|
|
1700
1856
|
export {
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import type { QBittorrentClientConfig } from '../core/types';
|
|
2
2
|
import type { TorrentInfo, TorrentsInfoPostData, TransferInfo } from '../generated/qbittorrent/types.gen';
|
|
3
3
|
type TorrentFilter = NonNullable<TorrentsInfoPostData['body']['filter']>;
|
|
4
|
-
/**
|
|
5
|
-
* qBittorrent WebUI API client
|
|
6
|
-
*
|
|
7
|
-
* Uses cookie-based session authentication (SID) instead of API keys.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const qbit = new QBittorrentClient({
|
|
12
|
-
* baseUrl: 'http://localhost:8080',
|
|
13
|
-
* username: 'admin',
|
|
14
|
-
* password: 'adminadmin'
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* const torrents = await qbit.getTorrents();
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
4
|
export declare class QBittorrentClient {
|
|
21
5
|
private baseUrl;
|
|
22
6
|
private username;
|
|
23
7
|
private password;
|
|
24
8
|
private sid;
|
|
9
|
+
private fetch;
|
|
25
10
|
constructor(config: QBittorrentClientConfig);
|
|
26
11
|
private ensureAuth;
|
|
27
12
|
private login;
|
|
@@ -36,6 +21,5 @@ export declare class QBittorrentClient {
|
|
|
36
21
|
resumeTorrents(hashes: string): Promise<void>;
|
|
37
22
|
deleteTorrents(hashes: string, deleteFiles?: boolean): Promise<void>;
|
|
38
23
|
}
|
|
39
|
-
export * from './qbittorrent-types';
|
|
40
24
|
export * from './qbittorrent-types.js';
|
|
41
25
|
//# sourceMappingURL=qbittorrent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qbittorrent.d.ts","sourceRoot":"","sources":["../../src/clients/qbittorrent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qbittorrent.d.ts","sourceRoot":"","sources":["../../src/clients/qbittorrent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,CAAC;AAE5C,KAAK,aAAa,GAAG,WAAW,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAoBzE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,KAAK,CAA0B;gBAE3B,MAAM,EAAE,uBAAuB;YAoB7B,UAAU;YAOV,KAAK;IAiCb,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,eAAe;;;IAOf,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC;IAOxC,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAS3D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAKzE;AAGD,cAAc,wBAAwB,CAAC"}
|