|
|
@ -45,11 +45,22 @@ export abstract class IpcClient<M extends Microservice = Microservice> extends I |
|
|
|
return <ITorrent[]>response.data; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Check if the torrent client has the given torrent |
|
|
|
*/ |
|
|
|
public async has(torrentId: string) { |
|
|
|
let response = await this.request("has", torrentId); |
|
|
|
if (response.error) { |
|
|
|
console.error(response.error); |
|
|
|
throw new Error("Failed to check if a torrent exists"); |
|
|
|
} |
|
|
|
return <Boolean>response.data; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get full details of each of the provided torrents |
|
|
|
* @param torrentIds Array of torrent info hashes |
|
|
|
*/ |
|
|
|
public async details(...torrentIds: string[]) { |
|
|
|
public async details(torrentIds: string[] = []) { |
|
|
|
let response = await this.request("details", torrentIds); |
|
|
|
if (response.error) { |
|
|
|
console.error(response.error); |
|
|
|