mirror of https://github.com/Ombi-app/Ombi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.2 KiB
57 lines
2.2 KiB
import { Injectable } from '@angular/core';
|
|
import { AuthHttp } from 'angular2-jwt';
|
|
import { Observable } from 'rxjs/Rx';
|
|
|
|
import { ServiceAuthHelpers } from './service.helpers';
|
|
import { ISearchMovieResult } from '../interfaces/ISearchMovieResult';
|
|
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
|
|
|
|
@Injectable()
|
|
export class SearchService extends ServiceAuthHelpers {
|
|
constructor(http: AuthHttp) {
|
|
super(http, "/api/v1/search");
|
|
}
|
|
|
|
// Movies
|
|
searchMovie(searchTerm: string): Observable<ISearchMovieResult[]> {
|
|
return this.http.get(`${this.url}/Movie/` + searchTerm).map(this.extractData);
|
|
}
|
|
|
|
popularMovies(): Observable<ISearchMovieResult[]> {
|
|
return this.http.get(`${this.url}/Movie/Popular`).map(this.extractData);
|
|
}
|
|
upcomignMovies(): Observable<ISearchMovieResult[]> {
|
|
return this.http.get(`${this.url}/Movie/upcoming`).map(this.extractData);
|
|
}
|
|
nowPlayingMovies(): Observable<ISearchMovieResult[]> {
|
|
return this.http.get(`${this.url}/Movie/nowplaying`).map(this.extractData);
|
|
}
|
|
topRatedMovies(): Observable<ISearchMovieResult[]> {
|
|
return this.http.get(`${this.url}/Movie/toprated`).map(this.extractData);
|
|
}
|
|
getMovieInformation(theMovieDbId: number): Observable<ISearchMovieResult> {
|
|
return this.http.get(`${this.url}/Movie/info/${theMovieDbId}`).map(this.extractData);
|
|
}
|
|
|
|
// TV
|
|
searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
|
|
return this.http.get(`${this.url}/Tv/` + searchTerm).map(this.extractData);
|
|
}
|
|
|
|
getShowInformation(theTvDbId: number): Observable<ISearchTvResult> {
|
|
return this.http.get(`${this.url}/Tv/info/${theTvDbId}`).map(this.extractData);
|
|
}
|
|
|
|
popularTv(): Observable<ISearchTvResult[]> {
|
|
return this.http.get(`${this.url}/Tv/popular`).map(this.extractData);
|
|
}
|
|
mostWatchedTv(): Observable<ISearchTvResult[]> {
|
|
return this.http.get(`${this.url}/Tv/mostwatched`).map(this.extractData);
|
|
}
|
|
anticiplatedTv(): Observable<ISearchTvResult[]> {
|
|
return this.http.get(`${this.url}/Tv/anticipated`).map(this.extractData);
|
|
}
|
|
trendingTv(): Observable<ISearchTvResult[]> {
|
|
return this.http.get(`${this.url}/Tv/trending`).map(this.extractData);
|
|
}
|
|
} |