Formatting with eslint
Should probably be configured to run for every commit in the future
This commit is contained in:
@@ -21,7 +21,7 @@ const tmdb = new TMDB('accessToken');
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const movies = await tmdb.search.movies({ query: 'American Pie' });
|
const movies = await tmdb.search.movies({ query: 'American Pie' });
|
||||||
console.log(movies);
|
console.log(movies);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// handle error
|
// handle error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import {
|
import {
|
||||||
ChangeOptions,
|
ChangeOptions,
|
||||||
ExternalIds,
|
ExternalIds,
|
||||||
Image,
|
Image,
|
||||||
PageOption,
|
PageOption,
|
||||||
PeopleTranslations,
|
PeopleTranslations,
|
||||||
PersonChanges,
|
PersonChanges,
|
||||||
PersonCombinedCredits,
|
PersonCombinedCredits,
|
||||||
PersonDetail,
|
PersonDetail,
|
||||||
PersonMovieCredit,
|
PersonMovieCredit,
|
||||||
PersonTvShowCredit,
|
PersonTvShowCredit,
|
||||||
PopularPersons,
|
PopularPersons,
|
||||||
TaggedImages
|
TaggedImages,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { parseOptions } from '../utils';
|
import { parseOptions } from '../utils';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
@@ -18,54 +18,54 @@ import { BaseEndpoint } from './base';
|
|||||||
const BASE_PERSON = '/person';
|
const BASE_PERSON = '/person';
|
||||||
|
|
||||||
export class PeopleEndpoint extends BaseEndpoint {
|
export class PeopleEndpoint extends BaseEndpoint {
|
||||||
constructor(accessToken: string) {
|
constructor(accessToken: string) {
|
||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async details(id: number): Promise<PersonDetail> {
|
async details(id: number): Promise<PersonDetail> {
|
||||||
return await this.api.get<PersonDetail>(`${BASE_PERSON}/${id}`);
|
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);
|
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> {
|
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> {
|
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> {
|
async combinedCredits(id: number) : Promise<PersonCombinedCredits> {
|
||||||
return await this.api.get<PersonCombinedCredits>(`${BASE_PERSON}/${id}/combined_credits`)
|
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`)
|
return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async images(id: number): Promise<{id: number, profiles: Image[]}>{
|
async images(id: number): Promise<{id: number, profiles: Image[]}>{
|
||||||
return await this.api.get<{id: number, profiles: Image[]}>(`${BASE_PERSON}/${id}/images`)
|
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);
|
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>{
|
async translation(id: number) : Promise<PeopleTranslations>{
|
||||||
return await this.api.get<PeopleTranslations>(`${BASE_PERSON}/${id}/translations`)
|
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`);
|
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);
|
const params = parseOptions(options);
|
||||||
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
|
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MediaType, TimeWindow, TrendingResults, } from '../types';
|
import { MediaType, TimeWindow, TrendingResults } from '../types';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
export class TrendingEndpoint extends BaseEndpoint {
|
export class TrendingEndpoint extends BaseEndpoint {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Movie } from ".";
|
import { Movie } from '.';
|
||||||
|
|
||||||
export interface Collection {
|
export interface Collection {
|
||||||
id: number;
|
id: number;
|
||||||
backdrop_path: string;
|
backdrop_path: string;
|
||||||
name: string;
|
name: string;
|
||||||
poster_path: string;
|
poster_path: string;
|
||||||
adult: boolean;
|
adult: boolean;
|
||||||
original_language: string;
|
original_language: string;
|
||||||
original_name: string;
|
original_name: string;
|
||||||
overview: string;
|
overview: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DetailedCollection extends Collection {
|
export interface DetailedCollection extends Collection {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Movie, TV } from ".";
|
import { Movie, TV } from '.';
|
||||||
|
|
||||||
export type SortOption =
|
export type SortOption =
|
||||||
| 'popularity.asc'
|
| 'popularity.asc'
|
||||||
@@ -17,15 +17,15 @@ export type SortOption =
|
|||||||
| 'vote_count.desc';
|
| 'vote_count.desc';
|
||||||
|
|
||||||
export interface MovieDiscoverResult{
|
export interface MovieDiscoverResult{
|
||||||
page: number;
|
page: number;
|
||||||
results: Movie[];
|
results: Movie[];
|
||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TvShowDiscoverResult{
|
export interface TvShowDiscoverResult{
|
||||||
page: number;
|
page: number;
|
||||||
results: TV[];
|
results: TV[];
|
||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import { Episode, Media, MediaType, Movie, Person, Season, TV } from '.';
|
import { Episode, MediaType, Movie, Person, Season, TV } from '.';
|
||||||
|
|
||||||
export type ExternalSource =
|
export type ExternalSource =
|
||||||
| 'imdb_id'
|
| 'imdb_id'
|
||||||
| 'freebase_mid'
|
| 'freebase_mid'
|
||||||
| 'freebase_id'
|
| 'freebase_id'
|
||||||
| 'tvdb_id'
|
| 'tvdb_id'
|
||||||
| 'tvrage_id'
|
| 'tvrage_id'
|
||||||
| 'facebook_id'
|
| 'facebook_id'
|
||||||
| 'twitter_id'
|
| 'twitter_id'
|
||||||
| 'instagram_id';
|
| 'instagram_id';
|
||||||
|
|
||||||
export interface ExternalIdOptions {
|
export interface ExternalIdOptions {
|
||||||
external_source: ExternalSource;
|
external_source: ExternalSource;
|
||||||
language?: string;
|
language?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type MediaTagged<T> = T & {
|
type MediaTagged<T> = T & {
|
||||||
media_type: MediaType;
|
media_type: MediaType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface FindResult {
|
export interface FindResult {
|
||||||
movie_results: MediaTagged<Movie>[];
|
movie_results: MediaTagged<Movie>[];
|
||||||
person_results: MediaTagged<Person>[];
|
person_results: MediaTagged<Person>[];
|
||||||
tv_results: MediaTagged<TV>[];
|
tv_results: MediaTagged<TV>[];
|
||||||
tv_episode_results: MediaTagged<Episode>[];
|
tv_episode_results: MediaTagged<Episode>[];
|
||||||
tv_season_results: MediaTagged<Season & { show_id: string }>[];
|
tv_season_results: MediaTagged<Season & { show_id: string }>[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,126 +1,126 @@
|
|||||||
import { Movie, Person, TV, TvShowItem } from ".";
|
import { Movie, Person, TV } from '.';
|
||||||
|
|
||||||
interface Cast {
|
interface Cast {
|
||||||
character: string;
|
character: string;
|
||||||
credit_id: string;
|
credit_id: string;
|
||||||
vote_count: number;
|
vote_count: number;
|
||||||
id: number;
|
id: number;
|
||||||
backdrop_path: string;
|
backdrop_path: string;
|
||||||
poster_path: string;
|
poster_path: string;
|
||||||
original_language: string;
|
original_language: string;
|
||||||
vote_average: number;
|
vote_average: number;
|
||||||
genre_ids: number[];
|
genre_ids: number[];
|
||||||
popularity: number;
|
popularity: number;
|
||||||
overview: string;
|
overview: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Crew {
|
interface Crew {
|
||||||
id: number;
|
id: number;
|
||||||
department: string;
|
department: string;
|
||||||
original_language: string;
|
original_language: string;
|
||||||
credit_id: string;
|
credit_id: string;
|
||||||
overview: string;
|
overview: string;
|
||||||
vote_count: number;
|
vote_count: number;
|
||||||
poster_path: string;
|
poster_path: string;
|
||||||
backdrop_path: string;
|
backdrop_path: string;
|
||||||
popularity: number;
|
popularity: number;
|
||||||
genre_ids: number[];
|
genre_ids: number[];
|
||||||
job: string;
|
job: string;
|
||||||
vote_average: number;
|
vote_average: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMovieCast extends Cast {
|
export interface PersonMovieCast extends Cast {
|
||||||
release_date: string;
|
release_date: string;
|
||||||
video: boolean;
|
video: boolean;
|
||||||
adult: boolean;
|
adult: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
original_title: string;
|
original_title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMovieCrew extends Crew {
|
export interface PersonMovieCrew extends Crew {
|
||||||
original_title: string;
|
original_title: string;
|
||||||
video: boolean;
|
video: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
adult: boolean;
|
adult: boolean;
|
||||||
release_date: string;
|
release_date: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonTvShowCrew extends Crew {
|
export interface PersonTvShowCrew extends Crew {
|
||||||
episode_count: number;
|
episode_count: number;
|
||||||
origin_country: string[];
|
origin_country: string[];
|
||||||
original_name: string;
|
original_name: string;
|
||||||
name: string;
|
name: string;
|
||||||
first_air_date: string;
|
first_air_date: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonTvShowCast extends Cast {
|
export interface PersonTvShowCast extends Cast {
|
||||||
original_name: string;
|
original_name: string;
|
||||||
name: string;
|
name: string;
|
||||||
episode_count: number;
|
episode_count: number;
|
||||||
first_air_date: string;
|
first_air_date: string;
|
||||||
origin_country: string[];
|
origin_country: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMovieCredit {
|
export interface PersonMovieCredit {
|
||||||
cast: PersonMovieCast[];
|
cast: PersonMovieCast[];
|
||||||
crew: PersonMovieCrew[];
|
crew: PersonMovieCrew[];
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonTvShowCredit {
|
export interface PersonTvShowCredit {
|
||||||
cast: PersonTvShowCast[];
|
cast: PersonTvShowCast[];
|
||||||
crew: PersonTvShowCrew[];
|
crew: PersonTvShowCrew[];
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonCombinedCredits {
|
export interface PersonCombinedCredits {
|
||||||
cast: (PersonMovieCast & PersonTvShowCast)[];
|
cast: (PersonMovieCast & PersonTvShowCast)[];
|
||||||
crew: (PersonMovieCrew & PersonTvShowCrew)[];
|
crew: (PersonMovieCrew & PersonTvShowCrew)[];
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonDetail {
|
export interface PersonDetail {
|
||||||
birthday: string,
|
birthday: string;
|
||||||
known_for_department: string,
|
known_for_department: string;
|
||||||
deathday: string,
|
deathday: string;
|
||||||
id: number,
|
id: number;
|
||||||
name: string,
|
name: string;
|
||||||
also_known_as: string[]
|
also_known_as: string[];
|
||||||
gender: number,
|
gender: number;
|
||||||
biography: string,
|
biography: string;
|
||||||
popularity: number,
|
popularity: number;
|
||||||
place_of_birth: string,
|
place_of_birth: string;
|
||||||
profile_path: string,
|
profile_path: string;
|
||||||
adult: boolean,
|
adult: boolean;
|
||||||
imdb_id: string,
|
imdb_id: string;
|
||||||
homepage: string
|
homepage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonChange{
|
export interface PersonChange {
|
||||||
id: string;
|
id: string;
|
||||||
action: string;
|
action: string;
|
||||||
time: string;
|
time: string;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
iso_3166_1: string;
|
iso_3166_1: string;
|
||||||
value: string | { profile: { file_path: string;} };
|
value: string | { profile: { file_path: string } };
|
||||||
original_value: string | { profile: { file_path: string; } };
|
original_value: string | { profile: { file_path: string } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonChanges {
|
export interface PersonChanges {
|
||||||
changes: {
|
changes: {
|
||||||
key: string;
|
key: string;
|
||||||
items: PersonChange[];
|
items: PersonChange[];
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PopularPersons{
|
export interface PopularPersons {
|
||||||
page: number;
|
page: number;
|
||||||
results: Person[];
|
results: Person[];
|
||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaggedImage{
|
export interface TaggedImage {
|
||||||
aspect_ratio: number;
|
aspect_ratio: number;
|
||||||
file_path: string;
|
file_path: string;
|
||||||
height: number;
|
height: number;
|
||||||
@@ -131,25 +131,25 @@ export interface TaggedImage{
|
|||||||
width: number;
|
width: number;
|
||||||
image_type: string;
|
image_type: string;
|
||||||
media_type: string;
|
media_type: string;
|
||||||
media: Movie | TV
|
media: Movie | TV;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaggedImages{
|
export interface TaggedImages {
|
||||||
page: number;
|
page: number;
|
||||||
results: TaggedImage[];
|
results: TaggedImage[];
|
||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeopleTranslations{
|
export interface PeopleTranslations {
|
||||||
id: number;
|
id: number;
|
||||||
translations: {
|
translations: {
|
||||||
iso_3166_1: string;
|
iso_3166_1: string;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
name: string;
|
name: string;
|
||||||
english_name: string;
|
english_name: string;
|
||||||
data: {
|
data: {
|
||||||
biography: string
|
biography: string;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@ export type MediaType = 'all' | 'movie' | 'tv' | 'person';
|
|||||||
export type TimeWindow = 'day' | 'week';
|
export type TimeWindow = 'day' | 'week';
|
||||||
|
|
||||||
type TrendingResult<T extends MediaType> = T extends 'tv'
|
type TrendingResult<T extends MediaType> = T extends 'tv'
|
||||||
? TV
|
? TV
|
||||||
: T extends 'movie'
|
: T extends 'movie'
|
||||||
? Movie
|
? Movie
|
||||||
: T extends 'person'
|
: T extends 'person'
|
||||||
? Person
|
? Person
|
||||||
: TV | Movie | Person;
|
: TV | Movie | Person;
|
||||||
|
|
||||||
export interface TrendingResults<T extends MediaType> {
|
export interface TrendingResults<T extends MediaType> {
|
||||||
page: number;
|
page: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user