import { ChangeOptions, ExternalIds, Image, PeopleTranslations, PersonChanges, PersonCombinedCredits, PersonDetail, PersonMovieCredit, PersonTvShowCredit, PopularPersons, TaggedImages } from '../types'; import { BaseEndpoint } from './base'; import querystring from 'querystring'; const BASE_PERSON = '/person'; export class PeopleEndpoint extends BaseEndpoint { constructor(accessToken: string) { super(accessToken); } async details(id: number): Promise { return await this.api.get(`${BASE_PERSON}/${id}`); } async changes(id: number, options? : ChangeOptions): Promise { const params = querystring.encode(options); return await this.api.get(`${BASE_PERSON}/${id}/changes?${params}`); } async movieCredits(id: number): Promise { return await this.api.get(`${BASE_PERSON}/${id}/movie_credits`); } async tvShowCredits(id: number): Promise { return await this.api.get(`${BASE_PERSON}/${id}/tv_credits`); } async combinedCredits(id: number) : Promise { return await this.api.get(`${BASE_PERSON}/${id}/combined_credits`) } async externalId(id: number): Promise{ return await this.api.get(`${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 taggedImages(id: number, options?: {page?: number}): Promise{ const params = querystring.encode(options); return await this.api.get(`${BASE_PERSON}/${id}/tagged_images?${params}`); } async translation(id: number) : Promise{ return await this.api.get(`${BASE_PERSON}/${id}/translations`) } async latest(): Promise{ return await this.api.get(`${BASE_PERSON}/latest`); } async popular(options?: {page?: number}): Promise{ const params = querystring.encode(options); return await this.api.get(`${BASE_PERSON}/popular?${params}`); } }