|
|
@ -14,7 +14,7 @@ export abstract class IpcClient<M extends Microservice = Microservice> extends I |
|
|
|
* Add a torrent to the client |
|
|
|
* @param torrent Magnet URI or file buffer |
|
|
|
*/ |
|
|
|
protected async add(torrent: string | Buffer, downloadPath?: string) { |
|
|
|
public async add(torrent: string | Buffer, downloadPath?: string) { |
|
|
|
let response = await this.request("add", { torrent, downloadPath }); |
|
|
|
if (response.error) { |
|
|
|
throw new Error("Failed to add torrent"); |
|
|
@ -26,7 +26,7 @@ export abstract class IpcClient<M extends Microservice = Microservice> extends I |
|
|
|
* Remove a torrent from the client |
|
|
|
* @param torrent Torrent info hash |
|
|
|
*/ |
|
|
|
protected async remove(torrent: string) { |
|
|
|
public async remove(torrent: string) { |
|
|
|
let response = await this.request("remove", torrent); |
|
|
|
if (response.error) { |
|
|
|
throw new Error("Failed to remove torrent"); |
|
|
@ -36,7 +36,7 @@ export abstract class IpcClient<M extends Microservice = Microservice> extends I |
|
|
|
/** |
|
|
|
* Get a list of all torrents in the client |
|
|
|
*/ |
|
|
|
protected async list() { |
|
|
|
public async list() { |
|
|
|
let response = await this.request("list"); |
|
|
|
if (response.error) { |
|
|
|
console.error(response.error); |
|
|
@ -49,7 +49,7 @@ export abstract class IpcClient<M extends Microservice = Microservice> extends I |
|
|
|
* Get full details of each of the provided torrents |
|
|
|
* @param torrentIds Array of torrent info hashes |
|
|
|
*/ |
|
|
|
protected async details(...torrentIds: string[]) { |
|
|
|
public async details(...torrentIds: string[]) { |
|
|
|
let response = await this.request("details", torrentIds); |
|
|
|
if (response.error) { |
|
|
|
console.error(response.error); |
|
|
|