@tdanks2000/tmdb-wrapper
Version:
A powerful and easy-to-use TypeScript wrapper for The Movie Database (TMDb) API
1,516 lines (1,493 loc) • 67 kB
JavaScript
//#region src/@types/endpoints/configuration.ts
let BackdropSizes = /* @__PURE__ */ function(BackdropSizes$1) {
BackdropSizes$1["W300"] = "w300";
BackdropSizes$1["W500"] = "w500";
BackdropSizes$1["W780"] = "w780";
BackdropSizes$1["W1280"] = "w1280";
BackdropSizes$1["ORIGINAL"] = "original";
return BackdropSizes$1;
}({});
let LogoSizes = /* @__PURE__ */ function(LogoSizes$1) {
LogoSizes$1["W45"] = "w45";
LogoSizes$1["W92"] = "w92";
LogoSizes$1["W154"] = "w154";
LogoSizes$1["W185"] = "w185";
LogoSizes$1["W300"] = "w300";
LogoSizes$1["W500"] = "w500";
LogoSizes$1["ORIGINAL"] = "original";
return LogoSizes$1;
}({});
let PosterSizes = /* @__PURE__ */ function(PosterSizes$1) {
PosterSizes$1["W92"] = "w92";
PosterSizes$1["W154"] = "w154";
PosterSizes$1["W185"] = "w185";
PosterSizes$1["W300"] = "w300";
PosterSizes$1["W500"] = "w500";
PosterSizes$1["W780"] = "w780";
PosterSizes$1["ORIGINAL"] = "original";
return PosterSizes$1;
}({});
let ProfileSizes = /* @__PURE__ */ function(ProfileSizes$1) {
ProfileSizes$1["W45"] = "w45";
ProfileSizes$1["W185"] = "w185";
ProfileSizes$1["W632"] = "w632";
ProfileSizes$1["ORIGINAL"] = "original";
return ProfileSizes$1;
}({});
let StillSizes = /* @__PURE__ */ function(StillSizes$1) {
StillSizes$1["W92"] = "w92";
StillSizes$1["W185"] = "w185";
StillSizes$1["W300"] = "w300";
StillSizes$1["ORIGINAL"] = "original";
return StillSizes$1;
}({});
let ChangeKeys = /* @__PURE__ */ function(ChangeKeys$1) {
ChangeKeys$1["ADULT"] = "adult";
ChangeKeys$1["AIR_DATE"] = "air_date";
ChangeKeys$1["ALSO_KNOWN_AS"] = "also_known_as";
ChangeKeys$1["ALTERNATIVE_TITLES"] = "alternative_titles";
ChangeKeys$1["BIOGRAPHY"] = "biography";
ChangeKeys$1["BIRTHDAY"] = "birthday";
ChangeKeys$1["BUDGET"] = "budget";
ChangeKeys$1["CAST"] = "cast";
ChangeKeys$1["CERTIFICATIONS"] = "certifications";
ChangeKeys$1["CHARACTER_NAMES"] = "character_names";
ChangeKeys$1["CREATED_BY"] = "created_by";
ChangeKeys$1["CREW"] = "crew";
ChangeKeys$1["DEATHDAY"] = "deathday";
ChangeKeys$1["EPISODE"] = "episode";
ChangeKeys$1["EPISODE_NUMBER"] = "episode_number";
ChangeKeys$1["EPISODE_RUN_TIME"] = "episode_run_time";
ChangeKeys$1["FREEBASE_ID"] = "freebase_id";
ChangeKeys$1["FREEBASE_MID"] = "freebase_mid";
ChangeKeys$1["GENERAL"] = "general";
ChangeKeys$1["GENRES"] = "genres";
ChangeKeys$1["GUEST_STARS"] = "guest_stars";
ChangeKeys$1["HOMEPAGE"] = "homepage";
ChangeKeys$1["IMAGES"] = "images";
ChangeKeys$1["IMDB_ID"] = "imdb_id";
ChangeKeys$1["LANGUAGES"] = "languages";
ChangeKeys$1["NAME"] = "name";
ChangeKeys$1["NETWORK"] = "network";
ChangeKeys$1["ORIGIN_COUNTRY"] = "origin_country";
ChangeKeys$1["ORIGINAL_NAME"] = "original_name";
ChangeKeys$1["ORIGINAL_TITLE"] = "original_title";
ChangeKeys$1["OVERVIEW"] = "overview";
ChangeKeys$1["PARTS"] = "parts";
ChangeKeys$1["PLACE_OF_BIRTH"] = "place_of_birth";
ChangeKeys$1["PLOT_KEYWORDS"] = "plot_keywords";
ChangeKeys$1["PRODUCTION_CODE"] = "production_code";
ChangeKeys$1["PRODUCTION_COMPANIES"] = "production_companies";
ChangeKeys$1["PRODUCTION_COUNTRIES"] = "production_countries";
ChangeKeys$1["RELEASES"] = "releases";
ChangeKeys$1["REVENUE"] = "revenue";
ChangeKeys$1["RUNTIME"] = "runtime";
ChangeKeys$1["SEASON"] = "season";
ChangeKeys$1["SEASON_NUMBER"] = "season_number";
ChangeKeys$1["SEASON_REGULAR"] = "season_regular";
ChangeKeys$1["SPOKEN_LANGUAGES"] = "spoken_languages";
ChangeKeys$1["STATUS"] = "status";
ChangeKeys$1["TAGLINE"] = "tagline";
ChangeKeys$1["TITLE"] = "title";
ChangeKeys$1["TRANSLATIONS"] = "translations";
ChangeKeys$1["TVDB_ID"] = "tvdb_id";
ChangeKeys$1["TVRAGE_ID"] = "tvrage_id";
ChangeKeys$1["TYPE"] = "type";
ChangeKeys$1["VIDEO"] = "video";
ChangeKeys$1["VIDEOS"] = "videos";
return ChangeKeys$1;
}({});
//#endregion
//#region src/@types/endpoints/movies.ts
let ReleaseDateType = /* @__PURE__ */ function(ReleaseDateType$1) {
ReleaseDateType$1[ReleaseDateType$1["Premiere"] = 1] = "Premiere";
ReleaseDateType$1[ReleaseDateType$1["Theatrical (limited)"] = 2] = "Theatrical (limited)";
ReleaseDateType$1[ReleaseDateType$1["Theatrical"] = 3] = "Theatrical";
ReleaseDateType$1[ReleaseDateType$1["Digital"] = 4] = "Digital";
ReleaseDateType$1[ReleaseDateType$1["Physical"] = 5] = "Physical";
ReleaseDateType$1[ReleaseDateType$1["TV"] = 6] = "TV";
return ReleaseDateType$1;
}({});
//#endregion
//#region src/utils/api.ts
const BASE_URL_V3 = "https://api.themoviedb.org/3";
var TMDBError = class extends Error {
constructor(message, status, url, payload) {
super(message);
this.status = status;
this.url = url;
this.payload = payload;
this.name = "TMDBError";
}
};
const parseOptions = (options) => {
if (!options) return "";
const entries = [];
for (const [key, value] of Object.entries(options)) {
if (value === void 0 || value === null) continue;
if (Array.isArray(value)) for (const item of value) {
if (item === void 0 || item === null) continue;
entries.push([key, String(item)]);
}
else entries.push([key, String(value)]);
}
return new URLSearchParams(entries).toString();
};
const csv = (values) => {
if (!values) return void 0;
const normalized = values.filter((value) => value !== void 0 && value !== null).map(String);
return normalized.length > 0 ? normalized.join(",") : void 0;
};
const withQuery = (query, config) => ({
...config,
query
});
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const shouldRetry = (status) => status === 429 || status === 502 || status === 503 || status === 504;
const readRetryAfterMs = (res) => {
const raw = res.headers.get("retry-after");
if (!raw) return void 0;
const asSeconds = Number(raw);
if (Number.isFinite(asSeconds)) return Math.max(0, asSeconds * 1e3);
const asDate = Date.parse(raw);
if (!Number.isNaN(asDate)) return Math.max(0, asDate - Date.now());
return void 0;
};
var API = class {
apiKey;
accessToken;
constructor(auth) {
if (typeof auth === "string") this.accessToken = auth;
else {
this.apiKey = auth.apiKey;
this.accessToken = auth.accessToken;
}
}
async get(path, opts = {}) {
if (!this.apiKey && !this.accessToken) throw new TMDBError("No TMDB authentication provided", 0, `${BASE_URL_V3}${path}`);
const query = {
...opts.query ? opts.query : {},
...this.apiKey ? { api_key: this.apiKey } : {}
};
const qs = parseOptions(query);
const url = `${BASE_URL_V3}${path}${qs ? `?${qs}` : ""}`;
const retries = opts.retries ?? 2;
const retryDelayMs = opts.retryDelayMs ?? 300;
const timeoutMs = opts.timeoutMs ?? 3e4;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), timeoutMs);
const abortFromSignal = () => controller.abort();
if (opts.signal) if (opts.signal.aborted) controller.abort();
else opts.signal.addEventListener("abort", abortFromSignal, { once: true });
try {
for (let attempt = 0; attempt <= retries; attempt++) {
const res = await fetch(url, {
method: "GET",
signal: controller.signal,
headers: {
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {},
Accept: "application/json"
}
});
if (res.ok) return await res.json();
let payload;
let message = `${res.status} ${res.statusText}`;
try {
payload = await res.json();
if (payload && typeof payload === "object" && "status_message" in payload) message = String(payload.status_message);
} catch {
try {
payload = await res.text();
} catch {}
}
if (attempt < retries && shouldRetry(res.status)) {
const retryAfter = readRetryAfterMs(res);
const delay = retryAfter ?? retryDelayMs * 2 ** attempt;
await sleep(delay);
continue;
}
throw new TMDBError(message, res.status, url, payload);
}
throw new TMDBError("Request failed", 0, url);
} finally {
clearTimeout(timeout);
if (opts.signal) opts.signal.removeEventListener("abort", abortFromSignal);
}
}
};
//#endregion
//#region src/utils/getimagePath.ts
const TMDB_IMAGE_BASE_URL = "https://image.tmdb.org/t/p/";
const ImageSizes = {
ORIGINAL: "original",
W500: "w500",
W300: "w300",
W185: "w185",
W92: "w92",
H632: "h632"
};
const ImageFormats = {
JPG: "jpg",
PNG: "png",
SVG: "svg"
};
const isAbsoluteUrl = (value) => /^https?:\/\//i.test(value);
const normalizeBaseUrl = (baseUrl) => baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
const normalizeSize = (size) => size.replace(/^\/+|\/+$/g, "");
const normalizePath = (path) => path.startsWith("/") ? path : `/${path}`;
const setExtension = (path, format) => {
const lastSlash = path.lastIndexOf("/");
const lastDot = path.lastIndexOf(".");
const hasExt = lastDot > lastSlash;
if (!hasExt) return `${path}.${format}`;
return `${path.slice(0, lastDot + 1)}${format}`;
};
/**
* Constructs a TMDB image URL.
*
* - Keeps paths as-is unless `format` is provided (then it replaces/appends
* the extension safely using the last dot after the last slash).
* - Handles leading/trailing slashes robustly.
* - If `imagePath` is already an absolute URL, it is returned unchanged.
*/
const getFullImagePath = (baseUrl, fileSize, imagePath, format) => {
if (!imagePath) return "";
if (isAbsoluteUrl(imagePath)) return imagePath;
const base = normalizeBaseUrl(baseUrl);
const size = normalizeSize(fileSize);
let path = normalizePath(imagePath);
if (format) path = setExtension(path, format);
return `${base}${size}${path}`;
};
/**
* Convenience helper for TMDB `Image` objects.
*/
const formImage = (image, fileSize, format) => {
const path = image?.file_path;
if (!path) return void 0;
return getFullImagePath(TMDB_IMAGE_BASE_URL, fileSize, path, format);
};
//#endregion
//#region src/@types/models/baseEndpoint.ts
/**
* Base class for all TMDB API endpoints.
*
* Provides a configured {@link API} client instance to subclasses.
*/
var BaseEndpoint = class {
/**
* Low-level HTTP client wrapper used by all endpoints.
*/
api;
/**
* Create a new endpoint instance.
*
* @param {TokenType} auth - Authentication information.
* - If a string: treated as a v4 API Read Access Token (Bearer token).
* - If an object: can include an API key and/or access token.
*/
constructor(auth) {
this.auth = auth;
this.api = new API(auth);
}
};
//#endregion
//#region src/endpoints/account.ts
/**
* Represents an endpoint for retrieving account details.
*
* TMDB v3 reference:
* - GET /account/{account_id}
*
* Note:
* TMDB does not expose a generic "GET /account" for account details. You must
* provide an `account_id`. Most apps obtain it from an auth flow and then cache
* it for subsequent requests.
*/
var AccountEndpoint = class extends BaseEndpoint {
/**
* Constructs a new AccountEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token) {
super(access_token);
this.access_token = access_token;
}
/**
* Retrieves account details asynchronously.
*
* TMDB: GET /account/{account_id}
*
* @param {number} accountId - The TMDB account ID.
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
*/
details(accountId) {
return this.api.get(`/account/${accountId}`);
}
};
//#endregion
//#region src/endpoints/certification.ts
/**
* Represents an endpoint for retrieving certifications for movies and TV shows.
*
* TMDB v3 reference:
* - GET /certification/movie/list
* - GET /certification/tv/list
*/
var CertificationEndpoint = class extends BaseEndpoint {
/**
* Constructs a new CertificationEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token) {
super(access_token);
this.access_token = access_token;
}
/**
* Retrieves certifications for movies asynchronously.
*
* TMDB: GET /certification/movie/list
*
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
*/
movies() {
return this.api.get("/certification/movie/list");
}
/**
* Retrieves certifications for TV shows asynchronously.
*
* TMDB: GET /certification/tv/list
*
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
*/
tv() {
return this.api.get("/certification/tv/list");
}
};
//#endregion
//#region src/endpoints/changes.ts
/**
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
*
* TMDB v3 reference:
* - GET /movie/changes
* - GET /tv/changes
* - GET /person/changes
*/
var ChangeEndpoint = class extends BaseEndpoint {
/**
* Constructs a new ChangeEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token) {
super(access_token);
this.access_token = access_token;
}
/**
* Retrieves changes in movies asynchronously.
*
* TMDB: GET /movie/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
*/
movies(options) {
return this.api.get("/movie/changes", { query: options });
}
/**
* Retrieves changes in TV shows asynchronously.
*
* TMDB: GET /tv/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
*/
tv(options) {
return this.api.get("/tv/changes", { query: options });
}
/**
* Retrieves changes related to persons asynchronously.
*
* TMDB: GET /person/changes
*
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
*/
person(options) {
return this.api.get("/person/changes", { query: options });
}
};
//#endregion
//#region src/endpoints/collections.ts
const BASE_COLLECTION = "/collection";
/**
* Represents an endpoint for accessing collections and their details.
*/
var CollectionsEndpoint = class extends BaseEndpoint {
/**
* Constructs a new CollectionsEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<DetailedCollection>} A Promise that resolves with the
* detailed information of the collection.
*/
details(id, options, request) {
return this.api.get(`${BASE_COLLECTION}/${id}`, withQuery(options, request));
}
/**
* Retrieves images associated with a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {CollectionImageOptions} [options] - Optional parameters for
* specifying image options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ImageCollection>} A Promise that resolves with the
* collection images.
*/
images(id, options, request) {
const query = {
include_image_language: csv(options?.include_image_language),
language: options?.language
};
return this.api.get(`${BASE_COLLECTION}/${id}/images`, withQuery(query, request));
}
/**
* Retrieves translations for a specific collection asynchronously.
*
* @param {number} id - The ID of the collection.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Translations>} A Promise that resolves with the
* translations of the collection.
*/
translations(id, options, request) {
return this.api.get(`${BASE_COLLECTION}/${id}/translations`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/companies.ts
/**
* Represents an endpoint for accessing company details and related information.
*/
var CompaniesEndpoint = class extends BaseEndpoint {
/**
* Constructs a new CompaniesEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<CompanyDetails>} A Promise that resolves with the
* detailed information of the company.
*/
details(id) {
return this.api.get(`/company/${id}`);
}
/**
* Retrieves alternative names of a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<AlternativeNames>} A Promise that resolves with the
* alternative names of the company.
*/
alternativeNames(id) {
return this.api.get(`/company/${id}/alternative_names`);
}
/**
* Retrieves images associated with a specific company asynchronously.
*
* @param {number} id - The ID of the company.
* @returns {Promise<CompanyImages>} A Promise that resolves with the images
* of the company.
*/
images(id) {
return this.api.get(`/company/${id}/images`);
}
};
//#endregion
//#region src/endpoints/configuration.ts
/**
* Represents an endpoint for retrieving current system configuration.
*/
var ConfigurationEndpoint = class extends BaseEndpoint {
/**
* Constructs a new ConfigurationEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves the current system configuration asynchronously.
*
* @returns {Promise<Configuration>} A Promise that resolves with the current
* system configuration.
*/
getCurrent() {
return this.api.get("/configuration");
}
};
//#endregion
//#region src/endpoints/credits.ts
/**
* Represents an endpoint for retrieving credit details.
*/
var CreditsEndpoint = class extends BaseEndpoint {
/**
* Constructs a new CreditsEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves credit details by ID asynchronously.
*
* @param {string} id - The ID of the credit.
* @returns {Promise<CreditResponse>} A Promise that resolves with the credit
* details.
*/
getById(id) {
return this.api.get(`/credit/${id}`);
}
};
//#endregion
//#region src/endpoints/discover.ts
const BASE_DISCOVER = "/discover";
/**
* Represents an endpoint for discovering movies and TV shows based on various
* criteria.
*
* TMDB v3 reference:
* - GET /discover/movie
* - GET /discover/tv
*/
var DiscoverEndpoint = class extends BaseEndpoint {
/**
* Constructs a new DiscoverEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token) {
super(access_token);
this.access_token = access_token;
}
/**
* Retrieves a list of movies based on the provided query options
* asynchronously.
*
* @param {MovieQueryOptions} [options] - Optional parameters for refining the
* movie discovery.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the
* movie discovery results.
*/
movie(options, request) {
return this.api.get(`${BASE_DISCOVER}/movie`, withQuery(options, request));
}
/**
* Retrieves a list of TV shows based on the provided query options
* asynchronously.
*
* @param {TvShowQueryOptions} [options] - Optional parameters for refining
* the TV show discovery.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the
* TV show discovery results.
*/
tvShow(options, request) {
return this.api.get(`${BASE_DISCOVER}/tv`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/find.ts
/**
* Represents an endpoint for finding media by external ID.
*/
var FindEndpoint = class extends BaseEndpoint {
/**
* Constructs a new FindEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves media by external ID asynchronously.
*
* @param {string} externalId - The external ID of the media.
* @param {ExternalIdOptions} options - Options for finding media by external
* ID.
* @returns {Promise<FindResult>} A Promise that resolves with the result of
* the find operation.
*/
byId(externalId, options) {
return this.api.get(`/find/${externalId}`, { query: options });
}
};
//#endregion
//#region src/endpoints/genre.ts
/**
* Represents an endpoint for retrieving genre information for movies and TV
* shows.
*/
var GenreEndpoint = class extends BaseEndpoint {
/**
* Constructs a new GenreEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves genre information for movies asynchronously.
*
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @returns {Promise<Genres>} A Promise that resolves with the genre
* information for movies.
*/
movies(options) {
return this.api.get("/genre/movie/list", { query: options });
}
/**
* Retrieves genre information for TV shows asynchronously.
*
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @returns {Promise<Genres>} A Promise that resolves with the genre
* information for TV shows.
*/
tv(options) {
return this.api.get("/genre/tv/list", { query: options });
}
};
//#endregion
//#region src/endpoints/keywords.ts
const BASE_KEYWORD = "/keyword";
/**
* Represents an endpoint for accessing keyword details and related movies.
*/
var KeywordsEndpoint = class extends BaseEndpoint {
/**
* Constructs a new KeywordsEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific keyword asynchronously.
*
* @param {number} keywordId - The ID of the keyword.
* @returns {Promise<Keyword>} A Promise that resolves with the details of
* the keyword.
*/
details(keywordId) {
return this.api.get(`${BASE_KEYWORD}/${keywordId}`);
}
/**
* Retrieves movies belonging to a specific keyword asynchronously.
*
* @param {number} keywordId - The ID of the keyword.
* @param {KeywordsOptions} [options] - Optional parameters for refining the
* search.
* @returns {Promise<BelongingMovies>} A Promise that resolves with the
* movies belonging to the keyword.
*/
belongingMovies(keywordId, options) {
return this.api.get(`${BASE_KEYWORD}/${keywordId}/movies`, { query: options });
}
};
//#endregion
//#region src/endpoints/movies.ts
const BASE_MOVIE = "/movie";
/**
* Represents an endpoint for accessing movie-related information.
*/
var MoviesEndpoint = class extends BaseEndpoint {
/**
* Constructs a new MoviesEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {AppendToResponseMovieKey[]} [appendToResponse] - Optional keys to
* append to the response.
* @param {string} [language] - Optional parameter for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<AppendToResponse<MovieDetails, T, "movie">>} A Promise
* that resolves with the details of the movie.
*/
details(id, appendToResponse, language, request) {
const query = {
append_to_response: csv(appendToResponse),
language
};
return this.api.get(`${BASE_MOVIE}/${id}`, withQuery(query, request));
}
/**
* Retrieves alternative titles of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<AlternativeTitles>} A Promise that resolves with the
* alternative titles of the movie.
*/
alternativeTitles(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/alternative_titles`, request);
}
/**
* Retrieves changes made to a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {ChangeOption} [options] - Optional parameters for filtering
* changes.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Changes<MovieChangeValue>>} A Promise that resolves with
* the changes made to the movie.
*/
changes(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/changes`, withQuery(options, request));
}
/**
* Retrieves credits of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Credits>} A Promise that resolves with the credits of
* the movie.
*/
credits(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/credits`, withQuery(options, request));
}
/**
* Retrieves external IDs of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
* IDs of the movie.
*/
externalIds(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/external_ids`, request);
}
/**
* Retrieves images of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {MoviesImageSearchOptions} [options] - Optional parameters for
* specifying image search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Images>} A Promise that resolves with the images of the
* movie.
*/
images(id, options, request) {
const query = {
include_image_language: csv(options?.include_image_language),
language: options?.language
};
return this.api.get(`${BASE_MOVIE}/${id}/images`, withQuery(query, request));
}
/**
* Retrieves keywords of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Keywords>} A Promise that resolves with the keywords of
* the movie.
*/
keywords(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/keywords`, request);
}
/**
* Retrieves lists containing a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<MovieLists>} A Promise that resolves with the lists
* containing the movie.
*/
lists(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/lists`, withQuery(options, request));
}
/**
* Retrieves recommendations for a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Recommendations>} A Promise that resolves with the
* recommendations for the movie.
*/
recommendations(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/recommendations`, withQuery(options, request));
}
/**
* Retrieves release dates of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ReleaseDates>} A Promise that resolves with the release
* dates of the movie.
*/
releaseDates(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/release_dates`, request);
}
/**
* Retrieves reviews for a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Reviews>} A Promise that resolves with the reviews for
* the movie.
*/
reviews(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/reviews`, withQuery(options, request));
}
/**
* Retrieves similar movies for a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<SimilarMovies>} A Promise that resolves with the similar
* movies for the movie.
*/
similar(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/similar`, withQuery(options, request));
}
/**
* Retrieves translations of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Translations>} A Promise that resolves with the
* translations of the movie.
*/
translations(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/translations`, request);
}
/**
* Retrieves videos of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Videos>} A Promise that resolves with the videos of the
* movie.
*/
videos(id, options, request) {
return this.api.get(`${BASE_MOVIE}/${id}/videos`, withQuery(options, request));
}
/**
* Retrieves watch providers of a specific movie asynchronously.
*
* @param {number} id - The ID of the movie.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<WatchProviders>} A Promise that resolves with the watch
* providers of the movie.
*/
watchProviders(id, request) {
return this.api.get(`${BASE_MOVIE}/${id}/watch/providers`, request);
}
/**
* Retrieves details of the latest movie asynchronously.
*
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<LatestMovie>} A Promise that resolves with the details
* of the latest movie.
*/
latest(request) {
return this.api.get(`${BASE_MOVIE}/latest`, request);
}
/**
* Retrieves movies playing now asynchronously.
*
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
* parameters for specifying language, region, and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<MoviesPlayingNow>} A Promise that resolves with the
* movies playing now.
*/
nowPlaying(options, request) {
return this.api.get(`${BASE_MOVIE}/now_playing`, withQuery(options, request));
}
/**
* Retrieves popular movies asynchronously.
*
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PopularMovies>} A Promise that resolves with the popular
* movies.
*/
popular(options, request) {
return this.api.get(`${BASE_MOVIE}/popular`, withQuery(options, request));
}
/**
* Retrieves top rated movies asynchronously.
*
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
* parameters for specifying language, region, and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TopRatedMovies>} A Promise that resolves with the top
* rated movies.
*/
topRated(options, request) {
return this.api.get(`${BASE_MOVIE}/top_rated`, withQuery(options, request));
}
/**
* Retrieves upcoming movies asynchronously.
*
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
* parameters for specifying language, region, and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<UpcomingMovies>} A Promise that resolves with the
* upcoming movies.
*/
upcoming(options, request) {
return this.api.get(`${BASE_MOVIE}/upcoming`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/networks.ts
/**
* Represents an endpoint for accessing network details.
*/
var NetworksEndpoint = class extends BaseEndpoint {
/**
* Constructs a new NetworksEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific network asynchronously.
*
* @param {number} id - The ID of the network.
* @returns {Promise<NetworkDetails>} A Promise that resolves with the
* details of the network.
*/
details(id) {
return this.api.get(`/network/${id}`);
}
/**
* Retrieves alternative names of a specific network asynchronously.
*
* @param {number} id - The ID of the network.
* @returns {Promise<AlternativeNames>} A Promise that resolves with the
* alternative names of the network.
*/
alternativeNames(id) {
return this.api.get(`/network/${id}/alternative_names`);
}
/**
* Retrieves images of a specific network asynchronously.
*
* @param {number} id - The ID of the network.
* @returns {Promise<NetworkImages>} A Promise that resolves with the images
* of the network.
*/
images(id) {
return this.api.get(`/network/${id}/images`);
}
};
//#endregion
//#region src/endpoints/people.ts
const BASE_PERSON = "/person";
/**
* Represents an endpoint for accessing information about people.
*/
var PeopleEndpoint = class extends BaseEndpoint {
/**
* Constructs a new PeopleEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {AppendToResponsePersonKey[]} [appendToResponse] - Optional keys to
* append to the response.
* @param {string} [language] - Optional parameter for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<AppendToResponse<PersonDetails, T, "person">>} A
* Promise that resolves with the details of the person.
*/
details(id, appendToResponse, language, request) {
const query = {
append_to_response: csv(appendToResponse),
language
};
return this.api.get(`${BASE_PERSON}/${id}`, withQuery(query, request));
}
/**
* Retrieves changes made to a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {ChangeOption} [options] - Optional parameters for filtering
* changes.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Changes<PersonChangeValue>>} A Promise that resolves
* with the changes made to the person.
*/
changes(id, options, request) {
return this.api.get(`${BASE_PERSON}/${id}/changes`, withQuery(options, request));
}
/**
* Retrieves movie credits of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PersonMovieCredit>} A Promise that resolves with the
* movie credits of the person.
*/
movieCredits(id, options, request) {
return this.api.get(`${BASE_PERSON}/${id}/movie_credits`, withQuery(options, request));
}
/**
* Retrieves TV show credits of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PersonTvShowCredit>} A Promise that resolves with the
* TV show credits of the person.
*/
tvShowCredits(id, options, request) {
return this.api.get(`${BASE_PERSON}/${id}/tv_credits`, withQuery(options, request));
}
/**
* Retrieves combined credits of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PersonCombinedCredits>} A Promise that resolves with the
* combined credits of the person.
*/
combinedCredits(id, options, request) {
return this.api.get(`${BASE_PERSON}/${id}/combined_credits`, withQuery(options, request));
}
/**
* Retrieves external IDs of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
* IDs of the person.
*/
externalId(id, request) {
return this.api.get(`${BASE_PERSON}/${id}/external_ids`, request);
}
/**
* Retrieves images of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PeopleImages>} A Promise that resolves with the images
* of the person.
*/
images(id, request) {
return this.api.get(`${BASE_PERSON}/${id}/images`, request);
}
/**
* Retrieves tagged images of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {PageOption} [options] - Optional parameters for specifying
* pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TaggedImages>} A Promise that resolves with the tagged
* images of the person.
*/
taggedImages(id, options, request) {
return this.api.get(`${BASE_PERSON}/${id}/tagged_images`, withQuery(options, request));
}
/**
* Retrieves translations of a specific person asynchronously.
*
* @param {number} id - The ID of the person.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PersonTranslations>} A Promise that resolves with the
* translations of the person.
*/
translation(id, request) {
return this.api.get(`${BASE_PERSON}/${id}/translations`, request);
}
/**
* Retrieves details of the latest person asynchronously.
*
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PersonDetails>} A Promise that resolves with the details
* of the latest person.
*/
latest(request) {
return this.api.get(`${BASE_PERSON}/latest`, request);
}
/**
* Retrieves popular persons asynchronously.
*
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying language and pagination options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<PopularPersons>} A Promise that resolves with the
* popular persons.
*/
popular(options, request) {
return this.api.get(`${BASE_PERSON}/popular`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/review.ts
/**
* Represents an endpoint for accessing review details.
*/
var ReviewEndpoint = class extends BaseEndpoint {
/**
* Constructs a new ReviewEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific review asynchronously.
*
* @param {string} id - The ID of the review.
* @returns {Promise<ReviewDetails>} A Promise that resolves with the details
* of the review.
*/
details(id) {
return this.api.get(`/review/${id}`);
}
};
//#endregion
//#region src/endpoints/search.ts
const BASE_SEARCH = "/search";
/**
* Represents an endpoint for performing various search operations.
*/
var SearchEndpoint = class extends BaseEndpoint {
/**
* Constructs a new SearchEndpoint instance.
*
* @param {TokenType} access_token - The access token used for authentication.
*/
constructor(access_token) {
super(access_token);
this.access_token = access_token;
}
/**
* Searches for companies asynchronously.
*
* @param {SearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<Company>>} A Promise that resolves with the
* search results for companies.
*/
companies(options, request) {
return this.api.get(`${BASE_SEARCH}/company`, withQuery(options, request));
}
/**
* Searches for collections asynchronously.
*
* @param {CollectionSearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<Collection>>} A Promise that resolves with the
* search results for collections.
*/
collections(options, request) {
return this.api.get(`${BASE_SEARCH}/collection`, withQuery(options, request));
}
/**
* Searches for keywords asynchronously.
*
* @param {SearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<{ id: string; name: string }>>} A Promise that
* resolves with the search results for keywords.
*/
keywords(options, request) {
return this.api.get(`${BASE_SEARCH}/keyword`, withQuery(options, request));
}
/**
* Searches for movies asynchronously.
*
* @param {MovieSearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<Movie>>} A Promise that resolves with the search
* results for movies.
*/
movies(options, request) {
return this.api.get(`${BASE_SEARCH}/movie`, withQuery(options, request));
}
/**
* Searches for people asynchronously.
*
* @param {PeopleSearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<Person>>} A Promise that resolves with the search
* results for people.
*/
people(options, request) {
return this.api.get(`${BASE_SEARCH}/person`, withQuery(options, request));
}
/**
* Searches for TV shows asynchronously.
*
* @param {TvSearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<TV>>} A Promise that resolves with the search
* results for TV shows.
*/
tv(options, request) {
return this.api.get(`${BASE_SEARCH}/tv`, withQuery(options, request));
}
/**
* Performs a multi-search asynchronously.
*
* @param {MultiSearchOptions} options - The search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Search<MultiSearchResult>>} A Promise that resolves with
* the multi-search results.
*/
multi(options, request) {
return this.api.get(`${BASE_SEARCH}/multi`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/trending.ts
/**
* Represents an endpoint for retrieving trending content.
*/
var TrendingEndpoint = class extends BaseEndpoint {
/**
* Constructs a new TrendingEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves trending content asynchronously based on media type and time
* window.
*
* @param {TrendingMediaType} mediaType - The type of media.
* @param {TimeWindow} timeWindow - The time window for trending content.
* @param {LanguageOption & PageOption} [options] - Optional parameters for
* specifying the language and pagination.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TrendingResults<T>>} A Promise that resolves with the
* trending results.
* @template T - The type of media being searched for.
*/
trending(mediaType, timeWindow, options, request) {
return this.api.get(`/trending/${mediaType}/${timeWindow}`, withQuery(options, request));
}
};
//#endregion
//#region src/endpoints/tvEpisodes.ts
const BASE_EPISODE = (episodeSelection) => {
return `/tv/${episodeSelection.tvShowID}/season/${episodeSelection.seasonNumber}/episode/${episodeSelection.episodeNumber}`;
};
/**
* Represents an endpoint for accessing TV episode-related information.
*/
var TvEpisodesEndpoint = class extends BaseEndpoint {
/**
* Constructs a new TvEpisodesEndpoint instance.
*
* @param {TokenType} auth - The authentication configuration.
*/
constructor(auth) {
super(auth);
this.auth = auth;
}
/**
* Retrieves details of a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {AppendToResponseTvEpisodeKey[]} [appendToResponse] - Additional
* data to append to the response.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<AppendToResponse<Omit<Episode, "show_id">, T,
* "tvEpisode">>} A Promise that resolves with the details of the TV
* episode.
*/
details(episodeSelection, appendToResponse, options, request) {
const query = {
append_to_response: csv(appendToResponse),
...options
};
return this.api.get(BASE_EPISODE(episodeSelection), withQuery(query, request));
}
/**
* Retrieves changes related to a specific TV episode asynchronously.
*
* @param {number} episodeID - The ID of the TV episode.
* @param {ChangeOption} [options] - Optional parameters for specifying
* changes.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Changes<TvEpisodeChangeValue>>} A Promise that resolves
* with the changes related to the TV episode.
*/
changes(episodeID, options, request) {
return this.api.get(`/tv/episode/${episodeID}/changes`, withQuery(options, request));
}
/**
* Retrieves credits for a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {LanguageOption} [options] - Optional parameters for specifying the
* language.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TvEpisodeCredit>} A Promise that resolves with the
* credits for the TV episode.
*/
credits(episodeSelection, options, request) {
return this.api.get(`${BASE_EPISODE(episodeSelection)}/credits`, withQuery(options, request));
}
/**
* Retrieves external IDs for a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
* IDs for the TV episode.
*/
externalIds(episodeSelection, request) {
return this.api.get(`${BASE_EPISODE(episodeSelection)}/external_ids`, request);
}
/**
* Retrieves images for a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {TvEpisodeImageSearchOptions} [options] - Optional parameters for
* specifying image search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Images>} A Promise that resolves with the images for the
* TV episode.
*/
images(episodeSelection, options, request) {
const query = {
include_image_language: csv(options?.include_image_language),
language: options?.language
};
return this.api.get(`${BASE_EPISODE(episodeSelection)}/images`, withQuery(query, request));
}
/**
* Retrieves translations for a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<TvEpisodeTranslations>} A Promise that resolves with the
* translations for the TV episode.
*/
translations(episodeSelection, request) {
return this.api.get(`${BASE_EPISODE(episodeSelection)}/translations`, request);
}
/**
* Retrieves videos for a specific TV episode asynchronously.
*
* @param {EpisodeSelection} episodeSelection - The selection criteria for
* the TV episode.
* @param {TvEpisodeVideoSearchOptions} [options] - Optional parameters for
* specifying video search options.
* @param {RequestConfig} [request] - Optional request behavior overrides.
* @returns {Promise<Videos>} A Promise that resolves with the videos for the
* TV episode.
*/
videos(episodeSelection, options, request) {
const query = {
include_video_language: csv(options?.include_video_language),
language: options?.language
};
return this.api.get(`${BASE_EPISODE(episodeSelection)}/videos`, withQuery(query, request));
}
};
//#endregion
//#region src/endpoints/tvSeasons.ts
const BASE_SEASON = (seasonSelection) => {
return `/tv/${seasonSelection.tvShowID}/season/${seasonSelection.seasonNumber}`;
};
/**
* Represents an endpoint for accessing TV season-related information.
*/
var TvSeasonsEndpoint = class extends BaseEndpoint {
/**
* Constructs a n