Merge pull request #19 from Hoidi/formatting

Formatting with eslint
This commit is contained in:
Blake
2023-04-13 06:55:08 -04:00
committed by GitHub
10 changed files with 200 additions and 200 deletions

View File

@@ -21,7 +21,7 @@ const tmdb = new TMDB('accessToken');
try {
const movies = await tmdb.search.movies({ query: 'American Pie' });
console.log(movies);
console.log(movies);
} catch(err) {
// handle error
}

View File

@@ -26,7 +26,7 @@ interface DiscoverQueryOptions {
with_companies?: string;
}
interface MovieQueryOptions extends DiscoverQueryOptions{
interface MovieQueryOptions extends DiscoverQueryOptions{
region?: string;
certification_country?: string;
certification?: string;

View File

@@ -1,16 +1,16 @@
import {
ChangeOptions,
ExternalIds,
Image,
PageOption,
PeopleTranslations,
PersonChanges,
PersonCombinedCredits,
PersonDetail,
PersonMovieCredit,
PersonTvShowCredit,
PopularPersons,
TaggedImages
import {
ChangeOptions,
ExternalIds,
Image,
PageOption,
PeopleTranslations,
PersonChanges,
PersonCombinedCredits,
PersonDetail,
PersonMovieCredit,
PersonTvShowCredit,
PopularPersons,
TaggedImages,
} from '../types';
import { parseOptions } from '../utils';
import { BaseEndpoint } from './base';
@@ -18,54 +18,54 @@ import { BaseEndpoint } from './base';
const BASE_PERSON = '/person';
export class PeopleEndpoint extends BaseEndpoint {
constructor(accessToken: string) {
super(accessToken);
}
constructor(accessToken: string) {
super(accessToken);
}
async details(id: number): Promise<PersonDetail> {
return await this.api.get<PersonDetail>(`${BASE_PERSON}/${id}`);
}
async details(id: number): Promise<PersonDetail> {
return await this.api.get<PersonDetail>(`${BASE_PERSON}/${id}`);
}
async changes(id: number, options? : ChangeOptions): Promise<PersonChanges> {
const params = parseOptions(options);
return await this.api.get<PersonChanges>(`${BASE_PERSON}/${id}/changes?${params}`);
}
async changes(id: number, options? : ChangeOptions): Promise<PersonChanges> {
const params = parseOptions(options);
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`);
}
async movieCredits(id: number): Promise<PersonMovieCredit> {
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`);
}
async tvShowCredits(id: number): Promise<PersonTvShowCredit> {
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>{
return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`)
}
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>{
const params = parseOptions(options);
return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images?${params}`);
}
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages>{
const params = parseOptions(options);
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>{
return await this.api.get<PersonDetail>(`${BASE_PERSON}/latest`);
}
async latest(): Promise<PersonDetail>{
return await this.api.get<PersonDetail>(`${BASE_PERSON}/latest`);
}
async popular(options?: PageOption): Promise<PopularPersons>{
const params = parseOptions(options);
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
}
async popular(options?: PageOption): Promise<PopularPersons>{
const params = parseOptions(options);
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${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 {

View File

@@ -63,7 +63,7 @@ export default class TMDB {
get discover(): DiscoverEndpoint{
return new DiscoverEndpoint(this.accessToken);
}
get people(): PeopleEndpoint{
return new PeopleEndpoint(this.accessToken);
}

View File

@@ -1,14 +1,14 @@
import { Movie } from ".";
import { Movie } from '.';
export interface Collection {
id: number;
backdrop_path: string;
name: string;
poster_path: string;
adult: boolean;
original_language: string;
original_name: string;
overview: string;
id: number;
backdrop_path: string;
name: string;
poster_path: string;
adult: boolean;
original_language: string;
original_name: string;
overview: string;
}
export interface DetailedCollection extends Collection {

View File

@@ -1,4 +1,4 @@
import { Movie, TV } from ".";
import { Movie, TV } from '.';
export type SortOption =
| 'popularity.asc'
@@ -17,15 +17,15 @@ export type SortOption =
| 'vote_count.desc';
export interface MovieDiscoverResult{
page: number;
results: Movie[];
total_results: number;
total_pages: number;
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
export interface TvShowDiscoverResult{
page: number;
results: TV[];
total_results: number;
total_pages: number;
page: number;
results: TV[];
total_results: number;
total_pages: number;
}

View File

@@ -1,28 +1,28 @@
import { Episode, Media, MediaType, Movie, Person, Season, TV } from '.';
import { Episode, MediaType, Movie, Person, Season, TV } from '.';
export type ExternalSource =
| 'imdb_id'
| 'freebase_mid'
| 'freebase_id'
| 'tvdb_id'
| 'tvrage_id'
| 'facebook_id'
| 'twitter_id'
| 'instagram_id';
| 'imdb_id'
| 'freebase_mid'
| 'freebase_id'
| 'tvdb_id'
| 'tvrage_id'
| 'facebook_id'
| 'twitter_id'
| 'instagram_id';
export interface ExternalIdOptions {
external_source: ExternalSource;
language?: string;
external_source: ExternalSource;
language?: string;
}
type MediaTagged<T> = T & {
media_type: MediaType;
media_type: MediaType;
};
export interface FindResult {
movie_results: MediaTagged<Movie>[];
person_results: MediaTagged<Person>[];
tv_results: MediaTagged<TV>[];
tv_episode_results: MediaTagged<Episode>[];
tv_season_results: MediaTagged<Season & { show_id: string }>[];
movie_results: MediaTagged<Movie>[];
person_results: MediaTagged<Person>[];
tv_results: MediaTagged<TV>[];
tv_episode_results: MediaTagged<Episode>[];
tv_season_results: MediaTagged<Season & { show_id: string }>[];
}

View File

@@ -1,126 +1,126 @@
import { Movie, Person, TV, TvShowItem } from ".";
import { Movie, Person, TV } from '.';
interface Cast {
character: string;
credit_id: string;
vote_count: number;
id: number;
backdrop_path: string;
poster_path: string;
original_language: string;
vote_average: number;
genre_ids: number[];
popularity: number;
overview: string;
character: string;
credit_id: string;
vote_count: number;
id: number;
backdrop_path: string;
poster_path: string;
original_language: string;
vote_average: number;
genre_ids: number[];
popularity: number;
overview: string;
}
interface Crew {
id: number;
department: string;
original_language: string;
credit_id: string;
overview: string;
vote_count: number;
poster_path: string;
backdrop_path: string;
popularity: number;
genre_ids: number[];
job: string;
vote_average: number;
id: number;
department: string;
original_language: string;
credit_id: string;
overview: string;
vote_count: number;
poster_path: string;
backdrop_path: string;
popularity: number;
genre_ids: number[];
job: string;
vote_average: number;
}
export interface PersonMovieCast extends Cast {
release_date: string;
video: boolean;
adult: boolean;
title: string;
original_title: string;
release_date: string;
video: boolean;
adult: boolean;
title: string;
original_title: string;
}
export interface PersonMovieCrew extends Crew {
original_title: string;
video: boolean;
title: string;
adult: boolean;
release_date: string;
original_title: string;
video: boolean;
title: string;
adult: boolean;
release_date: string;
}
export interface PersonTvShowCrew extends Crew {
episode_count: number;
origin_country: string[];
original_name: string;
name: string;
first_air_date: string;
episode_count: number;
origin_country: string[];
original_name: string;
name: string;
first_air_date: string;
}
export interface PersonTvShowCast extends Cast {
original_name: string;
name: string;
episode_count: number;
first_air_date: string;
origin_country: string[];
original_name: string;
name: string;
episode_count: number;
first_air_date: string;
origin_country: string[];
}
export interface PersonMovieCredit {
cast: PersonMovieCast[];
crew: PersonMovieCrew[];
id: number;
cast: PersonMovieCast[];
crew: PersonMovieCrew[];
id: number;
}
export interface PersonTvShowCredit {
cast: PersonTvShowCast[];
crew: PersonTvShowCrew[];
id: number;
cast: PersonTvShowCast[];
crew: PersonTvShowCrew[];
id: number;
}
export interface PersonCombinedCredits {
cast: (PersonMovieCast & PersonTvShowCast)[];
crew: (PersonMovieCrew & PersonTvShowCrew)[];
id: number;
cast: (PersonMovieCast & PersonTvShowCast)[];
crew: (PersonMovieCrew & PersonTvShowCrew)[];
id: number;
}
export interface PersonDetail {
birthday: string,
known_for_department: string,
deathday: string,
id: number,
name: string,
also_known_as: string[]
gender: number,
biography: string,
popularity: number,
place_of_birth: string,
profile_path: string,
adult: boolean,
imdb_id: string,
homepage: string
birthday: string;
known_for_department: string;
deathday: string;
id: number;
name: string;
also_known_as: string[];
gender: number;
biography: string;
popularity: number;
place_of_birth: string;
profile_path: string;
adult: boolean;
imdb_id: string;
homepage: string;
}
export interface PersonChange{
id: string;
action: string;
time: string;
iso_639_1: string;
iso_3166_1: string;
value: string | { profile: { file_path: string;} };
original_value: string | { profile: { file_path: string; } };
export interface PersonChange {
id: string;
action: string;
time: string;
iso_639_1: string;
iso_3166_1: string;
value: string | { profile: { file_path: string } };
original_value: string | { profile: { file_path: string } };
}
export interface PersonChanges {
changes: {
key: string;
items: PersonChange[];
}[];
changes: {
key: string;
items: PersonChange[];
}[];
}
export interface PopularPersons{
page: number;
results: Person[];
total_results: number;
total_pages: number;
export interface PopularPersons {
page: number;
results: Person[];
total_results: number;
total_pages: number;
}
export interface TaggedImage{
export interface TaggedImage {
aspect_ratio: number;
file_path: string;
height: number;
@@ -131,25 +131,25 @@ export interface TaggedImage{
width: number;
image_type: string;
media_type: string;
media: Movie | TV
media: Movie | TV;
}
export interface TaggedImages{
page: number;
results: TaggedImage[];
total_results: number;
total_pages: number;
export interface TaggedImages {
page: number;
results: TaggedImage[];
total_results: number;
total_pages: number;
}
export interface PeopleTranslations{
id: number;
translations: {
iso_3166_1: string;
iso_639_1: string;
name: string;
english_name: string;
data: {
biography: string
};
}
}
export interface PeopleTranslations {
id: number;
translations: {
iso_3166_1: string;
iso_639_1: string;
name: string;
english_name: string;
data: {
biography: string;
};
};
}

View File

@@ -4,12 +4,12 @@ export type MediaType = 'all' | 'movie' | 'tv' | 'person';
export type TimeWindow = 'day' | 'week';
type TrendingResult<T extends MediaType> = T extends 'tv'
? TV
: T extends 'movie'
? Movie
: T extends 'person'
? Person
: TV | Movie | Person;
? TV
: T extends 'movie'
? Movie
: T extends 'person'
? Person
: TV | Movie | Person;
export interface TrendingResults<T extends MediaType> {
page: number;