add linting and prettier

This commit is contained in:
Blake Joynes
2023-04-13 21:58:41 -04:00
parent 7cccdb9929
commit 06155bd323
38 changed files with 2514 additions and 2135 deletions

View File

@@ -1,4 +1,4 @@
import { BaseEndpoint } from './base';
import { BaseEndpoint } from './base';
import { Certifications } from '../types/certification';
export class CertificationEndpoint extends BaseEndpoint {

View File

@@ -2,7 +2,6 @@ import { BaseEndpoint } from './base';
import { ChangeOptions, Changes } from '../types/changes';
import { parseOptions } from '../utils';
export class ChangeEndpoint extends BaseEndpoint {
constructor(protected readonly accessToken: string) {
super(accessToken);

View File

@@ -1,6 +1,11 @@
import { DetailedCollection, ImageCollection, LanguageOption, Translations } from '../types';
import {
DetailedCollection,
ImageCollection,
LanguageOption,
Translations,
} from '../types';
import { parseOptions } from '../utils';
import { BaseEndpoint } from './base';
import { BaseEndpoint } from './base';
const BASE_COLLECTION = '/collection';
@@ -9,18 +14,30 @@ export class CollectionsEndpoint extends BaseEndpoint {
super(accessToken);
}
async details(id: number, options? : LanguageOption): Promise<DetailedCollection> {
async details(
id: number,
options?: LanguageOption
): Promise<DetailedCollection> {
const params = parseOptions(options);
return await this.api.get<DetailedCollection>(`${BASE_COLLECTION}/${id}?${params}`);
return await this.api.get<DetailedCollection>(
`${BASE_COLLECTION}/${id}?${params}`
);
}
async images(id: number, options? : LanguageOption): Promise<ImageCollection> {
async images(id: number, options?: LanguageOption): Promise<ImageCollection> {
const params = parseOptions(options);
return await this.api.get<ImageCollection>(`${BASE_COLLECTION}/${id}/images?${params}`);
return await this.api.get<ImageCollection>(
`${BASE_COLLECTION}/${id}/images?${params}`
);
}
async translations(id: number, options? : LanguageOption): Promise<Translations> {
async translations(
id: number,
options?: LanguageOption
): Promise<Translations> {
const params = parseOptions(options);
return await this.api.get<Translations>(`${BASE_COLLECTION}/${id}/translations?${params}`);
return await this.api.get<Translations>(
`${BASE_COLLECTION}/${id}/translations?${params}`
);
}
}
}

View File

@@ -9,5 +9,4 @@ export class ConfigurationEndpoint extends BaseEndpoint {
async getCurrent(): Promise<Configuration> {
return await this.api.get<Configuration>(`/configuration`);
}
}

View File

@@ -1,7 +1,6 @@
import { BaseEndpoint } from './base';
import { CreditResponse } from '../types/credits';
export class CreditsEndpoint extends BaseEndpoint {
constructor(protected readonly accessToken: string) {
super(accessToken);
@@ -10,5 +9,4 @@ export class CreditsEndpoint extends BaseEndpoint {
async getById(id: string): Promise<CreditResponse> {
return await this.api.get<CreditResponse>(`/credit/${id}`);
}
}

View File

@@ -1,4 +1,8 @@
import { MovieDiscoverResult, SortOption, TvShowDiscoverResult } from '../types';
import {
MovieDiscoverResult,
SortOption,
TvShowDiscoverResult,
} from '../types';
import { parseOptions } from '../utils';
import { BaseEndpoint } from './base';
@@ -26,7 +30,7 @@ interface DiscoverQueryOptions {
with_companies?: string;
}
interface MovieQueryOptions extends DiscoverQueryOptions{
interface MovieQueryOptions extends DiscoverQueryOptions {
region?: string;
certification_country?: string;
certification?: string;
@@ -46,7 +50,7 @@ interface MovieQueryOptions extends DiscoverQueryOptions{
with_people?: string;
}
interface TvShowQueryOptions extends DiscoverQueryOptions{
interface TvShowQueryOptions extends DiscoverQueryOptions {
'air_date.gte'?: string;
'air_date.lte'?: string;
'first_air_date.gte'?: string;
@@ -67,11 +71,15 @@ export class DiscoverEndpoint extends BaseEndpoint {
async movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult> {
const params = parseOptions(options);
return await this.api.get<MovieDiscoverResult>(`${BASE_DISCOVER}/movie?${params}`);
return await this.api.get<MovieDiscoverResult>(
`${BASE_DISCOVER}/movie?${params}`
);
}
async tvShow(options?: TvShowQueryOptions): Promise<TvShowDiscoverResult> {
const params = parseOptions(options);
return await this.api.get<TvShowDiscoverResult>(`${BASE_DISCOVER}/tv?${params}`);
return await this.api.get<TvShowDiscoverResult>(
`${BASE_DISCOVER}/tv?${params}`
);
}
}

View File

@@ -7,7 +7,10 @@ export class FindEndpoint extends BaseEndpoint {
super(accessToken);
}
async byId(externalId: string, options: ExternalIdOptions): Promise<FindResult> {
async byId(
externalId: string,
options: ExternalIdOptions
): Promise<FindResult> {
const params = parseOptions(options);
return await this.api.get<FindResult>(`/find/${externalId}?${params}`);
}

View File

@@ -1,7 +1,7 @@
import { BaseEndpoint } from './base';
import { BaseEndpoint } from './base';
export interface Genres {
genres: Array<{id: number, name: string}>
genres: Array<{ id: number; name: string }>;
}
export class GenreEndpoint extends BaseEndpoint {

View File

@@ -1,5 +1,3 @@
export * from './account';
export * from './certification';
export * from './changes';
@@ -16,4 +14,3 @@ export * from './trending';
export * from './find';
export * from './keywords';
export * from './collections';

View File

@@ -9,12 +9,17 @@ export class KeywordsEndpoint extends BaseEndpoint {
super(accessToken);
}
async details(keywordId : number): Promise<Keyword> {
async details(keywordId: number): Promise<Keyword> {
return await this.api.get<Keyword>(`${BASE_Keyword}/${keywordId}`);
}
async belongingMovies(keywordId : number, options?: KeywordsOptions): Promise<BelongingMovies> {
async belongingMovies(
keywordId: number,
options?: KeywordsOptions
): Promise<BelongingMovies> {
const params = parseOptions(options);
return await this.api.get<BelongingMovies>(`${BASE_Keyword}/${keywordId}/movies?${params}`);
return await this.api.get<BelongingMovies>(
`${BASE_Keyword}/${keywordId}/movies?${params}`
);
}
}

View File

@@ -19,7 +19,8 @@ import {
ReleaseDates,
Reviews,
SimilarMovies,
TopRatedMovies, Translations,
TopRatedMovies,
Translations,
UpcomingMovies,
Videos,
WatchProviders,
@@ -28,69 +29,87 @@ import { parseOptions } from '../utils';
const BASE_MOVIE = '/movie';
export class MoviesEndpoint extends BaseEndpoint{
export class MoviesEndpoint extends BaseEndpoint {
constructor(protected readonly accessToken: string) {
super(accessToken);
}
async details(id: number): Promise<MovieDetails>{
async details(id: number): Promise<MovieDetails> {
return await this.api.get<MovieDetails>(`${BASE_MOVIE}/${id}`);
}
async alternativeTitles(id: number): Promise<AlternativeTitles>{
return await this.api.get<AlternativeTitles>(`${BASE_MOVIE}/${id}/alternative_titles`);
async alternativeTitles(id: number): Promise<AlternativeTitles> {
return await this.api.get<AlternativeTitles>(
`${BASE_MOVIE}/${id}/alternative_titles`
);
}
async changes(id: number, options?: ChangeOptions): Promise<MovieChanges>{
async changes(id: number, options?: ChangeOptions): Promise<MovieChanges> {
const params = parseOptions(options);
return await this.api.get<MovieChanges>(`${BASE_MOVIE}/${id}/changes?${params}`);
return await this.api.get<MovieChanges>(
`${BASE_MOVIE}/${id}/changes?${params}`
);
}
async credits(id: number): Promise<Credits>{
async credits(id: number): Promise<Credits> {
return await this.api.get<Credits>(`${BASE_MOVIE}/${id}/credits`);
}
async externalIds(id: number): Promise<ExternalIds>{
async externalIds(id: number): Promise<ExternalIds> {
return await this.api.get<ExternalIds>(`${BASE_MOVIE}/${id}/external_ids`);
}
async images(id: number): Promise<Images>{
async images(id: number): Promise<Images> {
return await this.api.get<Images>(`${BASE_MOVIE}/${id}/images`);
}
async keywords(id: number): Promise<Keywords>{
async keywords(id: number): Promise<Keywords> {
return await this.api.get<Keywords>(`${BASE_MOVIE}/${id}/keywords`);
}
async lists(id: number, options?: LanguageOption | PageOption): Promise<MovieLists>{
async lists(
id: number,
options?: LanguageOption | PageOption
): Promise<MovieLists> {
const params = parseOptions(options);
return await this.api.get<MovieLists>(`${BASE_MOVIE}/${id}/lists?${params}`);
return await this.api.get<MovieLists>(
`${BASE_MOVIE}/${id}/lists?${params}`
);
}
async recommendations(id: number, options?: PageOption): Promise<Recommendations>{
async recommendations(
id: number,
options?: PageOption
): Promise<Recommendations> {
const params = parseOptions(options);
return await this.api.get<Recommendations>(`${BASE_MOVIE}/${id}/recommendations?${params}`);
return await this.api.get<Recommendations>(
`${BASE_MOVIE}/${id}/recommendations?${params}`
);
}
async releaseDates(id: number): Promise<ReleaseDates>{
return await this.api.get<ReleaseDates>(`${BASE_MOVIE}/${id}/release_dates`);
async releaseDates(id: number): Promise<ReleaseDates> {
return await this.api.get<ReleaseDates>(
`${BASE_MOVIE}/${id}/release_dates`
);
}
async reviews(id: number, options?: PageOption): Promise<Reviews>{
async reviews(id: number, options?: PageOption): Promise<Reviews> {
const params = parseOptions(options);
return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews?${params}`);
}
async similar(id: number, options?: PageOption): Promise<SimilarMovies>{
async similar(id: number, options?: PageOption): Promise<SimilarMovies> {
const params = parseOptions(options);
return await this.api.get<SimilarMovies>(`${BASE_MOVIE}/${id}/similar?${params}`);
return await this.api.get<SimilarMovies>(
`${BASE_MOVIE}/${id}/similar?${params}`
);
}
async translations(id: number): Promise<Translations>{
async translations(id: number): Promise<Translations> {
return await this.api.get<Translations>(`${BASE_MOVIE}/${id}/translations`);
}
async videos(id: number): Promise<Videos>{
async videos(id: number): Promise<Videos> {
return await this.api.get<Videos>(`${BASE_MOVIE}/${id}/videos`);
}
@@ -98,33 +117,45 @@ export class MoviesEndpoint extends BaseEndpoint{
* Powered by JustWatch
* @param id
*/
async watchProviders(id: number): Promise<WatchProviders>{
return await this.api.get<WatchProviders>(`${BASE_MOVIE}/${id}/watch/providers`);
async watchProviders(id: number): Promise<WatchProviders> {
return await this.api.get<WatchProviders>(
`${BASE_MOVIE}/${id}/watch/providers`
);
}
async latest(): Promise<LatestMovie>{
async latest(): Promise<LatestMovie> {
return await this.api.get<LatestMovie>(`${BASE_MOVIE}/latest`);
}
async nowPlaying(options?: PageOption & LanguageOption & RegionOption): Promise<MoviesPlayingNow>{
async nowPlaying(
options?: PageOption & LanguageOption & RegionOption
): Promise<MoviesPlayingNow> {
const params = parseOptions(options);
return await this.api.get<MoviesPlayingNow>(`${BASE_MOVIE}/now_playing?${params}`);
return await this.api.get<MoviesPlayingNow>(
`${BASE_MOVIE}/now_playing?${params}`
);
}
async popular(options?: PageOption): Promise<PopularMovies>{
async popular(options?: PageOption): Promise<PopularMovies> {
const params = parseOptions(options);
return await this.api.get<PopularMovies>(`${BASE_MOVIE}/popular?${params}`);
}
async topRated(options?: PageOption & LanguageOption & RegionOption): Promise<TopRatedMovies>{
async topRated(
options?: PageOption & LanguageOption & RegionOption
): Promise<TopRatedMovies> {
const params = parseOptions(options);
return await this.api.get<TopRatedMovies>(`${BASE_MOVIE}/top_rated?${params}`);
return await this.api.get<TopRatedMovies>(
`${BASE_MOVIE}/top_rated?${params}`
);
}
async upcoming(options?: PageOption & LanguageOption & RegionOption): Promise<UpcomingMovies>{
async upcoming(
options?: PageOption & LanguageOption & RegionOption
): Promise<UpcomingMovies> {
const params = parseOptions(options);
return await this.api.get<UpcomingMovies>(`${BASE_MOVIE}/upcoming?${params}`);
return await this.api.get<UpcomingMovies>(
`${BASE_MOVIE}/upcoming?${params}`
);
}
}

View File

@@ -26,46 +26,62 @@ export class PeopleEndpoint extends BaseEndpoint {
return await this.api.get<PersonDetail>(`${BASE_PERSON}/${id}`);
}
async changes(id: number, options? : ChangeOptions): Promise<PersonChanges> {
async changes(id: number, options?: ChangeOptions): Promise<PersonChanges> {
const params = parseOptions(options);
return await this.api.get<PersonChanges>(`${BASE_PERSON}/${id}/changes?${params}`);
return await this.api.get<PersonChanges>(
`${BASE_PERSON}/${id}/changes?${params}`
);
}
async movieCredits(id: number): Promise<PersonMovieCredit> {
return await this.api.get<PersonMovieCredit>(`${BASE_PERSON}/${id}/movie_credits`);
return await this.api.get<PersonMovieCredit>(
`${BASE_PERSON}/${id}/movie_credits`
);
}
async tvShowCredits(id: number): Promise<PersonTvShowCredit> {
return await this.api.get<PersonTvShowCredit>(`${BASE_PERSON}/${id}/tv_credits`);
return await this.api.get<PersonTvShowCredit>(
`${BASE_PERSON}/${id}/tv_credits`
);
}
async combinedCredits(id: number) : Promise<PersonCombinedCredits> {
return await this.api.get<PersonCombinedCredits>(`${BASE_PERSON}/${id}/combined_credits`);
async combinedCredits(id: number): Promise<PersonCombinedCredits> {
return await this.api.get<PersonCombinedCredits>(
`${BASE_PERSON}/${id}/combined_credits`
);
}
async externalId(id: number): Promise<ExternalIds>{
async externalId(id: number): Promise<ExternalIds> {
return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
}
async images(id: number): Promise<{id: number, profiles: Image[]}>{
return await this.api.get<{id: number, profiles: Image[]}>(`${BASE_PERSON}/${id}/images`);
async images(id: number): Promise<{ id: number; profiles: Image[] }> {
return await this.api.get<{ id: number; profiles: Image[] }>(
`${BASE_PERSON}/${id}/images`
);
}
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages>{
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
const params = parseOptions(options);
return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images?${params}`);
return await this.api.get<TaggedImages>(
`${BASE_PERSON}/${id}/tagged_images?${params}`
);
}
async translation(id: number) : Promise<PeopleTranslations>{
return await this.api.get<PeopleTranslations>(`${BASE_PERSON}/${id}/translations`);
async translation(id: number): Promise<PeopleTranslations> {
return await this.api.get<PeopleTranslations>(
`${BASE_PERSON}/${id}/translations`
);
}
async latest(): Promise<PersonDetail>{
async latest(): Promise<PersonDetail> {
return await this.api.get<PersonDetail>(`${BASE_PERSON}/latest`);
}
async popular(options?: PageOption): Promise<PopularPersons>{
async popular(options?: PageOption): Promise<PopularPersons> {
const params = parseOptions(options);
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
return await this.api.get<PopularPersons>(
`${BASE_PERSON}/popular?${params}`
);
}
}

View File

@@ -16,12 +16,12 @@ export interface MovieSearchOptions extends SearchOptions {
primary_release_year?: number;
}
export interface TvSearchOptions extends SearchOptions{
export interface TvSearchOptions extends SearchOptions {
include_adult?: boolean;
first_air_date_year?: number;
}
export interface PeopleSearchOptions extends SearchOptions{
export interface PeopleSearchOptions extends SearchOptions {
include_adult?: boolean;
}
@@ -30,34 +30,44 @@ export class SearchEndpoint extends BaseEndpoint {
super(accessToken);
}
async companies(options: SearchOptions): Promise<Search<Company>>{
async companies(options: SearchOptions): Promise<Search<Company>> {
const params = parseOptions(options);
return await this.api.get<Search<Company>>(`${BASE_SEARCH}/company?${params}`);
return await this.api.get<Search<Company>>(
`${BASE_SEARCH}/company?${params}`
);
}
async collections(options: SearchOptions): Promise<Search<Collection>>{
async collections(options: SearchOptions): Promise<Search<Collection>> {
const params = parseOptions(options);
return await this.api.get<Search<Collection>>(`${BASE_SEARCH}/collection?${params}`);
return await this.api.get<Search<Collection>>(
`${BASE_SEARCH}/collection?${params}`
);
}
async keywords(options: SearchOptions): Promise<Search<{ id: string, name: string }>>{
async keywords(
options: SearchOptions
): Promise<Search<{ id: string; name: string }>> {
const params = parseOptions(options);
return await this.api.get<Search<{ id: string, name: string }>>(`${BASE_SEARCH}/keyword?${params}`);
return await this.api.get<Search<{ id: string; name: string }>>(
`${BASE_SEARCH}/keyword?${params}`
);
}
async movies(options: MovieSearchOptions): Promise<Search<Movie>>{
async movies(options: MovieSearchOptions): Promise<Search<Movie>> {
const params = parseOptions(options);
return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie?${params}`);
}
async people(options: PeopleSearchOptions): Promise<Search<Person>>{
async people(options: PeopleSearchOptions): Promise<Search<Person>> {
const params = parseOptions(options);
return await this.api.get<Search<Person>>(`${BASE_SEARCH}/person?${params}`);
return await this.api.get<Search<Person>>(
`${BASE_SEARCH}/person?${params}`
);
}
// TODO: Multi search
async tvShows(options: TvSearchOptions): Promise<Search<TV>>{
async tvShows(options: TvSearchOptions): Promise<Search<TV>> {
const params = parseOptions(options);
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv?${params}`);
}

View File

@@ -1,4 +1,4 @@
import { MediaType, TimeWindow, TrendingResults } from '../types';
import { MediaType, TimeWindow, TrendingResults } from '../types';
import { BaseEndpoint } from './base';
export class TrendingEndpoint extends BaseEndpoint {
@@ -6,9 +6,12 @@ export class TrendingEndpoint extends BaseEndpoint {
super(accessToken);
}
async trending<T extends MediaType>(mediaType : T, timeWindow: TimeWindow): Promise<TrendingResults<T>> {
return await this.api.get<TrendingResults<T>>(`/trending/${mediaType}/${timeWindow}`);
async trending<T extends MediaType>(
mediaType: T,
timeWindow: TimeWindow
): Promise<TrendingResults<T>> {
return await this.api.get<TrendingResults<T>>(
`/trending/${mediaType}/${timeWindow}`
);
}
}

View File

@@ -31,107 +31,136 @@ import { parseOptions } from '../utils';
const BASE_TV = '/tv';
export class TvShowsEndpoint extends BaseEndpoint{
export class TvShowsEndpoint extends BaseEndpoint {
constructor(protected readonly accessToken: string) {
super(accessToken);
}
async details(id: number): Promise<TvShowDetails>{
async details(id: number): Promise<TvShowDetails> {
return await this.api.get<TvShowDetails>(`${BASE_TV}/${id}`);
}
async alternativeTitles(id: number): Promise<AlternativeTitles>{
return await this.api.get<AlternativeTitles>(`${BASE_TV}/${id}/alternative_titles`);
async alternativeTitles(id: number): Promise<AlternativeTitles> {
return await this.api.get<AlternativeTitles>(
`${BASE_TV}/${id}/alternative_titles`
);
}
async changes(id: number, options?: ChangeOptions): Promise<TvShowChanges>{
async changes(id: number, options?: ChangeOptions): Promise<TvShowChanges> {
const params = parseOptions(options);
return await this.api.get<TvShowChanges>(`${BASE_TV}/${id}/changes?${params}`);
return await this.api.get<TvShowChanges>(
`${BASE_TV}/${id}/changes?${params}`
);
}
async contentRatings(id: number): Promise<ContentRatings>{
return await this.api.get<ContentRatings>(`${BASE_TV}/${id}/content_ratings`);
async contentRatings(id: number): Promise<ContentRatings> {
return await this.api.get<ContentRatings>(
`${BASE_TV}/${id}/content_ratings`
);
}
async credits(id: number): Promise<Credits>{
async credits(id: number): Promise<Credits> {
return await this.api.get<Credits>(`${BASE_TV}/${id}/credits`);
}
async season(tvId: number, seasonNumber: number): Promise<SeasonDetails>{
return await this.api.get<SeasonDetails>(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
async season(tvId: number, seasonNumber: number): Promise<SeasonDetails> {
return await this.api.get<SeasonDetails>(
`${BASE_TV}/${tvId}/season/${seasonNumber}`
);
}
async episodeGroups(id: number): Promise<EpisodeGroups>{
async episodeGroups(id: number): Promise<EpisodeGroups> {
return await this.api.get<EpisodeGroups>(`${BASE_TV}/${id}/episode_groups`);
}
async externalIds(id: number): Promise<ExternalIds>{
async externalIds(id: number): Promise<ExternalIds> {
return await this.api.get<ExternalIds>(`${BASE_TV}/${id}/external_ids`);
}
async images(id: number): Promise<Images>{
async images(id: number): Promise<Images> {
return await this.api.get<Images>(`${BASE_TV}/${id}/images`);
}
async keywords(id: number): Promise<Keywords>{
async keywords(id: number): Promise<Keywords> {
return await this.api.get<Keywords>(`${BASE_TV}/${id}/keywords`);
}
async recommendations(id: number, options?: PageOption): Promise<Recommendations>{
async recommendations(
id: number,
options?: PageOption
): Promise<Recommendations> {
const params = parseOptions(options);
return await this.api.get<Recommendations>(`${BASE_TV}/${id}/recommendations?${params}`);
return await this.api.get<Recommendations>(
`${BASE_TV}/${id}/recommendations?${params}`
);
}
async reviews(id: number, options?: PageOption): Promise<Reviews>{
async reviews(id: number, options?: PageOption): Promise<Reviews> {
const params = parseOptions(options);
return await this.api.get<Reviews>(`${BASE_TV}/${id}/reviews?${params}`);
}
async screenedTheatrically(id: number): Promise<ScreenedTheatrically>{
return await this.api.get<ScreenedTheatrically>(`${BASE_TV}/${id}/screened_theatrically`);
async screenedTheatrically(id: number): Promise<ScreenedTheatrically> {
return await this.api.get<ScreenedTheatrically>(
`${BASE_TV}/${id}/screened_theatrically`
);
}
async similar(id: number, options?: PageOption): Promise<SimilarTvShows>{
async similar(id: number, options?: PageOption): Promise<SimilarTvShows> {
const params = parseOptions(options);
return await this.api.get<SimilarTvShows>(`${BASE_TV}/${id}/similar?${params}`);
return await this.api.get<SimilarTvShows>(
`${BASE_TV}/${id}/similar?${params}`
);
}
async translations(id: number): Promise<Translations>{
async translations(id: number): Promise<Translations> {
return await this.api.get<Translations>(`${BASE_TV}/${id}/translations`);
}
async videos(id: number): Promise<Videos>{
async videos(id: number): Promise<Videos> {
return await this.api.get<Videos>(`${BASE_TV}/${id}/videos`);
}
/**
* Powered by JustWatch
* @param id
*/
async watchProviders(id: number): Promise<WatchProviders>{
return await this.api.get<WatchProviders>(`${BASE_TV}/${id}/watch/providers`);
* Powered by JustWatch
* @param id
*/
async watchProviders(id: number): Promise<WatchProviders> {
return await this.api.get<WatchProviders>(
`${BASE_TV}/${id}/watch/providers`
);
}
async latest(): Promise<LatestTvShows>{
async latest(): Promise<LatestTvShows> {
return await this.api.get<LatestTvShows>(`${BASE_TV}/latest`);
}
async onTheAir(): Promise<OnTheAir>{
async onTheAir(): Promise<OnTheAir> {
return await this.api.get<OnTheAir>(`${BASE_TV}/on_the_air`);
}
async airingToday(options?: PageOption & LanguageOption & RegionOption): Promise<TvShowsAiringToday>{
async airingToday(
options?: PageOption & LanguageOption & RegionOption
): Promise<TvShowsAiringToday> {
const params = parseOptions(options);
return await this.api.get<TvShowsAiringToday>(`${BASE_TV}/airing_today?${params}`);
return await this.api.get<TvShowsAiringToday>(
`${BASE_TV}/airing_today?${params}`
);
}
async popular(options?: PageOption & LanguageOption & RegionOption): Promise<PopularTvShows>{
async popular(
options?: PageOption & LanguageOption & RegionOption
): Promise<PopularTvShows> {
const params = parseOptions(options);
return await this.api.get<PopularTvShows>(`${BASE_TV}/popular?${params}`);
}
async topRated(options?: PageOption & LanguageOption & RegionOption): Promise<TopRatedTvShows>{
async topRated(
options?: PageOption & LanguageOption & RegionOption
): Promise<TopRatedTvShows> {
const params = parseOptions(options);
return await this.api.get<TopRatedTvShows>(`${BASE_TV}/top_rated?${params}`);
return await this.api.get<TopRatedTvShows>(
`${BASE_TV}/top_rated?${params}`
);
}
}