tmdb-kit 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -0
- package/dist/index.cjs +465 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +513 -0
- package/dist/index.d.ts +513 -0
- package/dist/index.js +459 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#apiKey","#accessToken","#baseUrl","#fetch","#headers","#createUrl","#createHeaders","#transport","#transport","#transport","#transport","#transport","#transport","#transport","#transport","#http"],"sources":["../src/errors.ts","../src/query.ts","../src/http.ts","../src/resources/configuration.ts","../src/resources/genres.ts","../src/resources/images.ts","../src/resources/movies.ts","../src/resources/people.ts","../src/resources/search.ts","../src/resources/trending.ts","../src/resources/tv.ts","../src/client.ts"],"sourcesContent":["import type { JsonValue } from './types'\n\nexport interface TMDBErrorResponseBody {\n success?: boolean\n status_code?: number\n status_message?: string\n}\n\nexport interface TMDBResponseErrorOptions {\n body: JsonValue | undefined\n headers: Headers\n status: number\n statusText: string\n url: string\n}\n\n/** Base class for all SDK-originated errors. */\nexport class TMDBError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'TMDBError'\n }\n}\n\n/** Thrown before a request is sent or when fetch itself rejects. */\nexport class TMDBRequestError extends TMDBError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'TMDBRequestError'\n }\n}\n\n/** Thrown when TMDB returns a non-2xx response. */\nexport class TMDBResponseError extends TMDBError {\n readonly body: JsonValue | undefined\n readonly headers: Headers\n readonly requestId: string | null\n readonly status: number\n readonly statusCode: number | undefined\n readonly statusMessage: string | undefined\n readonly statusText: string\n readonly url: string\n\n constructor(message: string, options: TMDBResponseErrorOptions) {\n super(message)\n this.name = 'TMDBResponseError'\n this.body = options.body\n this.headers = options.headers\n this.requestId = options.headers.get('x-request-id')\n this.status = options.status\n this.statusText = options.statusText\n this.url = options.url\n\n const body = isErrorResponseBody(options.body) ? options.body : undefined\n this.statusCode = body?.status_code\n this.statusMessage = body?.status_message\n }\n}\n\nexport function createResponseError(options: TMDBResponseErrorOptions): TMDBResponseError {\n const body = isErrorResponseBody(options.body) ? options.body : undefined\n const message = body?.status_message ?? `${options.status} ${options.statusText}`.trim()\n\n return new TMDBResponseError(message, options)\n}\n\nfunction isErrorResponseBody(value: unknown): value is TMDBErrorResponseBody {\n return typeof value === 'object' && value !== null\n}\n","import { TMDBRequestError } from './errors'\nimport type { ImageSize, RegionCode, LanguageCode, TrendingTimeWindow } from './types'\n\nexport type QueryPrimitive = string | number | boolean\nexport type QueryValue = QueryPrimitive | readonly QueryPrimitive[] | null | undefined\nexport type QueryParams = Record<string, QueryValue>\n\nexport interface QueryDefaults {\n language?: LanguageCode\n region?: RegionCode\n}\n\nexport const DEFAULT_API_BASE_URL = 'https://api.themoviedb.org/3'\nexport const DEFAULT_IMAGE_BASE_URL = 'https://image.tmdb.org/t/p'\n\nexport function appendQuery(url: URL, query: QueryParams): void {\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) {\n continue\n }\n\n if (Array.isArray(value)) {\n url.searchParams.set(key, value.map(String).join(','))\n continue\n }\n\n url.searchParams.set(key, String(value))\n }\n}\n\nexport function withLanguage(\n defaults: QueryDefaults,\n query: QueryParams,\n): QueryParams {\n const language = typeof query.language === 'string' ? query.language : defaults.language\n\n return {\n ...query,\n language,\n }\n}\n\nexport function withListDefaults(\n defaults: QueryDefaults,\n query: QueryParams,\n): QueryParams {\n const region = typeof query.region === 'string' ? query.region : defaults.region\n\n return {\n ...withLanguage(defaults, query),\n region,\n }\n}\n\nexport function toCommaList(value: string | readonly string[] | undefined): string | undefined {\n if (value === undefined) {\n return undefined\n }\n\n return typeof value === 'string' ? value : value.join(',')\n}\n\nexport function toId(value: number, name: string): string {\n if (!Number.isInteger(value) || value <= 0) {\n throw new TMDBRequestError(`${name} must be a positive integer`)\n }\n\n return String(value)\n}\n\nexport function toSearchQuery(value: string): string {\n const query = value.trim()\n\n if (query.length === 0) {\n throw new TMDBRequestError('search query must not be empty')\n }\n\n return query\n}\n\nexport function toTimeWindow(value: TrendingTimeWindow): TrendingTimeWindow {\n if (value !== 'day' && value !== 'week') {\n throw new TMDBRequestError('timeWindow must be either \"day\" or \"week\"')\n }\n\n return value\n}\n\nexport interface BuildImageUrlOptions {\n baseUrl?: string\n}\n\n/**\n * Build a full TMDB image URL from the path returned by API payloads.\n * Returns null for nullish image paths so UI code can branch naturally.\n */\nexport function buildImageUrl(\n path: string | null | undefined,\n size: ImageSize = 'original',\n options: BuildImageUrlOptions = {},\n): string | null {\n if (path === undefined || path === null || path.trim() === '') {\n return null\n }\n\n const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_IMAGE_BASE_URL)\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n\n return `${baseUrl}/${size}${normalizedPath}`\n}\n\nexport function normalizeBaseUrl(baseUrl: string): string {\n return baseUrl.replace(/\\/+$/, '')\n}\n","import { createResponseError, TMDBRequestError } from './errors'\nimport {\n appendQuery,\n DEFAULT_API_BASE_URL,\n DEFAULT_IMAGE_BASE_URL,\n normalizeBaseUrl,\n type QueryDefaults,\n type QueryParams,\n} from './query'\nimport type { JsonValue, LanguageCode, RegionCode } from './types'\n\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>\n\nexport interface TMDBAccessTokenAuth {\n /** TMDB API Read Access Token. Sent as an Authorization Bearer header. */\n accessToken: string\n apiKey?: never\n}\n\nexport interface TMDBApiKeyAuth {\n /** Legacy v3 API key. Sent as api_key query parameter. */\n apiKey: string\n accessToken?: never\n}\n\nexport type TMDBAuth = TMDBAccessTokenAuth | TMDBApiKeyAuth\n\nexport interface TMDBClientDefaults extends QueryDefaults {\n imageBaseUrl: string\n}\n\nexport type TMDBClientOptions = TMDBAuth & {\n /** Defaults to https://api.themoviedb.org/3. Useful for tests or proxies. */\n baseUrl?: string\n /** Inject a fetch implementation for tests, custom runtimes, or instrumentation. */\n fetch?: FetchLike\n /** Default language for endpoints that accept a language query parameter. */\n defaultLanguage?: LanguageCode\n /** Default region for movie list/search endpoints that accept a region query parameter. */\n defaultRegion?: RegionCode\n /** Custom image host. Defaults to https://image.tmdb.org/t/p. */\n imageBaseUrl?: string\n /** Additional headers merged into every request before authentication is applied. */\n headers?: HeadersInit\n}\n\nexport interface TMDBRequestOptions {\n headers?: HeadersInit\n query?: QueryParams\n signal?: AbortSignal\n}\n\nexport interface TMDBTransport {\n readonly defaults: TMDBClientDefaults\n get<T>(path: string, options?: TMDBRequestOptions): Promise<T>\n}\n\nexport class TMDBHttpClient implements TMDBTransport {\n readonly defaults: TMDBClientDefaults\n\n readonly #apiKey: string | undefined\n readonly #accessToken: string | undefined\n readonly #baseUrl: string\n readonly #fetch: FetchLike\n readonly #headers: HeadersInit | undefined\n\n constructor(options: TMDBClientOptions) {\n const accessToken = normalizeSecret('accessToken' in options ? options.accessToken : undefined)\n const apiKey = normalizeSecret('apiKey' in options ? options.apiKey : undefined)\n\n if (Boolean(accessToken) === Boolean(apiKey)) {\n throw new TMDBRequestError('Provide exactly one of accessToken or apiKey')\n }\n\n const fetchImpl = options.fetch ?? globalThis.fetch?.bind(globalThis)\n\n if (typeof fetchImpl !== 'function') {\n throw new TMDBRequestError('No fetch implementation found. Pass options.fetch in this runtime.')\n }\n\n this.#accessToken = accessToken\n this.#apiKey = apiKey\n this.#baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_API_BASE_URL)\n this.#fetch = fetchImpl\n this.#headers = options.headers\n this.defaults = {\n imageBaseUrl: normalizeBaseUrl(options.imageBaseUrl ?? DEFAULT_IMAGE_BASE_URL),\n language: options.defaultLanguage,\n region: options.defaultRegion,\n }\n }\n\n async get<T>(path: string, options: TMDBRequestOptions = {}): Promise<T> {\n const url = this.#createUrl(path, options.query ?? {})\n const headers = this.#createHeaders(options.headers)\n\n let response: Response\n\n try {\n response = await this.#fetch(url, {\n headers,\n method: 'GET',\n signal: options.signal,\n })\n } catch (error) {\n throw new TMDBRequestError(`TMDB request failed: ${String(error)}`, { cause: error })\n }\n\n const body = await readJson(response)\n\n if (!response.ok) {\n throw createResponseError({\n body,\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n url,\n })\n }\n\n return body as T\n }\n\n #createHeaders(headersInit: HeadersInit | undefined): Headers {\n const headers = new Headers(this.#headers)\n const requestHeaders = new Headers(headersInit)\n\n headers.set('Accept', 'application/json')\n\n for (const [key, value] of requestHeaders) {\n headers.set(key, value)\n }\n\n if (this.#accessToken !== undefined) {\n headers.set('Authorization', `Bearer ${this.#accessToken}`)\n }\n\n return headers\n }\n\n #createUrl(path: string, query: QueryParams): string {\n const relativePath = path.replace(/^\\/+/, '')\n const url = new URL(relativePath, `${this.#baseUrl}/`)\n\n appendQuery(url, {\n ...query,\n api_key: this.#apiKey,\n })\n\n return url.toString()\n }\n}\n\nasync function readJson(response: Response): Promise<JsonValue | undefined> {\n const text = await response.text()\n\n if (text.length === 0) {\n return undefined\n }\n\n try {\n return JSON.parse(text) as JsonValue\n } catch {\n return text\n }\n}\n\nfunction normalizeSecret(value: string | undefined): string | undefined {\n const secret = value?.trim()\n return secret === '' ? undefined : secret\n}\n","import type { TMDBTransport } from '../http'\nimport type { Configuration, Country, JobDepartment, Language, Timezone } from '../types'\n\nexport class ConfigurationResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n details(): Promise<Configuration> {\n return this.#transport.get('/configuration')\n }\n\n countries(): Promise<Country[]> {\n return this.#transport.get('/configuration/countries')\n }\n\n jobs(): Promise<JobDepartment[]> {\n return this.#transport.get('/configuration/jobs')\n }\n\n languages(): Promise<Language[]> {\n return this.#transport.get('/configuration/languages')\n }\n\n primaryTranslations(): Promise<string[]> {\n return this.#transport.get('/configuration/primary_translations')\n }\n\n timezones(): Promise<Timezone[]> {\n return this.#transport.get('/configuration/timezones')\n }\n}\n","import type { TMDBTransport } from '../http'\nimport { withLanguage } from '../query'\nimport type { GenresResponse, LanguageOptions } from '../types'\n\nexport class GenresResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n movies(options: LanguageOptions = {}): Promise<GenresResponse> {\n return this.#transport.get('/genre/movie/list', {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n tv(options: LanguageOptions = {}): Promise<GenresResponse> {\n return this.#transport.get('/genre/tv/list', {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n}\n","import type { TMDBTransport } from '../http'\nimport { buildImageUrl } from '../query'\nimport type { ImageSize } from '../types'\n\nexport class ImagesHelper {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n url(path: string | null | undefined, size: ImageSize = 'original'): string | null {\n return buildImageUrl(path, size, {\n baseUrl: this.#transport.defaults.imageBaseUrl,\n })\n }\n}\n","import type { TMDBTransport } from '../http'\nimport { toCommaList, toId, withLanguage, withListDefaults, type QueryParams } from '../query'\nimport type {\n CreditsResponse,\n ImageQueryOptions,\n ImagesResponse,\n ListOptions,\n MovieDetails,\n MovieDetailsOptions,\n MovieSummary,\n PagedResponse,\n TMDBObject,\n VideosResponse,\n} from '../types'\n\nexport class MoviesResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n popular(options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get('/movie/popular', {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n topRated(options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get('/movie/top_rated', {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n nowPlaying(options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get('/movie/now_playing', {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n upcoming(options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get('/movie/upcoming', {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n details<TAppend extends TMDBObject = TMDBObject>(\n movieId: number,\n options: MovieDetailsOptions = {},\n ): Promise<MovieDetails & TAppend> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}`, {\n query: withLanguage(this.#transport.defaults, {\n append_to_response: toCommaList(options.appendToResponse),\n language: options.language,\n }),\n })\n }\n\n credits(movieId: number, options: Pick<ListOptions, 'language'> = {}): Promise<CreditsResponse> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}/credits`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n images(movieId: number, options: ImageQueryOptions = {}): Promise<ImagesResponse> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}/images`, {\n query: withLanguage(this.#transport.defaults, {\n include_image_language: toCommaList(options.includeImageLanguage),\n language: options.language,\n }),\n })\n }\n\n recommendations(movieId: number, options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}/recommendations`, {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n similar(movieId: number, options: ListOptions = {}): Promise<PagedResponse<MovieSummary>> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}/similar`, {\n query: movieListQuery(this.#transport, options),\n })\n }\n\n videos(movieId: number, options: Pick<ListOptions, 'language'> = {}): Promise<VideosResponse> {\n return this.#transport.get(`/movie/${toId(movieId, 'movieId')}/videos`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n}\n\nfunction movieListQuery(transport: TMDBTransport, options: ListOptions): QueryParams {\n return withListDefaults(transport.defaults, {\n language: options.language,\n page: options.page,\n region: options.region,\n })\n}\n","import type { TMDBTransport } from '../http'\nimport { toId, withLanguage, type QueryParams } from '../query'\nimport type { LanguageOptions, ListOptions, PagedResponse, PersonDetails, PersonSummary } from '../types'\n\nexport class PeopleResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n popular(options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<PersonSummary>> {\n return this.#transport.get('/person/popular', {\n query: peopleListQuery(this.#transport, options),\n })\n }\n\n details(personId: number, options: LanguageOptions = {}): Promise<PersonDetails> {\n return this.#transport.get(`/person/${toId(personId, 'personId')}`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n}\n\nfunction peopleListQuery(\n transport: TMDBTransport,\n options: Omit<ListOptions, 'region'>,\n): QueryParams {\n return withLanguage(transport.defaults, {\n language: options.language,\n page: options.page,\n })\n}\n","import type { TMDBTransport } from '../http'\nimport { toSearchQuery, withLanguage, withListDefaults, type QueryParams } from '../query'\nimport type {\n MovieSearchOptions,\n MovieSearchResult,\n MultiSearchOptions,\n PagedResponse,\n PersonSearchResult,\n SearchMultiResult,\n TVSearchOptions,\n TVSearchResult,\n} from '../types'\n\nexport class SearchResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n movies(query: string, options: MovieSearchOptions = {}): Promise<PagedResponse<MovieSearchResult>> {\n return this.#transport.get('/search/movie', {\n query: movieSearchQuery(this.#transport, query, options),\n })\n }\n\n tv(query: string, options: TVSearchOptions = {}): Promise<PagedResponse<TVSearchResult>> {\n return this.#transport.get('/search/tv', {\n query: tvSearchQuery(this.#transport, query, options),\n })\n }\n\n people(query: string, options: MultiSearchOptions = {}): Promise<PagedResponse<PersonSearchResult>> {\n return this.#transport.get('/search/person', {\n query: commonSearchQuery(this.#transport, query, options),\n })\n }\n\n multi(query: string, options: MultiSearchOptions = {}): Promise<PagedResponse<SearchMultiResult>> {\n return this.#transport.get('/search/multi', {\n query: commonSearchQuery(this.#transport, query, options),\n })\n }\n}\n\nfunction movieSearchQuery(\n transport: TMDBTransport,\n query: string,\n options: MovieSearchOptions,\n): QueryParams {\n return withListDefaults(transport.defaults, {\n include_adult: options.includeAdult,\n language: options.language,\n page: options.page,\n primary_release_year: options.primaryReleaseYear,\n query: toSearchQuery(query),\n region: options.region,\n year: options.year,\n })\n}\n\nfunction tvSearchQuery(\n transport: TMDBTransport,\n query: string,\n options: TVSearchOptions,\n): QueryParams {\n return withLanguage(transport.defaults, {\n first_air_date_year: options.firstAirDateYear,\n include_adult: options.includeAdult,\n language: options.language,\n page: options.page,\n query: toSearchQuery(query),\n year: options.year,\n })\n}\n\nfunction commonSearchQuery(\n transport: TMDBTransport,\n query: string,\n options: MultiSearchOptions,\n): QueryParams {\n return withLanguage(transport.defaults, {\n include_adult: options.includeAdult,\n language: options.language,\n page: options.page,\n query: toSearchQuery(query),\n })\n}\n","import type { TMDBTransport } from '../http'\nimport { toTimeWindow, withLanguage } from '../query'\nimport type {\n LanguageOptions,\n MovieSummary,\n PagedResponse,\n PersonSummary,\n TrendingResult,\n TrendingTimeWindow,\n TVSummary,\n} from '../types'\n\nexport class TrendingResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n all(\n timeWindow: TrendingTimeWindow = 'day',\n options: LanguageOptions = {},\n ): Promise<PagedResponse<TrendingResult>> {\n return this.#transport.get(`/trending/all/${toTimeWindow(timeWindow)}`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n movies(\n timeWindow: TrendingTimeWindow = 'day',\n options: LanguageOptions = {},\n ): Promise<PagedResponse<MovieSummary & { media_type?: 'movie' }>> {\n return this.#transport.get(`/trending/movie/${toTimeWindow(timeWindow)}`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n tv(\n timeWindow: TrendingTimeWindow = 'day',\n options: LanguageOptions = {},\n ): Promise<PagedResponse<TVSummary & { media_type?: 'tv' }>> {\n return this.#transport.get(`/trending/tv/${toTimeWindow(timeWindow)}`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n people(\n timeWindow: TrendingTimeWindow = 'day',\n options: LanguageOptions = {},\n ): Promise<PagedResponse<PersonSummary & { media_type?: 'person' }>> {\n return this.#transport.get(`/trending/person/${toTimeWindow(timeWindow)}`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n}\n","import type { TMDBTransport } from '../http'\nimport { toCommaList, toId, withLanguage, type QueryParams } from '../query'\nimport type {\n CreditsResponse,\n ImageQueryOptions,\n ImagesResponse,\n LanguageOptions,\n ListOptions,\n PagedResponse,\n TMDBObject,\n TVDetails,\n TVDetailsOptions,\n TVSummary,\n VideosResponse,\n} from '../types'\n\nexport class TVResource {\n readonly #transport: TMDBTransport\n\n constructor(transport: TMDBTransport) {\n this.#transport = transport\n }\n\n popular(options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get('/tv/popular', {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n topRated(options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get('/tv/top_rated', {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n airingToday(options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get('/tv/airing_today', {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n onTheAir(options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get('/tv/on_the_air', {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n details<TAppend extends TMDBObject = TMDBObject>(\n seriesId: number,\n options: TVDetailsOptions = {},\n ): Promise<TVDetails & TAppend> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}`, {\n query: withLanguage(this.#transport.defaults, {\n append_to_response: toCommaList(options.appendToResponse),\n language: options.language,\n }),\n })\n }\n\n credits(seriesId: number, options: LanguageOptions = {}): Promise<CreditsResponse> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}/credits`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n\n images(seriesId: number, options: ImageQueryOptions = {}): Promise<ImagesResponse> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}/images`, {\n query: withLanguage(this.#transport.defaults, {\n include_image_language: toCommaList(options.includeImageLanguage),\n language: options.language,\n }),\n })\n }\n\n recommendations(seriesId: number, options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}/recommendations`, {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n similar(seriesId: number, options: Omit<ListOptions, 'region'> = {}): Promise<PagedResponse<TVSummary>> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}/similar`, {\n query: tvListQuery(this.#transport, options),\n })\n }\n\n videos(seriesId: number, options: LanguageOptions = {}): Promise<VideosResponse> {\n return this.#transport.get(`/tv/${toId(seriesId, 'seriesId')}/videos`, {\n query: withLanguage(this.#transport.defaults, {\n language: options.language,\n }),\n })\n }\n}\n\nfunction tvListQuery(\n transport: TMDBTransport,\n options: Omit<ListOptions, 'region'>,\n): QueryParams {\n return withLanguage(transport.defaults, {\n language: options.language,\n page: options.page,\n })\n}\n","import { TMDBHttpClient, type TMDBClientOptions, type TMDBRequestOptions } from './http'\nimport { ConfigurationResource } from './resources/configuration'\nimport { GenresResource } from './resources/genres'\nimport { ImagesHelper } from './resources/images'\nimport { MoviesResource } from './resources/movies'\nimport { PeopleResource } from './resources/people'\nimport { SearchResource } from './resources/search'\nimport { TrendingResource } from './resources/trending'\nimport { TVResource } from './resources/tv'\n\n/**\n * Main SDK entry point.\n *\n * Resource properties are intentionally small and explicit. The SDK focuses on\n * common TMDB workflows first, while request<T>() keeps uncommon endpoints easy\n * to call without waiting for a generated surface area.\n */\nexport class TMDBClient {\n readonly configuration: ConfigurationResource\n readonly genres: GenresResource\n readonly images: ImagesHelper\n readonly movies: MoviesResource\n readonly people: PeopleResource\n readonly search: SearchResource\n readonly trending: TrendingResource\n readonly tv: TVResource\n\n readonly #http: TMDBHttpClient\n\n constructor(options: TMDBClientOptions) {\n this.#http = new TMDBHttpClient(options)\n\n this.configuration = new ConfigurationResource(this.#http)\n this.genres = new GenresResource(this.#http)\n this.images = new ImagesHelper(this.#http)\n this.movies = new MoviesResource(this.#http)\n this.people = new PeopleResource(this.#http)\n this.search = new SearchResource(this.#http)\n this.trending = new TrendingResource(this.#http)\n this.tv = new TVResource(this.#http)\n }\n\n request<T>(path: string, options?: TMDBRequestOptions): Promise<T> {\n return this.#http.get<T>(path, options)\n }\n}\n\nexport function createTMDB(options: TMDBClientOptions): TMDBClient {\n return new TMDBClient(options)\n}\n"],"mappings":";;;AAiBA,IAAa,YAAb,cAA+B,MAAM;CACnC,YAAY,SAAiB,SAAwB;EACnD,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,mBAAb,cAAsC,UAAU;CAC9C,YAAY,SAAiB,SAAwB;EACnD,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,oBAAb,cAAuC,UAAU;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAiB,SAAmC;EAC9D,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO,QAAQ;EACpB,KAAK,UAAU,QAAQ;EACvB,KAAK,YAAY,QAAQ,QAAQ,IAAI,cAAc;EACnD,KAAK,SAAS,QAAQ;EACtB,KAAK,aAAa,QAAQ;EAC1B,KAAK,MAAM,QAAQ;EAEnB,MAAM,OAAO,oBAAoB,QAAQ,IAAI,IAAI,QAAQ,OAAO,KAAA;EAChE,KAAK,aAAa,MAAM;EACxB,KAAK,gBAAgB,MAAM;CAC7B;AACF;AAEA,SAAgB,oBAAoB,SAAsD;CAIxF,OAAO,IAAI,mBAHE,oBAAoB,QAAQ,IAAI,IAAI,QAAQ,OAAO,KAAA,EAAA,EAC1C,kBA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AA4B;EACtC,KAAKC,QAAQ,IAAI,eAAe,OAAO;EAEvC,KAAK,gBAAgB,IAAI,sBAAsB,KAAKA,KAAK;EACzD,KAAK,SAAS,IAAI,eAAe,KAAKA,KAAK;EAC3C,KAAK,SAAS,IAAI,aAAa,KAAKA,KAAK;EACzC,KAAK,SAAS,IAAI,eAAe,KAAKA,KAAK;EAC3C,KAAK,SAAS,IAAI,eAAe,KAAKA,KAAK;EAC3C,KAAK,SAAS,IAAI,eAAe,KAAKA,KAAK;EAC3C,KAAK,WAAW,IAAI,iBAAiB,KAAKA,KAAK;EAC/C,KAAK,KAAK,IAAI,WAAW,KAAKA,KAAK;CACrC;CAEA,QAAW,MAAc,SAA0C;EACjE,OAAO,KAAKA,MAAM,IAAO,MAAM,OAAO;CACxC;AACF;AAEA,SAAgB,WAAW,SAAwC;CACjE,OAAO,IAAI,WAAW,OAAO;AAC/B"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/** Primitive JSON values returned by TMDB. */
|
|
3
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
4
|
+
/** JSON object/array tree returned by TMDB for fields this SDK does not model yet. */
|
|
5
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
6
|
+
interface JsonObject {
|
|
7
|
+
[key: string]: JsonValue | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** Escape hatch for append_to_response payloads and future TMDB fields. */
|
|
10
|
+
type TMDBObject = Record<string, unknown>;
|
|
11
|
+
type TMDBDateString = string;
|
|
12
|
+
type LanguageCode = string;
|
|
13
|
+
type RegionCode = string;
|
|
14
|
+
type MediaType = 'movie' | 'tv' | 'person';
|
|
15
|
+
type TrendingTimeWindow = 'day' | 'week';
|
|
16
|
+
interface PagedResponse<T> {
|
|
17
|
+
page: number;
|
|
18
|
+
results: T[];
|
|
19
|
+
total_pages: number;
|
|
20
|
+
total_results: number;
|
|
21
|
+
}
|
|
22
|
+
interface Genre {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
interface ProductionCompany {
|
|
27
|
+
id: number;
|
|
28
|
+
logo_path: string | null;
|
|
29
|
+
name: string;
|
|
30
|
+
origin_country: string;
|
|
31
|
+
}
|
|
32
|
+
interface ProductionCountry {
|
|
33
|
+
iso_3166_1: string;
|
|
34
|
+
name: string;
|
|
35
|
+
}
|
|
36
|
+
interface SpokenLanguage {
|
|
37
|
+
english_name: string;
|
|
38
|
+
iso_639_1: string;
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
interface CollectionSummary {
|
|
42
|
+
id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
poster_path: string | null;
|
|
45
|
+
backdrop_path: string | null;
|
|
46
|
+
}
|
|
47
|
+
interface MovieSummary {
|
|
48
|
+
adult: boolean;
|
|
49
|
+
backdrop_path: string | null;
|
|
50
|
+
genre_ids: number[];
|
|
51
|
+
id: number;
|
|
52
|
+
original_language: string;
|
|
53
|
+
original_title: string;
|
|
54
|
+
overview: string;
|
|
55
|
+
popularity: number;
|
|
56
|
+
poster_path: string | null;
|
|
57
|
+
release_date: TMDBDateString;
|
|
58
|
+
title: string;
|
|
59
|
+
video: boolean;
|
|
60
|
+
vote_average: number;
|
|
61
|
+
vote_count: number;
|
|
62
|
+
}
|
|
63
|
+
interface MovieDetails extends Omit<MovieSummary, 'genre_ids'> {
|
|
64
|
+
belongs_to_collection: CollectionSummary | null;
|
|
65
|
+
budget: number;
|
|
66
|
+
genres: Genre[];
|
|
67
|
+
homepage: string | null;
|
|
68
|
+
imdb_id: string | null;
|
|
69
|
+
origin_country?: string[];
|
|
70
|
+
production_companies: ProductionCompany[];
|
|
71
|
+
production_countries: ProductionCountry[];
|
|
72
|
+
revenue: number;
|
|
73
|
+
runtime: number | null;
|
|
74
|
+
spoken_languages: SpokenLanguage[];
|
|
75
|
+
status: string;
|
|
76
|
+
tagline: string | null;
|
|
77
|
+
}
|
|
78
|
+
interface TVSummary {
|
|
79
|
+
adult?: boolean;
|
|
80
|
+
backdrop_path: string | null;
|
|
81
|
+
first_air_date: TMDBDateString;
|
|
82
|
+
genre_ids: number[];
|
|
83
|
+
id: number;
|
|
84
|
+
name: string;
|
|
85
|
+
origin_country: string[];
|
|
86
|
+
original_language: string;
|
|
87
|
+
original_name: string;
|
|
88
|
+
overview: string;
|
|
89
|
+
popularity: number;
|
|
90
|
+
poster_path: string | null;
|
|
91
|
+
vote_average: number;
|
|
92
|
+
vote_count: number;
|
|
93
|
+
}
|
|
94
|
+
interface CreatedBy {
|
|
95
|
+
id: number;
|
|
96
|
+
credit_id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
gender: number;
|
|
99
|
+
profile_path: string | null;
|
|
100
|
+
}
|
|
101
|
+
interface Network {
|
|
102
|
+
id: number;
|
|
103
|
+
logo_path: string | null;
|
|
104
|
+
name: string;
|
|
105
|
+
origin_country: string;
|
|
106
|
+
}
|
|
107
|
+
interface SeasonSummary {
|
|
108
|
+
air_date: TMDBDateString | null;
|
|
109
|
+
episode_count: number;
|
|
110
|
+
id: number;
|
|
111
|
+
name: string;
|
|
112
|
+
overview: string;
|
|
113
|
+
poster_path: string | null;
|
|
114
|
+
season_number: number;
|
|
115
|
+
vote_average: number;
|
|
116
|
+
}
|
|
117
|
+
interface TVDetails extends Omit<TVSummary, 'genre_ids'> {
|
|
118
|
+
created_by: CreatedBy[];
|
|
119
|
+
episode_run_time: number[];
|
|
120
|
+
genres: Genre[];
|
|
121
|
+
homepage: string | null;
|
|
122
|
+
in_production: boolean;
|
|
123
|
+
languages: string[];
|
|
124
|
+
last_air_date: TMDBDateString | null;
|
|
125
|
+
networks: Network[];
|
|
126
|
+
number_of_episodes: number;
|
|
127
|
+
number_of_seasons: number;
|
|
128
|
+
production_companies: ProductionCompany[];
|
|
129
|
+
production_countries: ProductionCountry[];
|
|
130
|
+
seasons: SeasonSummary[];
|
|
131
|
+
spoken_languages: SpokenLanguage[];
|
|
132
|
+
status: string;
|
|
133
|
+
tagline: string | null;
|
|
134
|
+
type: string;
|
|
135
|
+
}
|
|
136
|
+
interface PersonKnownForMovie extends MovieSummary {
|
|
137
|
+
media_type: 'movie';
|
|
138
|
+
}
|
|
139
|
+
interface PersonKnownForTV extends TVSummary {
|
|
140
|
+
media_type: 'tv';
|
|
141
|
+
}
|
|
142
|
+
type PersonKnownFor = PersonKnownForMovie | PersonKnownForTV;
|
|
143
|
+
interface PersonSummary {
|
|
144
|
+
adult: boolean;
|
|
145
|
+
gender: number;
|
|
146
|
+
id: number;
|
|
147
|
+
known_for: PersonKnownFor[];
|
|
148
|
+
known_for_department: string;
|
|
149
|
+
name: string;
|
|
150
|
+
original_name?: string;
|
|
151
|
+
popularity: number;
|
|
152
|
+
profile_path: string | null;
|
|
153
|
+
}
|
|
154
|
+
interface PersonDetails extends Omit<PersonSummary, 'known_for'> {
|
|
155
|
+
also_known_as: string[];
|
|
156
|
+
biography: string;
|
|
157
|
+
birthday: TMDBDateString | null;
|
|
158
|
+
deathday: TMDBDateString | null;
|
|
159
|
+
homepage: string | null;
|
|
160
|
+
imdb_id: string | null;
|
|
161
|
+
place_of_birth: string | null;
|
|
162
|
+
}
|
|
163
|
+
interface MovieSearchResult extends MovieSummary {
|
|
164
|
+
media_type?: 'movie';
|
|
165
|
+
}
|
|
166
|
+
interface TVSearchResult extends TVSummary {
|
|
167
|
+
media_type?: 'tv';
|
|
168
|
+
}
|
|
169
|
+
interface PersonSearchResult extends PersonSummary {
|
|
170
|
+
media_type?: 'person';
|
|
171
|
+
}
|
|
172
|
+
type SearchMultiResult = (MovieSummary & {
|
|
173
|
+
media_type: 'movie';
|
|
174
|
+
}) | (TVSummary & {
|
|
175
|
+
media_type: 'tv';
|
|
176
|
+
}) | (PersonSummary & {
|
|
177
|
+
media_type: 'person';
|
|
178
|
+
});
|
|
179
|
+
type TrendingResult = SearchMultiResult;
|
|
180
|
+
interface CreditCastMember {
|
|
181
|
+
adult?: boolean;
|
|
182
|
+
cast_id?: number;
|
|
183
|
+
character: string;
|
|
184
|
+
credit_id: string;
|
|
185
|
+
gender: number | null;
|
|
186
|
+
id: number;
|
|
187
|
+
known_for_department: string;
|
|
188
|
+
name: string;
|
|
189
|
+
order: number;
|
|
190
|
+
original_name: string;
|
|
191
|
+
popularity: number;
|
|
192
|
+
profile_path: string | null;
|
|
193
|
+
}
|
|
194
|
+
interface CreditCrewMember {
|
|
195
|
+
adult?: boolean;
|
|
196
|
+
credit_id: string;
|
|
197
|
+
department: string;
|
|
198
|
+
gender: number | null;
|
|
199
|
+
id: number;
|
|
200
|
+
job: string;
|
|
201
|
+
known_for_department: string;
|
|
202
|
+
name: string;
|
|
203
|
+
original_name: string;
|
|
204
|
+
popularity: number;
|
|
205
|
+
profile_path: string | null;
|
|
206
|
+
}
|
|
207
|
+
interface CreditsResponse {
|
|
208
|
+
id: number;
|
|
209
|
+
cast: CreditCastMember[];
|
|
210
|
+
crew: CreditCrewMember[];
|
|
211
|
+
}
|
|
212
|
+
interface Video {
|
|
213
|
+
id: string;
|
|
214
|
+
iso_3166_1: string;
|
|
215
|
+
iso_639_1: string;
|
|
216
|
+
key: string;
|
|
217
|
+
name: string;
|
|
218
|
+
official: boolean;
|
|
219
|
+
published_at: string;
|
|
220
|
+
site: string;
|
|
221
|
+
size: number;
|
|
222
|
+
type: string;
|
|
223
|
+
}
|
|
224
|
+
interface VideosResponse {
|
|
225
|
+
id: number;
|
|
226
|
+
results: Video[];
|
|
227
|
+
}
|
|
228
|
+
interface ImageItem {
|
|
229
|
+
aspect_ratio: number;
|
|
230
|
+
height: number;
|
|
231
|
+
iso_639_1: string | null;
|
|
232
|
+
file_path: string;
|
|
233
|
+
vote_average: number;
|
|
234
|
+
vote_count: number;
|
|
235
|
+
width: number;
|
|
236
|
+
}
|
|
237
|
+
interface ImagesResponse {
|
|
238
|
+
id: number;
|
|
239
|
+
backdrops: ImageItem[];
|
|
240
|
+
logos?: ImageItem[];
|
|
241
|
+
posters: ImageItem[];
|
|
242
|
+
}
|
|
243
|
+
interface ConfigurationImages {
|
|
244
|
+
base_url: string;
|
|
245
|
+
secure_base_url: string;
|
|
246
|
+
backdrop_sizes: string[];
|
|
247
|
+
logo_sizes: string[];
|
|
248
|
+
poster_sizes: string[];
|
|
249
|
+
profile_sizes: string[];
|
|
250
|
+
still_sizes: string[];
|
|
251
|
+
}
|
|
252
|
+
interface Configuration {
|
|
253
|
+
images: ConfigurationImages;
|
|
254
|
+
change_keys: string[];
|
|
255
|
+
}
|
|
256
|
+
interface Country {
|
|
257
|
+
iso_3166_1: string;
|
|
258
|
+
english_name: string;
|
|
259
|
+
native_name: string;
|
|
260
|
+
}
|
|
261
|
+
interface Language {
|
|
262
|
+
iso_639_1: string;
|
|
263
|
+
english_name: string;
|
|
264
|
+
name: string;
|
|
265
|
+
}
|
|
266
|
+
interface Timezone {
|
|
267
|
+
iso_3166_1: string;
|
|
268
|
+
zones: string[];
|
|
269
|
+
}
|
|
270
|
+
interface JobDepartment {
|
|
271
|
+
department: string;
|
|
272
|
+
jobs: string[];
|
|
273
|
+
}
|
|
274
|
+
interface GenresResponse {
|
|
275
|
+
genres: Genre[];
|
|
276
|
+
}
|
|
277
|
+
type BackdropSize = 'w300' | 'w780' | 'w1280' | 'original' | (string & {});
|
|
278
|
+
type LogoSize = 'w45' | 'w92' | 'w154' | 'w185' | 'w300' | 'w500' | 'original' | (string & {});
|
|
279
|
+
type PosterSize = 'w92' | 'w154' | 'w185' | 'w342' | 'w500' | 'w780' | 'original' | (string & {});
|
|
280
|
+
type ProfileSize = 'w45' | 'w185' | 'h632' | 'original' | (string & {});
|
|
281
|
+
type StillSize = 'w92' | 'w185' | 'w300' | 'original' | (string & {});
|
|
282
|
+
type ImageSize = BackdropSize | LogoSize | PosterSize | ProfileSize | StillSize;
|
|
283
|
+
type MovieAppendToResponse = 'account_states' | 'alternative_titles' | 'changes' | 'credits' | 'external_ids' | 'images' | 'keywords' | 'lists' | 'recommendations' | 'release_dates' | 'reviews' | 'similar' | 'translations' | 'videos' | 'watch/providers' | (string & {});
|
|
284
|
+
type TVAppendToResponse = 'account_states' | 'aggregate_credits' | 'alternative_titles' | 'changes' | 'content_ratings' | 'credits' | 'episode_groups' | 'external_ids' | 'images' | 'keywords' | 'recommendations' | 'reviews' | 'screened_theatrically' | 'similar' | 'translations' | 'videos' | 'watch/providers' | (string & {});
|
|
285
|
+
interface ListOptions {
|
|
286
|
+
language?: LanguageCode;
|
|
287
|
+
page?: number;
|
|
288
|
+
region?: RegionCode;
|
|
289
|
+
}
|
|
290
|
+
interface LanguageOptions {
|
|
291
|
+
language?: LanguageCode;
|
|
292
|
+
}
|
|
293
|
+
interface MovieDetailsOptions extends LanguageOptions {
|
|
294
|
+
appendToResponse?: MovieAppendToResponse | readonly MovieAppendToResponse[];
|
|
295
|
+
}
|
|
296
|
+
interface TVDetailsOptions extends LanguageOptions {
|
|
297
|
+
appendToResponse?: TVAppendToResponse | readonly TVAppendToResponse[];
|
|
298
|
+
}
|
|
299
|
+
interface MovieSearchOptions extends ListOptions {
|
|
300
|
+
includeAdult?: boolean;
|
|
301
|
+
primaryReleaseYear?: string | number;
|
|
302
|
+
year?: string | number;
|
|
303
|
+
}
|
|
304
|
+
interface TVSearchOptions extends Omit<ListOptions, 'region'> {
|
|
305
|
+
firstAirDateYear?: string | number;
|
|
306
|
+
includeAdult?: boolean;
|
|
307
|
+
year?: string | number;
|
|
308
|
+
}
|
|
309
|
+
interface MultiSearchOptions extends Omit<ListOptions, 'region'> {
|
|
310
|
+
includeAdult?: boolean;
|
|
311
|
+
}
|
|
312
|
+
interface ImageQueryOptions extends LanguageOptions {
|
|
313
|
+
includeImageLanguage?: string | readonly string[];
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/query.d.ts
|
|
317
|
+
type QueryPrimitive = string | number | boolean;
|
|
318
|
+
type QueryValue = QueryPrimitive | readonly QueryPrimitive[] | null | undefined;
|
|
319
|
+
type QueryParams = Record<string, QueryValue>;
|
|
320
|
+
interface QueryDefaults {
|
|
321
|
+
language?: LanguageCode;
|
|
322
|
+
region?: RegionCode;
|
|
323
|
+
}
|
|
324
|
+
interface BuildImageUrlOptions {
|
|
325
|
+
baseUrl?: string;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Build a full TMDB image URL from the path returned by API payloads.
|
|
329
|
+
* Returns null for nullish image paths so UI code can branch naturally.
|
|
330
|
+
*/
|
|
331
|
+
declare function buildImageUrl(path: string | null | undefined, size?: ImageSize, options?: BuildImageUrlOptions): string | null;
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/http.d.ts
|
|
334
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
335
|
+
interface TMDBAccessTokenAuth {
|
|
336
|
+
/** TMDB API Read Access Token. Sent as an Authorization Bearer header. */
|
|
337
|
+
accessToken: string;
|
|
338
|
+
apiKey?: never;
|
|
339
|
+
}
|
|
340
|
+
interface TMDBApiKeyAuth {
|
|
341
|
+
/** Legacy v3 API key. Sent as api_key query parameter. */
|
|
342
|
+
apiKey: string;
|
|
343
|
+
accessToken?: never;
|
|
344
|
+
}
|
|
345
|
+
type TMDBAuth = TMDBAccessTokenAuth | TMDBApiKeyAuth;
|
|
346
|
+
interface TMDBClientDefaults extends QueryDefaults {
|
|
347
|
+
imageBaseUrl: string;
|
|
348
|
+
}
|
|
349
|
+
type TMDBClientOptions = TMDBAuth & {
|
|
350
|
+
/** Defaults to https://api.themoviedb.org/3. Useful for tests or proxies. */baseUrl?: string; /** Inject a fetch implementation for tests, custom runtimes, or instrumentation. */
|
|
351
|
+
fetch?: FetchLike; /** Default language for endpoints that accept a language query parameter. */
|
|
352
|
+
defaultLanguage?: LanguageCode; /** Default region for movie list/search endpoints that accept a region query parameter. */
|
|
353
|
+
defaultRegion?: RegionCode; /** Custom image host. Defaults to https://image.tmdb.org/t/p. */
|
|
354
|
+
imageBaseUrl?: string; /** Additional headers merged into every request before authentication is applied. */
|
|
355
|
+
headers?: HeadersInit;
|
|
356
|
+
};
|
|
357
|
+
interface TMDBRequestOptions {
|
|
358
|
+
headers?: HeadersInit;
|
|
359
|
+
query?: QueryParams;
|
|
360
|
+
signal?: AbortSignal;
|
|
361
|
+
}
|
|
362
|
+
interface TMDBTransport {
|
|
363
|
+
readonly defaults: TMDBClientDefaults;
|
|
364
|
+
get<T>(path: string, options?: TMDBRequestOptions): Promise<T>;
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/resources/configuration.d.ts
|
|
368
|
+
declare class ConfigurationResource {
|
|
369
|
+
#private;
|
|
370
|
+
constructor(transport: TMDBTransport);
|
|
371
|
+
details(): Promise<Configuration>;
|
|
372
|
+
countries(): Promise<Country[]>;
|
|
373
|
+
jobs(): Promise<JobDepartment[]>;
|
|
374
|
+
languages(): Promise<Language[]>;
|
|
375
|
+
primaryTranslations(): Promise<string[]>;
|
|
376
|
+
timezones(): Promise<Timezone[]>;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/resources/genres.d.ts
|
|
380
|
+
declare class GenresResource {
|
|
381
|
+
#private;
|
|
382
|
+
constructor(transport: TMDBTransport);
|
|
383
|
+
movies(options?: LanguageOptions): Promise<GenresResponse>;
|
|
384
|
+
tv(options?: LanguageOptions): Promise<GenresResponse>;
|
|
385
|
+
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/resources/images.d.ts
|
|
388
|
+
declare class ImagesHelper {
|
|
389
|
+
#private;
|
|
390
|
+
constructor(transport: TMDBTransport);
|
|
391
|
+
url(path: string | null | undefined, size?: ImageSize): string | null;
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/resources/movies.d.ts
|
|
395
|
+
declare class MoviesResource {
|
|
396
|
+
#private;
|
|
397
|
+
constructor(transport: TMDBTransport);
|
|
398
|
+
popular(options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
399
|
+
topRated(options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
400
|
+
nowPlaying(options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
401
|
+
upcoming(options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
402
|
+
details<TAppend extends TMDBObject = TMDBObject>(movieId: number, options?: MovieDetailsOptions): Promise<MovieDetails & TAppend>;
|
|
403
|
+
credits(movieId: number, options?: Pick<ListOptions, 'language'>): Promise<CreditsResponse>;
|
|
404
|
+
images(movieId: number, options?: ImageQueryOptions): Promise<ImagesResponse>;
|
|
405
|
+
recommendations(movieId: number, options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
406
|
+
similar(movieId: number, options?: ListOptions): Promise<PagedResponse<MovieSummary>>;
|
|
407
|
+
videos(movieId: number, options?: Pick<ListOptions, 'language'>): Promise<VideosResponse>;
|
|
408
|
+
}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/resources/people.d.ts
|
|
411
|
+
declare class PeopleResource {
|
|
412
|
+
#private;
|
|
413
|
+
constructor(transport: TMDBTransport);
|
|
414
|
+
popular(options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<PersonSummary>>;
|
|
415
|
+
details(personId: number, options?: LanguageOptions): Promise<PersonDetails>;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/resources/search.d.ts
|
|
419
|
+
declare class SearchResource {
|
|
420
|
+
#private;
|
|
421
|
+
constructor(transport: TMDBTransport);
|
|
422
|
+
movies(query: string, options?: MovieSearchOptions): Promise<PagedResponse<MovieSearchResult>>;
|
|
423
|
+
tv(query: string, options?: TVSearchOptions): Promise<PagedResponse<TVSearchResult>>;
|
|
424
|
+
people(query: string, options?: MultiSearchOptions): Promise<PagedResponse<PersonSearchResult>>;
|
|
425
|
+
multi(query: string, options?: MultiSearchOptions): Promise<PagedResponse<SearchMultiResult>>;
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/resources/trending.d.ts
|
|
429
|
+
declare class TrendingResource {
|
|
430
|
+
#private;
|
|
431
|
+
constructor(transport: TMDBTransport);
|
|
432
|
+
all(timeWindow?: TrendingTimeWindow, options?: LanguageOptions): Promise<PagedResponse<TrendingResult>>;
|
|
433
|
+
movies(timeWindow?: TrendingTimeWindow, options?: LanguageOptions): Promise<PagedResponse<MovieSummary & {
|
|
434
|
+
media_type?: 'movie';
|
|
435
|
+
}>>;
|
|
436
|
+
tv(timeWindow?: TrendingTimeWindow, options?: LanguageOptions): Promise<PagedResponse<TVSummary & {
|
|
437
|
+
media_type?: 'tv';
|
|
438
|
+
}>>;
|
|
439
|
+
people(timeWindow?: TrendingTimeWindow, options?: LanguageOptions): Promise<PagedResponse<PersonSummary & {
|
|
440
|
+
media_type?: 'person';
|
|
441
|
+
}>>;
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/resources/tv.d.ts
|
|
445
|
+
declare class TVResource {
|
|
446
|
+
#private;
|
|
447
|
+
constructor(transport: TMDBTransport);
|
|
448
|
+
popular(options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
449
|
+
topRated(options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
450
|
+
airingToday(options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
451
|
+
onTheAir(options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
452
|
+
details<TAppend extends TMDBObject = TMDBObject>(seriesId: number, options?: TVDetailsOptions): Promise<TVDetails & TAppend>;
|
|
453
|
+
credits(seriesId: number, options?: LanguageOptions): Promise<CreditsResponse>;
|
|
454
|
+
images(seriesId: number, options?: ImageQueryOptions): Promise<ImagesResponse>;
|
|
455
|
+
recommendations(seriesId: number, options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
456
|
+
similar(seriesId: number, options?: Omit<ListOptions, 'region'>): Promise<PagedResponse<TVSummary>>;
|
|
457
|
+
videos(seriesId: number, options?: LanguageOptions): Promise<VideosResponse>;
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/client.d.ts
|
|
461
|
+
/**
|
|
462
|
+
* Main SDK entry point.
|
|
463
|
+
*
|
|
464
|
+
* Resource properties are intentionally small and explicit. The SDK focuses on
|
|
465
|
+
* common TMDB workflows first, while request<T>() keeps uncommon endpoints easy
|
|
466
|
+
* to call without waiting for a generated surface area.
|
|
467
|
+
*/
|
|
468
|
+
declare class TMDBClient {
|
|
469
|
+
#private;
|
|
470
|
+
readonly configuration: ConfigurationResource;
|
|
471
|
+
readonly genres: GenresResource;
|
|
472
|
+
readonly images: ImagesHelper;
|
|
473
|
+
readonly movies: MoviesResource;
|
|
474
|
+
readonly people: PeopleResource;
|
|
475
|
+
readonly search: SearchResource;
|
|
476
|
+
readonly trending: TrendingResource;
|
|
477
|
+
readonly tv: TVResource;
|
|
478
|
+
constructor(options: TMDBClientOptions);
|
|
479
|
+
request<T>(path: string, options?: TMDBRequestOptions): Promise<T>;
|
|
480
|
+
}
|
|
481
|
+
declare function createTMDB(options: TMDBClientOptions): TMDBClient;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/errors.d.ts
|
|
484
|
+
interface TMDBResponseErrorOptions {
|
|
485
|
+
body: JsonValue | undefined;
|
|
486
|
+
headers: Headers;
|
|
487
|
+
status: number;
|
|
488
|
+
statusText: string;
|
|
489
|
+
url: string;
|
|
490
|
+
}
|
|
491
|
+
/** Base class for all SDK-originated errors. */
|
|
492
|
+
declare class TMDBError extends Error {
|
|
493
|
+
constructor(message: string, options?: ErrorOptions);
|
|
494
|
+
}
|
|
495
|
+
/** Thrown before a request is sent or when fetch itself rejects. */
|
|
496
|
+
declare class TMDBRequestError extends TMDBError {
|
|
497
|
+
constructor(message: string, options?: ErrorOptions);
|
|
498
|
+
}
|
|
499
|
+
/** Thrown when TMDB returns a non-2xx response. */
|
|
500
|
+
declare class TMDBResponseError extends TMDBError {
|
|
501
|
+
readonly body: JsonValue | undefined;
|
|
502
|
+
readonly headers: Headers;
|
|
503
|
+
readonly requestId: string | null;
|
|
504
|
+
readonly status: number;
|
|
505
|
+
readonly statusCode: number | undefined;
|
|
506
|
+
readonly statusMessage: string | undefined;
|
|
507
|
+
readonly statusText: string;
|
|
508
|
+
readonly url: string;
|
|
509
|
+
constructor(message: string, options: TMDBResponseErrorOptions);
|
|
510
|
+
}
|
|
511
|
+
//#endregion
|
|
512
|
+
export { type BackdropSize, type CollectionSummary, type Configuration, type ConfigurationImages, type Country, type CreditCastMember, type CreditCrewMember, type CreditsResponse, type FetchLike, type Genre, type GenresResponse, type ImageItem, type ImageQueryOptions, type ImageSize, type ImagesResponse, type JobDepartment, type Language, type LanguageCode, type LanguageOptions, type ListOptions, type LogoSize, type MediaType, type MovieAppendToResponse, type MovieDetails, type MovieDetailsOptions, type MovieSearchOptions, type MovieSearchResult, type MovieSummary, type MultiSearchOptions, type Network, type PagedResponse, type PersonDetails, type PersonKnownFor, type PersonKnownForMovie, type PersonKnownForTV, type PersonSearchResult, type PersonSummary, type PosterSize, type ProductionCompany, type ProductionCountry, type ProfileSize, type RegionCode, type SearchMultiResult, type SeasonSummary, type SpokenLanguage, type StillSize, type TMDBAccessTokenAuth, type TMDBApiKeyAuth, type TMDBAuth, TMDBClient, type TMDBClientOptions, type TMDBDateString, TMDBError, type TMDBObject, TMDBRequestError, type TMDBRequestOptions, TMDBResponseError, type TVAppendToResponse, type TVDetails, type TVDetailsOptions, type TVSearchOptions, type TVSearchResult, type TVSummary, type Timezone, type TrendingResult, type TrendingTimeWindow, type Video, type VideosResponse, buildImageUrl, createTMDB };
|
|
513
|
+
//# sourceMappingURL=index.d.cts.map
|