@ctrl/nzbget 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Scott Cooper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # NZBGet
2
+
3
+ > TypeScript api wrapper for [NZBGet](https://nzbget.com/) using JSON-RPC
4
+
5
+ ### Overview
6
+
7
+ Includes the normalized usenet API shared with `@ctrl/sabnzbd`:
8
+
9
+ - [`getAllData()`](#getalldata)
10
+ - [`getQueue()`](#getqueue)
11
+ - [`getHistory()`](#gethistory)
12
+ - [`getQueueJob(id)`](#getqueuejobid)
13
+ - [`getHistoryJob(id)`](#gethistoryjobid)
14
+ - [`findJob(id)`](#findjobid)
15
+ - [`addNzbFile(...)` / `addNzbUrl(...)`](#addnzbfile--addnzburl)
16
+ - [`normalizedAddNzb(...)`](#normalizedaddnzb)
17
+ - queue control methods return `boolean`
18
+ - `addNzbFile` and `addNzbUrl` return the normalized queue id as a `string`
19
+
20
+ Use the normalized methods by default. Drop to the native NZBGet methods only when you need JSON-RPC specific behavior such as raw config access, raw `editQueue` commands, or direct `append` usage.
21
+
22
+ ### Install
23
+
24
+ ```console
25
+ npm install @ctrl/nzbget
26
+ ```
27
+
28
+ ### Use
29
+
30
+ ```ts
31
+ import { Nzbget } from '@ctrl/nzbget';
32
+
33
+ const client = new Nzbget({
34
+ baseUrl: 'http://localhost:6789/',
35
+ username: 'nzbget',
36
+ password: 'tegbzn6789',
37
+ });
38
+
39
+ async function main() {
40
+ const data = await client.getAllData();
41
+ console.log(data.queue);
42
+ }
43
+ ```
44
+
45
+ ### Normalized Example
46
+
47
+ ```ts
48
+ import { Nzbget, UsenetNotFoundError, UsenetPriority } from '@ctrl/nzbget';
49
+
50
+ const client = new Nzbget({
51
+ baseUrl: 'http://localhost:6789/',
52
+ username: 'nzbget',
53
+ password: 'tegbzn6789',
54
+ });
55
+
56
+ async function main() {
57
+ const id = await client.addNzbUrl('https://example.test/release.nzb', {
58
+ category: 'movies',
59
+ priority: UsenetPriority.high,
60
+ startPaused: false,
61
+ });
62
+
63
+ try {
64
+ const job = await client.getQueueJob(id);
65
+ console.log(job.state, job.progress);
66
+ } catch (error) {
67
+ if (error instanceof UsenetNotFoundError) {
68
+ console.log('job missing', error.id);
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ ### API
75
+
76
+ Docs: https://nzbget.ep.workers.dev
77
+ NZBGet API Docs: https://nzbget.net/api/
78
+
79
+ ### Normalized Methods
80
+
81
+ ##### `getAllData()`
82
+
83
+ Returns queue, history, categories, scripts, and status in normalized form. This is the broadest normalized read and fits best when you want an overview in one call.
84
+
85
+ ##### `getQueue()`
86
+
87
+ Returns normalized active queue items.
88
+
89
+ ##### `getHistory()`
90
+
91
+ Returns normalized history items.
92
+
93
+ ##### `getQueueJob(id)`
94
+
95
+ Returns one normalized active queue item. Missing ids throw `UsenetNotFoundError`.
96
+
97
+ ##### `getHistoryJob(id)`
98
+
99
+ Returns one normalized history item. Missing ids throw `UsenetNotFoundError`.
100
+
101
+ ##### `findJob(id)`
102
+
103
+ Searches queue first, then history, and returns `{ source, job }` or `null`. It is the convenient path when you do not know which side the id should be on.
104
+
105
+ ##### `addNzbFile(...)` / `addNzbUrl(...)`
106
+
107
+ Add an NZB and return the normalized queue id as a `string`. These are the lighter add helpers when an id is enough.
108
+ The normalized add option names are `category`, `priority`, `postProcess`, `postProcessScript`, `name`, `password`, and `startPaused`.
109
+
110
+ ##### `normalizedAddNzb(...)`
111
+
112
+ Add an NZB from either a URL or file content and return the created normalized queue item. This is the higher-level add helper when you want the normalized job back immediately.
113
+
114
+ ##### Normalized state labels
115
+
116
+ `stateMessage` uses the shared `UsenetStateMessage` vocabulary:
117
+ `Grabbing`, `Queued`, `Downloading`, `Paused`, `Post-processing`, `Completed`, `Failed`, `Warning`, `Deleted`, and `Unknown`.
118
+
119
+ ### Native API
120
+
121
+ NZBGet-specific methods are still available when you need the raw JSON-RPC surface.
122
+
123
+ Connection and discovery:
124
+
125
+ - `getVersion()` - wraps [`version`](https://nzbget-ng.github.io/api/version)
126
+ - `status()` - wraps [`status`](https://nzbget-ng.github.io/api/status)
127
+ - `listGroups()` - wraps [`listgroups`](https://nzbget-ng.github.io/api/listgroups)
128
+ - `history(hidden?)` - wraps [`history`](https://nzbget-ng.github.io/api/history)
129
+ - `getConfig()` - wraps [`config`](https://nzbget-ng.github.io/api/config)
130
+ - `configTemplates(loadFromDisk?)` - wraps [`configtemplates`](https://nzbget-ng.github.io/api/configtemplates)
131
+ - `listFiles(id)` - wraps [`listfiles`](https://nzbget-ng.github.io/api/listfiles)
132
+ - `getCategories()` - derived from [`config`](https://nzbget-ng.github.io/api/config)
133
+ - `getScripts()` - derived from [`configtemplates`](https://nzbget-ng.github.io/api/configtemplates)
134
+
135
+ Queue and rate control:
136
+
137
+ - `pauseDownload()` - wraps [`pausedownload`](https://nzbget-ng.github.io/api/pausedownload)
138
+ - `resumeDownload()` - wraps [`resumedownload`](https://nzbget-ng.github.io/api/resumedownload)
139
+ - `setRate(limitBytesPerSecond)` - wraps [`rate`](https://nzbget-ng.github.io/api/rate)
140
+ - `append(name, contentOrUrl, options?)` - wraps [`append`](https://nzbget-ng.github.io/api/append)
141
+ - `editQueue(command, parameter, ids)` - wraps [`editqueue`](https://nzbget-ng.github.io/api/editqueue)
142
+
143
+ ### State Export
144
+
145
+ ```ts
146
+ const state = client.exportState();
147
+ const restored = Nzbget.createFromState(config, state);
148
+ ```
149
+
150
+ ### Local Testing
151
+
152
+ Start a disposable NZBGet container on `localhost:6789` with the same credentials used by the client defaults:
153
+
154
+ ```console
155
+ docker run -d --name nzbget-local-test \
156
+ -p 6789:6789 \
157
+ -e NZBGET_USER=nzbget \
158
+ -e NZBGET_PASS=tegbzn6789 \
159
+ lscr.io/linuxserver/nzbget:latest
160
+ ```
161
+
162
+ Run the full local test suite against that container:
163
+
164
+ ```console
165
+ TEST_NZBGET_URL=http://127.0.0.1:6789 TEST_NZBGET_USERNAME=nzbget TEST_NZBGET_PASSWORD=tegbzn6789 pnpm test
166
+ ```
167
+
168
+ If you only want the container-backed integration spec:
169
+
170
+ ```console
171
+ TEST_NZBGET_URL=http://127.0.0.1:6789 TEST_NZBGET_USERNAME=nzbget TEST_NZBGET_PASSWORD=tegbzn6789 pnpm test test/integration.spec.ts
172
+ ```
173
+
174
+ Remove the disposable container when you are done:
175
+
176
+ ```console
177
+ docker rm -f nzbget-local-test
178
+ ```
@@ -0,0 +1,4 @@
1
+ export * from '@ctrl/shared-usenet';
2
+ export * from './types.js';
3
+ export * from './normalizeUsenetData.js';
4
+ export * from './nzbget.js';
@@ -0,0 +1,4 @@
1
+ export * from '@ctrl/shared-usenet';
2
+ export * from './types.js';
3
+ export * from './normalizeUsenetData.js';
4
+ export * from './nzbget.js';
@@ -0,0 +1,11 @@
1
+ import { type Category, type NormalizedUsenetHistoryItem, type NormalizedUsenetJob, type NormalizedUsenetStatus, type Script, UsenetPriority } from '@ctrl/shared-usenet';
2
+ import type { NzbGetConfigItem, NzbGetSettings, NzbGetConfigTemplate, NzbGetHistoryItem, NzbGetQueueItem, NzbGetStatus } from './types.js';
3
+ export declare function combineInt64(high: number | undefined, low: number | undefined): number;
4
+ export declare function nzbgetPriorityToNormalized(priority: number): UsenetPriority;
5
+ export declare function normalizedPriorityToNzbget(priority: UsenetPriority | undefined): number;
6
+ export declare function normalizeNzbgetStatus(status: NzbGetStatus): NormalizedUsenetStatus;
7
+ export declare function normalizeNzbgetJob(item: NzbGetQueueItem, globalStatus: NzbGetStatus, queuePosition: number): NormalizedUsenetJob;
8
+ export declare function normalizeNzbgetHistoryItem(item: NzbGetHistoryItem): NormalizedUsenetHistoryItem;
9
+ export declare function configItemsToMap(items: NzbGetConfigItem[]): NzbGetSettings;
10
+ export declare function deriveCategories(configMap: NzbGetSettings): Category[];
11
+ export declare function deriveScripts(templates: NzbGetConfigTemplate[]): Script[];
@@ -0,0 +1,227 @@
1
+ import { UsenetJobState, UsenetPriority, UsenetStateMessage, } from '@ctrl/shared-usenet';
2
+ const SUCCESS_STATUSES = new Set(['SUCCESS', 'NONE']);
3
+ const DELETE_FAILED_STATUSES = new Set(['HEALTH', 'DUPE', 'SCAN', 'COPY', 'BAD']);
4
+ export function combineInt64(high, low) {
5
+ return Number(BigInt(high ?? 0) * 4294967296n + BigInt(low ?? 0));
6
+ }
7
+ function getParameterValue(parameters, name) {
8
+ const match = parameters?.find(parameter => parameter.Name === name);
9
+ return typeof match?.Value === 'string' ? match.Value : undefined;
10
+ }
11
+ export function nzbgetPriorityToNormalized(priority) {
12
+ switch (priority) {
13
+ case -100: {
14
+ return UsenetPriority.veryLow;
15
+ }
16
+ case -50: {
17
+ return UsenetPriority.low;
18
+ }
19
+ case 0: {
20
+ return UsenetPriority.normal;
21
+ }
22
+ case 50: {
23
+ return UsenetPriority.high;
24
+ }
25
+ case 100: {
26
+ return UsenetPriority.veryHigh;
27
+ }
28
+ case 900: {
29
+ return UsenetPriority.force;
30
+ }
31
+ default: {
32
+ return UsenetPriority.normal;
33
+ }
34
+ }
35
+ }
36
+ export function normalizedPriorityToNzbget(priority) {
37
+ switch (priority) {
38
+ case UsenetPriority.veryLow: {
39
+ return -100;
40
+ }
41
+ case UsenetPriority.low: {
42
+ return -50;
43
+ }
44
+ case UsenetPriority.high: {
45
+ return 50;
46
+ }
47
+ case UsenetPriority.veryHigh: {
48
+ return 100;
49
+ }
50
+ case UsenetPriority.force: {
51
+ return 900;
52
+ }
53
+ case UsenetPriority.paused: {
54
+ return 0;
55
+ }
56
+ case UsenetPriority.normal:
57
+ case UsenetPriority.default:
58
+ default: {
59
+ return 0;
60
+ }
61
+ }
62
+ }
63
+ function buildHistoryMessage(item) {
64
+ return [
65
+ `par=${item.ParStatus}`,
66
+ `unpack=${item.UnpackStatus}`,
67
+ `move=${item.MoveStatus}`,
68
+ `script=${item.ScriptStatus}`,
69
+ `delete=${item.DeleteStatus}`,
70
+ `mark=${item.MarkStatus}`,
71
+ ].join(', ');
72
+ }
73
+ export function normalizeNzbgetStatus(status) {
74
+ return {
75
+ isDownloadPaused: status.DownloadPaused,
76
+ speedBytesPerSecond: status.DownloadRate,
77
+ speedLimitBytesPerSecond: status.DownloadLimit,
78
+ totalRemainingSize: combineInt64(status.RemainingSizeHi, status.RemainingSizeLo),
79
+ totalDownloadedSize: combineInt64(status.DownloadedSizeHi, status.DownloadedSizeLo),
80
+ raw: status,
81
+ };
82
+ }
83
+ export function normalizeNzbgetJob(item, globalStatus, queuePosition) {
84
+ const totalSize = combineInt64(item.FileSizeHi, item.FileSizeLo);
85
+ const remainingSize = combineInt64(item.RemainingSizeHi, item.RemainingSizeLo);
86
+ const pausedSize = combineInt64(item.PausedSizeHi, item.PausedSizeLo);
87
+ const activeId = getParameterValue(item.Parameters, 'drone') ?? `${item.NZBID}`;
88
+ const averagePriority = Math.round((item.MinPriority + item.MaxPriority) / 2);
89
+ const progress = totalSize === 0 ? 0 : ((totalSize - remainingSize) / totalSize) * 100;
90
+ let state = UsenetJobState.downloading;
91
+ let stateMessage = UsenetStateMessage.downloading;
92
+ if (globalStatus.DownloadPaused || (remainingSize === pausedSize && remainingSize !== 0)) {
93
+ state = UsenetJobState.paused;
94
+ stateMessage = UsenetStateMessage.paused;
95
+ }
96
+ else if (remainingSize === 0) {
97
+ state = UsenetJobState.postProcessing;
98
+ stateMessage = UsenetStateMessage.postProcessing;
99
+ }
100
+ else if (item.ActiveDownloads === 0) {
101
+ state = UsenetJobState.queued;
102
+ stateMessage = UsenetStateMessage.queued;
103
+ }
104
+ return {
105
+ id: activeId,
106
+ name: item.NZBName,
107
+ progress,
108
+ isCompleted: remainingSize === 0,
109
+ category: item.Category,
110
+ priority: nzbgetPriorityToNormalized(averagePriority),
111
+ state,
112
+ stateMessage,
113
+ downloadSpeed: state === UsenetJobState.downloading ? globalStatus.DownloadRate : 0,
114
+ eta: state === UsenetJobState.downloading && globalStatus.DownloadRate > 0
115
+ ? Math.ceil(remainingSize / globalStatus.DownloadRate)
116
+ : 0,
117
+ queuePosition,
118
+ totalSize,
119
+ remainingSize,
120
+ pausedSize,
121
+ raw: item,
122
+ };
123
+ }
124
+ export function normalizeNzbgetHistoryItem(item) {
125
+ const totalSize = combineInt64(item.FileSizeHi, item.FileSizeLo);
126
+ const activeId = getParameterValue(item.Parameters, 'drone') ?? `${item.ID}`;
127
+ const failureMessage = buildHistoryMessage(item);
128
+ let state = UsenetJobState.completed;
129
+ let stateMessage = UsenetStateMessage.completed;
130
+ let succeeded = true;
131
+ if (item.DeleteStatus === 'MANUAL') {
132
+ state = item.MarkStatus === 'BAD' ? UsenetJobState.error : UsenetJobState.deleted;
133
+ stateMessage =
134
+ item.MarkStatus === 'BAD' ? UsenetStateMessage.failed : UsenetStateMessage.deleted;
135
+ succeeded = false;
136
+ }
137
+ if (!SUCCESS_STATUSES.has(item.ParStatus)) {
138
+ state = UsenetJobState.error;
139
+ stateMessage = UsenetStateMessage.failed;
140
+ succeeded = false;
141
+ }
142
+ if (item.UnpackStatus === 'SPACE') {
143
+ state = UsenetJobState.warning;
144
+ stateMessage = UsenetStateMessage.warning;
145
+ succeeded = false;
146
+ }
147
+ else if (!SUCCESS_STATUSES.has(item.UnpackStatus)) {
148
+ state = UsenetJobState.error;
149
+ stateMessage = UsenetStateMessage.failed;
150
+ succeeded = false;
151
+ }
152
+ if (!SUCCESS_STATUSES.has(item.MoveStatus)) {
153
+ state = UsenetJobState.warning;
154
+ stateMessage = UsenetStateMessage.warning;
155
+ succeeded = false;
156
+ }
157
+ if (!SUCCESS_STATUSES.has(item.ScriptStatus)) {
158
+ state = UsenetJobState.error;
159
+ stateMessage = UsenetStateMessage.failed;
160
+ succeeded = false;
161
+ }
162
+ if (item.DeleteStatus &&
163
+ !SUCCESS_STATUSES.has(item.DeleteStatus) &&
164
+ item.DeleteStatus !== 'MANUAL') {
165
+ state = DELETE_FAILED_STATUSES.has(item.DeleteStatus)
166
+ ? UsenetJobState.error
167
+ : UsenetJobState.warning;
168
+ stateMessage =
169
+ state === UsenetJobState.error ? UsenetStateMessage.failed : UsenetStateMessage.warning;
170
+ succeeded = false;
171
+ }
172
+ return {
173
+ id: activeId,
174
+ name: item.Name,
175
+ progress: succeeded ? 100 : 0,
176
+ isCompleted: succeeded,
177
+ category: item.Category,
178
+ priority: undefined,
179
+ state,
180
+ stateMessage,
181
+ downloadSpeed: 0,
182
+ eta: 0,
183
+ queuePosition: -1,
184
+ totalSize,
185
+ remainingSize: 0,
186
+ savePath: item.FinalDir || item.DestDir,
187
+ dateCompleted: item.HistoryTime ? new Date(item.HistoryTime * 1000).toISOString() : undefined,
188
+ failureMessage: succeeded ? undefined : failureMessage,
189
+ storagePath: item.FinalDir || item.DestDir,
190
+ succeeded,
191
+ raw: item,
192
+ };
193
+ }
194
+ export function configItemsToMap(items) {
195
+ return Object.fromEntries(items.map(item => [item.Name, item.Value]));
196
+ }
197
+ export function deriveCategories(configMap) {
198
+ const categories = [];
199
+ for (let index = 1; index < 100; index++) {
200
+ const name = configMap[`Category${index}.Name`];
201
+ if (!name) {
202
+ break;
203
+ }
204
+ let path = configMap[`Category${index}.DestDir`];
205
+ if (!path) {
206
+ const mainDir = configMap.MainDir ?? '';
207
+ path = (configMap.DestDir ?? '').replace('${MainDir}', mainDir);
208
+ if ((configMap.AppendCategoryDir ?? 'yes') === 'yes') {
209
+ path = path ? `${path.replace(/\/$/, '')}/${name}` : name;
210
+ }
211
+ }
212
+ categories.push({
213
+ id: name,
214
+ name,
215
+ path,
216
+ });
217
+ }
218
+ return categories;
219
+ }
220
+ export function deriveScripts(templates) {
221
+ return templates
222
+ .filter(template => template.PostScript === true)
223
+ .map(template => ({
224
+ id: template.Name,
225
+ name: template.DisplayName ?? template.Name,
226
+ }));
227
+ }
@@ -0,0 +1,84 @@
1
+ import { AddNzbOptions as NormalizedAddNzbOptions, AllClientData, Category, FoundUsenetJob, NormalizedUsenetHistoryItem, NormalizedUsenetJob, NzbInput, Script, UsenetClient, UsenetClientConfig, UsenetClientState, UsenetPriority } from '@ctrl/shared-usenet';
2
+ import type { Jsonify } from 'type-fest';
3
+ import type { NzbGetAddOptions, NzbGetConfigTemplate, NzbGetEditQueueCommand, NzbGetEditQueueParameter, NzbGetFile, NzbGetHistoryItem, NzbGetLogEntry, NzbGetLogKind, NzbGetQueueItem, NzbGetServerVolume, NzbGetSettings, NzbGetStatus } from './types.js';
4
+ interface NzbgetState extends UsenetClientState {
5
+ version?: {
6
+ version: string;
7
+ };
8
+ }
9
+ export declare class Nzbget implements UsenetClient {
10
+ static createFromState(config: Readonly<UsenetClientConfig>, state: Readonly<Jsonify<NzbgetState>>): Nzbget;
11
+ config: UsenetClientConfig;
12
+ state: NzbgetState;
13
+ constructor(options?: Partial<UsenetClientConfig>);
14
+ exportState(): Jsonify<NzbgetState>;
15
+ /** Calls {@link https://nzbget-ng.github.io/api/version | version}. */
16
+ getVersion(): Promise<string>;
17
+ /** Calls {@link https://nzbget-ng.github.io/api/shutdown | shutdown}. */
18
+ shutdown(): Promise<boolean>;
19
+ /** Calls {@link https://nzbget-ng.github.io/api/reload | reload}. */
20
+ reload(): Promise<boolean>;
21
+ /** Calls {@link https://nzbget-ng.github.io/api/status | status}. */
22
+ status(): Promise<NzbGetStatus>;
23
+ /** Calls {@link https://nzbget-ng.github.io/api/listgroups | listgroups}. */
24
+ listGroups(): Promise<NzbGetQueueItem[]>;
25
+ /** Calls {@link https://nzbget-ng.github.io/api/history | history}. */
26
+ history(hidden?: boolean): Promise<NzbGetHistoryItem[]>;
27
+ /** Calls {@link https://nzbget-ng.github.io/api/config | config}. */
28
+ getConfig(): Promise<NzbGetSettings>;
29
+ /** Calls {@link https://nzbget-ng.github.io/api/configtemplates | configtemplates}. */
30
+ configTemplates(loadFromDisk?: boolean): Promise<NzbGetConfigTemplate[]>;
31
+ /** Calls {@link https://nzbget-ng.github.io/api/listfiles | listfiles}. */
32
+ listFiles(id: number | string): Promise<NzbGetFile[]>;
33
+ /** Calls {@link https://nzbget-ng.github.io/api/pausedownload | pausedownload}. */
34
+ pauseDownload(): Promise<boolean>;
35
+ /** Calls {@link https://nzbget-ng.github.io/api/resumedownload | resumedownload}. */
36
+ resumeDownload(): Promise<boolean>;
37
+ /** Calls {@link https://nzbget-ng.github.io/api/pausepost | pausepost}. */
38
+ pausePost(): Promise<boolean>;
39
+ /** Calls {@link https://nzbget-ng.github.io/api/resumepost | resumepost}. */
40
+ resumePost(): Promise<boolean>;
41
+ /** Calls {@link https://nzbget-ng.github.io/api/pausescan | pausescan}. */
42
+ pauseScan(): Promise<boolean>;
43
+ /** Calls {@link https://nzbget-ng.github.io/api/resumescan | resumescan}. */
44
+ resumeScan(): Promise<boolean>;
45
+ /** Calls {@link https://nzbget-ng.github.io/api/scheduleresume | scheduleresume}. */
46
+ scheduleResume(seconds: number): Promise<boolean>;
47
+ /** Calls {@link https://nzbget-ng.github.io/api/rate | rate}. */
48
+ setRate(limitBytesPerSecond: number): Promise<boolean>;
49
+ /** Calls {@link https://nzbget-ng.github.io/api/append | append}. */
50
+ append(name: string, contentOrUrl: string, options?: NzbGetAddOptions): Promise<number>;
51
+ /** Calls {@link https://nzbget-ng.github.io/api/editqueue | editqueue}. */
52
+ editQueue<TCommand extends NzbGetEditQueueCommand>(command: TCommand, parameter: NzbGetEditQueueParameter<TCommand>, ids: Array<number | string> | number | string): Promise<boolean>;
53
+ /** Calls {@link https://nzbget-ng.github.io/api/scan | scan}. */
54
+ scan(): Promise<boolean>;
55
+ /** Calls {@link https://nzbget-ng.github.io/api/log | log}. */
56
+ log(idFrom: number, numberOfEntries: number): Promise<NzbGetLogEntry[]>;
57
+ /** Calls {@link https://nzbget-ng.github.io/api/writelog | writelog}. */
58
+ writeLog(kind: NzbGetLogKind, text: string): Promise<boolean>;
59
+ /** Calls {@link https://nzbget-ng.github.io/api/loadlog | loadlog}. */
60
+ loadLog(nzbId: number | string, idFrom: number, numberOfEntries: number): Promise<NzbGetLogEntry[]>;
61
+ /** Calls {@link https://nzbget-ng.github.io/api/servervolumes | servervolumes}. */
62
+ serverVolumes(): Promise<NzbGetServerVolume[]>;
63
+ getCategories(): Promise<Category[]>;
64
+ getScripts(): Promise<Script[]>;
65
+ pauseQueue(): Promise<boolean>;
66
+ resumeQueue(): Promise<boolean>;
67
+ pauseJob(id: string): Promise<boolean>;
68
+ resumeJob(id: string): Promise<boolean>;
69
+ removeJob(id: string, removeData?: boolean): Promise<boolean>;
70
+ moveJob(id: string, position: number): Promise<boolean>;
71
+ setCategory(id: string, category: string): Promise<boolean>;
72
+ setPriority(id: string, priority: UsenetPriority): Promise<boolean>;
73
+ addNzbFile(nzb: string | Uint8Array, options?: Partial<NormalizedAddNzbOptions>): Promise<string>;
74
+ addNzbUrl(url: string, options?: Partial<NormalizedAddNzbOptions>): Promise<string>;
75
+ getQueue(): Promise<NormalizedUsenetJob[]>;
76
+ getHistory(): Promise<NormalizedUsenetHistoryItem[]>;
77
+ getQueueJob(id: string): Promise<NormalizedUsenetJob>;
78
+ getHistoryJob(id: string): Promise<NormalizedUsenetHistoryItem>;
79
+ findJob(id: string): Promise<FoundUsenetJob | null>;
80
+ getAllData(): Promise<AllClientData>;
81
+ normalizedAddNzb(input: NzbInput, options?: Partial<NormalizedAddNzbOptions>): Promise<NormalizedUsenetJob>;
82
+ private rpc;
83
+ }
84
+ export {};