@segha/tmdb
v0.0.5
Published
Schemas for TMDB
Readme
@segha/tmdb
Schemas for TMDB
Requirements
zod
Installation
pnpm add @segha/tmdbUsage
import { BackdropSizeSchema, GenreSchema, ImageSchema, ... } from '@segha/tmdb';
// Validate data
const result = BackdropSizeSchema.parse(data);
// Infer TypeScript types
type BackdropSize = z.infer<typeof BackdropSizeSchema>;You can also import specific submodules:
import { SpecSchema, ConfigurationSchema } from '@segha/tmdb/api';Schemas
- BackdropSize
- Genre
- Image
- ImagesResponse
- Language
- MovieDetailsParams
- MovieDetails
- Movie
- MoviesResponse
- PaginationParams
- PosterSize
- ProductionCompany
- ProductionCountry
- SearchMoviesParams
- SearchSeriesParams
- SerieDetailsParams
- SerieDetails
- Serie
- SeriesResponse
- Video
- VideosResponse
API Reference
BackdropSize
Backdrop size
Enum, one of the following possible values:
'w300''w780''w1280''original'
Genre
Object containing the following properties:
| Property | Description | Type |
| :-------------- | :------------------------------ | :------- |
| id (*) | Unique identifier for the genre | number |
| name (*) | Genre name | string |
(*) Required.
Image
Object containing the following properties:
| Property | Description | Type |
| :---------------------- | :----------------------------- | :-------------------- |
| aspect_ratio (*) | Aspect ratio | number |
| height (*) | Height | number |
| iso_639_1 (*) | Spoken language ISO 639-1 code | string (nullable) |
| file_path (*) | File path | string |
| vote_average (*) | Vote average | number |
| vote_count (*) | Vote count | number |
| width (*) | Width | number |
(*) Required.
ImagesResponse
Object containing the following properties:
| Property | Description | Type |
| :------------------- | :---------- | :------------------------------- |
| id (*) | Image ID | number |
| backdrops (*) | Backdrops | Array of Image items |
| logos (*) | Logos | Array of Image items |
| posters (*) | Posters | Array of Image items |
(*) Required.
Language
Object containing the following properties:
| Property | Description | Type |
| :---------------------- | :----------------------------- | :------- |
| iso_639_1 (*) | Spoken language ISO 639-1 code | string |
| name (*) | Spoken language name | string |
| english_name (*) | Spoken language English name | string |
(*) Required.
MovieDetailsParams
Object containing the following properties:
| Property | Description | Type |
| :----------------------- | :--------------------- | :------- |
| append_to_response | Append to response | string |
| include_image_language | Include image language | string |
| language | Language | string |
All properties are optional.
MovieDetails
Object containing the following properties:
| Property | Description | Type |
| :------------------------------ | :----------------------------------------------- | :------------------------------------------------------- |
| id (*) | Unique identifier for the movie | number |
| title (*) | Movie title | string |
| original_title (*) | Original movie title (in original language) | string |
| original_language (*) | Original language code (e.g., 'en', 'es', 'fr') | string |
| overview (*) | Movie overview/synopsis | string |
| poster_path (*) | Poster path (relative URL) | string |
| backdrop_path (*) | Backdrop path (relative URL) | string |
| release_date (*) | Release date (YYYY-MM-DD format) | string |
| vote_average (*) | Average vote rating (0-10) | number |
| vote_count (*) | Total number of votes | number |
| popularity (*) | Popularity score | number |
| adult (*) | Adult content flag | boolean |
| video (*) | Video flag | boolean |
| genres (*) | Movie genres | Array of Genre items |
| runtime (*) | Movie runtime in minutes | number (nullable) |
| budget (*) | Budget in USD | number |
| revenue (*) | Revenue in USD | number |
| homepage (*) | Homepage URL | string (nullable) |
| imdb_id (*) | IMDB ID | string (nullable) |
| production_companies (*) | Production companies | Array of ProductionCompany items |
| production_countries (*) | Production countries | Array of ProductionCountry items |
| spoken_languages (*) | Spoken languages | Array of Language items |
| status (*) | Current status (Released, Post Production, etc.) | string |
| tagline (*) | Tagline | string (nullable) |
(*) Required.
Movie
Object containing the following properties:
| Property | Description | Type |
| :--------------------------- | :---------------------------------------------- | :-------------- |
| id (*) | Unique identifier for the movie | number |
| title (*) | Movie title | string |
| original_title (*) | Original movie title (in original language) | string |
| original_language (*) | Original language code (e.g., 'en', 'es', 'fr') | string |
| overview (*) | Movie overview/synopsis | string |
| poster_path (*) | Poster path (relative URL) | string |
| backdrop_path (*) | Backdrop path (relative URL) | string |
| release_date (*) | Release date (YYYY-MM-DD format) | string |
| vote_average (*) | Average vote rating (0-10) | number |
| vote_count (*) | Total number of votes | number |
| popularity (*) | Popularity score | number |
| adult (*) | Adult content flag | boolean |
| genre_ids (*) | Array of genre IDs | Array<number> |
| video (*) | Video flag | boolean |
(*) Required.
MoviesResponse
Object containing the following properties:
| Property | Description | Type |
| :----------------------- | :------------ | :------------------------------- |
| page (*) | Page number | number |
| results (*) | Movies | Array of Movie items |
| total_pages (*) | Total pages | number |
| total_results (*) | Total results | number |
(*) Required.
PaginationParams
Pagination parameters
Object containing the following properties:
| Property | Description | Type |
| :--------- | :------------ | :------- |
| page | Page number | number |
| language | Language code | string |
All properties are optional.
PosterSize
Poster size
Enum, one of the following possible values:
'w92''w154''w185''w342''w500''w780''original'
ProductionCompany
Object containing the following properties:
| Property | Description | Type |
| :------------------------ | :------------------------------------------- | :-------------------- |
| id (*) | Unique identifier for the production company | number |
| name (*) | Production company name | string |
| logo_path (*) | Logo path (relative URL) | string (nullable) |
| origin_country (*) | Production company origin country | string |
(*) Required.
ProductionCountry
Object containing the following properties:
| Property | Description | Type |
| :-------------------- | :----------------------------------------- | :------- |
| iso_3166_1 (*) | Production country ISO 3166-1 Alpha-2 code | string |
| name (*) | Production country name | string |
(*) Required.
SearchMoviesParams
Object containing the following properties:
| Property | Description | Type |
| :--------------- | :------------------- | :-------- |
| page | Page number | number |
| language | Language code | string |
| query (*) | Search query | string |
| include_adult | Include adult movies | boolean |
| year | Year | number |
(*) Required.
SearchSeriesParams
Object containing the following properties:
| Property | Description | Type |
| :--------------- | :------------------- | :-------- |
| page | Page number | number |
| language | Language code | string |
| query (*) | Search query | string |
| include_adult | Include adult movies | boolean |
| year | Year | number |
(*) Required.
SerieDetailsParams
Object containing the following properties:
| Property | Description | Type |
| :----------------------- | :--------------------- | :------- |
| append_to_response | Append to response | string |
| include_image_language | Include image language | string |
| language | Language | string |
All properties are optional.
SerieDetails
Object containing the following properties:
| Property | Description | Type |
| :------------------------------ | :---------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| backdrop_path (*) | Backdrop path (relative URL) | string (nullable) |
| first_air_date (*) | First air date (YYYY-MM-DD format) | string (nullable) |
| id (*) | Unique identifier for the serie | number |
| name (*) | Serie name | string |
| origin_country (*) | Array of origin countries | Array<string> |
| original_language (*) | Original language code (e.g., 'en', 'es', 'fr') | string |
| original_name (*) | Original serie name (in original language) | string |
| overview (*) | Serie overview/synopsis | string (nullable) |
| popularity (*) | Popularity score | number |
| poster_path (*) | Poster path (relative URL) | string (nullable) |
| vote_average (*) | Average vote rating (0-10) | number |
| vote_count (*) | Total number of votes | number |
| adult (*) | Adult content flag | boolean |
| created_by (*) | Creators of the serie | Array of objects:id (*): number - Unique identifier for the creatorcredit_id (*): string - Credit IDname (*): string - Creator namegender (*): number - Creator genderprofile_path (*): string (nullable) - Creator profile path (relative URL) |
| episode_run_time (*) | Episode runtime in minutes | Array<number> |
| genres (*) | Genres of the serie | Array of Genre items |
| homepage (*) | Homepage URL | string (nullable) |
| in_production (*) | In production flag | boolean |
| languages (*) | Languages of the serie | Array<string> |
| last_air_date (*) | Last air date (YYYY-MM-DD format) | string |
| last_episode_to_air (*) | Last episode to air | Object with properties:id (*): number - Unique identifier for the episodename (*): string - Episode nameoverview (*): string (nullable) - Episode overview/synopsisvote_average (*): number - Average vote rating (0-10)vote_count (*): number - Total number of votesair_date (*): string - Air date (YYYY-MM-DD format)episode_number (*): number - Episode numberproduction_code (*): string - Production coderuntime (*): number (nullable) - Runtime in minutesseason_number (*): number - Season numbershow_id (*): number - Show IDstill_path (*): string (nullable) - Still path (relative URL) |
| next_episode_to_air (*) | Next episode to air | string |
| networks (*) | Networks of the serie | Array of objects:id (*): number - Unique identifier for the networkname (*): string - Network namelogo_path (*): string (nullable) - Logo path (relative URL)origin_country (*): string - Network origin country |
| number_of_episodes (*) | Number of episodes | number |
| number_of_seasons (*) | Number of seasons | number |
| production_companies (*) | Production companies of the serie | Array of ProductionCompany items |
| production_countries (*) | Production countries of the serie | Array of ProductionCountry items |
| seasons (*) | Seasons of the serie | Array of objects:air_date (*): string - Air date (YYYY-MM-DD format)episode_count (*): number - Episode countid (*): number - Unique identifier for the seasonname (*): string - Season nameoverview (*): string (nullable) - Season overview/synopsisposter_path (*): string (nullable) - Poster path (relative URL)season_number (*): number - Season number |
| spoken_languages (*) | Spoken languages of the serie | Array of Language items |
| status (*) | Status of the serie | string |
| tagline (*) | Tagline of the serie | string (nullable) |
| type (*) | Type of the serie | string |
(*) Required.
Serie
Object containing the following properties:
| Property | Description | Type |
| :--------------------------- | :---------------------------------------------- | :-------------------- |
| backdrop_path (*) | Backdrop path (relative URL) | string (nullable) |
| first_air_date (*) | First air date (YYYY-MM-DD format) | string (nullable) |
| genre_ids (*) | Array of genre IDs | Array<number> |
| id (*) | Unique identifier for the serie | number |
| name (*) | Serie name | string |
| origin_country (*) | Array of origin countries | Array<string> |
| original_language (*) | Original language code (e.g., 'en', 'es', 'fr') | string |
| original_name (*) | Original serie name (in original language) | string |
| overview (*) | Serie overview/synopsis | string (nullable) |
| popularity (*) | Popularity score | number |
| poster_path (*) | Poster path (relative URL) | string (nullable) |
| vote_average (*) | Average vote rating (0-10) | number |
| vote_count (*) | Total number of votes | number |
(*) Required.
SeriesResponse
Object containing the following properties:
| Property | Description | Type |
| :----------------------- | :------------ | :------------------------------- |
| page (*) | Page number | number |
| results (*) | Series | Array of Serie items |
| total_pages (*) | Total pages | number |
| total_results (*) | Total results | number |
(*) Required.
Video
Object containing the following properties:
| Property | Description | Type |
| :---------------------- | :----------------------------------------- | :-------- |
| iso_639_1 (*) | Spoken language ISO 639-1 code | string |
| iso_3166_1 (*) | Production country ISO 3166-1 Alpha-2 code | string |
| name (*) | Video name | string |
| key (*) | Video key | string |
| site (*) | Video site | string |
| size (*) | Video size | number |
| type (*) | Video type | string |
| official (*) | Video official | boolean |
| published_at (*) | Video published at | string |
| id (*) | Video ID | string |
(*) Required.
VideosResponse
Object containing the following properties:
| Property | Description | Type |
| :----------------- | :---------- | :------------------------------- |
| id (*) | Video ID | number |
| results (*) | Videos | Array of Video items |
(*) Required.
