@tdanks2000/tmdb-wrapper
Version:
A powerful and easy-to-use TypeScript wrapper for The Movie Database (TMDb) API
1,874 lines • 99 kB
text/typescript
//#region src/@types/endpoints/account.d.ts
interface Gravatar {
hash: string;
}
interface Avatar {
gravatar: Gravatar;
}
interface AccountDetails {
avatar: Avatar;
id: number;
include_adult: boolean;
iso_3166_1: string;
iso_639_1: string;
name: string;
username: string;
}
//# sourceMappingURL=account.d.ts.map
//#endregion
//#region src/@types/endpoints/certification.d.ts
interface Certification {
certification: string;
meaning: string;
order: number;
}
interface Certifications {
certifications: Record<string, Certification[]>;
}
//# sourceMappingURL=certification.d.ts.map
//#endregion
//#region src/@types/endpoints/changes.d.ts
interface MediaChange {
id: number;
adult: boolean | undefined;
}
interface MediaChanges {
results: MediaChange[];
page: number;
total_pages: number;
total_results: number;
}
interface Changes<T> {
changes: Change<T>[];
}
interface Change<T> {
key: string;
items: ChangeItem<T>[];
}
interface ChangeItem<T> {
id: string;
action: string;
time: string;
value: T;
iso_639_1: string;
original_value: T;
}
//# sourceMappingURL=changes.d.ts.map
//#endregion
//#region src/@types/wire.d.ts
type TMDBDate = string;
type TMDBDateTime = string;
type Nullable<T> = T | null;
//# sourceMappingURL=wire.d.ts.map
//#endregion
//#region src/@types/endpoints/collection.d.ts
interface Collection {
id: number;
backdrop_path: Nullable<string>;
name: string;
poster_path: Nullable<string>;
adult: boolean;
original_language: string;
original_name: string;
overview: string;
}
interface DetailedCollection extends Collection {
parts: Movie[];
}
interface CollectionImageOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_image_language?: string[];
}
//# sourceMappingURL=collection.d.ts.map
//#endregion
//#region src/@types/endpoints/companies.d.ts
interface CompanyDetails {
description: string;
headquarters: string;
homepage: Nullable<string>;
id: number;
logo_path: Nullable<string>;
name: string;
origin_country: string;
parent_company: Nullable<ParentCompany>;
}
interface ParentCompany {
name: string;
id: number;
logo_path: Nullable<string>;
}
interface AlternativeNames {
id: number;
results: Name[];
}
interface Name {
name: string;
type: string;
}
interface CompanyImages {
id: number;
logos: Image[];
}
//# sourceMappingURL=companies.d.ts.map
//#endregion
//#region src/@types/endpoints/configuration.d.ts
interface ImageConfiguration {
base_url: string;
secure_base_url: string;
backdrop_sizes: BackdropSizes[];
logo_sizes: LogoSizes[];
poster_sizes: PosterSizes[];
profile_sizes: ProfileSizes[];
still_sizes: StillSizes[];
}
interface Configuration {
images: ImageConfiguration;
change_keys: ChangeKeys[];
}
declare enum BackdropSizes {
W300 = "w300",
W500 = "w500",
W780 = "w780",
W1280 = "w1280",
ORIGINAL = "original",
}
declare enum LogoSizes {
W45 = "w45",
W92 = "w92",
W154 = "w154",
W185 = "w185",
W300 = "w300",
W500 = "w500",
ORIGINAL = "original",
}
declare enum PosterSizes {
W92 = "w92",
W154 = "w154",
W185 = "w185",
W300 = "w300",
W500 = "w500",
W780 = "w780",
ORIGINAL = "original",
}
declare enum ProfileSizes {
W45 = "w45",
W185 = "w185",
W632 = "w632",
ORIGINAL = "original",
}
declare enum StillSizes {
W92 = "w92",
W185 = "w185",
W300 = "w300",
ORIGINAL = "original",
}
declare enum ChangeKeys {
ADULT = "adult",
AIR_DATE = "air_date",
ALSO_KNOWN_AS = "also_known_as",
ALTERNATIVE_TITLES = "alternative_titles",
BIOGRAPHY = "biography",
BIRTHDAY = "birthday",
BUDGET = "budget",
CAST = "cast",
CERTIFICATIONS = "certifications",
CHARACTER_NAMES = "character_names",
CREATED_BY = "created_by",
CREW = "crew",
DEATHDAY = "deathday",
EPISODE = "episode",
EPISODE_NUMBER = "episode_number",
EPISODE_RUN_TIME = "episode_run_time",
FREEBASE_ID = "freebase_id",
FREEBASE_MID = "freebase_mid",
GENERAL = "general",
GENRES = "genres",
GUEST_STARS = "guest_stars",
HOMEPAGE = "homepage",
IMAGES = "images",
IMDB_ID = "imdb_id",
LANGUAGES = "languages",
NAME = "name",
NETWORK = "network",
ORIGIN_COUNTRY = "origin_country",
ORIGINAL_NAME = "original_name",
ORIGINAL_TITLE = "original_title",
OVERVIEW = "overview",
PARTS = "parts",
PLACE_OF_BIRTH = "place_of_birth",
PLOT_KEYWORDS = "plot_keywords",
PRODUCTION_CODE = "production_code",
PRODUCTION_COMPANIES = "production_companies",
PRODUCTION_COUNTRIES = "production_countries",
RELEASES = "releases",
REVENUE = "revenue",
RUNTIME = "runtime",
SEASON = "season",
SEASON_NUMBER = "season_number",
SEASON_REGULAR = "season_regular",
SPOKEN_LANGUAGES = "spoken_languages",
STATUS = "status",
TAGLINE = "tagline",
TITLE = "title",
TRANSLATIONS = "translations",
TVDB_ID = "tvdb_id",
TVRAGE_ID = "tvrage_id",
TYPE = "type",
VIDEO = "video",
VIDEOS = "videos",
}
//# sourceMappingURL=configuration.d.ts.map
//#endregion
//#region src/@types/endpoints/credits.d.ts
interface CreditSeason {
air_date?: string;
poster_path: Nullable<string>;
season_number?: number;
}
interface Media$1 {
id?: number;
name?: string;
first_air_date?: string;
vote_count?: number;
overview?: string;
vote_average?: number;
backdrop_path: Nullable<string>;
genre_ids?: number[];
original_name?: string;
origin_country?: string[];
poster_path: Nullable<string>;
original_language?: string;
popularity?: number;
character?: string;
episodes?: string[];
seasons?: CreditSeason[];
}
interface CreditResponse {
credit_type?: string;
department?: string;
job?: string;
media?: Media$1;
media_type?: string;
id?: string;
person?: Person;
}
interface Title {
iso_3166_1: string;
title: string;
type: string;
}
interface AlternativeTitles {
id: number;
titles: Title[];
}
interface Cast {
adult: boolean;
gender: number;
id: number;
known_for_department: string;
name: string;
original_name: string;
popularity: number;
profile_path: Nullable<string>;
cast_id: number;
character: string;
credit_id: string;
order: number;
}
interface Crew {
adult: boolean;
gender: number;
id: number;
known_for_department: string;
name: string;
original_name: string;
popularity: number;
profile_path: Nullable<string>;
credit_id: string;
department: string;
job: string;
}
interface Credits {
id: number;
cast: Cast[];
crew: Crew[];
}
interface ImageCollection {
id: number;
backdrops: Image[];
posters: Image[];
}
interface Video {
id: string;
iso_639_1: string;
iso_3166_1: string;
key: string;
name: string;
site: string;
size: number;
type: string;
}
interface Videos {
id: number;
results: Video[];
}
interface AggregateCredits {
id: number;
cast: AggregateCast[];
crew: AggregateCrew[];
}
interface CastRole {
credit_id: string;
character: string;
episode_count: number;
}
interface AggregateCast {
adult: boolean;
gender: number;
id: number;
known_for_department: string;
name: string;
original_name: string;
popularity: number;
profile_path: Nullable<string>;
roles: CastRole[];
total_episode_count: number;
order: number;
}
interface CrewJob {
credit_id: string;
job: string;
episode_count: number;
}
interface AggregateCrew {
adult: boolean;
gender: number;
id: number;
known_for_department: string;
name: string;
original_name: string;
popularity: number;
profile_path: Nullable<string>;
jobs: CrewJob[];
department: string;
total_episode_count: number;
}
//# sourceMappingURL=credits.d.ts.map
//#endregion
//#region src/@types/endpoints/discover.d.ts
type MovieSortOption = "original_title.asc" | "original_title.desc" | "popularity.asc" | "popularity.desc" | "revenue.asc" | "revenue.desc" | "primary_release_date.asc" | "primary_release_date.desc" | "title.asc" | "title.desc" | "vote_average.asc" | "vote_average.desc" | "vote_count.asc" | "vote_count.desc";
type TvSortOption = "first_air_date.asc" | "first_air_date.desc" | "name.asc" | "name.desc" | "original_name.asc" | "original_name.desc" | "popularity.asc" | "popularity.desc" | "vote_average.asc" | "vote_average.desc" | "vote_count.asc" | "vote_count.desc";
interface MovieDiscoverResult {
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
interface TvShowDiscoverResult {
page: number;
results: TV[];
total_results: number;
total_pages: number;
}
type WatchMonetizationType = "flatrate" | "free" | "ads" | "rent" | "buy";
interface DiscoverQueryOptions {
language?: string;
page?: number;
"vote_average.gte"?: number;
"vote_average.lte"?: number;
"vote_count.gte"?: number;
"vote_count.lte"?: number;
with_watch_providers?: string;
without_watch_providers?: string;
watch_region?: string;
with_watch_monetization_types?: WatchMonetizationType | string;
"with_runtime.gte"?: number;
"with_runtime.lte"?: number;
with_genres?: string;
without_genres?: string;
with_keywords?: string;
without_keywords?: string;
with_companies?: string;
without_companies?: string;
with_original_language?: string;
with_text_query?: string;
}
interface MovieQueryOptions extends Omit<DiscoverQueryOptions, "with_text_query"> {
sort_by?: MovieSortOption;
region?: string;
certification_country?: string;
certification?: string;
"certification.lte"?: string;
"certification.gte"?: string;
include_adult?: boolean;
include_video?: boolean;
primary_release_year?: number;
"primary_release_date.gte"?: string;
"primary_release_date.lte"?: string;
"release_date.gte"?: string;
"release_date.lte"?: string;
with_release_type?: number | string;
year?: number;
with_cast?: string;
with_crew?: string;
with_people?: string;
}
interface TvShowQueryOptions extends DiscoverQueryOptions {
sort_by?: TvSortOption;
"air_date.gte"?: string;
"air_date.lte"?: string;
"first_air_date.gte"?: string;
"first_air_date.lte"?: string;
first_air_date_year?: number;
include_adult?: boolean;
include_null_first_air_dates?: boolean;
screened_theatrically?: boolean;
timezone?: string;
with_networks?: number | string;
with_origin_country?: string;
with_status?: string;
with_type?: string;
}
//# sourceMappingURL=discover.d.ts.map
//#endregion
//#region src/@types/endpoints/find.d.ts
type ExternalSource = "imdb_id" | "freebase_mid" | "freebase_id" | "tvdb_id" | "tvrage_id" | "facebook_id" | "twitter_id" | "instagram_id";
interface ExternalIdOptions {
external_source: ExternalSource;
language?: string;
}
type MediaTagged<T, TMediaType extends string> = T & {
media_type: TMediaType;
};
interface FindResult {
movie_results: MediaTagged<Movie, "movie">[];
person_results: MediaTagged<Person, "person">[];
tv_results: MediaTagged<TV, "tv">[];
tv_episode_results: MediaTagged<Episode, "tv_episode">[];
tv_season_results: MediaTagged<Season & {
show_id: number;
}, "tv_season">[];
}
//#endregion
//#region src/@types/endpoints/genre.d.ts
interface Genres {
genres: Array<{
id: number;
name: string;
}>;
}
//# sourceMappingURL=genre.d.ts.map
//#endregion
//#region src/@types/endpoints/options.d.ts
interface LanguageOption {
language?: string;
}
interface RegionOption {
region?: string;
}
interface TimezoneOption {
timezone?: string;
}
interface PageOption {
page?: number;
}
interface ChangeOption extends PageOption {
start_date?: TMDBDate;
end_date?: TMDBDate;
}
type AppendToResponseMovieKey = "images" | "videos" | "credits" | "recommendations" | "reviews" | "changes" | "similar" | "lists" | "release_dates" | "alternative_titles" | "external_ids" | "translations" | "watch/providers" | "keywords";
type AppendToResponseTvKey = "content_ratings" | "images" | "videos" | "credits" | "recommendations" | "reviews" | "changes" | "similar" | "alternative_titles" | "external_ids" | "translations" | "watch/providers" | "aggregate_credits" | "episode_groups" | "screened_theatrically" | "keywords";
type AppendToResponsePersonKey = "images" | "changes" | "movie_credits" | "tv_credits" | "combined_credits" | "external_ids" | "tagged_images" | "translations";
type AppendToResponseTvEpisodeKey = "images" | "credits" | "external_ids" | "videos" | "translations";
type AppendToResponseTvSeasonKey = "images" | "credits" | "external_ids" | "videos" | "aggregate_credits" | "translations";
type AppendToResponseAllKeys = AppendToResponseTvKey | AppendToResponseMovieKey | AppendToResponseTvEpisodeKey | AppendToResponseTvSeasonKey | AppendToResponsePersonKey;
type AppendToResponseMediaType = "movie" | "tvShow" | "person" | "tvSeason" | "tvEpisode";
type AppendToResponse<K, T extends AppendToResponseAllKeys[] | undefined, Media extends AppendToResponseMediaType> = K & (T extends undefined ? object : T extends Array<unknown> ? ("credits" extends T[number] ? {
credits: Media extends "tvEpisode" ? TvEpisodeCredit : Omit<Credits, "id">;
} : object) & ("videos" extends T[number] ? {
videos: Omit<Videos, "id">;
} : object) & ("images" extends T[number] ? {
images: Omit<Media extends "person" ? PeopleImages : Images, "id">;
} : object) & ("recommendations" extends T[number] ? {
recommendations: Recommendations;
} : object) & ("reviews" extends T[number] ? {
reviews: Omit<Reviews, "id">;
} : object) & ("changes" extends T[number] ? {
changes: Changes<Media extends "person" ? PersonChangeValue : Media extends "movie" ? MovieChangeValue : Media extends "tvShow" ? TvShowChangeValue : Media extends "tvSeason" ? TvSeasonChangeValue : TvEpisodeChangeValue>;
} : object) & ("keywords" extends T[number] ? {
keywords: Omit<Keywords, "id">;
} : object) & ("lists" extends T[number] ? {
lists: Omit<MovieLists, "id">;
} : object) & ("release_dates" extends T[number] ? {
release_dates: Omit<ReleaseDates, "id">;
} : object) & ("alternative_titles" extends T[number] ? {
alternative_titles: Omit<AlternativeTitles, "id">;
} : object) & ("external_ids" extends T[number] ? {
external_ids: Omit<ExternalIds, "id">;
} : object) & ("translations" extends T[number] ? {
translations: Omit<Media extends "person" ? PersonTranslations : Media extends "tvEpisode" ? TvEpisodeTranslations : Translations, "id">;
} : object) & ("watch/providers" extends T[number] ? {
"watch/providers": Omit<WatchProviders, "id">;
} : object) & ("aggregate_credits" extends T[number] ? {
aggregate_credits: Omit<AggregateCredits, "id">;
} : object) & ("episode_groups" extends T[number] ? {
episode_groups: Omit<EpisodeGroups, "id">;
} : object) & ("screened_theatrically" extends T[number] ? {
screened_theatrically: Omit<ScreenedTheatrically, "id">;
} : object) & ("similar" extends T[number] ? {
similar: Media extends "movie" ? SimilarMovies : Media extends "tvShow" ? Similartv : unknown;
} : object) & ("content_ratings" extends T[number] ? {
content_ratings: Omit<ContentRatings, "id">;
} : object) & ("movie_credits" extends T[number] ? {
movie_credits: Omit<PersonMovieCredit, "id">;
} : object) & ("tv_credits" extends T[number] ? {
tv_credits: Omit<PersonTvShowCredit, "id">;
} : object) & ("combined_credits" extends T[number] ? {
combined_credits: Omit<PersonCombinedCredits, "id">;
} : object) & ("tagged_images" extends T[number] ? {
tagged_images: TaggedImages;
} : object) : never);
//#endregion
//#region src/@types/endpoints/keywords.d.ts
interface KeywordsOptions extends PageOption {
include_adult?: boolean;
language?: string;
}
interface BelongingMovies {
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
interface Keyword {
id: number;
name: string;
}
interface Keywords {
id: number;
keywords: Keyword[];
}
//# sourceMappingURL=keywords.d.ts.map
//#endregion
//#region src/@types/endpoints/movies.d.ts
interface BelongsToCollection {
id: number;
name: string;
poster_path: Nullable<string>;
backdrop_path: Nullable<string>;
}
interface MovieDetails {
adult: boolean;
backdrop_path: Nullable<string>;
belongs_to_collection?: Nullable<BelongsToCollection>;
budget: number;
genres: Genre[];
homepage: Nullable<string>;
id: number;
imdb_id: Nullable<string>;
original_language: string;
original_title: string;
overview: string;
popularity: number;
poster_path: Nullable<string>;
production_companies: ProductionCompany[];
production_countries: ProductionCountry[];
release_date: string;
revenue: number;
runtime: Nullable<number>;
spoken_languages: SpokenLanguage[];
status: string;
tagline: Nullable<string>;
title: string;
video: boolean;
vote_average: number;
vote_count: number;
}
declare enum ReleaseDateType {
Premiere = 1,
"Theatrical (limited)" = 2,
Theatrical = 3,
Digital = 4,
Physical = 5,
TV = 6,
}
interface ReleaseDate {
certification: string;
iso_639_1: string;
release_date: TMDBDateTime;
type: ReleaseDateType;
note: string;
}
interface ReleaseDateResult {
iso_3166_1: string;
release_dates: ReleaseDate[];
}
interface ReleaseDates {
id: number;
results: ReleaseDateResult[];
}
interface SimilarMovies {
page: number;
results: Movie[];
total_pages: number;
total_results: number;
}
interface MovieList {
description: string;
favorite_count: number;
id: number;
item_count: number;
iso_639_1: string;
list_type: string;
name: string;
poster_path: Nullable<string>;
}
interface MovieLists {
id: number;
page: number;
results: MovieList[];
total_pages: number;
total_results: number;
}
interface LatestMovie {
adult: boolean;
backdrop_path: Nullable<string>;
belongs_to_collection?: Nullable<BelongsToCollection>;
budget: number;
genres: Genre[];
homepage: Nullable<string>;
id: number;
imdb_id: Nullable<string>;
original_language: string;
original_title: string;
overview: string;
popularity: number;
poster_path: Nullable<string>;
production_companies: ProductionCompany[];
production_countries: ProductionCountry[];
release_date: string;
revenue: number;
runtime: Nullable<number>;
spoken_languages: SpokenLanguage[];
status: string;
tagline: Nullable<string>;
title: string;
video: boolean;
vote_average: number;
vote_count: number;
}
interface Dates {
maximum: string;
minimum: string;
}
interface MoviesPlayingNow {
page: number;
results: Movie[];
dates: Dates;
total_pages: number;
total_results: number;
}
interface PopularMovies {
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
interface TopRatedMovies {
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
interface UpcomingMovies {
page: number;
results: Movie[];
total_results: number;
total_pages: number;
}
type MovieChangeValue = string | {
person_id: number;
character: string;
order: number;
cast_id: number;
credit_id: string;
} | unknown;
interface MoviesImageSearchOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_image_language?: string[];
}
//# sourceMappingURL=movies.d.ts.map
//#endregion
//#region src/@types/endpoints/networks.d.ts
interface NetworkDetails {
headquarters: string;
homepage: Nullable<string>;
id: number;
logo_path: Nullable<string>;
name: string;
origin_country: string;
}
interface NetworkImages {
id: number;
logos: Image[];
}
//# sourceMappingURL=networks.d.ts.map
//#endregion
//#region src/@types/endpoints/people.d.ts
interface Cast$1 {
character: string;
credit_id: string;
vote_count: number;
id: number;
backdrop_path: Nullable<string>;
poster_path: Nullable<string>;
original_language: string;
vote_average: number;
genre_ids: number[];
popularity: number;
overview: string;
}
interface Crew$1 {
id: number;
department: string;
original_language: string;
credit_id: string;
overview: string;
vote_count: number;
poster_path: Nullable<string>;
backdrop_path: Nullable<string>;
popularity: number;
genre_ids: number[];
job: string;
vote_average: number;
}
interface PersonMovieCast extends Cast$1 {
release_date: string;
video: boolean;
adult: boolean;
title: string;
original_title: string;
}
interface PersonMovieCrew extends Crew$1 {
original_title: string;
video: boolean;
title: string;
adult: boolean;
release_date: string;
}
interface PersonTvShowCrew extends Crew$1 {
episode_count: number;
origin_country: string[];
original_name: string;
name: string;
first_air_date: string;
}
interface PersonTvShowCast extends Cast$1 {
original_name: string;
name: string;
episode_count: number;
first_air_date: string;
origin_country: string[];
}
interface PersonMovieCredit {
cast: PersonMovieCast[];
crew: PersonMovieCrew[];
id: number;
}
interface PersonTvShowCredit {
cast: PersonTvShowCast[];
crew: PersonTvShowCrew[];
id: number;
}
interface PersonCombinedCredits {
cast: Array<PersonMovieCast | PersonTvShowCast>;
crew: Array<PersonMovieCrew | PersonTvShowCrew>;
id: number;
}
interface PersonDetails {
birthday: Nullable<string>;
known_for_department: string;
deathday: Nullable<string>;
id: number;
name: string;
also_known_as: string[];
gender: number;
biography: string;
popularity: number;
place_of_birth: Nullable<string>;
profile_path: Nullable<string>;
adult: boolean;
imdb_id: Nullable<string>;
homepage: Nullable<string>;
}
type PersonChangeValue = string | {
profile: {
file_path: Nullable<string>;
};
};
interface PopularPersons {
page: number;
results: Person[];
total_results: number;
total_pages: number;
}
interface PeopleImages {
id: number;
profiles: Image[];
}
interface TaggedImage {
aspect_ratio: number;
file_path: Nullable<string>;
height: number;
id: string;
iso_639_1: Nullable<string>;
vote_average: number;
vote_count: number;
width: number;
image_type: string;
media_type: "movie" | "tv";
media: Movie | TV;
}
interface TaggedImages {
page: number;
results: TaggedImage[];
total_results: number;
total_pages: number;
}
interface PersonTranslations {
id: number;
translations: Array<{
iso_3166_1: string;
iso_639_1: string;
name: string;
english_name: string;
data: {
biography: string;
};
}>;
}
//#endregion
//#region src/@types/endpoints/review.d.ts
interface ReviewDetails extends Review {
iso_639_1: string;
media_id: number;
media_title: string;
media_type: "movie" | "tv";
}
//# sourceMappingURL=review.d.ts.map
//#endregion
//#region src/@types/endpoints/search.d.ts
interface Search<T> {
page: number;
results: T[];
total_pages: number;
total_results: number;
}
type MultiSearchResult = MovieWithMediaType | TVWithMediaType | PersonWithMediaType;
interface SearchOptions {
query: string;
page?: number;
}
interface MovieSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
include_adult?: boolean;
year?: number;
primary_release_year?: number;
}
interface CollectionSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
include_adult?: boolean;
}
interface TvSearchOptions extends SearchOptions, LanguageOption, PageOption {
include_adult?: boolean;
year?: number;
first_air_date_year?: number;
}
interface PeopleSearchOptions extends SearchOptions, LanguageOption, PageOption {
include_adult?: boolean;
}
interface MultiSearchOptions extends SearchOptions, LanguageOption, PageOption {
include_adult?: boolean;
}
//# sourceMappingURL=search.d.ts.map
//#endregion
//#region src/@types/endpoints/trending.d.ts
type TimeWindow = "day" | "week";
type TrendingMediaType = MediaType | "all";
type TrendingResult<T extends TrendingMediaType> = T extends "tv" ? TV : T extends "movie" ? Movie : T extends "person" ? Person : TVWithMediaType | MovieWithMediaType | PersonWithMediaType;
interface TrendingResults<T extends TrendingMediaType> {
page: number;
results: TrendingResult<T>[];
total_pages: number;
total_results: number;
}
//#endregion
//#region src/@types/endpoints/tvEpisode.d.ts
interface EpisodeSelection {
tvShowID: number;
seasonNumber: number;
episodeNumber: number;
}
interface Episode {
air_date: string;
episode_number: number;
crew: Crew[];
guest_stars: GuestStar[];
id: number;
name: string;
overview: string;
production_code: string;
season_number: number;
still_path: Nullable<string>;
vote_average: number;
vote_count: number;
runtime: number;
show_id: number;
}
interface GuestStar {
credit_id: string;
order: number;
character: string;
adult: boolean;
gender: number | null;
id: number;
known_for_department: string;
name: string;
original_name: string;
popularity: number;
profile_path: string | null;
}
interface TvEpisodeCredit extends Credits {
guest_stars: GuestStar[];
}
interface TvEpisodeTranslations {
id: number;
translations: Array<{
iso_3166_1: string;
iso_639_1: string;
name: string;
english_name: string;
data: {
name: string;
overview: string;
};
}>;
}
type TvEpisodeChangeValue = string | unknown;
interface TvEpisodeImageSearchOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_image_language?: string[];
}
interface TvEpisodeVideoSearchOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_video_language?: string[];
}
//# sourceMappingURL=tvEpisode.d.ts.map
//#endregion
//#region src/@types/endpoints/tvSeasons.d.ts
interface SeasonSelection {
tvShowID: number;
seasonNumber: number;
}
interface SeasonDetails {
air_date: string;
episodes: Episode[];
name: string;
overview: string;
id: number;
poster_path: Nullable<string>;
season_number: number;
}
type TvSeasonChangeValue = string | {
episode_id: number;
episode_number: number;
};
interface TvSeasonImageSearchOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_image_language?: string[];
}
interface TvSeasonVideoSearchOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_video_language?: string[];
}
//# sourceMappingURL=tvSeasons.d.ts.map
//#endregion
//#region src/@types/endpoints/tvShows.d.ts
interface CreatedBy {
id: number;
credit_id: string;
name: string;
gender: number;
profile_path: Nullable<string>;
}
interface NextEpisodeToAir {
id: number;
name: string;
overview: string;
vote_average: number;
vote_count: number;
air_date: string;
episode_number: number;
production_code: string;
runtime: Nullable<number>;
season_number: number;
show_id: number;
still_path: Nullable<string>;
}
interface LastEpisodeToAir {
air_date: string;
episode_number: number;
id: number;
name: string;
overview: string;
production_code: string;
season_number: number;
still_path: Nullable<string>;
vote_average: number;
vote_count: number;
}
interface Network {
id: number;
logo_path: Nullable<string>;
name: string;
origin_country: string;
}
interface Season {
air_date: string;
episode_count: number;
id: number;
name: string;
overview: string;
poster_path: Nullable<string>;
season_number: number;
}
interface TvShowDetails {
backdrop_path: Nullable<string>;
created_by: CreatedBy[];
episode_run_time: number[];
first_air_date: string;
genres: Genre[];
homepage: Nullable<string>;
id: number;
in_production: boolean;
languages: string[];
last_air_date: string;
last_episode_to_air: Nullable<LastEpisodeToAir>;
name: string;
next_episode_to_air?: Nullable<NextEpisodeToAir>;
networks: Network[];
number_of_episodes: number;
number_of_seasons: number;
origin_country: string[];
original_language: string;
original_name: string;
overview: string;
popularity: number;
poster_path: Nullable<string>;
production_companies: ProductionCompany[];
production_countries: ProductionCountry[];
seasons: Season[];
spoken_languages: SpokenLanguage[];
status: string;
tagline: Nullable<string>;
type: string;
vote_average: number;
vote_count: number;
}
interface EpisodeGroup {
description: string;
episode_count: number;
group_count: number;
id: string;
name: string;
network: Network;
type: number;
}
interface EpisodeGroups {
results: EpisodeGroup[];
id: number;
}
interface ScreenedTheatricallyResult {
id: number;
episode_number: number;
season_number: number;
}
interface ScreenedTheatrically {
id: number;
results: ScreenedTheatricallyResult[];
}
interface SimilarTvShow {
backdrop_path: Nullable<string>;
first_air_date: string;
genre_ids: number[];
id: number;
original_language: string;
original_name: string;
overview: string;
origin_country: string[];
poster_path: Nullable<string>;
popularity: number;
name: string;
vote_average: number;
vote_count: number;
}
interface Similartv {
page: number;
results: SimilarTvShow[];
total_pages: number;
total_results: number;
}
interface Latesttv {
backdrop_path: Nullable<string>;
created_by: CreatedBy[];
episode_run_time: number[];
first_air_date: string;
genres: Genre[];
homepage: Nullable<string>;
id: number;
in_production: boolean;
languages: string[];
last_air_date: string;
name: string;
networks: Network[];
number_of_episodes: number;
number_of_seasons: number;
origin_country: string[];
original_language: string;
original_name: string;
overview?: Nullable<string>;
popularity: number;
poster_path: Nullable<string>;
production_companies: ProductionCompany[];
seasons: Season[];
status: string;
type: string;
vote_average: number;
vote_count: number;
}
interface OnTheAirResult {
poster_path: Nullable<string>;
popularity: number;
id: number;
backdrop_path: Nullable<string>;
vote_average: number;
overview: string;
first_air_date: string;
origin_country: string[];
genre_ids: number[];
original_language: string;
vote_count: number;
name: string;
original_name: string;
}
interface OnTheAir {
page: number;
results: OnTheAirResult[];
total_results: number;
total_pages: number;
}
interface AiringTodayResult {
poster_path: Nullable<string>;
popularity: number;
id: number;
backdrop_path: Nullable<string>;
vote_average: number;
overview: string;
first_air_date: string;
origin_country: string[];
genre_ids: number[];
original_language: string;
vote_count: number;
name: string;
original_name: string;
}
interface tvAiringToday {
page: number;
results: AiringTodayResult[];
total_results: number;
total_pages: number;
}
interface PopularTvShowResult {
poster_path: Nullable<string>;
popularity: number;
id: number;
backdrop_path: Nullable<string>;
vote_average: number;
overview: string;
first_air_date: string;
origin_country: string[];
genre_ids: number[];
original_language: string;
vote_count: number;
name: string;
original_name: string;
}
interface Populartv {
page: number;
results: PopularTvShowResult[];
total_results: number;
total_pages: number;
}
interface TopRatedTvShowResult {
poster_path: Nullable<string>;
popularity: number;
id: number;
backdrop_path: Nullable<string>;
vote_average: number;
overview: string;
first_air_date: string;
origin_country: string[];
genre_ids: number[];
original_language: string;
vote_count: number;
name: string;
original_name: string;
}
interface TopRatedtv {
page: number;
results: TopRatedTvShowResult[];
total_results: number;
total_pages: number;
}
interface TvShowChangeValue {
season_id: number;
season_number: number;
}
interface TvShowImageOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_image_language?: string[];
}
interface TvShowVideoOptions extends LanguageOption {
/**
* a list of ISO-639-1 values to query
*/
include_video_language?: string[];
}
//# sourceMappingURL=tvShows.d.ts.map
//#endregion
//#region src/@types/endpoints/watchProviders.d.ts
interface Flatrate {
display_priority: number;
logo_path: string;
provider_id: number;
provider_name: string;
}
interface Rent {
display_priority: number;
logo_path: string;
provider_id: number;
provider_name: string;
}
interface Buy {
display_priority: number;
logo_path: string;
provider_id: number;
provider_name: string;
}
interface WatchRegion {
iso_3166_1: string;
english_name: string;
native_name: string;
}
interface WatchRegionsResponse {
results: WatchRegion[];
}
interface WatchProviderEntry {
display_priority: number;
logo_path: string | null;
provider_id: number;
provider_name: string;
}
type WatchLocale = Record<string, {
link: string;
flatrate?: WatchProviderEntry[];
rent?: WatchProviderEntry[];
buy?: WatchProviderEntry[];
free?: WatchProviderEntry[];
ads?: WatchProviderEntry[];
}>;
interface WatchProviders {
id: number;
results: WatchLocale;
}
interface WatchProviderListItem {
display_priority: number;
logo_path: string | null;
provider_id: number;
provider_name: string;
}
interface WatchProviderListResponse {
results: WatchProviderListItem[];
}
//# sourceMappingURL=watchProviders.d.ts.map
//#endregion
//#region src/utils/api.d.ts
type Primitive = string | number | boolean;
type QueryValue = Primitive | null | undefined | Array<Primitive | null | undefined>;
type Query = Record<string, QueryValue>;
interface RequestOptions<Q extends object = object> {
query?: Q;
signal?: AbortSignal;
timeoutMs?: number;
retries?: number;
retryDelayMs?: number;
}
interface RequestConfig {
signal?: AbortSignal;
timeoutMs?: number;
retries?: number;
retryDelayMs?: number;
}
declare class TMDBError extends Error {
readonly status: number;
readonly url: string;
readonly payload?: unknown | undefined;
constructor(message: string, status: number, url: string, payload?: unknown | undefined);
}
declare const parseOptions: (options?: Query) => string;
declare const csv: (values?: ReadonlyArray<Primitive | null | undefined>) => string | undefined;
declare const withQuery: <Q extends object>(query?: Q, config?: RequestConfig) => RequestOptions<Q>;
declare class API {
private apiKey?;
private accessToken?;
constructor(auth: TokenType);
get<T, Q extends object = object>(path: string, opts?: RequestOptions<Q>): Promise<T>;
}
//# sourceMappingURL=api.d.ts.map
//#endregion
//#region src/utils/getimagePath.d.ts
declare const TMDB_IMAGE_BASE_URL = "https://image.tmdb.org/t/p/";
declare const ImageSizes: {
readonly ORIGINAL: "original";
readonly W500: "w500";
readonly W300: "w300";
readonly W185: "w185";
readonly W92: "w92";
readonly H632: "h632";
};
type ImageSize = (typeof ImageSizes)[keyof typeof ImageSizes];
declare const ImageFormats: {
readonly JPG: "jpg";
readonly PNG: "png";
readonly SVG: "svg";
};
type ImageFormat = (typeof ImageFormats)[keyof typeof ImageFormats];
/**
* Constructs a TMDB image URL.
*
* - Keeps paths as-is unless `format` is provided (then it replaces/appends
* the extension safely using the last dot after the last slash).
* - Handles leading/trailing slashes robustly.
* - If `imagePath` is already an absolute URL, it is returned unchanged.
*/
declare const getFullImagePath: (baseUrl: string, fileSize: string, imagePath: string, format?: string) => string;
/**
* Convenience helper for TMDB `Image` objects.
*/
declare const formImage: (image: Image, fileSize: ImageSize, format?: ImageFormat) => string | undefined;
//# sourceMappingURL=getimagePath.d.ts.map
//#endregion
//#region src/@types/types.d.ts
interface ErrorResponse {
status_code: number;
status_message: string;
success: boolean;
}
type MediaType = "movie" | "tv" | "person";
interface AuthorDetails {
name: string;
username: string;
avatar_path: Nullable<string>;
rating?: Nullable<number>;
}
type KnownFor = MovieWithMediaType | TVWithMediaType;
interface Person {
id: number;
name: string;
known_for: KnownFor[];
profile_path: Nullable<string>;
adult: boolean;
known_for_department: string;
gender: number;
popularity: number;
}
interface PersonWithMediaType extends Person {
media_type: "person";
}
interface Movie {
id: number;
poster_path: Nullable<string>;
adult: boolean;
overview: string;
release_date: string;
genre_ids: number[];
original_title: string;
original_language: string;
title: string;
backdrop_path: Nullable<string>;
popularity: number;
vote_count: number;
video: boolean;
vote_average: number;
}
interface MovieWithMediaType extends Movie {
media_type: "movie";
}
interface Company {
id: number;
logo_path: Nullable<string>;
name: string;
origin_country: string;
}
interface TV {
id: number;
name: string;
first_air_date: string;
backdrop_path: Nullable<string>;
genre_ids: number[];
origin_country: string[];
original_language: string;
original_name: string;
overview: string;
poster_path: Nullable<string>;
popularity: number;
vote_count: number;
vote_average: number;
}
interface TVWithMediaType extends TV {
media_type: "tv";
}
interface Genre {
id: number;
name: string;
}
interface ExternalIds {
imdb_id: Nullable<string>;
facebook_id: Nullable<string>;
instagram_id: Nullable<string>;
twitter_id: Nullable<string>;
id: number;
}
interface ProductionCompany {
id: number;
logo_path: Nullable<string>;
name: string;
origin_country: string;
}
interface ProductionCountry {
iso_3166_1: string;
name: string;
}
interface SpokenLanguage {
english_name: string;
iso_639_1: string;
name: string;
}
interface ContentRatings {
results: ContentRatingsResult[];
id: number;
}
interface ContentRatingsResult {
descriptor: unknown[];
iso_3166_1: string;
rating: string;
}
interface Recommendation {
adult: boolean;
backdrop_path?: string;
genre_ids: number[];
id: number;
original_language: string;
original_title: string;
overview: string;
release_date: string;
poster_path?: string;
popularity: number;
title: string;
video: boolean;
vote_average: number;
vote_count: number;
}
interface Recommendations {
page: number;
results: Recommendation[];
total_pages: number;
total_results: number;
}
interface Review {
author: string;
author_details: AuthorDetails;
content: string;
created_at: TMDBDateTime;
id: string;
updated_at: TMDBDateTime;
url: string;
}
interface Reviews {
id: number;
page: number;
results: Review[];
total_pages: number;
total_results: number;
}
interface TranslationData {
title: string;
overview: string;
homepage: string;
}
interface Translation {
iso_3166_1: string;
iso_639_1: string;
name: string;
english_name: string;
data: TranslationData;
}
interface Translations {
id: number;
translations: Translation[];
}
interface Image {
aspect_ratio: number;
file_path: string;
height: number;
iso_639_1: Nullable<string>;
vote_average: number;
vote_count: number;
width: number;
}
interface Images {
id: number;
backdrops: Image[];
logos: Image[];
posters: Image[];
}
type TMDBConfig = {
accessToken: string;
apiKey?: string;
} | {
apiKey: string;
accessToken?: string;
};
type TokenType = string | TMDBConfig;
//# sourceMappingURL=types.d.ts.map
//#endregion
//#region src/@types/models/baseEndpoint.d.ts
/**
* Base class for all TMDB API endpoints.
*
* Provides a configured {@link API} client instance to subclasses.
*/
declare class BaseEndpoint {
protected readonly auth: TokenType;
/**
* Low-level HTTP client wrapper used by all endpoints.
*/
protected readonly api: API;
/**
* Create a new endpoint instance.
*
* @param {TokenType} auth - Authentication information.
* - If a string: treated as a v4 API Read Access Token (Bearer token).
* - If an object: can include an API key and/or access token.
*/
constructor(auth: TokenType);
}
//# sourceMappingURL=baseEndpoint.d.ts.map
//#endregion
//#region src/endpoints/account.d.ts
/**
* Represents an endpoint for retrieving account details.
*
* TMDB v3 reference:
* - GET /account/{account_id}
*
* Note:
* TMDB does not expose a generic "GET /account" for account details. You must
* provide an `account_id`. Most apps obtain it from an auth flow and then cache
* it for subsequent requests.
*/
declare class AccountEndpoint extends BaseEndpoint {
protected readonly access_token: TokenType;
/**
* Constructs a new AccountEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token: TokenType);
/**
* Retrieves account details asynchronously.
*
* TMDB: GET /account/{account_id}
*
* @param {number} accountId - The TMDB account ID.
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
*/
details(accountId: number): Promise<AccountDetails>;
}
//# sourceMappingURL=account.d.ts.map
//#endregion
//#region src/endpoints/certification.d.ts
/**
* Represents an endpoint for retrieving certifications for movies and TV shows.
*
* TMDB v3 reference:
* - GET /certification/movie/list
* - GET /certification/tv/list
*/
declare class CertificationEndpoint extends BaseEndpoint {
protected readonly access_token: TokenType;
/**
* Constructs a new CertificationEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token: TokenType);
/**
* Retrieves certifications for movies asynchronously.
*
* TMDB: GET /certification/movie/list
*
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
*/
movies(): Promise<Certifications>;
/**
* Retrieves certifications for TV shows asynchronously.
*
* TMDB: GET /certification/tv/list
*
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
*/
tv(): Promise<Certifications>;
}
//# sourceMappingURL=certification.d.ts.map
//#endregion
//#region src/endpoints/changes.d.ts
/**
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
*
* TMDB v3 reference:
* - GET /movie/changes
* - GET /tv/changes
* - GET /person/changes
*/
declare class ChangeEndpoint extends BaseEndpoint {
protected readonly access_token: TokenType;
/**
* Constructs a new ChangeEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token: TokenType);
/**
* Retrieves changes in movies asynchronously.
*
* TMDB: GET /movie/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
*/
movies(options?: ChangeOption): Promise<MediaChanges>;
/**
* Retrieves changes in TV shows asynchronously.
*
* TMDB: GET /tv/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
*/
tv(options?: ChangeOption): Promise<MediaChanges>;
/**
* Retrieves changes related to persons asynchronously.
*
* TMDB: GET /person/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
*/
person(options?: ChangeOption): Promise<MediaChanges>;
}
//# sourceMappingURL=changes.d.ts.map
//#endregion
//#region src/endpoints/collections.d.ts
/**
* Represents an endpoint for accessing collections and their details.
*/
declare class CollectionsEndpoint extends BaseEndpoint {
protected readonly auth: TokenType;
/**
* Constructs a new CollectionsEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth: TokenType);
/**
* Retrieves details of a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<DetailedCollection>} A Promise that resolves with the
* detailed information of the collection.
*/
details(id: number, options?: LanguageOption, request?: RequestConfig): Promise<DetailedCollection>;
/**
* Retrieves images associated with a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {CollectionImageOptions} [options] - Optional parameters for
* specifying image options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ImageCollection>} A Promise that resolves with the
* collection images.
*/
images(id: number, options?: CollectionImageOptions, request?: RequestConfig): Promise<ImageCollection>;
/**
* Retrieves translations for a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Translations>} A Promise that resolves with the
* translations of the collection.
*/
translations(id: number, options?: LanguageOption, request?: RequestConfig): Promise<Translations>;
}
//# sourceMappingURL=collections.d.ts.map
//#endregion
//#region src/endpoints/companies.d.ts
/**
* Represents an endpoint for accessing company details and related information.
*/
declare class CompaniesEndpoint extends BaseEndpoint {
protected readonly auth: TokenType;
/**
* Constructs a new CompaniesEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth: TokenType);
/**
* Retrieves details of a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<CompanyDetails>} A Promise that resolves with the
* detailed information of the company.
*/
details(id: number): Promise<CompanyDetails>;
/**
* Retrieves alternative names of a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<AlternativeNames>} A Promise that resolves with the
* alternative names of the company.
*/
alternativeNames(id: number): Promise<AlternativeNames>;
/**
* Retrieves images associated with a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<CompanyImages>} A Promise that resolves with the images
* of the company.
*/
images(id: number): Promise<CompanyImages>;
}
//# sourceMappingURL=companies.d.ts.map
//#endregion
//#region src/endpoints/configuration.d.ts
/**
* Represents an endpoint for retrieving current system configuration.
*/
declare class ConfigurationEndpoint extends BaseEndpoint {
protected readonly auth: TokenType;
/**
* Constructs a new ConfigurationEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth: TokenType);
/**
* Retrieves the current system configuration asynchronously.
*
* @returns {Promise<Configuration>} A Promise that resolves with the current
* system configuration.
*/
getCurrent(): Promise<Configuration>;
}
//# sourceMappingURL=configuration.d.ts.map
//#endregion
//#region src/endpoints/credits.d.ts
/**
* Represents an endpoint for retrieving credit details.
*/
declare class CreditsEndpoint extends BaseEndpoint {
protected readonly auth: TokenType;
/**
* Constructs a new CreditsEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth: TokenType);
/**
* Retrieves credit details by ID asynchronously.
*
* @param {string} id - The ID of the credit.
* @returns {Promise<CreditResponse>} A Promise that resolves with the credit
* details.
*/
getById(id: string): Promise<CreditResponse>;
}
//# sourceMappingURL=credits.d.ts.map
//#endregion
//#region src/endpoints/discover.d.ts
/**
* Represents an endpoint for discovering movies and TV shows based on various
* criteria.
*
* TMDB v3 reference:
* - GET /discover/movie
* - GET /discover/tv
*/
declare class DiscoverEndpoint extends BaseEndpoint {
protected readonly access_token: TokenType;
/**
* Constructs a new DiscoverEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token: TokenType);
/**
* Retrieves a list of movies based on the provided query options
* asynchronously.
*
* @param {MovieQueryOptions} [options] - Optional parameters for refining the
* movie discovery.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the
* movie discovery results.
*/
movie(options?: MovieQueryOptions, request?: RequestConfig): Promise<MovieDiscoverResult>;
/**
* Retrieves a list of TV shows based on the provided query options
* asynchronously.
*
* @param {TvShowQueryOptions} [options] - Optional parameters for refining
* the TV show discovery.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the
* TV show discovery results.
*/
tvShow(options?: TvShowQueryOptions, request?: RequestConfig): Promise<TvShow