|
|
@ -10,6 +10,7 @@ import { ServiceHelpers } from "./service.helpers";
|
|
|
|
import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2";
|
|
|
|
import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2";
|
|
|
|
import { ISearchTvResultV2, IMovieCollectionsViewModel, IActorCredits } from "../interfaces/ISearchTvResultV2";
|
|
|
|
import { ISearchTvResultV2, IMovieCollectionsViewModel, IActorCredits } from "../interfaces/ISearchTvResultV2";
|
|
|
|
import { IArtistSearchResult, IAlbumArt } from "../interfaces/IMusicSearchResultV2";
|
|
|
|
import { IArtistSearchResult, IAlbumArt } from "../interfaces/IMusicSearchResultV2";
|
|
|
|
|
|
|
|
import { SearchFilter } from "../my-nav/SearchFilter";
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
@Injectable()
|
|
|
|
export class SearchV2Service extends ServiceHelpers {
|
|
|
|
export class SearchV2Service extends ServiceHelpers {
|
|
|
@ -17,8 +18,8 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
super(http, "/api/v2/search", href);
|
|
|
|
super(http, "/api/v2/search", href);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public multiSearch(searchTerm: string): Observable<IMultiSearchResult[]> {
|
|
|
|
public multiSearch(searchTerm: string, filter: SearchFilter): Observable<IMultiSearchResult[]> {
|
|
|
|
return this.http.get<IMultiSearchResult[]>(`${this.url}/multi/${searchTerm}`);
|
|
|
|
return this.http.post<IMultiSearchResult[]>(`${this.url}/multi/${searchTerm}`, filter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public getFullMovieDetails(theMovieDbId: number): Observable<ISearchMovieResultV2> {
|
|
|
|
public getFullMovieDetails(theMovieDbId: number): Observable<ISearchMovieResultV2> {
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/${theMovieDbId}`);
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/${theMovieDbId}`);
|
|
|
@ -27,7 +28,7 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public getMovieByImdbId(imdbId: string): Observable<ISearchMovieResultV2> {
|
|
|
|
public getMovieByImdbId(imdbId: string): Observable<ISearchMovieResultV2> {
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/imdb/${imdbId}`);
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/imdb/${imdbId}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getFullMovieDetailsByRequestId(requestId: number): Promise<ISearchMovieResultV2> {
|
|
|
|
public getFullMovieDetailsByRequestId(requestId: number): Promise<ISearchMovieResultV2> {
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/request/${requestId}`).toPromise();
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/request/${requestId}`).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -35,7 +36,7 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public getFullMovieDetailsPromise(theMovieDbId: number): Promise<ISearchMovieResultV2> {
|
|
|
|
public getFullMovieDetailsPromise(theMovieDbId: number): Promise<ISearchMovieResultV2> {
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/${theMovieDbId}`).toPromise();
|
|
|
|
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/${theMovieDbId}`).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public similarMovies(theMovieDbId: number, langCode: string): Observable<ISearchMovieResult[]> {
|
|
|
|
public similarMovies(theMovieDbId: number, langCode: string): Observable<ISearchMovieResult[]> {
|
|
|
|
return this.http.post<ISearchMovieResult[]>(`${this.url}/Movie/similar`, {theMovieDbId, languageCode: langCode});
|
|
|
|
return this.http.post<ISearchMovieResult[]>(`${this.url}/Movie/similar`, {theMovieDbId, languageCode: langCode});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -62,11 +63,11 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public nowPlayingMoviesByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchMovieResult[]> {
|
|
|
|
public nowPlayingMoviesByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchMovieResult[]> {
|
|
|
|
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/nowplaying/${currentlyLoaded}/${toLoad}`).toPromise();
|
|
|
|
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/nowplaying/${currentlyLoaded}/${toLoad}`).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public topRatedMovies(): Observable<ISearchMovieResult[]> {
|
|
|
|
public topRatedMovies(): Observable<ISearchMovieResult[]> {
|
|
|
|
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/toprated`);
|
|
|
|
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/toprated`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public popularTv(): Observable<ISearchTvResult[]> {
|
|
|
|
public popularTv(): Observable<ISearchTvResult[]> {
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/popular`, { headers: this.headers });
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/popular`, { headers: this.headers });
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -84,7 +85,7 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public anticipatedTvByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchTvResult[]> {
|
|
|
|
public anticipatedTvByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchTvResult[]> {
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/anticipated/${currentlyLoaded}/${toLoad}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/anticipated/${currentlyLoaded}/${toLoad}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public trendingTv(): Observable<ISearchTvResult[]> {
|
|
|
|
public trendingTv(): Observable<ISearchTvResult[]> {
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending`, { headers: this.headers });
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending`, { headers: this.headers });
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -92,7 +93,7 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public trendingTvByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchTvResult[]> {
|
|
|
|
public trendingTvByPage(currentlyLoaded: number, toLoad: number): Promise<ISearchTvResult[]> {
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending/${currentlyLoaded}/${toLoad}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending/${currentlyLoaded}/${toLoad}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getTvInfo(tvdbid: number): Promise<ISearchTvResultV2> {
|
|
|
|
public getTvInfo(tvdbid: number): Promise<ISearchTvResultV2> {
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/${tvdbid}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/${tvdbid}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,11 +101,11 @@ export class SearchV2Service extends ServiceHelpers {
|
|
|
|
public getTvInfoWithRequestId(requestId: number): Promise<ISearchTvResultV2> {
|
|
|
|
public getTvInfoWithRequestId(requestId: number): Promise<ISearchTvResultV2> {
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/request/${requestId}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/request/${requestId}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getTvInfoWithMovieDbId(theMovieDbId: number): Promise<ISearchTvResultV2> {
|
|
|
|
public getTvInfoWithMovieDbId(theMovieDbId: number): Promise<ISearchTvResultV2> {
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getMovieCollections(collectionId: number): Promise<IMovieCollectionsViewModel> {
|
|
|
|
public getMovieCollections(collectionId: number): Promise<IMovieCollectionsViewModel> {
|
|
|
|
return this.http.get<IMovieCollectionsViewModel>(`${this.url}/movie/collection/${collectionId}`, { headers: this.headers }).toPromise();
|
|
|
|
return this.http.get<IMovieCollectionsViewModel>(`${this.url}/movie/collection/${collectionId}`, { headers: this.headers }).toPromise();
|
|
|
|
}
|
|
|
|
}
|
|
|
|