tsarr 1.0.0 β 1.1.1
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 +9 -11
- package/dist/clients/lidarr.js +626 -0
- package/dist/clients/prowlarr.js +408 -0
- package/dist/clients/radarr.js +1059 -0
- package/dist/clients/readarr.js +432 -0
- package/dist/clients/sonarr.js +432 -0
- package/dist/index.js +1 -1
- package/dist/tsarr-1.1.1.tgz +0 -0
- package/package.json +7 -3
- package/dist/tsarr-1.0.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**Type-safe TypeScript SDK for Servarr APIs (Radarr, Sonarr, etc.)**
|
|
9
9
|
|
|
10
|
-
TsArr provides type-safe TypeScript clients for all Servarr APIs, generated from their Swagger/OpenAPI specifications.
|
|
10
|
+
TsArr provides type-safe TypeScript clients for all Servarr APIs, generated from their Swagger/OpenAPI specifications. Perfect for building automation tools, scripts, and applications to manage your media servers.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ TsArr provides type-safe TypeScript clients for all Servarr APIs, generated from
|
|
|
16
16
|
- π¦ **Modular** - Separate modules for each Servarr app (Radarr, Sonarr, etc.)
|
|
17
17
|
- π³ **Tree-shakable** - Lightweight and dependency-minimal
|
|
18
18
|
- π **Auto-generated** - CI pipeline regenerates when APIs change
|
|
19
|
-
-
|
|
19
|
+
- π€ **Automation-friendly** - Perfect for building tools and scripts
|
|
20
20
|
|
|
21
21
|
## Supported Servarr Apps
|
|
22
22
|
|
|
@@ -76,20 +76,18 @@ bun run format
|
|
|
76
76
|
|
|
77
77
|
## π Documentation
|
|
78
78
|
|
|
79
|
+
- [API Documentation](https://robbeverhelst.github.io/tsarr/) - Auto-generated TypeScript API docs
|
|
79
80
|
- [Usage Guide](./docs/usage.md) - Complete usage documentation with examples
|
|
80
81
|
- [Examples](./docs/examples.md) - Real-world automation examples
|
|
81
|
-
- [IaC Integration](./docs/iac-integration.md) - Docker, Kubernetes, Terraform guides
|
|
82
|
-
- [Releasing](./docs/releasing.md) - Release process and conventional commits
|
|
83
|
-
- [Setup Secrets](./docs/setup-secrets.md) - Configure GitHub secrets for releases
|
|
84
82
|
- [Examples Directory](./examples/) - Runnable example scripts
|
|
85
83
|
|
|
86
|
-
##
|
|
84
|
+
## Use Cases
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
- **
|
|
90
|
-
- **
|
|
91
|
-
- **
|
|
92
|
-
- **
|
|
86
|
+
Perfect for building:
|
|
87
|
+
- **Automation scripts** - Bulk movie imports, library maintenance, and media organization
|
|
88
|
+
- **Management tools** - Custom dashboards, backup utilities, and monitoring scripts
|
|
89
|
+
- **Integration scripts** - Connect Servarr apps with other services and workflows
|
|
90
|
+
- **CLI tools** - Command-line utilities for media server administration
|
|
93
91
|
|
|
94
92
|
## Contributing
|
|
95
93
|
|
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
// src/core/errors.ts
|
|
2
|
+
class TsArrError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
statusCode;
|
|
5
|
+
details;
|
|
6
|
+
constructor(message, code, statusCode, details) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.statusCode = statusCode;
|
|
10
|
+
this.details = details;
|
|
11
|
+
this.name = "TsArrError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class ApiKeyError extends TsArrError {
|
|
16
|
+
constructor(message = "Invalid or missing API key") {
|
|
17
|
+
super(message, "API_KEY_ERROR", 401);
|
|
18
|
+
this.name = "ApiKeyError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class ConnectionError extends TsArrError {
|
|
23
|
+
constructor(message, details) {
|
|
24
|
+
super(message, "CONNECTION_ERROR", undefined, details);
|
|
25
|
+
this.name = "ConnectionError";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/core/client.ts
|
|
30
|
+
function createServarrClient(config) {
|
|
31
|
+
if (!config.apiKey) {
|
|
32
|
+
throw new ApiKeyError;
|
|
33
|
+
}
|
|
34
|
+
if (!config.baseUrl) {
|
|
35
|
+
throw new ConnectionError("No base URL provided");
|
|
36
|
+
}
|
|
37
|
+
const validatedConfig = {
|
|
38
|
+
...config,
|
|
39
|
+
baseUrl: config.baseUrl.replace(/\/$/, "")
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
config: validatedConfig,
|
|
43
|
+
getHeaders: () => ({
|
|
44
|
+
"X-Api-Key": validatedConfig.apiKey,
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
...validatedConfig.headers
|
|
47
|
+
}),
|
|
48
|
+
getBaseUrl: () => validatedConfig.baseUrl
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// node_modules/@hey-api/client-fetch/dist/index.js
|
|
53
|
+
var T = /\{[^{}]+\}/g;
|
|
54
|
+
var h = ({ allowReserved: i, name: n, value: e }) => {
|
|
55
|
+
if (e == null)
|
|
56
|
+
return "";
|
|
57
|
+
if (typeof e == "object")
|
|
58
|
+
throw new Error("Deeply-nested arrays/objects arenβt supported. Provide your own `querySerializer()` to handle these.");
|
|
59
|
+
return `${n}=${i ? e : encodeURIComponent(e)}`;
|
|
60
|
+
};
|
|
61
|
+
var U = (i) => {
|
|
62
|
+
switch (i) {
|
|
63
|
+
case "label":
|
|
64
|
+
return ".";
|
|
65
|
+
case "matrix":
|
|
66
|
+
return ";";
|
|
67
|
+
case "simple":
|
|
68
|
+
return ",";
|
|
69
|
+
default:
|
|
70
|
+
return "&";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var $ = (i) => {
|
|
74
|
+
switch (i) {
|
|
75
|
+
case "form":
|
|
76
|
+
return ",";
|
|
77
|
+
case "pipeDelimited":
|
|
78
|
+
return "|";
|
|
79
|
+
case "spaceDelimited":
|
|
80
|
+
return "%20";
|
|
81
|
+
default:
|
|
82
|
+
return ",";
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var D = (i) => {
|
|
86
|
+
switch (i) {
|
|
87
|
+
case "label":
|
|
88
|
+
return ".";
|
|
89
|
+
case "matrix":
|
|
90
|
+
return ";";
|
|
91
|
+
case "simple":
|
|
92
|
+
return ",";
|
|
93
|
+
default:
|
|
94
|
+
return "&";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var j = ({ allowReserved: i, explode: n, name: e, style: a, value: o }) => {
|
|
98
|
+
if (!n) {
|
|
99
|
+
let r = (i ? o : o.map((c) => encodeURIComponent(c))).join($(a));
|
|
100
|
+
switch (a) {
|
|
101
|
+
case "label":
|
|
102
|
+
return `.${r}`;
|
|
103
|
+
case "matrix":
|
|
104
|
+
return `;${e}=${r}`;
|
|
105
|
+
case "simple":
|
|
106
|
+
return r;
|
|
107
|
+
default:
|
|
108
|
+
return `${e}=${r}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let s = U(a), t = o.map((r) => a === "label" || a === "simple" ? i ? r : encodeURIComponent(r) : h({ allowReserved: i, name: e, value: r })).join(s);
|
|
112
|
+
return a === "label" || a === "matrix" ? s + t : t;
|
|
113
|
+
};
|
|
114
|
+
var C = ({ allowReserved: i, explode: n, name: e, style: a, value: o }) => {
|
|
115
|
+
if (o instanceof Date)
|
|
116
|
+
return `${e}=${o.toISOString()}`;
|
|
117
|
+
if (a !== "deepObject" && !n) {
|
|
118
|
+
let r = [];
|
|
119
|
+
Object.entries(o).forEach(([u, l]) => {
|
|
120
|
+
r = [...r, u, i ? l : encodeURIComponent(l)];
|
|
121
|
+
});
|
|
122
|
+
let c = r.join(",");
|
|
123
|
+
switch (a) {
|
|
124
|
+
case "form":
|
|
125
|
+
return `${e}=${c}`;
|
|
126
|
+
case "label":
|
|
127
|
+
return `.${c}`;
|
|
128
|
+
case "matrix":
|
|
129
|
+
return `;${e}=${c}`;
|
|
130
|
+
default:
|
|
131
|
+
return c;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
let s = D(a), t = Object.entries(o).map(([r, c]) => h({ allowReserved: i, name: a === "deepObject" ? `${e}[${r}]` : r, value: c })).join(s);
|
|
135
|
+
return a === "label" || a === "matrix" ? s + t : t;
|
|
136
|
+
};
|
|
137
|
+
var _ = ({ path: i, url: n }) => {
|
|
138
|
+
let e = n, a = n.match(T);
|
|
139
|
+
if (a)
|
|
140
|
+
for (let o of a) {
|
|
141
|
+
let s = false, t = o.substring(1, o.length - 1), r = "simple";
|
|
142
|
+
t.endsWith("*") && (s = true, t = t.substring(0, t.length - 1)), t.startsWith(".") ? (t = t.substring(1), r = "label") : t.startsWith(";") && (t = t.substring(1), r = "matrix");
|
|
143
|
+
let c = i[t];
|
|
144
|
+
if (c == null)
|
|
145
|
+
continue;
|
|
146
|
+
if (Array.isArray(c)) {
|
|
147
|
+
e = e.replace(o, j({ explode: s, name: t, style: r, value: c }));
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (typeof c == "object") {
|
|
151
|
+
e = e.replace(o, C({ explode: s, name: t, style: r, value: c }));
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (r === "matrix") {
|
|
155
|
+
e = e.replace(o, `;${h({ name: t, value: c })}`);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
let u = encodeURIComponent(r === "label" ? `.${c}` : c);
|
|
159
|
+
e = e.replace(o, u);
|
|
160
|
+
}
|
|
161
|
+
return e;
|
|
162
|
+
};
|
|
163
|
+
var b = ({ allowReserved: i, array: n, object: e } = {}) => (o) => {
|
|
164
|
+
let s = [];
|
|
165
|
+
if (o && typeof o == "object")
|
|
166
|
+
for (let t in o) {
|
|
167
|
+
let r = o[t];
|
|
168
|
+
if (r != null) {
|
|
169
|
+
if (Array.isArray(r)) {
|
|
170
|
+
s = [...s, j({ allowReserved: i, explode: true, name: t, style: "form", value: r, ...n })];
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (typeof r == "object") {
|
|
174
|
+
s = [...s, C({ allowReserved: i, explode: true, name: t, style: "deepObject", value: r, ...e })];
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
s = [...s, h({ allowReserved: i, name: t, value: r })];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return s.join("&");
|
|
181
|
+
};
|
|
182
|
+
var A = (i) => {
|
|
183
|
+
if (!i)
|
|
184
|
+
return;
|
|
185
|
+
let n = i.split(";")[0].trim();
|
|
186
|
+
if (n.startsWith("application/json") || n.endsWith("+json"))
|
|
187
|
+
return "json";
|
|
188
|
+
if (n === "multipart/form-data")
|
|
189
|
+
return "formData";
|
|
190
|
+
if (["application/", "audio/", "image/", "video/"].some((e) => n.startsWith(e)))
|
|
191
|
+
return "blob";
|
|
192
|
+
if (n.startsWith("text/"))
|
|
193
|
+
return "text";
|
|
194
|
+
};
|
|
195
|
+
var w = ({ baseUrl: i, path: n, query: e, querySerializer: a, url: o }) => {
|
|
196
|
+
let s = o.startsWith("/") ? o : `/${o}`, t = i + s;
|
|
197
|
+
n && (t = _({ path: n, url: t }));
|
|
198
|
+
let r = e ? a(e) : "";
|
|
199
|
+
return r.startsWith("?") && (r = r.substring(1)), r && (t += `?${r}`), t;
|
|
200
|
+
};
|
|
201
|
+
var R = (i, n) => {
|
|
202
|
+
let e = { ...i, ...n };
|
|
203
|
+
return e.baseUrl?.endsWith("/") && (e.baseUrl = e.baseUrl.substring(0, e.baseUrl.length - 1)), e.headers = O(i.headers, n.headers), e;
|
|
204
|
+
};
|
|
205
|
+
var O = (...i) => {
|
|
206
|
+
let n = new Headers;
|
|
207
|
+
for (let e of i) {
|
|
208
|
+
if (!e || typeof e != "object")
|
|
209
|
+
continue;
|
|
210
|
+
let a = e instanceof Headers ? e.entries() : Object.entries(e);
|
|
211
|
+
for (let [o, s] of a)
|
|
212
|
+
if (s === null)
|
|
213
|
+
n.delete(o);
|
|
214
|
+
else if (Array.isArray(s))
|
|
215
|
+
for (let t of s)
|
|
216
|
+
n.append(o, t);
|
|
217
|
+
else
|
|
218
|
+
s !== undefined && n.set(o, typeof s == "object" ? JSON.stringify(s) : s);
|
|
219
|
+
}
|
|
220
|
+
return n;
|
|
221
|
+
};
|
|
222
|
+
var y = class {
|
|
223
|
+
_fns;
|
|
224
|
+
constructor() {
|
|
225
|
+
this._fns = [];
|
|
226
|
+
}
|
|
227
|
+
clear() {
|
|
228
|
+
this._fns = [];
|
|
229
|
+
}
|
|
230
|
+
exists(n) {
|
|
231
|
+
return this._fns.indexOf(n) !== -1;
|
|
232
|
+
}
|
|
233
|
+
eject(n) {
|
|
234
|
+
let e = this._fns.indexOf(n);
|
|
235
|
+
e !== -1 && (this._fns = [...this._fns.slice(0, e), ...this._fns.slice(e + 1)]);
|
|
236
|
+
}
|
|
237
|
+
use(n) {
|
|
238
|
+
this._fns = [...this._fns, n];
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
var P = () => ({ error: new y, request: new y, response: new y });
|
|
242
|
+
var E = { bodySerializer: (i) => JSON.stringify(i) };
|
|
243
|
+
var W = b({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } });
|
|
244
|
+
var B = { "Content-Type": "application/json" };
|
|
245
|
+
var x = (i = {}) => ({ ...E, baseUrl: "", fetch: globalThis.fetch, headers: B, parseAs: "auto", querySerializer: W, ...i });
|
|
246
|
+
var J = (i = {}) => {
|
|
247
|
+
let n = R(x(), i), e = () => ({ ...n }), a = (t) => (n = R(n, t), e()), o = P(), s = async (t) => {
|
|
248
|
+
let r = { ...n, ...t, headers: O(n.headers, t.headers) };
|
|
249
|
+
r.body && r.bodySerializer && (r.body = r.bodySerializer(r.body)), r.body || r.headers.delete("Content-Type");
|
|
250
|
+
let c = w({ baseUrl: r.baseUrl ?? "", path: r.path, query: r.query, querySerializer: typeof r.querySerializer == "function" ? r.querySerializer : b(r.querySerializer), url: r.url }), u = { redirect: "follow", ...r }, l = new Request(c, u);
|
|
251
|
+
for (let f of o.request._fns)
|
|
252
|
+
l = await f(l, r);
|
|
253
|
+
let I = r.fetch, p = await I(l);
|
|
254
|
+
for (let f of o.response._fns)
|
|
255
|
+
p = await f(p, l, r);
|
|
256
|
+
let g = { request: l, response: p };
|
|
257
|
+
if (p.ok) {
|
|
258
|
+
if (p.status === 204 || p.headers.get("Content-Length") === "0")
|
|
259
|
+
return { data: {}, ...g };
|
|
260
|
+
if (r.parseAs === "stream")
|
|
261
|
+
return { data: p.body, ...g };
|
|
262
|
+
let f = (r.parseAs === "auto" ? A(p.headers.get("Content-Type")) : r.parseAs) ?? "json", S = await p[f]();
|
|
263
|
+
return f === "json" && r.responseTransformer && (S = await r.responseTransformer(S)), { data: S, ...g };
|
|
264
|
+
}
|
|
265
|
+
let m = await p.text();
|
|
266
|
+
try {
|
|
267
|
+
m = JSON.parse(m);
|
|
268
|
+
} catch {}
|
|
269
|
+
let d = m;
|
|
270
|
+
for (let f of o.error._fns)
|
|
271
|
+
d = await f(m, p, l, r);
|
|
272
|
+
if (d = d || {}, r.throwOnError)
|
|
273
|
+
throw d;
|
|
274
|
+
return { error: d, ...g };
|
|
275
|
+
};
|
|
276
|
+
return { connect: (t) => s({ ...t, method: "CONNECT" }), delete: (t) => s({ ...t, method: "DELETE" }), get: (t) => s({ ...t, method: "GET" }), getConfig: e, head: (t) => s({ ...t, method: "HEAD" }), interceptors: o, options: (t) => s({ ...t, method: "OPTIONS" }), patch: (t) => s({ ...t, method: "PATCH" }), post: (t) => s({ ...t, method: "POST" }), put: (t) => s({ ...t, method: "PUT" }), request: s, setConfig: a, trace: (t) => s({ ...t, method: "TRACE" }) };
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// src/generated/lidarr/services.gen.ts
|
|
280
|
+
var client = J(x());
|
|
281
|
+
var getApiV1Album = (options) => {
|
|
282
|
+
return (options?.client ?? client).get({
|
|
283
|
+
...options,
|
|
284
|
+
url: "/api/v1/album"
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
var postApiV1Album = (options) => {
|
|
288
|
+
return (options?.client ?? client).post({
|
|
289
|
+
...options,
|
|
290
|
+
url: "/api/v1/album"
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
var putApiV1AlbumById = (options) => {
|
|
294
|
+
return (options?.client ?? client).put({
|
|
295
|
+
...options,
|
|
296
|
+
url: "/api/v1/album/{id}"
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
var deleteApiV1AlbumById = (options) => {
|
|
300
|
+
return (options?.client ?? client).delete({
|
|
301
|
+
...options,
|
|
302
|
+
url: "/api/v1/album/{id}"
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
var getApiV1AlbumById = (options) => {
|
|
306
|
+
return (options?.client ?? client).get({
|
|
307
|
+
...options,
|
|
308
|
+
url: "/api/v1/album/{id}"
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
var getApiV1AlbumLookup = (options) => {
|
|
312
|
+
return (options?.client ?? client).get({
|
|
313
|
+
...options,
|
|
314
|
+
url: "/api/v1/album/lookup"
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
var getApiV1ArtistById = (options) => {
|
|
318
|
+
return (options?.client ?? client).get({
|
|
319
|
+
...options,
|
|
320
|
+
url: "/api/v1/artist/{id}"
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
var putApiV1ArtistById = (options) => {
|
|
324
|
+
return (options?.client ?? client).put({
|
|
325
|
+
...options,
|
|
326
|
+
url: "/api/v1/artist/{id}"
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
var deleteApiV1ArtistById = (options) => {
|
|
330
|
+
return (options?.client ?? client).delete({
|
|
331
|
+
...options,
|
|
332
|
+
url: "/api/v1/artist/{id}"
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
var getApiV1Artist = (options) => {
|
|
336
|
+
return (options?.client ?? client).get({
|
|
337
|
+
...options,
|
|
338
|
+
url: "/api/v1/artist"
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
var postApiV1Artist = (options) => {
|
|
342
|
+
return (options?.client ?? client).post({
|
|
343
|
+
...options,
|
|
344
|
+
url: "/api/v1/artist"
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
var getApiV1ArtistLookup = (options) => {
|
|
348
|
+
return (options?.client ?? client).get({
|
|
349
|
+
...options,
|
|
350
|
+
url: "/api/v1/artist/lookup"
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
var getApiV1Calendar = (options) => {
|
|
354
|
+
return (options?.client ?? client).get({
|
|
355
|
+
...options,
|
|
356
|
+
url: "/api/v1/calendar"
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
var getFeedV1CalendarLidarrIcs = (options) => {
|
|
360
|
+
return (options?.client ?? client).get({
|
|
361
|
+
...options,
|
|
362
|
+
url: "/feed/v1/calendar/lidarr.ics"
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
var postApiV1Command = (options) => {
|
|
366
|
+
return (options?.client ?? client).post({
|
|
367
|
+
...options,
|
|
368
|
+
url: "/api/v1/command"
|
|
369
|
+
});
|
|
370
|
+
};
|
|
371
|
+
var getApiV1Command = (options) => {
|
|
372
|
+
return (options?.client ?? client).get({
|
|
373
|
+
...options,
|
|
374
|
+
url: "/api/v1/command"
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
var getApiV1CustomformatById = (options) => {
|
|
378
|
+
return (options?.client ?? client).get({
|
|
379
|
+
...options,
|
|
380
|
+
url: "/api/v1/customformat/{id}"
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
var putApiV1CustomformatById = (options) => {
|
|
384
|
+
return (options?.client ?? client).put({
|
|
385
|
+
...options,
|
|
386
|
+
url: "/api/v1/customformat/{id}"
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
var deleteApiV1CustomformatById = (options) => {
|
|
390
|
+
return (options?.client ?? client).delete({
|
|
391
|
+
...options,
|
|
392
|
+
url: "/api/v1/customformat/{id}"
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
var getApiV1Customformat = (options) => {
|
|
396
|
+
return (options?.client ?? client).get({
|
|
397
|
+
...options,
|
|
398
|
+
url: "/api/v1/customformat"
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
var postApiV1Customformat = (options) => {
|
|
402
|
+
return (options?.client ?? client).post({
|
|
403
|
+
...options,
|
|
404
|
+
url: "/api/v1/customformat"
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
var putApiV1CustomformatBulk = (options) => {
|
|
408
|
+
return (options?.client ?? client).put({
|
|
409
|
+
...options,
|
|
410
|
+
url: "/api/v1/customformat/bulk"
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
var deleteApiV1CustomformatBulk = (options) => {
|
|
414
|
+
return (options?.client ?? client).delete({
|
|
415
|
+
...options,
|
|
416
|
+
url: "/api/v1/customformat/bulk"
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
var getApiV1CustomformatSchema = (options) => {
|
|
420
|
+
return (options?.client ?? client).get({
|
|
421
|
+
...options,
|
|
422
|
+
url: "/api/v1/customformat/schema"
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
var getApiV1Health = (options) => {
|
|
426
|
+
return (options?.client ?? client).get({
|
|
427
|
+
...options,
|
|
428
|
+
url: "/api/v1/health"
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
var postApiV1Qualityprofile = (options) => {
|
|
432
|
+
return (options?.client ?? client).post({
|
|
433
|
+
...options,
|
|
434
|
+
url: "/api/v1/qualityprofile"
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
var getApiV1Qualityprofile = (options) => {
|
|
438
|
+
return (options?.client ?? client).get({
|
|
439
|
+
...options,
|
|
440
|
+
url: "/api/v1/qualityprofile"
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
var deleteApiV1QualityprofileById = (options) => {
|
|
444
|
+
return (options?.client ?? client).delete({
|
|
445
|
+
...options,
|
|
446
|
+
url: "/api/v1/qualityprofile/{id}"
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
var putApiV1QualityprofileById = (options) => {
|
|
450
|
+
return (options?.client ?? client).put({
|
|
451
|
+
...options,
|
|
452
|
+
url: "/api/v1/qualityprofile/{id}"
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
var getApiV1QualityprofileById = (options) => {
|
|
456
|
+
return (options?.client ?? client).get({
|
|
457
|
+
...options,
|
|
458
|
+
url: "/api/v1/qualityprofile/{id}"
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
var getApiV1QualityprofileSchema = (options) => {
|
|
462
|
+
return (options?.client ?? client).get({
|
|
463
|
+
...options,
|
|
464
|
+
url: "/api/v1/qualityprofile/schema"
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
var postApiV1Rootfolder = (options) => {
|
|
468
|
+
return (options?.client ?? client).post({
|
|
469
|
+
...options,
|
|
470
|
+
url: "/api/v1/rootfolder"
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
var getApiV1Rootfolder = (options) => {
|
|
474
|
+
return (options?.client ?? client).get({
|
|
475
|
+
...options,
|
|
476
|
+
url: "/api/v1/rootfolder"
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
var getApiV1SystemStatus = (options) => {
|
|
480
|
+
return (options?.client ?? client).get({
|
|
481
|
+
...options,
|
|
482
|
+
url: "/api/v1/system/status"
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// src/clients/lidarr.ts
|
|
487
|
+
class LidarrClient {
|
|
488
|
+
clientConfig;
|
|
489
|
+
constructor(config) {
|
|
490
|
+
this.clientConfig = createServarrClient(config);
|
|
491
|
+
client.setConfig({
|
|
492
|
+
baseUrl: this.clientConfig.getBaseUrl(),
|
|
493
|
+
headers: this.clientConfig.getHeaders()
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
async getSystemStatus() {
|
|
497
|
+
return getApiV1SystemStatus();
|
|
498
|
+
}
|
|
499
|
+
async getHealth() {
|
|
500
|
+
return getApiV1Health();
|
|
501
|
+
}
|
|
502
|
+
async getArtists() {
|
|
503
|
+
return getApiV1Artist();
|
|
504
|
+
}
|
|
505
|
+
async getArtist(id) {
|
|
506
|
+
return getApiV1ArtistById({ path: { id } });
|
|
507
|
+
}
|
|
508
|
+
async addArtist(artist) {
|
|
509
|
+
return postApiV1Artist({ body: artist });
|
|
510
|
+
}
|
|
511
|
+
async updateArtist(id, artist) {
|
|
512
|
+
return putApiV1ArtistById({ path: { id: String(id) }, body: artist });
|
|
513
|
+
}
|
|
514
|
+
async deleteArtist(id) {
|
|
515
|
+
return deleteApiV1ArtistById({ path: { id } });
|
|
516
|
+
}
|
|
517
|
+
async getAlbums() {
|
|
518
|
+
return getApiV1Album();
|
|
519
|
+
}
|
|
520
|
+
async getAlbum(id) {
|
|
521
|
+
return getApiV1AlbumById({ path: { id } });
|
|
522
|
+
}
|
|
523
|
+
async searchArtists(term) {
|
|
524
|
+
return getApiV1ArtistLookup({ query: { term } });
|
|
525
|
+
}
|
|
526
|
+
async runCommand(command) {
|
|
527
|
+
return postApiV1Command({ body: command });
|
|
528
|
+
}
|
|
529
|
+
async getCommands() {
|
|
530
|
+
return getApiV1Command();
|
|
531
|
+
}
|
|
532
|
+
async getRootFolders() {
|
|
533
|
+
return getApiV1Rootfolder();
|
|
534
|
+
}
|
|
535
|
+
async addRootFolder(path) {
|
|
536
|
+
return postApiV1Rootfolder({
|
|
537
|
+
body: { path }
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
async addAlbum(album) {
|
|
541
|
+
return postApiV1Album({ body: album });
|
|
542
|
+
}
|
|
543
|
+
async updateAlbum(id, album) {
|
|
544
|
+
return putApiV1AlbumById({ path: { id: String(id) }, body: album });
|
|
545
|
+
}
|
|
546
|
+
async deleteAlbum(id) {
|
|
547
|
+
return deleteApiV1AlbumById({ path: { id } });
|
|
548
|
+
}
|
|
549
|
+
async searchAlbums(term) {
|
|
550
|
+
return getApiV1AlbumLookup({ query: { term } });
|
|
551
|
+
}
|
|
552
|
+
async getCalendar(start, end, unmonitored) {
|
|
553
|
+
const query = {};
|
|
554
|
+
if (start)
|
|
555
|
+
query.start = start;
|
|
556
|
+
if (end)
|
|
557
|
+
query.end = end;
|
|
558
|
+
if (unmonitored !== undefined)
|
|
559
|
+
query.unmonitored = unmonitored;
|
|
560
|
+
return getApiV1Calendar(Object.keys(query).length > 0 ? { query } : {});
|
|
561
|
+
}
|
|
562
|
+
async getCalendarFeed(pastDays, futureDays, tags) {
|
|
563
|
+
const query = {};
|
|
564
|
+
if (pastDays !== undefined)
|
|
565
|
+
query.pastDays = pastDays;
|
|
566
|
+
if (futureDays !== undefined)
|
|
567
|
+
query.futureDays = futureDays;
|
|
568
|
+
if (tags)
|
|
569
|
+
query.tags = tags;
|
|
570
|
+
return getFeedV1CalendarLidarrIcs(Object.keys(query).length > 0 ? { query } : {});
|
|
571
|
+
}
|
|
572
|
+
async getQualityProfiles() {
|
|
573
|
+
return getApiV1Qualityprofile();
|
|
574
|
+
}
|
|
575
|
+
async getQualityProfile(id) {
|
|
576
|
+
return getApiV1QualityprofileById({ path: { id } });
|
|
577
|
+
}
|
|
578
|
+
async addQualityProfile(profile) {
|
|
579
|
+
return postApiV1Qualityprofile({ body: profile });
|
|
580
|
+
}
|
|
581
|
+
async updateQualityProfile(id, profile) {
|
|
582
|
+
return putApiV1QualityprofileById({ path: { id: String(id) }, body: profile });
|
|
583
|
+
}
|
|
584
|
+
async deleteQualityProfile(id) {
|
|
585
|
+
return deleteApiV1QualityprofileById({ path: { id } });
|
|
586
|
+
}
|
|
587
|
+
async getQualityProfileSchema() {
|
|
588
|
+
return getApiV1QualityprofileSchema();
|
|
589
|
+
}
|
|
590
|
+
async getCustomFormats() {
|
|
591
|
+
return getApiV1Customformat();
|
|
592
|
+
}
|
|
593
|
+
async getCustomFormat(id) {
|
|
594
|
+
return getApiV1CustomformatById({ path: { id } });
|
|
595
|
+
}
|
|
596
|
+
async addCustomFormat(format) {
|
|
597
|
+
return postApiV1Customformat({ body: format });
|
|
598
|
+
}
|
|
599
|
+
async updateCustomFormat(id, format) {
|
|
600
|
+
return putApiV1CustomformatById({ path: { id: String(id) }, body: format });
|
|
601
|
+
}
|
|
602
|
+
async deleteCustomFormat(id) {
|
|
603
|
+
return deleteApiV1CustomformatById({ path: { id } });
|
|
604
|
+
}
|
|
605
|
+
async updateCustomFormatsBulk(formats) {
|
|
606
|
+
return putApiV1CustomformatBulk({ body: formats });
|
|
607
|
+
}
|
|
608
|
+
async deleteCustomFormatsBulk(ids) {
|
|
609
|
+
return deleteApiV1CustomformatBulk({ body: { ids } });
|
|
610
|
+
}
|
|
611
|
+
async getCustomFormatSchema() {
|
|
612
|
+
return getApiV1CustomformatSchema();
|
|
613
|
+
}
|
|
614
|
+
updateConfig(newConfig) {
|
|
615
|
+
const updatedConfig = { ...this.clientConfig.config, ...newConfig };
|
|
616
|
+
this.clientConfig = createServarrClient(updatedConfig);
|
|
617
|
+
client.setConfig({
|
|
618
|
+
baseUrl: this.clientConfig.getBaseUrl(),
|
|
619
|
+
headers: this.clientConfig.getHeaders()
|
|
620
|
+
});
|
|
621
|
+
return this.clientConfig.config;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
export {
|
|
625
|
+
LidarrClient
|
|
626
|
+
};
|