@remote-app/transmission-client 0.0.3 → 0.0.4
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/{lib → dist}/client.d.ts +0 -0
- package/dist/client.js +45 -0
- package/{lib → dist}/config.d.ts +0 -0
- package/{lib → dist}/config.js +0 -0
- package/{lib → dist}/index.d.ts +0 -0
- package/{lib → dist}/index.js +0 -0
- package/{lib → dist}/rpc-call.d.ts +0 -0
- package/{lib → dist}/rpc-call.js +0 -0
- package/{lib → dist}/rpc-calls/free-space.d.ts +0 -0
- package/{lib → dist}/rpc-calls/free-space.js +0 -0
- package/{lib → dist}/rpc-calls/session-get.d.ts +0 -0
- package/{lib → dist}/rpc-calls/session-get.js +0 -0
- package/{lib → dist}/rpc-calls/session-set.d.ts +0 -0
- package/{lib → dist}/rpc-calls/session-set.js +0 -0
- package/{lib → dist}/rpc-calls/session-stats.d.ts +0 -0
- package/{lib → dist}/rpc-calls/session-stats.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-add.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-add.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-get.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-get.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-reannounce.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-reannounce.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-remove.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-remove.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-set-location.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-set-location.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-set.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-set.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-start-now.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-start-now.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-start.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-start.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-stop.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-stop.js +0 -0
- package/{lib → dist}/rpc-calls/torrent-verify.d.ts +0 -0
- package/{lib → dist}/rpc-calls/torrent-verify.js +0 -0
- package/{lib → dist}/rpc-calls/utils.d.ts +0 -0
- package/{lib → dist}/rpc-calls/utils.js +0 -0
- package/package.json +4 -5
- package/lib/client.js +0 -34
- package/src/client.ts +0 -48
- package/src/config.ts +0 -5
- package/src/index.ts +0 -27
- package/src/rpc-call.ts +0 -76
- package/src/rpc-calls/free-space.ts +0 -8
- package/src/rpc-calls/session-get.ts +0 -59
- package/src/rpc-calls/session-set.ts +0 -3
- package/src/rpc-calls/session-stats.ts +0 -25
- package/src/rpc-calls/torrent-add.ts +0 -23
- package/src/rpc-calls/torrent-get.ts +0 -169
- package/src/rpc-calls/torrent-reannounce.ts +0 -2
- package/src/rpc-calls/torrent-remove.ts +0 -5
- package/src/rpc-calls/torrent-set-location.ts +0 -6
- package/src/rpc-calls/torrent-set.ts +0 -26
- package/src/rpc-calls/torrent-start-now.ts +0 -1
- package/src/rpc-calls/torrent-start.ts +0 -1
- package/src/rpc-calls/torrent-stop.ts +0 -1
- package/src/rpc-calls/torrent-verify.ts +0 -1
- package/src/rpc-calls/utils.ts +0 -3
package/{lib → dist}/client.d.ts
RENAMED
|
File without changes
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { encode } from "base-64";
|
|
11
|
+
export class TransmissionClient {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.session = null;
|
|
15
|
+
}
|
|
16
|
+
request(body) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const headers = new Headers({
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
});
|
|
22
|
+
if (this.session) {
|
|
23
|
+
headers.set("x-transmission-session-id", this.session);
|
|
24
|
+
}
|
|
25
|
+
if (this.config.username || this.config.password) {
|
|
26
|
+
const creds = `${(_a = this.config.username) !== null && _a !== void 0 ? _a : ""}:${(_b = this.config.password) !== null && _b !== void 0 ? _b : ""}`;
|
|
27
|
+
headers.set("Authorization", `Basic ${encode(creds)}`);
|
|
28
|
+
}
|
|
29
|
+
const request = new Request(this.config.url, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers,
|
|
32
|
+
body: JSON.stringify(body),
|
|
33
|
+
});
|
|
34
|
+
const response = yield fetch(request);
|
|
35
|
+
if (response.status === 409) {
|
|
36
|
+
this.session = response.headers.get("x-transmission-session-id");
|
|
37
|
+
return yield this.request(body);
|
|
38
|
+
}
|
|
39
|
+
if (response.status >= 400) {
|
|
40
|
+
throw new Error(response.statusText);
|
|
41
|
+
}
|
|
42
|
+
return (yield response.json());
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
package/{lib → dist}/config.d.ts
RENAMED
|
File without changes
|
package/{lib → dist}/config.js
RENAMED
|
File without changes
|
package/{lib → dist}/index.d.ts
RENAMED
|
File without changes
|
package/{lib → dist}/index.js
RENAMED
|
File without changes
|
|
File without changes
|
package/{lib → dist}/rpc-call.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remote-app/transmission-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Transmission RPC client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
"url": "https://github.com/jgalat/remote-app",
|
|
9
9
|
"directory": "packages/transmission-client"
|
|
10
10
|
},
|
|
11
|
-
"main": "
|
|
12
|
-
"types": "
|
|
13
|
-
"
|
|
14
|
-
"files": ["src", "lib"],
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": ["dist"],
|
|
15
14
|
"scripts": {
|
|
16
15
|
"build": "tsc --build"
|
|
17
16
|
},
|
package/lib/client.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { encode } from "base-64";
|
|
2
|
-
export class TransmissionClient {
|
|
3
|
-
constructor(config) {
|
|
4
|
-
this.config = config;
|
|
5
|
-
this.session = null;
|
|
6
|
-
}
|
|
7
|
-
async request(body) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const headers = new Headers({
|
|
10
|
-
"Content-Type": "application/json",
|
|
11
|
-
});
|
|
12
|
-
if (this.session) {
|
|
13
|
-
headers.set("x-transmission-session-id", this.session);
|
|
14
|
-
}
|
|
15
|
-
if (this.config.username || this.config.password) {
|
|
16
|
-
const creds = `${(_a = this.config.username) !== null && _a !== void 0 ? _a : ""}:${(_b = this.config.password) !== null && _b !== void 0 ? _b : ""}`;
|
|
17
|
-
headers.set("Authorization", `Basic ${encode(creds)}`);
|
|
18
|
-
}
|
|
19
|
-
const request = new Request(this.config.url, {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers,
|
|
22
|
-
body: JSON.stringify(body),
|
|
23
|
-
});
|
|
24
|
-
const response = await fetch(request);
|
|
25
|
-
if (response.status === 409) {
|
|
26
|
-
this.session = response.headers.get("x-transmission-session-id");
|
|
27
|
-
return await this.request(body);
|
|
28
|
-
}
|
|
29
|
-
if (response.status >= 400) {
|
|
30
|
-
throw new Error(response.statusText);
|
|
31
|
-
}
|
|
32
|
-
return (await response.json());
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/client.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { encode } from "base-64";
|
|
2
|
-
|
|
3
|
-
import type { TransmissionConfig } from "./config";
|
|
4
|
-
import type { Methods, Mapping } from "./rpc-call";
|
|
5
|
-
|
|
6
|
-
export class TransmissionClient {
|
|
7
|
-
private session: string | null = null;
|
|
8
|
-
|
|
9
|
-
constructor(private config: TransmissionConfig) {}
|
|
10
|
-
|
|
11
|
-
async request<M extends Methods>(
|
|
12
|
-
body: Mapping[M][0] & { method: M }
|
|
13
|
-
): Promise<Mapping[M][1]> {
|
|
14
|
-
const headers = new Headers({
|
|
15
|
-
"Content-Type": "application/json",
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
if (this.session) {
|
|
19
|
-
headers.set("x-transmission-session-id", this.session);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (this.config.username || this.config.password) {
|
|
23
|
-
const creds = `${this.config.username ?? ""}:${
|
|
24
|
-
this.config.password ?? ""
|
|
25
|
-
}`;
|
|
26
|
-
headers.set("Authorization", `Basic ${encode(creds)}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const request: Request = new Request(this.config.url, {
|
|
30
|
-
method: "POST",
|
|
31
|
-
headers,
|
|
32
|
-
body: JSON.stringify(body),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const response: Response = await fetch(request);
|
|
36
|
-
|
|
37
|
-
if (response.status === 409) {
|
|
38
|
-
this.session = response.headers.get("x-transmission-session-id");
|
|
39
|
-
return await this.request<M>(body);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (response.status >= 400) {
|
|
43
|
-
throw new Error(response.statusText);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (await response.json()) as Mapping[M][1];
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/config.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type { Response as SessionGetResponse } from "./rpc-calls/session-get";
|
|
2
|
-
export type { Request as SessionSetRequest } from "./rpc-calls/session-set";
|
|
3
|
-
export type { Response as SessionStatsResponse } from "./rpc-calls/session-stats";
|
|
4
|
-
export type {
|
|
5
|
-
Request as FreeSpaceRequest,
|
|
6
|
-
Response as FreeSpaceResponse,
|
|
7
|
-
} from "./rpc-calls/free-space";
|
|
8
|
-
export type { Request as TorrentStartRequest } from "./rpc-calls/torrent-start";
|
|
9
|
-
export type { Request as TorrentStartNowRequest } from "./rpc-calls/torrent-start-now";
|
|
10
|
-
export type { Request as TorrentStopRequest } from "./rpc-calls/torrent-stop";
|
|
11
|
-
export type { Request as TorrentVerifyRequest } from "./rpc-calls/torrent-verify";
|
|
12
|
-
export type { Request as TorrentReannounceRequest } from "./rpc-calls/torrent-reannounce";
|
|
13
|
-
export type { Request as TorrentSetRequest } from "./rpc-calls/torrent-set";
|
|
14
|
-
export type {
|
|
15
|
-
Request as TorrentGetRequest,
|
|
16
|
-
Response as TorrentGetResponse,
|
|
17
|
-
} from "./rpc-calls/torrent-get";
|
|
18
|
-
export type {
|
|
19
|
-
Request as TorrentAddRequest,
|
|
20
|
-
Response as TorrentAddResponse,
|
|
21
|
-
} from "./rpc-calls/torrent-add";
|
|
22
|
-
export type { Request as TorrentRemoveRequest } from "./rpc-calls/torrent-remove";
|
|
23
|
-
export type { Request as TorrentSetLocationRequest } from "./rpc-calls/torrent-set-location";
|
|
24
|
-
|
|
25
|
-
export type { Methods } from "./rpc-call";
|
|
26
|
-
|
|
27
|
-
export { TransmissionClient as default } from "./client";
|
package/src/rpc-call.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { Response as SessionGetResponse } from "./rpc-calls/session-get";
|
|
2
|
-
import type { Request as SessionSetRequest } from "./rpc-calls/session-set";
|
|
3
|
-
import type { Response as SessionStatsResponse } from "./rpc-calls/session-stats";
|
|
4
|
-
import type {
|
|
5
|
-
Request as FreeSpaceRequest,
|
|
6
|
-
Response as FreeSpaceResponse,
|
|
7
|
-
} from "./rpc-calls/free-space";
|
|
8
|
-
import type { Request as TorrentStartRequest } from "./rpc-calls/torrent-start";
|
|
9
|
-
import type { Request as TorrentStartNowRequest } from "./rpc-calls/torrent-start-now";
|
|
10
|
-
import type { Request as TorrentStopRequest } from "./rpc-calls/torrent-stop";
|
|
11
|
-
import type { Request as TorrentVerifyRequest } from "./rpc-calls/torrent-verify";
|
|
12
|
-
import type { Request as TorrentReannounceRequest } from "./rpc-calls/torrent-reannounce";
|
|
13
|
-
import type { Request as TorrentSetRequest } from "./rpc-calls/torrent-set";
|
|
14
|
-
import type {
|
|
15
|
-
Request as TorrentGetRequest,
|
|
16
|
-
Response as TorrentGetResponse,
|
|
17
|
-
} from "./rpc-calls/torrent-get";
|
|
18
|
-
import type {
|
|
19
|
-
Request as TorrentAddRequest,
|
|
20
|
-
Response as TorrentAddResponse,
|
|
21
|
-
} from "./rpc-calls/torrent-add";
|
|
22
|
-
import type { Request as TorrentRemoveRequest } from "./rpc-calls/torrent-remove";
|
|
23
|
-
import type { Request as TorrentSetLocationRequest } from "./rpc-calls/torrent-set-location";
|
|
24
|
-
|
|
25
|
-
type SessionMethods =
|
|
26
|
-
| "session-get"
|
|
27
|
-
| "session-set"
|
|
28
|
-
| "session-stats"
|
|
29
|
-
| "free-space";
|
|
30
|
-
|
|
31
|
-
type TorrentMethods =
|
|
32
|
-
| "torrent-start"
|
|
33
|
-
| "torrent-start-now"
|
|
34
|
-
| "torrent-stop"
|
|
35
|
-
| "torrent-verify"
|
|
36
|
-
| "torrent-reannounce"
|
|
37
|
-
| "torrent-set"
|
|
38
|
-
| "torrent-get"
|
|
39
|
-
| "torrent-add"
|
|
40
|
-
| "torrent-remove"
|
|
41
|
-
| "torrent-set-location";
|
|
42
|
-
|
|
43
|
-
export type Methods = SessionMethods | TorrentMethods;
|
|
44
|
-
|
|
45
|
-
export type RPCRequest<A> = {
|
|
46
|
-
method: Methods;
|
|
47
|
-
arguments?: A;
|
|
48
|
-
tag?: number;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type RPCResponse<B> = {
|
|
52
|
-
result: "success" | string;
|
|
53
|
-
arguments?: B;
|
|
54
|
-
tag?: number;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type RPCCall<A, B = void> = B extends void
|
|
58
|
-
? [RPCRequest<A>, void]
|
|
59
|
-
: [RPCRequest<A>, RPCResponse<B>];
|
|
60
|
-
|
|
61
|
-
export type Mapping = {
|
|
62
|
-
"session-get": RPCCall<never, SessionGetResponse>;
|
|
63
|
-
"session-set": RPCCall<SessionSetRequest>;
|
|
64
|
-
"session-stats": RPCCall<never, SessionStatsResponse>;
|
|
65
|
-
"free-space": RPCCall<FreeSpaceRequest, FreeSpaceResponse>;
|
|
66
|
-
"torrent-start": RPCCall<TorrentStartRequest>;
|
|
67
|
-
"torrent-start-now": RPCCall<TorrentStartNowRequest>;
|
|
68
|
-
"torrent-stop": RPCCall<TorrentStopRequest>;
|
|
69
|
-
"torrent-verify": RPCCall<TorrentVerifyRequest>;
|
|
70
|
-
"torrent-reannounce": RPCCall<TorrentReannounceRequest>;
|
|
71
|
-
"torrent-remove": RPCCall<TorrentRemoveRequest>;
|
|
72
|
-
"torrent-set-location": RPCCall<TorrentSetLocationRequest>;
|
|
73
|
-
"torrent-get": RPCCall<TorrentGetRequest, TorrentGetResponse>;
|
|
74
|
-
"torrent-add": RPCCall<TorrentAddRequest, TorrentAddResponse>;
|
|
75
|
-
"torrent-set": RPCCall<TorrentSetRequest>;
|
|
76
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
type Units = {
|
|
2
|
-
"speed-units": string[];
|
|
3
|
-
"speed-bytes": number;
|
|
4
|
-
"size-units": string[];
|
|
5
|
-
"size-bytes": number;
|
|
6
|
-
"memory-units": string[];
|
|
7
|
-
"memory-bytes": number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type Response = {
|
|
11
|
-
"alt-speed-down": number;
|
|
12
|
-
"alt-speed-enabled": boolean;
|
|
13
|
-
"alt-speed-time-begin": number;
|
|
14
|
-
"alt-speed-time-enabled": boolean;
|
|
15
|
-
"alt-speed-time-end": number;
|
|
16
|
-
"alt-speed-time-day": number;
|
|
17
|
-
"alt-speed-up": number;
|
|
18
|
-
"blocklist-url": string;
|
|
19
|
-
"blocklist-enabled": boolean;
|
|
20
|
-
"blocklist-size": number;
|
|
21
|
-
"cache-size-mb": number;
|
|
22
|
-
"config-dir": string;
|
|
23
|
-
"download-dir": string;
|
|
24
|
-
"download-queue-size": number;
|
|
25
|
-
"download-queue-enabled": boolean;
|
|
26
|
-
"dht-enabled": boolean;
|
|
27
|
-
encryption: string;
|
|
28
|
-
"idle-seeding-limit": number;
|
|
29
|
-
"idle-seeding-limit-enabled": boolean;
|
|
30
|
-
"incomplete-dir": string;
|
|
31
|
-
"incomplete-dir-enabled": boolean;
|
|
32
|
-
"lpd-enabled": boolean;
|
|
33
|
-
"peer-limit-global": number;
|
|
34
|
-
"peer-limit-per-torrent": number;
|
|
35
|
-
"pex-enabled": boolean;
|
|
36
|
-
"peer-port": number;
|
|
37
|
-
"peer-port-random-on-start": boolean;
|
|
38
|
-
"port-forwarding-enabled": boolean;
|
|
39
|
-
"queue-stalled-enabled": boolean;
|
|
40
|
-
"queue-stalled-minutes": number;
|
|
41
|
-
"rename-partial-files": boolean;
|
|
42
|
-
"rpc-version": number;
|
|
43
|
-
"rpc-version-minimum": number;
|
|
44
|
-
"script-torrent-done-filename": string;
|
|
45
|
-
"script-torrent-done-enabled": boolean;
|
|
46
|
-
seedRatioLimit: number;
|
|
47
|
-
seedRatioLimited: boolean;
|
|
48
|
-
"seed-queue-size": number;
|
|
49
|
-
"seed-queue-enabled": boolean;
|
|
50
|
-
"speed-limit-down": number;
|
|
51
|
-
"speed-limit-down-enabled": boolean;
|
|
52
|
-
"speed-limit-up": number;
|
|
53
|
-
"speed-limit-up-enabled": boolean;
|
|
54
|
-
"start-added-torrents": boolean;
|
|
55
|
-
"trash-original-torrent-files": boolean;
|
|
56
|
-
units: Units;
|
|
57
|
-
"utp-enabled": boolean;
|
|
58
|
-
version: string;
|
|
59
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type CurrentStats = {
|
|
2
|
-
uploadedBytes: number;
|
|
3
|
-
downloadedBytes: number;
|
|
4
|
-
filesAdded: number;
|
|
5
|
-
sessionCount: number;
|
|
6
|
-
secondsActive: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type CumulativeStats = {
|
|
10
|
-
uploadedBytes: number;
|
|
11
|
-
downloadedBytes: number;
|
|
12
|
-
filesAdded: number;
|
|
13
|
-
sessionCount: number;
|
|
14
|
-
secondsActive: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type Response = {
|
|
18
|
-
activeTorrentCount: number;
|
|
19
|
-
downloadSpeed: number;
|
|
20
|
-
pausedTorrentCount: number;
|
|
21
|
-
torrentCount: number;
|
|
22
|
-
uploadSpeed: number;
|
|
23
|
-
"cumulative-stats": CumulativeStats;
|
|
24
|
-
"current-stats": CurrentStats;
|
|
25
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Response as TorrentAddResponse } from "./torrent-get";
|
|
2
|
-
|
|
3
|
-
export type Request = {
|
|
4
|
-
cookies?: string;
|
|
5
|
-
"download-dir": string;
|
|
6
|
-
filename?: string;
|
|
7
|
-
metainfo?: string;
|
|
8
|
-
paused?: boolean;
|
|
9
|
-
"peer-limit"?: number;
|
|
10
|
-
bandwidthPriority?: number;
|
|
11
|
-
"files-wanted"?: number[];
|
|
12
|
-
"files-unwanted"?: number[];
|
|
13
|
-
"priority-high"?: number[];
|
|
14
|
-
"priority-low"?: number[];
|
|
15
|
-
"priority-normal"?: number[];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type Response = {
|
|
19
|
-
torrents: Pick<
|
|
20
|
-
TorrentAddResponse["torrents"][number],
|
|
21
|
-
"id" | "name" | "hashString"
|
|
22
|
-
>[];
|
|
23
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Identifiers } from "./utils";
|
|
2
|
-
|
|
3
|
-
type File = {
|
|
4
|
-
bytesCompleted: number;
|
|
5
|
-
length: number;
|
|
6
|
-
name: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type FileStats = {
|
|
10
|
-
bytesCompleted: number;
|
|
11
|
-
wanted: boolean;
|
|
12
|
-
priority: number;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type Label = {
|
|
16
|
-
label: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type Peer = {
|
|
20
|
-
address: string;
|
|
21
|
-
clientName: string;
|
|
22
|
-
clientIsChoked: boolean;
|
|
23
|
-
clientIsInterested: boolean;
|
|
24
|
-
flagStr: string;
|
|
25
|
-
isDownloadingFrom: boolean;
|
|
26
|
-
isEncrypted: boolean;
|
|
27
|
-
isIncoming: boolean;
|
|
28
|
-
isUploadingTo: boolean;
|
|
29
|
-
isUTP: boolean;
|
|
30
|
-
peerIsChoked: boolean;
|
|
31
|
-
peerIsInterested: boolean;
|
|
32
|
-
port: number;
|
|
33
|
-
progress: number;
|
|
34
|
-
rateToClient: number;
|
|
35
|
-
rateToPeer: number;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
type PeersFrom = {
|
|
39
|
-
fromCache: number;
|
|
40
|
-
fromDht: number;
|
|
41
|
-
fromIncoming: number;
|
|
42
|
-
fromLpd: number;
|
|
43
|
-
fromLtep: number;
|
|
44
|
-
fromPex: number;
|
|
45
|
-
fromTracker: number;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type Tracker = {
|
|
49
|
-
announce: string;
|
|
50
|
-
id: number;
|
|
51
|
-
scrape: string;
|
|
52
|
-
tier: number;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
type TrackerStats = {
|
|
56
|
-
announce: string;
|
|
57
|
-
announceState: number;
|
|
58
|
-
downloadCount: number;
|
|
59
|
-
hasAnnounced: boolean;
|
|
60
|
-
hasScraped: boolean;
|
|
61
|
-
host: string;
|
|
62
|
-
id: number;
|
|
63
|
-
isBackup: boolean;
|
|
64
|
-
lastAnnouncePeerCount: number;
|
|
65
|
-
lastAnnounceResult: string;
|
|
66
|
-
lastAnnounceStartTime: number;
|
|
67
|
-
lastAnnounceSucceeded: boolean;
|
|
68
|
-
lastAnnounceTime: number;
|
|
69
|
-
lastAnnounceTimedOut: boolean;
|
|
70
|
-
lastScrapeResult: string;
|
|
71
|
-
lastScrapeStartTime: number;
|
|
72
|
-
lastScrapeSucceeded: boolean;
|
|
73
|
-
lastScrapeTime: number;
|
|
74
|
-
lastScrapeTimedOut: boolean;
|
|
75
|
-
leecherCount: number;
|
|
76
|
-
nextAnnounceTime: number;
|
|
77
|
-
nextScrapeTime: number;
|
|
78
|
-
scrape: string;
|
|
79
|
-
scrapeState: number;
|
|
80
|
-
seederCount: number;
|
|
81
|
-
tier: number;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
type WebSeed = {
|
|
85
|
-
webseed: string;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
type Torrent = {
|
|
89
|
-
activityDate: number;
|
|
90
|
-
addedDate: number;
|
|
91
|
-
bandwidthPriority: number;
|
|
92
|
-
comment: string;
|
|
93
|
-
corruptEver: number;
|
|
94
|
-
creator: string;
|
|
95
|
-
dateCreated: number;
|
|
96
|
-
desiredAvailable: number;
|
|
97
|
-
doneDate: number;
|
|
98
|
-
downloadDir: string;
|
|
99
|
-
downloadedEver: number;
|
|
100
|
-
downloadLimit: number;
|
|
101
|
-
downloadLimited: boolean;
|
|
102
|
-
editDate: number;
|
|
103
|
-
error: number;
|
|
104
|
-
errorString: string;
|
|
105
|
-
eta: number;
|
|
106
|
-
etaIdle: number;
|
|
107
|
-
"file-count": number;
|
|
108
|
-
files: File[];
|
|
109
|
-
fileStats: FileStats[];
|
|
110
|
-
hashString: string;
|
|
111
|
-
haveUnchecked: number;
|
|
112
|
-
haveValid: number;
|
|
113
|
-
honorsSessionLimits: boolean;
|
|
114
|
-
id: number;
|
|
115
|
-
isFinished: boolean;
|
|
116
|
-
isPrivate: boolean;
|
|
117
|
-
isStalled: boolean;
|
|
118
|
-
labels: Label[];
|
|
119
|
-
leftUntilDone: number;
|
|
120
|
-
magnetLink: string;
|
|
121
|
-
manualAnnounceTime: number;
|
|
122
|
-
maxConnectedPeers: number;
|
|
123
|
-
metadataPercentComplete: number;
|
|
124
|
-
name: string;
|
|
125
|
-
peerLimit: number;
|
|
126
|
-
peers: Peer[];
|
|
127
|
-
peersConnected: number;
|
|
128
|
-
peersFrom: PeersFrom;
|
|
129
|
-
peersGettingFromUs: number;
|
|
130
|
-
peersSendingToUs: number;
|
|
131
|
-
percentDone: number;
|
|
132
|
-
pieces: string;
|
|
133
|
-
pieceCount: number;
|
|
134
|
-
pieceSize: number;
|
|
135
|
-
priorities: any[];
|
|
136
|
-
"primary-mime-type": string;
|
|
137
|
-
queuePosition: number;
|
|
138
|
-
rateDownload: number;
|
|
139
|
-
rateUpload: number;
|
|
140
|
-
recheckProgress: number;
|
|
141
|
-
secondsDownloading: number;
|
|
142
|
-
secondsSeeding: number;
|
|
143
|
-
seedIdleLimit: number;
|
|
144
|
-
seedIdleMode: number;
|
|
145
|
-
seedRatioLimit: number;
|
|
146
|
-
seedRatioMode: number;
|
|
147
|
-
sizeWhenDone: number;
|
|
148
|
-
startDate: number;
|
|
149
|
-
status: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
150
|
-
trackers: Tracker[];
|
|
151
|
-
trackerStats: TrackerStats[];
|
|
152
|
-
totalSize: number;
|
|
153
|
-
torrentFile: string;
|
|
154
|
-
uploadedEver: number;
|
|
155
|
-
uploadLimit: number;
|
|
156
|
-
uploadLimited: boolean;
|
|
157
|
-
uploadRatio: number;
|
|
158
|
-
wanted: boolean[];
|
|
159
|
-
webseeds: WebSeed[];
|
|
160
|
-
webseedsSendingToUs: number;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export type Response = {
|
|
164
|
-
torrents: Torrent[];
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export type Request = Identifiers & {
|
|
168
|
-
fields: (keyof Torrent)[];
|
|
169
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Identifiers } from "./utils";
|
|
2
|
-
|
|
3
|
-
export type Request = Identifiers & {
|
|
4
|
-
bandwidthPriority?: number;
|
|
5
|
-
downloadLimit?: number;
|
|
6
|
-
downloadLimited?: boolean;
|
|
7
|
-
"files-wanted"?: number[];
|
|
8
|
-
"files-unwanted"?: number[];
|
|
9
|
-
honorsSessionLimits?: boolean;
|
|
10
|
-
labels?: any[];
|
|
11
|
-
location?: string;
|
|
12
|
-
peerLimit?: number;
|
|
13
|
-
"priority-high"?: any[];
|
|
14
|
-
"priority-low"?: any[];
|
|
15
|
-
"priority-normal"?: any[];
|
|
16
|
-
queuePosition?: number;
|
|
17
|
-
seedIdleLimit?: number;
|
|
18
|
-
seedIdleMode?: number;
|
|
19
|
-
seedRatioLimit?: number;
|
|
20
|
-
seedRatioMode?: number;
|
|
21
|
-
trackerAdd?: any[];
|
|
22
|
-
trackerRemove?: number[];
|
|
23
|
-
trackerReplace?: any[];
|
|
24
|
-
uploadLimit?: number;
|
|
25
|
-
uploadLimited?: boolean;
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Identifiers as Request } from "./utils";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Identifiers as Request } from "./utils";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Identifiers as Request } from "./utils";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Identifiers as Request } from "./utils";
|
package/src/rpc-calls/utils.ts
DELETED