### Install Dependencies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/CONTRIBUTING.md Install project dependencies using Bun. This command should be run after cloning the repository. ```bash bun install ``` -------------------------------- ### Install @api-wrappers/tmdb-wrapper Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/index.md Install the TMDB wrapper using your preferred package manager. ```bash npm install @api-wrappers/tmdb-wrapper yarn add @api-wrappers/tmdb-wrapper pnpm add @api-wrappers/tmdb-wrapper bun add @api-wrappers/tmdb-wrapper ``` -------------------------------- ### Installation Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Install the TMDB TypeScript Wrapper using your preferred package manager. ```APIDOC ## Installation To install the TMDB TypeScript Wrapper, follow these steps: 1. Run the following command in your project directory: ```typescript // npm npm install @api-wrappers/tmdb-wrapper // yarn yarn add @api-wrappers/tmdb-wrapper // pnpm pnpm i @api-wrappers/tmdb-wrapper // bun bun add @api-wrappers/tmdb-wrapper ``` ``` -------------------------------- ### Install TMDB API Wrapper Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Install the TMDB TypeScript Wrapper using your preferred package manager. ```typescript // npm npm install @api-wrappers/tmdb-wrapper // yarn yarn add @api-wrappers/tmdb-wrapper // pnpm pnpm i @api-wrappers/tmdb-wrapper // bun bun add @api-wrappers/tmdb-wrapper ``` -------------------------------- ### Example: Poster Path with Format Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Demonstrates using `getFullImagePath` to construct a poster URL, appending a JPG format. ```typescript const posterUrl = getFullImagePath( "https://image.tmdb.org/t/p/", ImageSizes.W500, "/wwemzKWzjKYJFfCeiB57q3r4Bcm", ImageFormats.JPG, ); // https://image.tmdb.org/t/p/w500/wwemzKWzjKYJFfCeiB57q3r4Bcm.jpg ``` -------------------------------- ### Videos Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get videos (trailers, teasers) for a movie. ```APIDOC ## videos ### Description Fetch videos for a movie. ### Method `tmdb.movies.videos(id: number, options?: { language?: string }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie. #### Query Parameters - **language** (string) - Optional - Specify the language for the videos. - **request** (RequestConfig) - Optional - Configuration for the request. ### Request Example ```typescript const videos = await tmdb.movies.videos(550); for (const v of videos.results) { // v.key (YouTube key), v.type ("Trailer" | "Teaser" | ...) } ``` ### Response #### Success Response (200) - **results** (Array) - A list of videos for the movie. ``` -------------------------------- ### Keywords Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get keywords associated with a movie. ```APIDOC ## keywords ### Description Fetch keywords for a movie. ### Method `tmdb.movies.keywords(id: number, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **keywords** (Array) - A list of keywords associated with the movie. ``` -------------------------------- ### Example: Override Image Format with `formImage` Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Demonstrates how to specify a different output format (PNG) when using `formImage`. ```typescript const posterPngUrl = formImage(poster, ImageSizes.W500, ImageFormats.PNG); ``` -------------------------------- ### Example: Profile Path with Existing Extension Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Shows `getFullImagePath` usage when the image path already includes a file extension. ```typescript const profileUrl = getFullImagePath( "https://image.tmdb.org/t/p/", ImageSizes.W185, "/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg", ); // https://image.tmdb.org/t/p/w185/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg ``` -------------------------------- ### Reviews Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get user reviews for a movie. ```APIDOC ## reviews ### Description Fetch reviews for a movie. ### Method `tmdb.movies.reviews(id: number, options?: { language?: string; page?: number }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie. #### Query Parameters - **language** (string) - Optional - Specify the language for the reviews. - **page** (number) - Optional - The page number for the reviews. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of reviews for the movie. ``` -------------------------------- ### Usage Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Import and instantiate the TMDB class to start using the wrapper. Provide your API key or read access token for authentication. ```APIDOC ## Usage To use the TMDB TypeScript API Wrapper in your TypeScript project, import the necessary classes and functions: ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; ``` Then, create an instance of the TMDB class, optionally providing an access token. Access tokens can be obtained from [TMDb API Settings](https://www.themoviedb.org/settings/api) under read access token. ```typescript const tmdb = new TMDB('YOUR_ACCESS_TOKEN'); ``` You can now use the `tmdb` object to access various functionalities of the TMDB API. The wrapper provides access to all major TMDB API endpoints including Movies, TV Shows, People, Companies, Networks, and Watch Providers. ``` -------------------------------- ### Example: Form Image from Response Object Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Illustrates using the `formImage` helper with a poster object obtained from a movie images request. ```typescript const images = await tmdb.movies.getImages(550); const poster = images.posters[0]; const posterUrl = formImage(poster, ImageSizes.W500); // e.g. https://image.tmdb.org/t/p/w500/xxxxx.jpg ``` -------------------------------- ### Similar Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get a list of movies that are similar to a given movie. ```APIDOC ## similar ### Description Fetch similar movies. ### Method `tmdb.movies.similar(id: number, options?: { language?: string; page?: number }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie to find similar movies for. #### Query Parameters - **language** (string) - Optional - Specify the language for the similar movies. - **page** (number) - Optional - The page number for the similar movies. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of similar movies. ``` -------------------------------- ### Get TV Episode Videos Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/tv-episodes.md Retrieves the videos (trailers, clips, etc.) for a specific TV episode. ```APIDOC ## videos ### Description Retrieves the videos (trailers, clips, etc.) for a specific TV episode. ### Method Signature ```typescript tmdb.tvEpisodes.videos( episodeSelection: EpisodeSelection, options?: { language?: string; include_video_language?: string[] }, request?: RequestConfig, ): Promise ``` ### Parameters #### Path Parameters - **episodeSelection** (EpisodeSelection) - Required - An object containing `tvShowID`, `seasonNumber`, and `episodeNumber`. - **options** (object) - Optional - Additional options. - **language** (string) - Optional - The language to use for the request. - **include_video_language** (string[]) - Optional - A list of video languages to include. - **request** (RequestConfig) - Optional - Configuration for the request. ``` -------------------------------- ### Get Movie Details Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Fetch detailed information for a specific movie by its ID. Requires an initialized TMDB instance. ```typescript // Get movie details const movieDetails = await tmdb.movies.getDetails(550); // Fight Club ``` -------------------------------- ### Get all watch providers for movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/watch-providers.md Retrieves a list of all watch providers available for movies. ```APIDOC ## Get Movie Watch Providers ### Description Returns all watch providers available for movies. ### Method GET ### Endpoint /watch/providers/movie ### Response #### Success Response (200) - **results** (WatchProviderListResponse) - A list of watch providers. ### Response Example ```json { "results": [ { "display_priority": 1, "logo_path": "/p3y5z7z7z7z7z7z7z7z7z7z7z7z7z7z7.jpg", "provider_id": 8, "provider_name": "Netflix" } ] } ``` ``` -------------------------------- ### Get all watch providers for TV shows Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/watch-providers.md Retrieves a list of all watch providers available for TV shows. ```APIDOC ## Get TV Show Watch Providers ### Description Returns all watch providers available for TV shows. ### Method GET ### Endpoint /watch/providers/tv ### Response #### Success Response (200) - **results** (WatchProviderListResponse) - A list of watch providers. ### Response Example ```json { "results": [ { "display_priority": 1, "logo_path": "/p3y5z7z7z7z7z7z7z7z7z7z7z7z7z7z7.jpg", "provider_id": 8, "provider_name": "Netflix" } ] } ``` ``` -------------------------------- ### Get TV Network Details Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Retrieve specific details for a given TV network ID. Example uses Netflix (ID 213). ```typescript // Get network details const networkDetails = await tmdb.networks.getDetails(213); // Netflix ``` ```typescript // Get alternative names const alternativeNames = await tmdb.networks.getAlternativeNames(213); ``` -------------------------------- ### Get Company Details - TypeScript Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/companies.md Fetches detailed information for a specific company using its ID. Requires the `id` parameter. Example retrieves details for Lucasfilm. ```typescript tmdb.companies.details(id: number): Promise ``` ```typescript const company = await tmdb.companies.details(1); // Lucasfilm company.name; company.headquarters; company.homepage; company.origin_country; company.parent_company; ``` -------------------------------- ### Get Person Changes Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/changes.md Retrieve a list of person IDs that have recently changed. Optional parameters include page number, start date, and end date for filtering. ```typescript tmdb.changes.person( options?: { page?: number; start_date?: string; end_date?: string; }, ): Promise ``` -------------------------------- ### Get Movie Changes Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/changes.md Retrieve a list of movie IDs that have recently changed. Optional parameters include page number, start date, and end date for filtering. ```typescript tmdb.changes.movies( options?: { page?: number; start_date?: string; // YYYY-MM-DD end_date?: string; // YYYY-MM-DD }, ): Promise ``` -------------------------------- ### Initialization & Authentication Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Demonstrates how to initialize the TMDB wrapper with different authentication methods, including using a read access token, an API key, or both. ```APIDOC ## Initialization & Authentication The `TMDB` constructor accepts a read access token string or a `TMDBConfig` object. Obtain credentials from [TMDB API Settings](https://www.themoviedb.org/settings/api). ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; // Option 1 – read access token (recommended, sent as Bearer header) const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!); // Option 2 – API key (appended as api_key query parameter) const tmdb = new TMDB({ apiKey: process.env.TMDB_API_KEY! }); // Option 3 – both (access token for Authorization header, key also appended) const tmdb = new TMDB({ accessToken: process.env.TMDB_ACCESS_TOKEN!, apiKey: process.env.TMDB_API_KEY!, }); ``` ``` -------------------------------- ### Get Genre Lists Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Retrieve official genre lists for movies and TV shows. Specify language for results. ```typescript const movieGenres = await tmdb.genre.movies({ language: 'en-US' }); // { genres: [{ id: 28, name: 'Action' }, { id: 12, name: 'Adventure' }, ...] } ``` ```typescript const tvGenres = await tmdb.genre.tv({ language: 'en-US' }); ``` -------------------------------- ### Get TV Show Changes Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/changes.md Retrieve a list of TV show IDs that have recently changed. Optional parameters include page number, start date, and end date for filtering. ```typescript tmdb.changes.tv( options?: { page?: number; start_date?: string; end_date?: string; }, ): Promise ``` -------------------------------- ### Quick Start with TMDB Wrapper Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/index.md Initialize the TMDB wrapper with your read access token and fetch popular movies. Obtain your token from TMDB API Settings. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; const tmdb = new TMDB('YOUR_READ_ACCESS_TOKEN'); const popular = await tmdb.movies.popular(); console.log(popular.results); ``` -------------------------------- ### Build Project Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/CONTRIBUTING.md Build the project using the provided Bun script. This command is typically used before deployment or for creating distributable artifacts. ```bash bun run build ``` -------------------------------- ### Import and Initialize TMDB Wrapper Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Import the TMDB class and create an instance. Provide your access token for authentication. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; const tmdb = new TMDB('YOUR_ACCESS_TOKEN'); ``` -------------------------------- ### Get Company Details Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Fetch detailed information for a specific company by its ID. Requires an initialized TMDB instance. ```typescript // Get company details const companyDetails = await tmdb.companies.getDetails(1); // Lucasfilm ``` -------------------------------- ### Get TV Show Details Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Fetch detailed information for a specific TV show by its ID. Requires an initialized TMDB instance. ```typescript // Get TV show details const showDetails = await tmdb.tvShows.getDetails(1396); // Breaking Bad ``` -------------------------------- ### Get Collection Translations Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/collections.md Retrieves the translated information for a movie collection. This allows you to get collection details in different languages. ```APIDOC ## Get Collection Translations ### Description Retrieves the translations for a movie collection, allowing access to its details in various languages. ### Method `translations(id: number, options?: { language?: string }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the collection. #### Query Parameters - **language** (string) - Optional - The ISO 639-1 language code to retrieve the data in. ### Response #### Success Response (200) - Returns an object containing translated information for the collection. ``` -------------------------------- ### Initialize TMDB with Combined Config Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/authentication.md Provide both an access token and an API key. The access token will be used for the Authorization header, and the API key will be added as a query parameter if present. ```typescript const tmdb = new TMDB({ accessToken: 'YOUR_READ_ACCESS_TOKEN', apiKey: 'YOUR_API_KEY', }); ``` -------------------------------- ### Run Tests Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/CONTRIBUTING.md Execute all project tests using Bun. This is a crucial step to ensure code quality and functionality. ```bash bun test ``` -------------------------------- ### Retrieve Movie, TV, and Person Changes Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Fetch recently changed records across the TMDB database. Useful for syncing local caches. Specify start and end dates for movies, or just a start date for TV shows and people. ```typescript // Movies changed in the last 24 hours const movieChanges = await tmdb.changes.movies({ start_date: '2024-06-01', end_date: '2024-06-02', page: 1, }); console.log(movieChanges.results); // [{ id: 550, adult: false }, ...] // TV show changes const tvChanges = await tmdb.changes.tv({ start_date: '2024-06-01' }); // Person changes const personChanges = await tmdb.changes.person({ start_date: '2024-06-01' }); ``` -------------------------------- ### Popular Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get a list of popular movies. ```APIDOC ## popular ### Description Fetch popular movies. ### Method `tmdb.movies.popular(options?: { language?: string; page?: number }, request?: RequestConfig): Promise` ### Parameters #### Query Parameters - **language** (string) - Optional - Specify the language for the results. - **page** (number) - Optional - The page number for the results. - **request** (RequestConfig) - Optional - Configuration for the request. ### Request Example ```typescript const popular = await tmdb.movies.popular(); popular.results; // Movie[] popular.page; popular.total_pages; popular.total_results; ``` ### Response #### Success Response (200) - **results** (Array) - A list of popular movies. - **page** (number) - The current page number. - **total_pages** (number) - The total number of pages. - **total_results** (number) - The total number of results. ``` -------------------------------- ### Initialize TMDB Wrapper with Access Token and API Key Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Initialize the TMDB wrapper with both an access token (for Authorization header) and an API key (appended as query parameter). ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; // Option 3 – both (access token for Authorization header, key also appended) const tmdb = new TMDB({ accessToken: process.env.TMDB_ACCESS_TOKEN!, apiKey: process.env.TMDB_API_KEY!, }); ``` -------------------------------- ### Get All Movie Watch Providers Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/watch-providers.md Retrieves a list of all watch providers available for movies. This is useful for understanding the general streaming landscape for films. ```typescript tmdb.watchProviders.movie(): Promise ``` -------------------------------- ### Watch Provider Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Get a list of movie providers. ```APIDOC ## Get Movie Providers ### Description Retrieves a list of providers that offer movies. ### Method `tmdb.watchProviders.getMovieProviders()` ### Request Example ```typescript const movieProviders = await tmdb.watchProviders.getMovieProviders(); ``` ### Response (Details of the movie providers object would be described here if available in source) ``` -------------------------------- ### Upcoming Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get a list of movies scheduled for release. ```APIDOC ## upcoming ### Description Fetch upcoming movies. ### Method `tmdb.movies.upcoming(options?: { page?: number; language?: string; region?: string }, request?: RequestConfig): Promise` ### Parameters #### Query Parameters - **page** (number) - Optional - The page number for the results. - **language** (string) - Optional - Specify the language for the results. - **region** (string) - Optional - Specify the region for the results. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of upcoming movies. ``` -------------------------------- ### Configuration API Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Retrieve TMDB system configuration including image base URLs and available sizes. ```APIDOC ## Configuration — `tmdb.configuration` Retrieve TMDB system configuration including image base URLs and available sizes. ```typescript const config = await tmdb.configuration.getCurrent(); console.log(config.images.base_url); // "http://image.tmdb.org/t/p/" console.log(config.images.secure_base_url); // "https://image.tmdb.org/t/p/" console.log(config.images.poster_sizes); // ["w92","w154","w185","w342","w500","w780","original"] console.log(config.images.backdrop_sizes); // ["w300","w780","w1280","original"] ``` ``` -------------------------------- ### Get Watch Providers Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Retrieve streaming and rental platform information powered by JustWatch. Supports fetching by region, movie, or TV show. ```typescript // All regions where watch providers are available const regions = await tmdb.watchProviders.regions(); ``` ```typescript // All available movie streaming providers const movieProviders = await tmdb.watchProviders.movie(); console.log(movieProviders.results[0].provider_name); // e.g. "Netflix" ``` ```typescript // All available TV streaming providers const tvProviders = await tmdb.watchProviders.tv(); ``` ```typescript // Watch providers for a specific movie or TV show const movieWhere = await tmdb.movies.watchProviders(550); // Fight Club const tvWhere = await tmdb.tvShows.watchProviders(1396); // Breaking Bad console.log(movieWhere.results?.US?.flatrate); // US streaming options ``` -------------------------------- ### Import Image Handling Utilities Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Import necessary functions and types for constructing TMDB image URLs. ```typescript import { formImage, getFullImagePath, ImageSizes, ImageFormats, } from "@api-wrappers/tmdb-wrapper"; ``` -------------------------------- ### Top Rated Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get a list of top-rated movies. ```APIDOC ## topRated ### Description Fetch top-rated movies. ### Method `tmdb.movies.topRated(options?: { page?: number; language?: string; region?: string }, request?: RequestConfig): Promise` ### Parameters #### Query Parameters - **page** (number) - Optional - The page number for the results. - **language** (string) - Optional - Specify the language for the results. - **region** (string) - Optional - Specify the region for the results. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of top-rated movies. ``` -------------------------------- ### Watch Providers Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get streaming availability information for a movie. ```APIDOC ## watchProviders ### Description Fetch watch providers for a movie. Streaming availability data powered by JustWatch. ### Method `tmdb.movies.watchProviders(id: number, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (object) - An object containing watch provider information. ``` -------------------------------- ### Initialize TMDB with API Key Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/authentication.md Initialize the TMDB wrapper using an API key. The API key will be appended as the `api_key` query parameter to requests. ```typescript const tmdb = new TMDB({ apiKey: 'YOUR_API_KEY' }); ``` -------------------------------- ### Recommendations Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get movie recommendations based on a specific movie. ```APIDOC ## recommendations ### Description Fetch movie recommendations. ### Method `tmdb.movies.recommendations(id: number, options?: { language?: string; page?: number }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie to get recommendations for. #### Query Parameters - **language** (string) - Optional - Specify the language for the recommendations. - **page** (number) - Optional - The page number for the recommendations. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of recommended movies. ``` -------------------------------- ### Initialize TMDB Wrapper with API Key Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Initialize the TMDB wrapper using an API key, which is appended as an api_key query parameter. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; // Option 2 – API key (appended as api_key query parameter) const tmdb = new TMDB({ apiKey: process.env.TMDB_API_KEY! }); ``` -------------------------------- ### Initialize TMDB Wrapper with Environment Variable Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/SECURITY.md Use environment variables to securely provide your TMDB access token when initializing the TMDB wrapper. Never commit sensitive tokens directly into your source code. ```typescript const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!); ``` -------------------------------- ### Get Popular People Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves a list of popular people. ```APIDOC ## Get Popular People ### Description Retrieves a list of popular people. ### Method `tmdb.people.popular(options?: { language?: string; page?: number }, request?: RequestConfig): Promise` ### Parameters #### Query Parameters - **language** (string) - Optional - The language for the list of popular people. - **page** (number) - Optional - The page number for the list. ### Response #### Success Response (200) - **PopularPersons** - An object containing a list of popular people. ``` -------------------------------- ### Authenticate TMDB Wrapper with API Key Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Initialize the TMDB wrapper using an API key for authentication. Read access tokens are recommended. ```typescript // Using API key const tmdb = new TMDB({ apiKey: 'YOUR_API_KEY' }); // Using read access token (recommended) const tmdb = new TMDB('YOUR_ACCESS_TOKEN'); ``` -------------------------------- ### Network Alternative Names Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Get alternative names for a TV network. ```APIDOC ## Get Network Alternative Names ### Description Retrieves a list of alternative names for a specific TV network. ### Method `tmdb.networks.getAlternativeNames(networkId: number)` ### Parameters #### Path Parameters - **networkId** (number) - Required - The ID of the network to retrieve alternative names for. ### Request Example ```typescript const alternativeNames = await tmdb.networks.getAlternativeNames(213); ``` ### Response (Details of the alternative names array would be described here if available in source) ``` -------------------------------- ### Now Playing Movies Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get a list of movies currently playing in theaters. ```APIDOC ## nowPlaying ### Description Fetch movies currently playing in theaters. ### Method `tmdb.movies.nowPlaying(options?: { page?: number; language?: string; region?: string }, request?: RequestConfig): Promise` ### Parameters #### Query Parameters - **page** (number) - Optional - The page number for the results. - **language** (string) - Optional - Specify the language for the results. - **region** (string) - Optional - Specify the region for the results. - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **results** (Array) - A list of movies currently playing. ``` -------------------------------- ### Initialize TMDB with Read Access Token Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/authentication.md Use this method to initialize the TMDB wrapper with a read access token. Obtain your token from TMDB API Settings. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; const tmdb = new TMDB('YOUR_READ_ACCESS_TOKEN'); ``` -------------------------------- ### Get Current Configuration Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/configuration.md Retrieves the current API system configuration. This includes base URLs and supported sizes for images, as well as a list of change keys. While this method can be called directly, image utilities often use default base URLs, making direct calls unnecessary in many cases. ```APIDOC ## getCurrent ### Description Returns the API system configuration, including image base URLs and supported sizes. ### Method `tmdb.configuration.getCurrent(): Promise` ### Parameters None ### Response #### Success Response (200) - **images** (object) - Contains image-related configuration. - **base_url** (string) - The base URL for images. - **secure_base_url** (string) - The secure base URL for images. - **backdrop_sizes** (string[]) - Supported sizes for backdrop images. - **logo_sizes** (string[]) - Supported sizes for logo images. - **poster_sizes** (string[]) - Supported sizes for poster images. - **profile_sizes** (string[]) - Supported sizes for profile images. - **still_sizes** (string[]) - Supported sizes for still images. - **change_keys** (string[]) - A list of keys that indicate changes in the API data. ### Request Example ```typescript const config = await tmdb.configuration.getCurrent(); console.log(config.images.base_url); console.log(config.images.backdrop_sizes); console.log(config.change_keys); ``` ### Response Example ```json { "images": { "base_url": "http://image.tmdb.org/t/p/", "secure_base_url": "https://image.tmdb.org/t/p/", "backdrop_sizes": [ "w300", "w780", "w1280", "original" ], "logo_sizes": [ "w45", "w92", "w154", "w185", "w300", "w500", "original" ], "poster_sizes": [ "w92", "w154", "w185", "w342", "w500", "w780", "original" ], "profile_sizes": [ "w45", "w185", "w300", "original" ], "still_sizes": [ "w92", "w185", "w300", "original" ] }, "change_keys": [ "adult", "air_date", "also_known_as", "alternative_titles", "biography", "birthday", "catalogue", "certifications", "created_by", "crew", "episode_run_time", "external_ids", "genres", "guest_stars", "homepage", "images", "imdb_id", "name", "network", "origin_country", "original_name", "overview", "parts", "place_of_birth", "poster_path", "production_companies", "production_countries", "release_date", "revenue", "runtime", "season_number", "spoken_languages", "status", "tagline", "title", "translations", "tvdb_id", "type", "video", "vote_average", "vote_count" ] } ``` ``` -------------------------------- ### Import TMDB Image Utilities Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/image-utilities.md Import necessary constants and functions for working with TMDB images. ```typescript import { TMDB_IMAGE_BASE_URL, ImageSizes, ImageFormats, getFullImagePath, formImage, } from '@api-wrappers/tmdb-wrapper'; ``` -------------------------------- ### Changes Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/movies.md Get the changes for a specific movie ID. This can be filtered by date. ```APIDOC ## changes ### Description Fetch changes for a movie. ### Method `tmdb.movies.changes(id: number, options?: { page?: number; start_date?: string; end_date?: string }, request?: RequestConfig): Promise>` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the movie. #### Query Parameters - **page** (number) - Optional - The page number for the changes. - **start_date** (string) - Optional - Filter changes starting from this date (YYYY-MM-DD). - **end_date** (string) - Optional - Filter changes up to this date (YYYY-MM-DD). - **request** (RequestConfig) - Optional - Configuration for the request. ### Response #### Success Response (200) - **changes** (Array) - A list of changes made to the movie. ``` -------------------------------- ### Get Person Translations Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves the translations of a person's details. ```APIDOC ## Get Person Translations ### Description Retrieves the translations of a person's details. ### Method `tmdb.people.translation(id: number, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the person. ### Response #### Success Response (200) - **PersonTranslations** - An object containing the person's translations. ``` -------------------------------- ### Image Utilities Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Build TMDB image URLs from path strings or from TMDB `Image` objects using helper functions. ```APIDOC ## Image Utilities — `getFullImagePath` & `formImage` Build TMDB image URLs from path strings or from TMDB `Image` objects. ```typescript import { TMDB, ImageSizes, ImageFormats, TMDB_IMAGE_BASE_URL, getFullImagePath, formImage, } from '@api-wrappers/tmdb-wrapper'; const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!); // Build a URL manually from a known path const posterUrl = getFullImagePath( TMDB_IMAGE_BASE_URL, // "https://image.tmdb.org/t/p/" ImageSizes.W500, // "w500" '/wwemzKWzjKYJFfCeiB57q3r4Bcm', ImageFormats.JPG, // force .jpg extension ); // → "https://image.tmdb.org/t/p/w500/wwemzKWzjKYJFfCeiB57q3r4Bcm.jpg" // Use formImage with a TMDB Image object from an API response const images = await tmdb.movies.images(550); // Fight Club const poster = images.posters[0]; const jpgUrl = formImage(poster, ImageSizes.W500); // → "https://image.tmdb.org/t/p/w500/.jpg" (extension preserved from file_path) const pngUrl = formImage(poster, ImageSizes.W500, ImageFormats.PNG); // → "https://image.tmdb.org/t/p/w500/.png" (extension replaced) const origUrl = formImage(poster, ImageSizes.ORIGINAL); // → "https://image.tmdb.org/t/p/original/" // Absolute URLs are returned as-is const unchanged = getFullImagePath(TMDB_IMAGE_BASE_URL, 'w500', 'https://example.com/img.jpg'); // → "https://example.com/img.jpg" // Available sizes: ORIGINAL, W500, W300, W185, W92, H632 // Available formats: JPG, PNG, SVG ``` ``` -------------------------------- ### Get Person Images Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves the images associated with a specific person. ```APIDOC ## Get Person Images ### Description Retrieves the images associated with a specific person. ### Method `tmdb.people.images(id: number, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the person. ### Response #### Success Response (200) - **PeopleImages** - An object containing the person's images. ``` -------------------------------- ### Review Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Fetch the full text and metadata for an individual review. ```APIDOC ## Review — `tmdb.review` Fetch the full text and metadata for an individual review. ```typescript // Review IDs come from the reviews sub-resource of movies or TV shows const review = await tmdb.review.details('5488c29bc3a368612300023c'); console.log(review.author); // reviewer's username console.log(review.content); // full review text console.log(review.url); // link to review on TMDB ``` ``` -------------------------------- ### Request Configuration with RequestConfig Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Shows how to customize per-request behavior, such as setting timeouts, disabling retries, or using `AbortSignal` for cancellation, by passing a `RequestConfig` object. ```APIDOC ## Request Configuration — `RequestConfig` An optional `RequestConfig` object is accepted as the last argument on most endpoint methods to override per-request behavior. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!); // Custom timeout (5 s), no retries const movie = await tmdb.movies.details(550, undefined, undefined, { timeoutMs: 5000, retries: 0, }); // Cancellation via AbortSignal const controller = new AbortController(); setTimeout(() => controller.abort(), 2000); const results = await tmdb.search.movies( { query: 'Inception' }, { signal: controller.signal }, ); // Custom retry strategy: 1 s base delay (doubles per attempt) const popular = await tmdb.movies.popular(undefined, { retries: 3, retryDelayMs: 1000, }); ``` ``` -------------------------------- ### Get Person Images Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves all images associated with a specific person. ```typescript tmdb.people.images( id: number, request?: RequestConfig, ): Promise ``` -------------------------------- ### Get Movies by Keyword Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/keywords.md Fetch a paginated list of movies associated with a specific keyword ID. Optional parameters include `include_adult`, `language`, and `page`. ```typescript tmdb.keywords.belongingMovies( keywordId: number, options?: { include_adult?: boolean; language?: string; page?: number; }, ): Promise ``` ```typescript const movies = await tmdb.keywords.belongingMovies(818); movies.results; // Movie[] ``` -------------------------------- ### Watch Provider TV Shows Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Get a list of TV show providers. ```APIDOC ## Get TV Providers ### Description Retrieves a list of providers that offer TV shows. ### Method `tmdb.watchProviders.getTvProviders()` ### Request Example ```typescript const tvProviders = await tmdb.watchProviders.getTvProviders(); ``` ### Response (Details of the TV providers object would be described here if available in source) ``` -------------------------------- ### Construct Full Image Path Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Build a complete URL for a TMDB image using base URL, size, path, and optional format. ```typescript getFullImagePath( baseUrl: string, // e.g. "https://image.tmdb.org/t/p/" fileSize: string, // e.g. ImageSizes.W500 or "w780" imagePath: string, // e.g. "/abc123" or "/abc123.jpg" format?: string // optional: ImageFormats.JPG / PNG / SVG ): string ``` -------------------------------- ### Watch Provider Regions Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Get a list of available regions for watch providers. ```APIDOC ## Get Available Regions ### Description Retrieves a list of regions where watch provider information is available. ### Method `tmdb.watchProviders.getAvailableRegions()` ### Request Example ```typescript const regions = await tmdb.watchProviders.getAvailableRegions(); ``` ### Response (Details of the regions object would be described here if available in source) ``` -------------------------------- ### Initialize TMDB Wrapper with Access Token Source: https://context7.com/api-wrappers/tmdb-wrapper/llms.txt Initialize the TMDB wrapper using a read access token, which is sent as a Bearer header. ```typescript import { TMDB } from '@api-wrappers/tmdb-wrapper'; // Option 1 – read access token (recommended, sent as Bearer header) const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!); ``` -------------------------------- ### Get Latest Person Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves the details of the latest person added to the database. ```APIDOC ## Get Latest Person ### Description Retrieves the details of the latest person added to the database. ### Method `tmdb.people.latest(request?: RequestConfig): Promise` ### Response #### Success Response (200) - **PersonDetails** - An object containing the details of the latest person. ``` -------------------------------- ### Image Handling Utilities Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/README.md Utilities for constructing TMDB image URLs and handling image objects. ```APIDOC ## Image Handling Utilities ### Description Provides functions to construct TMDB image URLs and process TMDB `Image` objects. ### `getFullImagePath(...)` #### Description Constructs a full image URL using provided base URL, file size, image path, and optional format. #### Signature ```typescript getFullImagePath( baseUrl: string, // e.g. "https://image.tmdb.org/t/p/" fileSize: string, // e.g. ImageSizes.W500 or "w780" imagePath: string, // e.g. "/abc123" or "/abc123.jpg" format?: string // optional: ImageFormats.JPG / PNG / SVG ): string ``` #### Notes - `imagePath` can be provided with or without a leading `/`. - If `imagePath` is already an absolute URL, it is returned unchanged. - Providing `format` appends or replaces the extension safely. - Omitting `format` preserves the original path's extension. ### `formImage(image, fileSize, format?)` #### Description A helper function that extracts `file_path` from a TMDB `Image` object and returns a complete URL. Returns `undefined` if `file_path` is missing. #### Signature ```typescript formImage( image: Image, fileSize: ImageSizes, format?: ImageFormats ): string | undefined ``` ### Examples #### Poster path without extension (add one via `format`) ```typescript const posterUrl = getFullImagePath( "https://image.tmdb.org/t/p/", ImageSizes.W500, "/wwemzKWzjKYJFfCeiB57q3r4Bcm", ImageFormats.JPG, ); // Expected output: https://image.tmdb.org/t/p/w500/wwemzKWzjKYJFfCeiB57q3r4Bcm.jpg ``` #### Profile path that already includes an extension ```typescript const profileUrl = getFullImagePath( "https://image.tmdb.org/t/p/", ImageSizes.W185, "/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg", ); // Expected output: https://image.tmdb.org/t/p/w185/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg ``` #### Using `formImage` with a TMDB response image object ```typescript const images = await tmdb.movies.getImages(550); const poster = images.posters[0]; const posterUrl = formImage(poster, ImageSizes.W500); // Expected output: e.g. https://image.tmdb.org/t/p/w500/xxxxx.jpg ``` #### Override the output extension with `format` using `formImage` ```typescript const posterPngUrl = formImage(poster, ImageSizes.W500, ImageFormats.PNG); ``` ### Sizes & formats #### Available Presets - **Sizes**: `ImageSizes.ORIGINAL`, `W500`, `W300`, `W185`, `W92`, `H632` - **Formats**: `ImageFormats.JPG`, `PNG`, `SVG` TMDB may support additional sizes; custom size strings like `"w780"` or `"w1280"` can also be used. ``` -------------------------------- ### Get Person Tagged Images Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves images where a specific person is tagged. ```APIDOC ## Get Person Tagged Images ### Description Retrieves images where a specific person is tagged. ### Method `tmdb.people.taggedImages(id: number, options?: { page?: number }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the person. #### Query Parameters - **page** (number) - Optional - The page number for the tagged images. ### Response #### Success Response (200) - **TaggedImages** - An object containing the tagged images. ``` -------------------------------- ### Fetch TV Show Recommendations Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/tv-shows.md Retrieves recommended TV shows based on a given TV show ID, with options for language and pagination. ```typescript tmdb.tvShows.recommendations( id: number, options?: { language?: string; page?: number }, ): Promise ``` -------------------------------- ### Get Person Movie Credits Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Retrieves the movie credits for a specific person. ```APIDOC ## Get Person Movie Credits ### Description Retrieves the movie credits for a specific person. ### Method `tmdb.people.movieCredits(id: number, options?: { language?: string }, request?: RequestConfig): Promise` ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the person. #### Query Parameters - **language** (string) - Optional - The language of the movie credits. ### Response #### Success Response (200) - **PersonMovieCredit** - An object containing the person's movie credits. ``` -------------------------------- ### Get Latest Person Source: https://github.com/api-wrappers/tmdb-wrapper/blob/main/docs/endpoints/people.md Fetches details for the most recently added person to the database. ```typescript tmdb.people.latest(request?: RequestConfig): Promise ```