@ctrl/qbittorrent 9.5.1 → 9.6.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.
@@ -79,11 +79,9 @@ export declare class QBittorrent implements TorrentClient {
79
79
  * @param category Get torrents with the given category (empty string means "without category"; no "category" parameter means "any category")
80
80
  * @returns list of torrents
81
81
  */
82
- listTorrents({ hashes, torrent_hashes, filter, status_filter, category, sort, offset, reverse, tag, limit, isPrivate, include_trackers, }?: {
82
+ listTorrents({ hashes, filter, category, sort, offset, reverse, tag, limit, isPrivate, includeTrackers, }?: {
83
83
  hashes?: string | string[];
84
- torrent_hashes?: string | string[];
85
84
  filter?: TorrentFilters;
86
- status_filter?: TorrentFilters;
87
85
  sort?: string;
88
86
  tag?: string;
89
87
  category?: string;
@@ -95,7 +93,7 @@ export declare class QBittorrent implements TorrentClient {
95
93
  * Renamed to avoid conflict with `private` keyword.
96
94
  */
97
95
  isPrivate?: boolean;
98
- include_trackers?: boolean;
96
+ includeTrackers?: boolean;
99
97
  }): Promise<Torrent[]>;
100
98
  getAllData(): Promise<AllClientData>;
101
99
  /**
@@ -180,10 +178,18 @@ export declare class QBittorrent implements TorrentClient {
180
178
  /**
181
179
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#pause-torrents}
182
180
  */
181
+ stopTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
182
+ /**
183
+ * @deprecated Alias for {@link stopTorrent}.
184
+ */
183
185
  pauseTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
184
186
  /**
185
187
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#resume-torrents}
186
188
  */
189
+ startTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
190
+ /**
191
+ * @deprecated Alias for {@link startTorrent}.
192
+ */
187
193
  resumeTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
188
194
  /**
189
195
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-torrents}
@@ -139,20 +139,30 @@ export class QBittorrent {
139
139
  * @param category Get torrents with the given category (empty string means "without category"; no "category" parameter means "any category")
140
140
  * @returns list of torrents
141
141
  */
142
- async listTorrents({ hashes, torrent_hashes, filter, status_filter, category, sort, offset, reverse, tag, limit, isPrivate, include_trackers, } = {}) {
142
+ async listTorrents({ hashes, filter, category, sort, offset, reverse, tag, limit, isPrivate, includeTrackers, } = {}) {
143
143
  const params = {};
144
144
  if (hashes) {
145
145
  params.hashes = normalizeHashes(hashes);
146
146
  }
147
- if (torrent_hashes) {
148
- params.torrent_hashes = normalizeHashes(torrent_hashes);
149
- }
150
147
  if (filter) {
148
+ if (this.state.version?.isVersion5OrHigher) {
149
+ if (filter === 'paused') {
150
+ filter = 'stopped';
151
+ }
152
+ else if (filter === 'resumed') {
153
+ filter = 'running';
154
+ }
155
+ }
156
+ else if (filter === 'stopped') {
157
+ // For versions < 5
158
+ filter = 'paused';
159
+ }
160
+ else if (filter === 'running') {
161
+ // For versions < 5
162
+ filter = 'resumed';
163
+ }
151
164
  params.filter = filter;
152
165
  }
153
- if (status_filter) {
154
- params.status_filter = status_filter;
155
- }
156
166
  if (category !== undefined) {
157
167
  params.category = category;
158
168
  }
@@ -174,8 +184,8 @@ export class QBittorrent {
174
184
  if (isPrivate) {
175
185
  params.private = JSON.stringify(isPrivate);
176
186
  }
177
- if (include_trackers) {
178
- params.include_trackers = JSON.stringify(include_trackers);
187
+ if (includeTrackers) {
188
+ params.includeTrackers = JSON.stringify(includeTrackers);
179
189
  }
180
190
  const res = await this.request('/torrents/info', 'GET', params);
181
191
  return res;
@@ -371,16 +381,22 @@ export class QBittorrent {
371
381
  /**
372
382
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#pause-torrents}
373
383
  */
374
- async pauseTorrent(hashes) {
384
+ async stopTorrent(hashes) {
375
385
  const endpoint = this.state.version?.isVersion5OrHigher ? '/torrents/stop' : '/torrents/pause';
376
386
  const data = { hashes: normalizeHashes(hashes) };
377
387
  await this.request(endpoint, 'POST', undefined, objToUrlSearchParams(data));
378
388
  return true;
379
389
  }
390
+ /**
391
+ * @deprecated Alias for {@link stopTorrent}.
392
+ */
393
+ async pauseTorrent(hashes) {
394
+ return this.stopTorrent(hashes);
395
+ }
380
396
  /**
381
397
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#resume-torrents}
382
398
  */
383
- async resumeTorrent(hashes) {
399
+ async startTorrent(hashes) {
384
400
  const endpoint = this.state.version?.isVersion5OrHigher
385
401
  ? '/torrents/start'
386
402
  : '/torrents/resume';
@@ -388,6 +404,12 @@ export class QBittorrent {
388
404
  await this.request(endpoint, 'POST', undefined, objToUrlSearchParams(data));
389
405
  return true;
390
406
  }
407
+ /**
408
+ * @deprecated Alias for {@link startTorrent}.
409
+ */
410
+ async resumeTorrent(hashes) {
411
+ return this.startTorrent(hashes);
412
+ }
391
413
  /**
392
414
  * {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-torrents}
393
415
  * @param deleteFiles (default: false) remove files from disk
@@ -20,7 +20,15 @@ export interface BuildInfo {
20
20
  */
21
21
  bitness: string;
22
22
  }
23
- export type TorrentFilters = 'all' | 'downloading' | 'seeding' | 'completed' | 'paused' | 'stopped' | 'active' | 'inactive' | 'resumed' | 'running' | 'stalled' | 'stalled_uploading' | 'stalled_downloading' | 'checking' | 'moving' | 'errored';
23
+ /**
24
+ * @deprecated Replaced by 'running' in qBittorrent v5.
25
+ */
26
+ type TorrentFilterResumed = 'resumed';
27
+ /**
28
+ * @deprecated Replaced by 'stopped' in qBittorrent v5.
29
+ */
30
+ type TorrentFilterPaused = 'paused';
31
+ export type TorrentFilters = 'all' | 'downloading' | 'seeding' | 'completed' | TorrentFilterPaused | 'stopped' | 'active' | 'inactive' | TorrentFilterResumed | 'running' | 'stalled' | 'stalled_uploading' | 'stalled_downloading' | 'checking' | 'moving' | 'errored';
24
32
  export interface Torrent {
25
33
  /**
26
34
  * Torrent name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/qbittorrent",
3
- "version": "9.5.1",
3
+ "version": "9.6.0",
4
4
  "description": "TypeScript api wrapper for qbittorrent using got",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "license": "MIT",
@@ -42,22 +42,21 @@
42
42
  "cookie": "^1.0.2",
43
43
  "node-fetch-native": "^1.6.6",
44
44
  "ofetch": "^1.4.1",
45
- "type-fest": "^4.39.1",
46
- "ufo": "^1.5.4",
45
+ "type-fest": "^4.40.0",
46
+ "ufo": "^1.6.1",
47
47
  "uint8array-extras": "^1.4.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@biomejs/biome": "1.9.4",
51
- "@ctrl/eslint-config-biome": "4.3.4",
51
+ "@ctrl/eslint-config-biome": "4.3.5",
52
52
  "@eslint/compat": "^1.2.8",
53
53
  "@sindresorhus/tsconfig": "7.0.0",
54
- "@types/cookie": "1.0.0",
55
- "@types/node": "22.14.0",
54
+ "@types/node": "22.14.1",
56
55
  "@vitest/coverage-v8": "3.1.1",
57
- "eslint": "^9.23.0",
56
+ "eslint": "^9.25.0",
58
57
  "p-wait-for": "5.0.2",
59
- "typedoc": "0.28.1",
60
- "typescript": "5.8.2",
58
+ "typedoc": "0.28.3",
59
+ "typescript": "5.8.3",
61
60
  "vitest": "3.1.1"
62
61
  },
63
62
  "release": {
@@ -67,5 +66,6 @@
67
66
  },
68
67
  "engines": {
69
68
  "node": ">=18"
70
- }
69
+ },
70
+ "packageManager": "pnpm@10.8.1"
71
71
  }