Browse Source

Adjust API parameter types

dev
David Ludwig 4 years ago
parent
commit
c55c1e0461
3 changed files with 8 additions and 8 deletions
  1. +5
    -5
      api/torrent-search/src/IpcClient.ts
  2. +2
    -2
      api/torrent-search/src/schema.ts
  3. +1
    -1
      services/torrent-search/src/torrents/providers/torrentgalaxy/index.ts

+ 5
- 5
api/torrent-search/src/IpcClient.ts View File

@ -1,7 +1,7 @@
import { IpcClientService } from "@autoplex/ipc";
import { Microservice } from "@autoplex/microservice";
import { SOCKET_PATH } from "./constants";
import { IMovieSearchInfo } from "./schema";
import { IMovieSearchInfo, ITorrentLink } from "./schema";
export class IpcClient<M extends Microservice = Microservice> extends IpcClientService<M>
{
@ -17,16 +17,16 @@ export class IpcClient<M extends Microservice = Microservice> extends IpcClientS
/**
* Add a torrent to the client
* @param torrent Magnet URI or file buffer
*/
public async searchMovie(title: string, imdbId?: string, year?: number, altTitles: string[] = [])
public async searchMovie(title: string, imdbId: string|null, year: number|null,
altTitles: string[] = [], torrentBlacklist: string[] = [])
{
let response = await this.request("search_movie", <IMovieSearchInfo> {
title, imdbId, year, altTitles
title, imdbId, year, altTitles, torrentBlacklist
});
if (response.error) {
throw new Error("Failed to search for movie torrent");
}
return <string>response.data;
return <ITorrentLink|null>response.data;
}
}

+ 2
- 2
api/torrent-search/src/schema.ts View File

@ -4,8 +4,8 @@
export interface IMovieSearchInfo {
title : string,
altTitles : string[],
imdbId? : string,
year? : number,
imdbId : string|null,
year : number|null,
torrentBlacklist: string[]
}


+ 1
- 1
services/torrent-search/src/torrents/providers/torrentgalaxy/index.ts View File

@ -19,7 +19,7 @@ export default class TorrentGalaxy extends Provider
* Search for a movie
*/
public async searchMovie(movie: IMovieSearchInfo) {
if (movie.imdbId === undefined) {
if (movie.imdbId === null) {
return [];
}
await this.lock();


Loading…
Cancel
Save