@ctrl/qbittorrent 9.3.0 → 9.5.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.
@@ -14,6 +14,7 @@ export function normalizeTorrentData(torrent) {
14
14
  stateMessage = 'qBittorrent is reporting an error';
15
15
  break;
16
16
  case TorrentState.PausedDL:
17
+ case TorrentState.StoppedDL:
17
18
  state = NormalizedTorrentState.paused;
18
19
  break;
19
20
  case TorrentState.QueuedDL: // queuing is enabled and torrent is queued for download
@@ -35,7 +36,8 @@ export function normalizeTorrentData(torrent) {
35
36
  state = NormalizedTorrentState.warning;
36
37
  stateMessage = 'The download is stalled with no connection';
37
38
  break;
38
- case TorrentState.PausedUP: // torrent is paused and has finished downloading:
39
+ case TorrentState.StoppedUP: // torrent is paused and has finished downloading
40
+ case TorrentState.PausedUP: // torrent is paused and has finished downloading
39
41
  case TorrentState.Uploading: // torrent is being seeded and data is being transferred
40
42
  case TorrentState.StalledUP: // torrent is being seeded, but no connection were made
41
43
  case TorrentState.QueuedUP: // queuing is enabled and torrent is queued for upload
@@ -79,14 +79,19 @@ 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, filter, category, sort, offset, reverse, tag, }?: {
82
+ listTorrents({ hashes, torrent_hashes, filter, status_filter, category, sort, offset, reverse, tag, limit, Private, include_trackers, }?: {
83
83
  hashes?: string | string[];
84
+ torrent_hashes?: string | string[];
84
85
  filter?: TorrentFilters;
86
+ status_filter?: TorrentFilters;
85
87
  sort?: string;
86
88
  tag?: string;
87
89
  category?: string;
88
90
  offset?: number;
91
+ limit?: number;
89
92
  reverse?: boolean;
93
+ Private?: boolean;
94
+ include_trackers?: boolean;
90
95
  }): Promise<Torrent[]>;
91
96
  getAllData(): Promise<AllClientData>;
92
97
  /**
@@ -139,14 +139,20 @@ 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, filter, category, sort, offset, reverse, tag, } = {}) {
142
+ async listTorrents({ hashes, torrent_hashes, filter, status_filter, category, sort, offset, reverse, tag, limit, Private, include_trackers, } = {}) {
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
+ }
147
150
  if (filter) {
148
151
  params.filter = filter;
149
152
  }
153
+ if (status_filter) {
154
+ params.status_filter = status_filter;
155
+ }
150
156
  if (category !== undefined) {
151
157
  params.category = category;
152
158
  }
@@ -156,12 +162,21 @@ export class QBittorrent {
156
162
  if (offset !== undefined) {
157
163
  params.offset = `${offset}`;
158
164
  }
165
+ if (limit !== undefined) {
166
+ params.limit = `${limit}`;
167
+ }
159
168
  if (sort) {
160
169
  params.sort = sort;
161
170
  }
162
171
  if (reverse) {
163
172
  params.reverse = JSON.stringify(reverse);
164
173
  }
174
+ if (Private) {
175
+ params.Private = JSON.stringify(Private);
176
+ }
177
+ if (include_trackers) {
178
+ params.include_trackers = JSON.stringify(include_trackers);
179
+ }
165
180
  const res = await this.request('/torrents/info', 'GET', params);
166
181
  return res;
167
182
  }
@@ -20,7 +20,7 @@ export interface BuildInfo {
20
20
  */
21
21
  bitness: string;
22
22
  }
23
- export type TorrentFilters = 'all' | 'downloading' | 'completed' | 'paused' | 'active' | 'inactive' | 'resumed' | 'stalled' | 'stalled_uploading' | 'stalled_downloading';
23
+ export type TorrentFilters = 'all' | 'downloading' | 'seeding' | 'completed' | 'paused' | 'stopped' | 'active' | 'inactive' | 'resumed' | 'running' | 'stalled' | 'stalled_uploading' | 'stalled_downloading' | 'checking' | 'moving' | 'errored';
24
24
  export interface Torrent {
25
25
  /**
26
26
  * Torrent name
@@ -187,10 +187,12 @@ export declare enum TorrentState {
187
187
  Error = "error",
188
188
  /**
189
189
  * Torrent is paused and has finished downloading
190
+ * ``pausedUP`` was renamed to ``stoppedUP`` in Web API v2.11.0
190
191
  */
191
192
  PausedUP = "pausedUP",
192
193
  /**
193
194
  * Torrent is paused and has NOT finished downloading
195
+ * ``pausedDL`` was renamed to ``stoppedDL`` in Web API v2.11.0
194
196
  */
195
197
  PausedDL = "pausedDL",
196
198
  /**
@@ -221,6 +223,14 @@ export declare enum TorrentState {
221
223
  * Torrent is being downloaded and data is being transferred
222
224
  */
223
225
  Downloading = "downloading",
226
+ /**
227
+ * Torrent has been stopped while downloading
228
+ */
229
+ StoppedDL = "stoppedDL",
230
+ /**
231
+ * Torrent has been stopped while downloading
232
+ */
233
+ StoppedUP = "stoppedUP",
224
234
  /**
225
235
  * Torrent is being downloaded, but no connection were made
226
236
  */
package/dist/src/types.js CHANGED
@@ -6,10 +6,12 @@ export var TorrentState;
6
6
  TorrentState["Error"] = "error";
7
7
  /**
8
8
  * Torrent is paused and has finished downloading
9
+ * ``pausedUP`` was renamed to ``stoppedUP`` in Web API v2.11.0
9
10
  */
10
11
  TorrentState["PausedUP"] = "pausedUP";
11
12
  /**
12
13
  * Torrent is paused and has NOT finished downloading
14
+ * ``pausedDL`` was renamed to ``stoppedDL`` in Web API v2.11.0
13
15
  */
14
16
  TorrentState["PausedDL"] = "pausedDL";
15
17
  /**
@@ -40,6 +42,14 @@ export var TorrentState;
40
42
  * Torrent is being downloaded and data is being transferred
41
43
  */
42
44
  TorrentState["Downloading"] = "downloading";
45
+ /**
46
+ * Torrent has been stopped while downloading
47
+ */
48
+ TorrentState["StoppedDL"] = "stoppedDL";
49
+ /**
50
+ * Torrent has been stopped while downloading
51
+ */
52
+ TorrentState["StoppedUP"] = "stoppedUP";
43
53
  /**
44
54
  * Torrent is being downloaded, but no connection were made
45
55
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/qbittorrent",
3
- "version": "9.3.0",
3
+ "version": "9.5.0",
4
4
  "description": "TypeScript api wrapper for qbittorrent using got",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "license": "MIT",
@@ -42,23 +42,23 @@
42
42
  "cookie": "^1.0.2",
43
43
  "node-fetch-native": "^1.6.6",
44
44
  "ofetch": "^1.4.1",
45
- "type-fest": "^4.34.1",
45
+ "type-fest": "^4.39.1",
46
46
  "ufo": "^1.5.4",
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.2",
52
- "@eslint/compat": "^1.2.6",
51
+ "@ctrl/eslint-config-biome": "4.3.4",
52
+ "@eslint/compat": "^1.2.8",
53
53
  "@sindresorhus/tsconfig": "7.0.0",
54
54
  "@types/cookie": "1.0.0",
55
- "@types/node": "22.13.1",
56
- "@vitest/coverage-v8": "3.0.5",
57
- "eslint": "^9.20.1",
55
+ "@types/node": "22.14.0",
56
+ "@vitest/coverage-v8": "3.1.1",
57
+ "eslint": "^9.23.0",
58
58
  "p-wait-for": "5.0.2",
59
- "typedoc": "0.27.7",
60
- "typescript": "5.7.3",
61
- "vitest": "3.0.5"
59
+ "typedoc": "0.28.1",
60
+ "typescript": "5.8.2",
61
+ "vitest": "3.1.1"
62
62
  },
63
63
  "release": {
64
64
  "branches": [