Compare commits
26 Commits
bump-1.7.1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e32ed16a48 | |||
| 670ab42b16 | |||
| 32e282a2e1 | |||
|
|
fdf00f6655 | ||
|
|
71817751a7 | ||
|
|
9f05886a5b | ||
|
|
7a1453d8d4 | ||
|
|
da5abe276a | ||
|
|
9e1e65205c | ||
|
|
6157405fe1 | ||
|
|
eaa5f9a751 | ||
|
|
2abf448bb2 | ||
|
|
4140bd7a7f | ||
|
|
f513103785 | ||
|
|
ea19c5b9e1 | ||
|
|
1bf4063121 | ||
|
|
8df7fe2f2a | ||
|
|
9ac3da7321 | ||
|
|
313d44878c | ||
|
|
6fc8c7b6d3 | ||
|
|
730afebd7d | ||
|
|
fc44bcf425 | ||
|
|
defd0a5998 | ||
|
|
64ba6e0fd1 | ||
|
|
e723b2f8fa | ||
|
|
3d3ec34fc5 |
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
lib
|
|
||||||
coverage
|
|
||||||
22
.eslintrc.js
22
.eslintrc.js
@@ -1,22 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: false,
|
|
||||||
es2021: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"prettier",
|
|
||||||
],
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 12,
|
|
||||||
sourceType: "module",
|
|
||||||
},
|
|
||||||
rules:{
|
|
||||||
'linebreak-style': ['off', 'unix'],
|
|
||||||
},
|
|
||||||
plugins: ["@typescript-eslint"],
|
|
||||||
};
|
|
||||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
|
||||||
- OS: [e.g. iOS]
|
|
||||||
- Browser [e.g. chrome, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
|
||||||
- Device: [e.g. iPhone6]
|
|
||||||
- OS: [e.g. iOS8.1]
|
|
||||||
- Browser [e.g. stock browser, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
33
.github/workflows/npm-publish.yml
vendored
33
.github/workflows/npm-publish.yml
vendored
@@ -1,33 +0,0 @@
|
|||||||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
||||||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
||||||
|
|
||||||
name: Node.js Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm test
|
|
||||||
|
|
||||||
publish-npm:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@
|
|||||||
dist
|
dist
|
||||||
/.npmignore
|
/.npmignore
|
||||||
.idea
|
.idea
|
||||||
|
.DS_Store
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
npm run lint
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
dist
|
|
||||||
node_modules
|
|
||||||
.github
|
|
||||||
12
.prettierrc
12
.prettierrc
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 80,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"useTabs": false,
|
|
||||||
"semi": true,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "es5",
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"arrowParens": "always",
|
|
||||||
"proseWrap": "never",
|
|
||||||
"htmlWhitespaceSensitivity": "strict"
|
|
||||||
}
|
|
||||||
1328
DOCUMENTATION.md
Normal file
1328
DOCUMENTATION.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 Blake Joynes
|
Copyright (c) 2024 Blake Joynes
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
17
eslint.config.mjs
Normal file
17
eslint.config.mjs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import globals from 'globals';
|
||||||
|
import pluginJs from '@eslint/js';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
files: ['src/*.ts'],
|
||||||
|
ignores: ['node_modules', 'dist', 'lib', 'coverage'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pluginJs.configs.recommended,
|
||||||
|
...tseslint.configs.recommended,
|
||||||
|
eslintPluginPrettierRecommended,
|
||||||
|
];
|
||||||
5311
package-lock.json
generated
5311
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
41
package.json
41
package.json
@@ -1,14 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "tmdb-ts",
|
"name": "tmdb-ts",
|
||||||
"version": "1.7.1",
|
"version": "2.0.2",
|
||||||
"description": "TMDB v3 library wrapper",
|
"description": "TMDB v3 library wrapper",
|
||||||
"main": "dist/index.js",
|
"main": "src/index.js",
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "rm -rf dist && tsc -d",
|
"compile": "rm -rf dist && tsc -d",
|
||||||
"lint": "eslint --ext .ts src/",
|
"lint": "eslint src/",
|
||||||
"lint:fix": "eslint --ext .ts src/ --fix",
|
"lint:fix": "eslint --fix",
|
||||||
"format": "npx prettier --write src",
|
"format": "prettier --write src",
|
||||||
"pre-commit": "npm run lint"
|
"pre-commit": "npm run lint"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -29,27 +28,17 @@
|
|||||||
"author": "Blake Joynes",
|
"author": "Blake Joynes",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.15.11",
|
"@types/node": "^20.16.10",
|
||||||
"@types/node-fetch": "^2.5.10",
|
"@types/node-fetch": "^3.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"dotenv": "^16.4.5",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"dotenv": "^9.0.2",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"eslint": "^8.38.0",
|
"globals": "^15.4.0",
|
||||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
"ts-node": "^10.9.2",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"typescript": "^5.4.5"
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
|
||||||
"husky": "^8.0.3",
|
|
||||||
"prettier": "^2.8.7",
|
|
||||||
"ts-node": "^10.9.1",
|
|
||||||
"typescript": "^4.9.5"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "^3.1.4"
|
"cross-fetch": "^4.0.0"
|
||||||
},
|
|
||||||
"volta": {
|
|
||||||
"node": "18.16.0",
|
|
||||||
"yarn": "1.22.4",
|
|
||||||
"npm": "9.5.1"
|
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
@@ -59,4 +48,4 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import fetch from 'cross-fetch';
|
import fetch from 'cross-fetch';
|
||||||
import { parseOptions } from './utils';
|
import { parseOptions } from './utils';
|
||||||
import { ErrorResponse } from './types';
|
import { ErrorResponse } from './types';
|
||||||
|
import { BASE_URL_V3 } from './common/constants';
|
||||||
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
|
||||||
|
|
||||||
export class Api {
|
export class Api {
|
||||||
constructor(private accessToken: string) {
|
constructor(private accessToken: string) {
|
||||||
this.accessToken = accessToken;
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
async get<T>(path: string, options?: Record<string, any>): Promise<T> {
|
async get<T>(path: string, options?: Record<string, any>): Promise<T> {
|
||||||
const params = parseOptions(options);
|
const params = parseOptions(options);
|
||||||
const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
|
const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
|
||||||
|
|||||||
1
src/common/constants.ts
Normal file
1
src/common/constants.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
||||||
@@ -15,6 +15,6 @@ export class ChangeEndpoint extends BaseEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async person(options?: ChangeOption): Promise<MediaChanges> {
|
async person(options?: ChangeOption): Promise<MediaChanges> {
|
||||||
return await this.api.get<MediaChanges>(`/person/change`, options);
|
return await this.api.get<MediaChanges>(`/person/changes`, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
|
CollectionDetails,
|
||||||
CollectionImageOptions,
|
CollectionImageOptions,
|
||||||
DetailedCollection,
|
|
||||||
ImageCollection,
|
ImageCollection,
|
||||||
LanguageOption,
|
LanguageOption,
|
||||||
Translations,
|
Translations,
|
||||||
@@ -17,8 +17,8 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
|||||||
async details(
|
async details(
|
||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption
|
options?: LanguageOption
|
||||||
): Promise<DetailedCollection> {
|
): Promise<CollectionDetails> {
|
||||||
return await this.api.get<DetailedCollection>(
|
return await this.api.get<CollectionDetails>(
|
||||||
`${BASE_COLLECTION}/${id}`,
|
`${BASE_COLLECTION}/${id}`,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import { Configuration } from '../types/configuration';
|
import {
|
||||||
|
Configuration,
|
||||||
|
CountryConfiguration,
|
||||||
|
JobConfiguration,
|
||||||
|
LanguageConfiguration,
|
||||||
|
TimezoneConfiguration,
|
||||||
|
} from '../types/configuration';
|
||||||
|
|
||||||
export class ConfigurationEndpoint extends BaseEndpoint {
|
export class ConfigurationEndpoint extends BaseEndpoint {
|
||||||
constructor(protected readonly accessToken: string) {
|
constructor(protected readonly accessToken: string) {
|
||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrent(): Promise<Configuration> {
|
async getApiConfiguration(): Promise<Configuration> {
|
||||||
return await this.api.get<Configuration>(`/configuration`);
|
return await this.api.get<Configuration>(`/configuration`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getCountries(): Promise<CountryConfiguration[]> {
|
||||||
|
return await this.api.get<CountryConfiguration[]>(
|
||||||
|
`/configuration/countries`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLanguages(): Promise<LanguageConfiguration[]> {
|
||||||
|
return await this.api.get<LanguageConfiguration[]>(
|
||||||
|
`/configuration/languages`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getJobs(): Promise<JobConfiguration[]> {
|
||||||
|
return await this.api.get<JobConfiguration[]>(`/configuration/jobs`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPrimaryTranslations(): Promise<string[]> {
|
||||||
|
return await this.api.get<string[]>(`/configuration/primary_translations`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTimezones(): Promise<TimezoneConfiguration[]> {
|
||||||
|
return await this.api.get<TimezoneConfiguration[]>(
|
||||||
|
`/configuration/timezones`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
MovieDiscoverResult,
|
MovieDiscoverResult,
|
||||||
SortOption,
|
MovieQueryOptions,
|
||||||
TvShowDiscoverResult,
|
TvShowDiscoverResult,
|
||||||
|
TvShowQueryOptions,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
const BASE_DISCOVER = '/discover';
|
const BASE_DISCOVER = '/discover';
|
||||||
|
|
||||||
interface DiscoverQueryOptions {
|
|
||||||
language?: string;
|
|
||||||
sort_by?: SortOption;
|
|
||||||
page?: number;
|
|
||||||
'vote_average.gte'?: number;
|
|
||||||
'vote_count.gte'?: number;
|
|
||||||
'vote_count.lte'?: number;
|
|
||||||
'vote_average.lte'?: number;
|
|
||||||
with_watch_providers?: string;
|
|
||||||
watch_region?: string;
|
|
||||||
without_companies?: string;
|
|
||||||
with_watch_monetization_types?: 'flatrate' | 'free' | 'ads' | 'rent' | 'buy';
|
|
||||||
'with_runtime.gte'?: number;
|
|
||||||
'with_runtime.lte'?: number;
|
|
||||||
with_genres?: string;
|
|
||||||
without_genres?: string;
|
|
||||||
with_original_language?: string;
|
|
||||||
without_keywords?: string;
|
|
||||||
with_keywords?: string;
|
|
||||||
with_companies?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MovieQueryOptions extends DiscoverQueryOptions {
|
|
||||||
region?: string;
|
|
||||||
certification_country?: string;
|
|
||||||
certification?: string;
|
|
||||||
'certification.lte'?: string;
|
|
||||||
'certification.gte'?: string;
|
|
||||||
include_adult?: boolean;
|
|
||||||
include_video?: boolean;
|
|
||||||
primary_release_year?: number;
|
|
||||||
'primary_release_date.gte'?: string;
|
|
||||||
'primary_release_date.lte'?: string;
|
|
||||||
'release_date.gte'?: string;
|
|
||||||
'release_date.lte'?: string;
|
|
||||||
with_release_type?: string;
|
|
||||||
year?: number;
|
|
||||||
with_cast?: string;
|
|
||||||
with_crew?: string;
|
|
||||||
with_people?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TvShowQueryOptions extends DiscoverQueryOptions {
|
|
||||||
'air_date.gte'?: string;
|
|
||||||
'air_date.lte'?: string;
|
|
||||||
'first_air_date.gte'?: string;
|
|
||||||
'first_air_date.lte'?: string;
|
|
||||||
first_air_date_year?: number;
|
|
||||||
timezone?: string;
|
|
||||||
with_networks?: string;
|
|
||||||
include_null_first_air_dates?: boolean;
|
|
||||||
screened_theatrically?: boolean;
|
|
||||||
with_status?: string;
|
|
||||||
with_type?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DiscoverEndpoint extends BaseEndpoint {
|
export class DiscoverEndpoint extends BaseEndpoint {
|
||||||
constructor(accessToken: string) {
|
constructor(accessToken: string) {
|
||||||
super(accessToken);
|
super(accessToken);
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ export class FindEndpoint extends BaseEndpoint {
|
|||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async byId(
|
async byExternalId(
|
||||||
externalId: string,
|
id: string,
|
||||||
options: ExternalIdOptions
|
options: ExternalIdOptions
|
||||||
): Promise<FindResult> {
|
): Promise<FindResult> {
|
||||||
return await this.api.get<FindResult>(`/find/${externalId}`, options);
|
return await this.api.get<FindResult>(`/find/${id}`, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,3 +16,4 @@ export * from './keywords';
|
|||||||
export * from './collections';
|
export * from './collections';
|
||||||
export * from './tv-seasons';
|
export * from './tv-seasons';
|
||||||
export * from './tv-episode';
|
export * from './tv-episode';
|
||||||
|
export * from './watch-providers';
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export class KeywordsEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<Keyword>(`${BASE_Keyword}/${keywordId}`);
|
return await this.api.get<Keyword>(`${BASE_Keyword}/${keywordId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
async belongingMovies(
|
async belongingMovies(
|
||||||
keywordId: number,
|
keywordId: number,
|
||||||
options?: KeywordsOptions
|
options?: KeywordsOptions
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import {
|
|||||||
PersonDetails,
|
PersonDetails,
|
||||||
PersonMovieCredit,
|
PersonMovieCredit,
|
||||||
PersonTvShowCredit,
|
PersonTvShowCredit,
|
||||||
PopularPersons,
|
|
||||||
TaggedImages,
|
TaggedImages,
|
||||||
Changes,
|
Changes,
|
||||||
PersonChangeValue,
|
PersonChangeValue,
|
||||||
LanguageOption,
|
LanguageOption,
|
||||||
|
PopularPeople,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
@@ -90,6 +90,9 @@ export class PeopleEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<PeopleImages>(`${BASE_PERSON}/${id}/images`);
|
return await this.api.get<PeopleImages>(`${BASE_PERSON}/${id}/images`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
|
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
|
||||||
return await this.api.get<TaggedImages>(
|
return await this.api.get<TaggedImages>(
|
||||||
`${BASE_PERSON}/${id}/tagged_images`,
|
`${BASE_PERSON}/${id}/tagged_images`,
|
||||||
@@ -107,12 +110,7 @@ export class PeopleEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<PersonDetails>(`${BASE_PERSON}/latest`);
|
return await this.api.get<PersonDetails>(`${BASE_PERSON}/latest`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async popular(
|
async popular(options?: LanguageOption & PageOption): Promise<PopularPeople> {
|
||||||
options?: LanguageOption & PageOption
|
return await this.api.get<PopularPeople>(`${BASE_PERSON}/popular`, options);
|
||||||
): Promise<PopularPersons> {
|
|
||||||
return await this.api.get<PopularPersons>(
|
|
||||||
`${BASE_PERSON}/popular`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
src/endpoints/watch-providers.ts
Normal file
40
src/endpoints/watch-providers.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { BaseEndpoint } from './base';
|
||||||
|
import {
|
||||||
|
LanguageOption,
|
||||||
|
RegionResult,
|
||||||
|
WatchProviderResult,
|
||||||
|
WatchRegionOption,
|
||||||
|
} from '../types';
|
||||||
|
|
||||||
|
type ProviderOptions = WatchRegionOption & LanguageOption;
|
||||||
|
|
||||||
|
export class WatchProvidersEndpoint extends BaseEndpoint {
|
||||||
|
constructor(protected readonly accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getRegions(options?: LanguageOption): Promise<RegionResult> {
|
||||||
|
return await this.api.get<RegionResult>(
|
||||||
|
`/watch/providers/regions`,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMovieProviders(
|
||||||
|
options?: ProviderOptions
|
||||||
|
): Promise<WatchProviderResult> {
|
||||||
|
return await this.api.get<WatchProviderResult>(
|
||||||
|
`/watch/providers/movie`,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTvProviders(
|
||||||
|
options?: ProviderOptions
|
||||||
|
): Promise<WatchProviderResult> {
|
||||||
|
return await this.api.get<WatchProviderResult>(
|
||||||
|
`/watch/providers/tv`,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
CollectionsEndpoint,
|
CollectionsEndpoint,
|
||||||
TvSeasonsEndpoint,
|
TvSeasonsEndpoint,
|
||||||
TvEpisodesEndpoint,
|
TvEpisodesEndpoint,
|
||||||
|
WatchProvidersEndpoint,
|
||||||
} from './endpoints';
|
} from './endpoints';
|
||||||
import { CompaniesEndpoint } from './endpoints/companies';
|
import { CompaniesEndpoint } from './endpoints/companies';
|
||||||
import { NetworksEndpoint } from './endpoints/networks';
|
import { NetworksEndpoint } from './endpoints/networks';
|
||||||
@@ -107,4 +108,8 @@ export class TMDB {
|
|||||||
get tvSeasons(): TvSeasonsEndpoint {
|
get tvSeasons(): TvSeasonsEndpoint {
|
||||||
return new TvSeasonsEndpoint(this.accessToken);
|
return new TvSeasonsEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get watchProviders(): WatchProvidersEndpoint {
|
||||||
|
return new WatchProvidersEndpoint(this.accessToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { CountryCode } from '../types';
|
||||||
|
|
||||||
export interface Gravatar {
|
export interface Gravatar {
|
||||||
hash: string;
|
hash: string;
|
||||||
}
|
}
|
||||||
@@ -10,7 +12,7 @@ export interface AccountDetails {
|
|||||||
avatar: Avatar;
|
avatar: Avatar;
|
||||||
id: number;
|
id: number;
|
||||||
include_adult: boolean;
|
include_adult: boolean;
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
name: string;
|
name: string;
|
||||||
username: string;
|
username: string;
|
||||||
|
|||||||
@@ -6,14 +6,56 @@ export interface Certification {
|
|||||||
|
|
||||||
export interface Certifications {
|
export interface Certifications {
|
||||||
certifications: {
|
certifications: {
|
||||||
US: Certification[];
|
AR: Certification[];
|
||||||
CA: Certification[];
|
AT: Certification[];
|
||||||
DE: Certification[];
|
|
||||||
GB: Certification[];
|
|
||||||
AU: Certification[];
|
AU: Certification[];
|
||||||
|
BG: Certification[];
|
||||||
BR: Certification[];
|
BR: Certification[];
|
||||||
|
CA: Certification[];
|
||||||
|
'CA-QC': Certification[];
|
||||||
|
CH: Certification[];
|
||||||
|
CL: Certification[];
|
||||||
|
CZ: Certification[];
|
||||||
|
DE: Certification[];
|
||||||
|
DK: Certification[];
|
||||||
|
ES: Certification[];
|
||||||
|
FI: Certification[];
|
||||||
FR: Certification[];
|
FR: Certification[];
|
||||||
NZ: Certification[];
|
GB: Certification[];
|
||||||
|
GR: Certification[];
|
||||||
|
HK: Certification[];
|
||||||
|
HU: Certification[];
|
||||||
|
ID: Certification[];
|
||||||
|
IE: Certification[];
|
||||||
|
IL: Certification[];
|
||||||
IN: Certification[];
|
IN: Certification[];
|
||||||
|
IT: Certification[];
|
||||||
|
JP: Certification[];
|
||||||
|
KR: Certification[];
|
||||||
|
LT: Certification[];
|
||||||
|
LU: Certification[];
|
||||||
|
LV: Certification[];
|
||||||
|
MO: Certification[];
|
||||||
|
MX: Certification[];
|
||||||
|
MY: Certification[];
|
||||||
|
NL: Certification[];
|
||||||
|
NO: Certification[];
|
||||||
|
NZ: Certification[];
|
||||||
|
PH: Certification[];
|
||||||
|
PL: Certification[];
|
||||||
|
PR: Certification[];
|
||||||
|
PT: Certification[];
|
||||||
|
RO: Certification[];
|
||||||
|
RU: Certification[];
|
||||||
|
SE: Certification[];
|
||||||
|
SG: Certification[];
|
||||||
|
SK: Certification[];
|
||||||
|
TH: Certification[];
|
||||||
|
TR: Certification[];
|
||||||
|
TW: Certification[];
|
||||||
|
UA: Certification[];
|
||||||
|
US: Certification[];
|
||||||
|
VI: Certification[];
|
||||||
|
ZA: Certification[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export interface MediaChange {
|
export interface MediaChange {
|
||||||
id: number;
|
id: number;
|
||||||
adult: boolean | undefined;
|
adult?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MediaChanges {
|
export interface MediaChanges {
|
||||||
|
|||||||
@@ -2,16 +2,13 @@ import { LanguageOption, Movie } from '.';
|
|||||||
|
|
||||||
export interface Collection {
|
export interface Collection {
|
||||||
id: number;
|
id: number;
|
||||||
backdrop_path: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
poster_path: string;
|
|
||||||
adult: boolean;
|
|
||||||
original_language: string;
|
|
||||||
original_name: string;
|
|
||||||
overview: string;
|
overview: string;
|
||||||
|
poster_path: string;
|
||||||
|
backdrop_path: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DetailedCollection extends Collection {
|
export interface CollectionDetails extends Collection {
|
||||||
parts: Movie[];
|
parts: Movie[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export interface CompanyDetails {
|
|||||||
logo_path: string;
|
logo_path: string;
|
||||||
name: string;
|
name: string;
|
||||||
origin_country: string;
|
origin_country: string;
|
||||||
parent_company: ParentCompany;
|
parent_company?: ParentCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ParentCompany {
|
export interface ParentCompany {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { CountryCode } from '../types';
|
||||||
|
|
||||||
export interface ImageConfiguration {
|
export interface ImageConfiguration {
|
||||||
base_url: string;
|
base_url: string;
|
||||||
secure_base_url: string;
|
secure_base_url: string;
|
||||||
@@ -13,100 +15,153 @@ export interface Configuration {
|
|||||||
change_keys: ChangeKeys[];
|
change_keys: ChangeKeys[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum BackdropSizes {
|
export interface CountryConfiguration {
|
||||||
W300 = 'w300',
|
iso_3166_1: CountryCode;
|
||||||
W500 = 'w500',
|
english_name: string;
|
||||||
W780 = 'w780',
|
native_name: string;
|
||||||
W1280 = 'w1280',
|
|
||||||
ORIGINAL = 'original',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum LogoSizes {
|
export interface LanguageConfiguration {
|
||||||
W45 = 'w45',
|
iso_639_1: string;
|
||||||
W92 = 'w92',
|
english_name: string;
|
||||||
W154 = 'w154',
|
name: string;
|
||||||
W185 = 'w185',
|
|
||||||
W300 = 'w300',
|
|
||||||
W500 = 'w500',
|
|
||||||
ORIGINAL = 'original',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum PosterSizes {
|
export interface JobConfiguration {
|
||||||
W92 = 'w92',
|
department: string;
|
||||||
W154 = 'w154',
|
jobs: string[];
|
||||||
W185 = 'w185',
|
|
||||||
W300 = 'w300',
|
|
||||||
W500 = 'w500',
|
|
||||||
W780 = 'w780',
|
|
||||||
ORIGINAL = 'original',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum ProfileSizes {
|
export interface TimezoneConfiguration {
|
||||||
W45 = 'w45',
|
iso_3166_1: CountryCode;
|
||||||
W185 = 'w185',
|
zones: string[];
|
||||||
W632 = 'w632',
|
|
||||||
ORIGINAL = 'original',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum StillSizes {
|
export const MediaSize = {
|
||||||
W92 = 'w92',
|
W45: 'w45',
|
||||||
W185 = 'w185',
|
W92: 'w92',
|
||||||
W300 = 'w300',
|
W154: 'w154',
|
||||||
ORIGINAL = 'original',
|
W185: 'w185',
|
||||||
}
|
W300: 'w300',
|
||||||
|
W342: 'w342',
|
||||||
|
W500: 'w500',
|
||||||
|
W632: 'w632',
|
||||||
|
W780: 'w780',
|
||||||
|
W1280: 'w1280',
|
||||||
|
ORIGINAL: 'original',
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const enum ChangeKeys {
|
export const BackdropSize = {
|
||||||
ADULT = 'adult',
|
W45: 'w45',
|
||||||
AIR_DATE = 'air_date',
|
W92: 'w92',
|
||||||
ALSO_KNOWN_AS = 'also_known_as',
|
W154: 'w154',
|
||||||
ALTERNATIVE_TITLES = 'alternative_titles',
|
W185: 'w185',
|
||||||
BIOGRAPHY = 'biography',
|
W300: 'w300',
|
||||||
BIRTHDAY = 'birthday',
|
W500: 'w500',
|
||||||
BUDGET = 'budget',
|
W780: 'w780',
|
||||||
CAST = 'cast',
|
W1280: 'w1280',
|
||||||
CERTIFICATIONS = 'certifications',
|
ORIGINAL: 'original',
|
||||||
CHARACTER_NAMES = 'character_names',
|
} as const;
|
||||||
CREATED_BY = 'created_by',
|
|
||||||
CREW = 'crew',
|
type BackdropSizes = (typeof BackdropSize)[keyof typeof BackdropSize];
|
||||||
DEATHDAY = 'deathday',
|
|
||||||
EPISODE = 'episode',
|
export const LogoSize = {
|
||||||
EPISODE_NUMBER = 'episode_number',
|
W45: 'w45',
|
||||||
EPISODE_RUN_TIME = 'episode_run_time',
|
W92: 'w92',
|
||||||
FREEBASE_ID = 'freebase_id',
|
W154: 'w154',
|
||||||
FREEBASE_MID = 'freebase_mid',
|
W185: 'w185',
|
||||||
GENERAL = 'general',
|
W300: 'w300',
|
||||||
GENRES = 'genres',
|
W500: 'w500',
|
||||||
GUEST_STARS = 'guest_stars',
|
ORIGINAL: 'original',
|
||||||
HOMEPAGE = 'homepage',
|
} as const;
|
||||||
IMAGES = 'images',
|
|
||||||
IMDB_ID = 'imdb_id',
|
type LogoSizes = (typeof LogoSize)[keyof typeof LogoSize];
|
||||||
LANGUAGES = 'languages',
|
|
||||||
NAME = 'name',
|
export const PosterSize = {
|
||||||
NETWORK = 'network',
|
W92: 'w92',
|
||||||
ORIGIN_COUNTRY = 'origin_country',
|
W154: 'w154',
|
||||||
ORIGINAL_NAME = 'original_name',
|
W185: 'w185',
|
||||||
ORIGINAL_TITLE = 'original_title',
|
W300: 'w300',
|
||||||
OVERVIEW = 'overview',
|
W342: 'w342',
|
||||||
PARTS = 'parts',
|
W500: 'w500',
|
||||||
PLACE_OF_BIRTH = 'place_of_birth',
|
W780: 'w780',
|
||||||
PLOT_KEYWORDS = 'plot_keywords',
|
ORIGINAL: 'original',
|
||||||
PRODUCTION_CODE = 'production_code',
|
} as const;
|
||||||
PRODUCTION_COMPANIES = 'production_companies',
|
|
||||||
PRODUCTION_COUNTRIES = 'production_countries',
|
type PosterSizes = (typeof PosterSize)[keyof typeof PosterSize];
|
||||||
RELEASES = 'releases',
|
|
||||||
REVENUE = 'revenue',
|
export const ProfileSize = {
|
||||||
RUNTIME = 'runtime',
|
W45: 'w45',
|
||||||
SEASON = 'season',
|
W185: 'w185',
|
||||||
SEASON_NUMBER = 'season_number',
|
W632: 'w632',
|
||||||
SEASON_REGULAR = 'season_regular',
|
ORIGINAL: 'original',
|
||||||
SPOKEN_LANGUAGES = 'spoken_languages',
|
} as const;
|
||||||
STATUS = 'status',
|
|
||||||
TAGLINE = 'tagline',
|
type ProfileSizes = (typeof ProfileSize)[keyof typeof ProfileSize];
|
||||||
TITLE = 'title',
|
|
||||||
TRANSLATIONS = 'translations',
|
export const StillSize = {
|
||||||
TVDB_ID = 'tvdb_id',
|
W92: 'w92',
|
||||||
TVRAGE_ID = 'tvrage_id',
|
W185: 'w185',
|
||||||
TYPE = 'type',
|
W300: 'w300',
|
||||||
VIDEO = 'video',
|
ORIGINAL: 'original',
|
||||||
VIDEOS = 'videos',
|
} as const;
|
||||||
}
|
|
||||||
|
type StillSizes = (typeof StillSize)[keyof typeof StillSize];
|
||||||
|
|
||||||
|
export const ChangeKey = {
|
||||||
|
ADULT: 'adult',
|
||||||
|
AIR_DATE: 'air_date',
|
||||||
|
ALSO_KNOWN_AS: 'also_known_as',
|
||||||
|
ALTERNATIVE_TITLES: 'alternative_titles',
|
||||||
|
BIOGRAPHY: 'biography',
|
||||||
|
BIRTHDAY: 'birthday',
|
||||||
|
BUDGET: 'budget',
|
||||||
|
CAST: 'cast',
|
||||||
|
CERTIFICATIONS: 'certifications',
|
||||||
|
CHARACTER_NAMES: 'character_names',
|
||||||
|
CREATED_BY: 'created_by',
|
||||||
|
CREW: 'crew',
|
||||||
|
DEATHDAY: 'deathday',
|
||||||
|
EPISODE: 'episode',
|
||||||
|
EPISODE_NUMBER: 'episode_number',
|
||||||
|
EPISODE_RUN_TIME: 'episode_run_time',
|
||||||
|
FREEBASE_ID: 'freebase_id',
|
||||||
|
FREEBASE_MID: 'freebase_mid',
|
||||||
|
GENERAL: 'general',
|
||||||
|
GENRES: 'genres',
|
||||||
|
GUEST_STARS: 'guest_stars',
|
||||||
|
HOMEPAGE: 'homepage',
|
||||||
|
IMAGES: 'images',
|
||||||
|
IMDB_ID: 'imdb_id',
|
||||||
|
LANGUAGES: 'languages',
|
||||||
|
NAME: 'name',
|
||||||
|
NETWORK: 'network',
|
||||||
|
ORIGIN_COUNTRY: 'origin_country',
|
||||||
|
ORIGINAL_NAME: 'original_name',
|
||||||
|
ORIGINAL_TITLE: 'original_title',
|
||||||
|
OVERVIEW: 'overview',
|
||||||
|
PARTS: 'parts',
|
||||||
|
PLACE_OF_BIRTH: 'place_of_birth',
|
||||||
|
PLOT_KEYWORDS: 'plot_keywords',
|
||||||
|
PRODUCTION_CODE: 'production_code',
|
||||||
|
PRODUCTION_COMPANIES: 'production_companies',
|
||||||
|
PRODUCTION_COUNTRIES: 'production_countries',
|
||||||
|
RELEASES: 'releases',
|
||||||
|
REVENUE: 'revenue',
|
||||||
|
RUNTIME: 'runtime',
|
||||||
|
SEASON: 'season',
|
||||||
|
SEASON_NUMBER: 'season_number',
|
||||||
|
SEASON_REGULAR: 'season_regular',
|
||||||
|
SPOKEN_LANGUAGES: 'spoken_languages',
|
||||||
|
STATUS: 'status',
|
||||||
|
TAGLINE: 'tagline',
|
||||||
|
TITLE: 'title',
|
||||||
|
TRANSLATIONS: 'translations',
|
||||||
|
TVDB_ID: 'tvdb_id',
|
||||||
|
TVRAGE_ID: 'tvrage_id',
|
||||||
|
TYPE: 'type',
|
||||||
|
VIDEO: 'video',
|
||||||
|
VIDEOS: 'videos',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
type ChangeKeys = (typeof ChangeKey)[keyof typeof ChangeKey];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Image, Person } from './';
|
import { CountryCode, Image, Person } from './';
|
||||||
|
|
||||||
export interface CreditSeason {
|
export interface CreditSeason {
|
||||||
air_date?: string;
|
air_date?: string;
|
||||||
@@ -7,7 +7,7 @@ export interface CreditSeason {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Media {
|
export interface Media {
|
||||||
i?: number;
|
id?: number;
|
||||||
name?: string;
|
name?: string;
|
||||||
first_air_date?: string;
|
first_air_date?: string;
|
||||||
vote_count?: number;
|
vote_count?: number;
|
||||||
@@ -15,6 +15,8 @@ export interface Media {
|
|||||||
vote_average?: number;
|
vote_average?: number;
|
||||||
backdrop_path?: string;
|
backdrop_path?: string;
|
||||||
genre_ids?: number[];
|
genre_ids?: number[];
|
||||||
|
media_type: string;
|
||||||
|
adult: boolean;
|
||||||
original_name?: string;
|
original_name?: string;
|
||||||
origin_country?: string[];
|
origin_country?: string[];
|
||||||
poster_path?: string;
|
poster_path?: string;
|
||||||
@@ -36,7 +38,7 @@ export interface CreditResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Title {
|
export interface Title {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
title: string;
|
title: string;
|
||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
@@ -89,7 +91,7 @@ export interface ImageCollection {
|
|||||||
export interface Video {
|
export interface Video {
|
||||||
id: string;
|
id: string;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
key: string;
|
key: string;
|
||||||
name: string;
|
name: string;
|
||||||
site: string;
|
site: string;
|
||||||
|
|||||||
@@ -1,6 +1,67 @@
|
|||||||
import { Movie, TV } from '.';
|
import { Movie, TV } from '.';
|
||||||
|
|
||||||
|
export type MonetizationType = 'flatrate' | 'free' | 'ads' | 'rent' | 'buy';
|
||||||
|
|
||||||
|
export interface DiscoverQueryOptions {
|
||||||
|
language?: string;
|
||||||
|
sort_by?: SortOption;
|
||||||
|
page?: number;
|
||||||
|
'vote_average.gte'?: number;
|
||||||
|
'vote_count.gte'?: number;
|
||||||
|
'vote_count.lte'?: number;
|
||||||
|
'vote_average.lte'?: number;
|
||||||
|
with_watch_providers?: string;
|
||||||
|
watch_region?: string;
|
||||||
|
without_companies?: string;
|
||||||
|
with_watch_monetization_types?: MonetizationType;
|
||||||
|
'with_runtime.gte'?: number;
|
||||||
|
'with_runtime.lte'?: number;
|
||||||
|
with_genres?: string;
|
||||||
|
without_genres?: string;
|
||||||
|
with_original_language?: string;
|
||||||
|
without_keywords?: string;
|
||||||
|
with_keywords?: string;
|
||||||
|
with_companies?: string;
|
||||||
|
include_adult?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MovieQueryOptions extends DiscoverQueryOptions {
|
||||||
|
region?: string;
|
||||||
|
certification_country?: string;
|
||||||
|
certification?: string;
|
||||||
|
'certification.lte'?: string;
|
||||||
|
'certification.gte'?: string;
|
||||||
|
include_adult?: boolean;
|
||||||
|
include_video?: boolean;
|
||||||
|
primary_release_year?: number;
|
||||||
|
'primary_release_date.gte'?: string;
|
||||||
|
'primary_release_date.lte'?: string;
|
||||||
|
'release_date.gte'?: string;
|
||||||
|
'release_date.lte'?: string;
|
||||||
|
with_release_type?: string;
|
||||||
|
year?: number;
|
||||||
|
with_cast?: string;
|
||||||
|
with_crew?: string;
|
||||||
|
with_people?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TvShowQueryOptions extends DiscoverQueryOptions {
|
||||||
|
'air_date.gte'?: string;
|
||||||
|
'air_date.lte'?: string;
|
||||||
|
'first_air_date.gte'?: string;
|
||||||
|
'first_air_date.lte'?: string;
|
||||||
|
first_air_date_year?: number;
|
||||||
|
timezone?: string;
|
||||||
|
with_networks?: string;
|
||||||
|
include_null_first_air_dates?: boolean;
|
||||||
|
screened_theatrically?: boolean;
|
||||||
|
with_status?: string;
|
||||||
|
with_type?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type SortOption =
|
export type SortOption =
|
||||||
|
| 'first_air_date.asc'
|
||||||
|
| 'first_air_date.desc'
|
||||||
| 'popularity.asc'
|
| 'popularity.asc'
|
||||||
| 'popularity.desc'
|
| 'popularity.desc'
|
||||||
| 'release_date.asc'
|
| 'release_date.asc'
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export type KnownFor = MovieWithMediaType | TVWithMediaType;
|
|||||||
export interface Person {
|
export interface Person {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
original_name: string;
|
||||||
known_for: KnownFor[];
|
known_for: KnownFor[];
|
||||||
profile_path: string;
|
profile_path: string;
|
||||||
adult: boolean;
|
adult: boolean;
|
||||||
@@ -81,6 +82,7 @@ export interface Company {
|
|||||||
|
|
||||||
export interface TV {
|
export interface TV {
|
||||||
id: number;
|
id: number;
|
||||||
|
adult: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
first_air_date: string;
|
first_air_date: string;
|
||||||
backdrop_path: string;
|
backdrop_path: string;
|
||||||
@@ -109,6 +111,13 @@ export interface ExternalIds {
|
|||||||
facebook_id: string;
|
facebook_id: string;
|
||||||
instagram_id: string;
|
instagram_id: string;
|
||||||
twitter_id: string;
|
twitter_id: string;
|
||||||
|
tvdb_id?: number;
|
||||||
|
freebase_mid?: string;
|
||||||
|
freebase_id?: string;
|
||||||
|
tvrage_id?: number;
|
||||||
|
wikidata_id: string;
|
||||||
|
tiktok_id?: string;
|
||||||
|
youtube_id?: string;
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +129,7 @@ export interface ProductionCompany {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductionCountry {
|
export interface ProductionCountry {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +146,7 @@ export interface ContentRatings {
|
|||||||
|
|
||||||
export interface ContentRatingsResult {
|
export interface ContentRatingsResult {
|
||||||
descriptor: unknown[];
|
descriptor: unknown[];
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
rating: string;
|
rating: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,9 +178,9 @@ export interface Review {
|
|||||||
author: string;
|
author: string;
|
||||||
author_details: AuthorDetails;
|
author_details: AuthorDetails;
|
||||||
content: string;
|
content: string;
|
||||||
created_at: Date;
|
created_at: string;
|
||||||
id: string;
|
id: string;
|
||||||
updated_at: Date;
|
updated_at: string;
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +199,7 @@ export interface TranslationData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Translation {
|
export interface Translation {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
name: string;
|
name: string;
|
||||||
english_name: string;
|
english_name: string;
|
||||||
@@ -218,3 +227,71 @@ export interface Images {
|
|||||||
logos: Image[];
|
logos: Image[];
|
||||||
posters: Image[];
|
posters: Image[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CountryCodes = [
|
||||||
|
'AE',
|
||||||
|
'AR',
|
||||||
|
'AT',
|
||||||
|
'AU',
|
||||||
|
'BE',
|
||||||
|
'BG',
|
||||||
|
'BO',
|
||||||
|
'BR',
|
||||||
|
'CA',
|
||||||
|
'CH',
|
||||||
|
'CL',
|
||||||
|
'CO',
|
||||||
|
'CR',
|
||||||
|
'CV',
|
||||||
|
'CZ',
|
||||||
|
'DE',
|
||||||
|
'DK',
|
||||||
|
'EC',
|
||||||
|
'EE',
|
||||||
|
'EG',
|
||||||
|
'ES',
|
||||||
|
'FI',
|
||||||
|
'FR',
|
||||||
|
'GB',
|
||||||
|
'GH',
|
||||||
|
'GR',
|
||||||
|
'GT',
|
||||||
|
'HK',
|
||||||
|
'HN',
|
||||||
|
'HU',
|
||||||
|
'ID',
|
||||||
|
'IE',
|
||||||
|
'IL',
|
||||||
|
'IN',
|
||||||
|
'IT',
|
||||||
|
'JP',
|
||||||
|
'LT',
|
||||||
|
'LV',
|
||||||
|
'MU',
|
||||||
|
'MX',
|
||||||
|
'MY',
|
||||||
|
'MZ',
|
||||||
|
'NL',
|
||||||
|
'NO',
|
||||||
|
'NZ',
|
||||||
|
'PE',
|
||||||
|
'PH',
|
||||||
|
'PL',
|
||||||
|
'PT',
|
||||||
|
'PY',
|
||||||
|
'RU',
|
||||||
|
'SA',
|
||||||
|
'SE',
|
||||||
|
'SG',
|
||||||
|
'SI',
|
||||||
|
'SK',
|
||||||
|
'TH',
|
||||||
|
'TR',
|
||||||
|
'TW',
|
||||||
|
'UG',
|
||||||
|
'US',
|
||||||
|
'VE',
|
||||||
|
'ZA',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export type CountryCode = (typeof CountryCodes)[number];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
CountryCode,
|
||||||
Genre,
|
Genre,
|
||||||
Movie,
|
Movie,
|
||||||
ProductionCompany,
|
ProductionCompany,
|
||||||
@@ -21,7 +22,7 @@ export interface MovieDetails {
|
|||||||
genres: Genre[];
|
genres: Genre[];
|
||||||
homepage: string;
|
homepage: string;
|
||||||
id: number;
|
id: number;
|
||||||
imdb_id: string;
|
imdb_id: string | null;
|
||||||
original_language: string;
|
original_language: string;
|
||||||
original_title: string;
|
original_title: string;
|
||||||
overview: string;
|
overview: string;
|
||||||
@@ -52,14 +53,15 @@ export enum ReleaseDateType {
|
|||||||
|
|
||||||
export interface ReleaseDate {
|
export interface ReleaseDate {
|
||||||
certification: string;
|
certification: string;
|
||||||
|
descriptors: string[];
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
release_date: Date;
|
release_date: string;
|
||||||
type: ReleaseDateType;
|
type: ReleaseDateType;
|
||||||
note: string;
|
note: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReleaseDateResult {
|
export interface ReleaseDateResult {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
release_dates: ReleaseDate[];
|
release_dates: ReleaseDate[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +104,7 @@ export interface LatestMovie {
|
|||||||
genres: Genre[];
|
genres: Genre[];
|
||||||
homepage: string;
|
homepage: string;
|
||||||
id: number;
|
id: number;
|
||||||
imdb_id: string;
|
imdb_id: string | null;
|
||||||
original_language: string;
|
original_language: string;
|
||||||
original_title: string;
|
original_title: string;
|
||||||
overview: string;
|
overview: string;
|
||||||
|
|||||||
@@ -30,10 +30,157 @@ import {
|
|||||||
TvEpisodeCredit,
|
TvEpisodeCredit,
|
||||||
TvEpisodeTranslations,
|
TvEpisodeTranslations,
|
||||||
TvSeasonChangeValue,
|
TvSeasonChangeValue,
|
||||||
|
CountryCode,
|
||||||
} from '.';
|
} from '.';
|
||||||
|
|
||||||
|
export const AvailableLanguages = [
|
||||||
|
'af-ZA',
|
||||||
|
'ar-AE',
|
||||||
|
'ar-BH',
|
||||||
|
'ar-EG',
|
||||||
|
'ar-IQ',
|
||||||
|
'ar-JO',
|
||||||
|
'ar-LY',
|
||||||
|
'ar-MA',
|
||||||
|
'ar-QA',
|
||||||
|
'ar-SA',
|
||||||
|
'ar-TD',
|
||||||
|
'ar-YE',
|
||||||
|
'be-BY',
|
||||||
|
'bg-BG',
|
||||||
|
'bn-BD',
|
||||||
|
'br-FR',
|
||||||
|
'ca-AD',
|
||||||
|
'ca-ES',
|
||||||
|
'ch-GU',
|
||||||
|
'cs-CZ',
|
||||||
|
'cy-GB',
|
||||||
|
'da-DK',
|
||||||
|
'de-AT',
|
||||||
|
'de-CH',
|
||||||
|
'de-DE',
|
||||||
|
'el-CY',
|
||||||
|
'el-GR',
|
||||||
|
'en-AG',
|
||||||
|
'en-AU',
|
||||||
|
'en-BB',
|
||||||
|
'en-BZ',
|
||||||
|
'en-CA',
|
||||||
|
'en-CM',
|
||||||
|
'en-GB',
|
||||||
|
'en-GG',
|
||||||
|
'en-GH',
|
||||||
|
'en-GI',
|
||||||
|
'en-GY',
|
||||||
|
'en-IE',
|
||||||
|
'en-JM',
|
||||||
|
'en-KE',
|
||||||
|
'en-LC',
|
||||||
|
'en-MW',
|
||||||
|
'en-NZ',
|
||||||
|
'en-PG',
|
||||||
|
'en-TC',
|
||||||
|
'en-US',
|
||||||
|
'en-ZM',
|
||||||
|
'en-ZW',
|
||||||
|
'eo-EO',
|
||||||
|
'es-AR',
|
||||||
|
'es-CL',
|
||||||
|
'es-DO',
|
||||||
|
'es-EC',
|
||||||
|
'es-ES',
|
||||||
|
'es-GQ',
|
||||||
|
'es-GT',
|
||||||
|
'es-HN',
|
||||||
|
'es-MX',
|
||||||
|
'es-NI',
|
||||||
|
'es-PA',
|
||||||
|
'es-PE',
|
||||||
|
'es-PY',
|
||||||
|
'es-SV',
|
||||||
|
'es-UY',
|
||||||
|
'et-EE',
|
||||||
|
'eu-ES',
|
||||||
|
'fa-IR',
|
||||||
|
'fi-FI',
|
||||||
|
'fr-BF',
|
||||||
|
'fr-CA',
|
||||||
|
'fr-CD',
|
||||||
|
'fr-CI',
|
||||||
|
'fr-FR',
|
||||||
|
'fr-GF',
|
||||||
|
'fr-GP',
|
||||||
|
'fr-MC',
|
||||||
|
'fr-ML',
|
||||||
|
'fr-MU',
|
||||||
|
'fr-PF',
|
||||||
|
'ga-IE',
|
||||||
|
'gd-GB',
|
||||||
|
'gl-ES',
|
||||||
|
'he-IL',
|
||||||
|
'hi-IN',
|
||||||
|
'hr-HR',
|
||||||
|
'hu-HU',
|
||||||
|
'id-ID',
|
||||||
|
'it-IT',
|
||||||
|
'it-VA',
|
||||||
|
'ja-JP',
|
||||||
|
'ka-GE',
|
||||||
|
'kk-KZ',
|
||||||
|
'kn-IN',
|
||||||
|
'ko-KR',
|
||||||
|
'ky-KG',
|
||||||
|
'lt-LT',
|
||||||
|
'lv-LV',
|
||||||
|
'ml-IN',
|
||||||
|
'mr-IN',
|
||||||
|
'ms-MY',
|
||||||
|
'ms-SG',
|
||||||
|
'nb-NO',
|
||||||
|
'nl-BE',
|
||||||
|
'nl-NL',
|
||||||
|
'no-NO',
|
||||||
|
'pa-IN',
|
||||||
|
'pl-PL',
|
||||||
|
'pt-AO',
|
||||||
|
'pt-BR',
|
||||||
|
'pt-MZ',
|
||||||
|
'pt-PT',
|
||||||
|
'ro-MD',
|
||||||
|
'ro-RO',
|
||||||
|
'ru-RU',
|
||||||
|
'si-LK',
|
||||||
|
'sk-SK',
|
||||||
|
'sl-SI',
|
||||||
|
'sq-AL',
|
||||||
|
'sq-XK',
|
||||||
|
'sr-ME',
|
||||||
|
'sr-RS',
|
||||||
|
'sv-SE',
|
||||||
|
'sw-TZ',
|
||||||
|
'ta-IN',
|
||||||
|
'te-IN',
|
||||||
|
'th-TH',
|
||||||
|
'tl-PH',
|
||||||
|
'tr-TR',
|
||||||
|
'uk-UA',
|
||||||
|
'ur-PK',
|
||||||
|
'vi-VN',
|
||||||
|
'zh-CN',
|
||||||
|
'zh-HK',
|
||||||
|
'zh-SG',
|
||||||
|
'zh-TW',
|
||||||
|
'zu-ZA',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export type AvailableLanguage = (typeof AvailableLanguages)[number];
|
||||||
|
|
||||||
export interface LanguageOption {
|
export interface LanguageOption {
|
||||||
language?: string;
|
language?: AvailableLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchRegionOption {
|
||||||
|
watch_region?: CountryCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegionOption {
|
export interface RegionOption {
|
||||||
@@ -49,8 +196,8 @@ export interface PageOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ChangeOption extends PageOption {
|
export interface ChangeOption extends PageOption {
|
||||||
start_date?: Date;
|
start_date?: string;
|
||||||
end_date?: Date;
|
end_date?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AppendToResponseMovieKey =
|
export type AppendToResponseMovieKey =
|
||||||
@@ -129,112 +276,114 @@ export type AppendToResponseMediaType =
|
|||||||
export type AppendToResponse<
|
export type AppendToResponse<
|
||||||
K,
|
K,
|
||||||
T extends AppendToResponseAllKeys[] | undefined,
|
T extends AppendToResponseAllKeys[] | undefined,
|
||||||
Media extends AppendToResponseMediaType
|
Media extends AppendToResponseMediaType,
|
||||||
> = K &
|
> = K &
|
||||||
(T extends undefined
|
(T extends undefined
|
||||||
? object
|
? object
|
||||||
: T extends Array<unknown>
|
: T extends Array<unknown>
|
||||||
? ('credits' extends T[number]
|
? ('credits' extends T[number]
|
||||||
? {
|
|
||||||
credits: Media extends 'tvEpisode'
|
|
||||||
? TvEpisodeCredit
|
|
||||||
: Omit<Credits, 'id'>;
|
|
||||||
}
|
|
||||||
: object) &
|
|
||||||
('videos' extends T[number] ? { videos: Omit<Videos, 'id'> } : object) &
|
|
||||||
('images' extends T[number]
|
|
||||||
? {
|
? {
|
||||||
images: Omit<
|
credits: Media extends 'tvEpisode'
|
||||||
Media extends 'person' ? PeopleImages : Images,
|
? TvEpisodeCredit
|
||||||
'id'
|
: Omit<Credits, 'id'>;
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
: object) &
|
: object) &
|
||||||
('recommendations' extends T[number]
|
('videos' extends T[number]
|
||||||
? { recommendations: Recommendations }
|
? { videos: Omit<Videos, 'id'> }
|
||||||
: object) &
|
: object) &
|
||||||
('reviews' extends T[number]
|
('images' extends T[number]
|
||||||
? { reviews: Omit<Reviews, 'id'> }
|
? {
|
||||||
: object) &
|
images: Omit<
|
||||||
('reviews' extends T[number]
|
Media extends 'person' ? PeopleImages : Images,
|
||||||
? { reviews: Omit<Translations, 'id'> }
|
'id'
|
||||||
: object) &
|
>;
|
||||||
('changes' extends T[number]
|
}
|
||||||
? {
|
: object) &
|
||||||
changes: Changes<
|
('recommendations' extends T[number]
|
||||||
Media extends 'person'
|
? { recommendations: Recommendations }
|
||||||
? PersonChangeValue
|
: object) &
|
||||||
: Media extends 'movie'
|
('reviews' extends T[number]
|
||||||
? MovieChangeValue
|
? { reviews: Omit<Reviews, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('reviews' extends T[number]
|
||||||
|
? { reviews: Omit<Translations, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('changes' extends T[number]
|
||||||
|
? {
|
||||||
|
changes: Changes<
|
||||||
|
Media extends 'person'
|
||||||
|
? PersonChangeValue
|
||||||
|
: Media extends 'movie'
|
||||||
|
? MovieChangeValue
|
||||||
|
: Media extends 'tvShow'
|
||||||
|
? TvShowChangeValue
|
||||||
|
: Media extends 'tvSeason'
|
||||||
|
? TvSeasonChangeValue
|
||||||
|
: TvEpisodeChangeValue
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
: object) &
|
||||||
|
('keywords' extends T[number]
|
||||||
|
? { keywords: Omit<Keywords, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('lists' extends T[number]
|
||||||
|
? { lists: Omit<MovieLists, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('release_dates' extends T[number]
|
||||||
|
? { release_dates: Omit<ReleaseDates, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('alternative_titles' extends T[number]
|
||||||
|
? { alternative_titles: Omit<AlternativeTitles, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('external_ids' extends T[number]
|
||||||
|
? { external_ids: Omit<ExternalIds, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('translations' extends T[number]
|
||||||
|
? {
|
||||||
|
translations: Omit<
|
||||||
|
Media extends 'person'
|
||||||
|
? PersonTranslations
|
||||||
|
: Media extends 'tvEpisode'
|
||||||
|
? TvEpisodeTranslations
|
||||||
|
: Translations,
|
||||||
|
'id'
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
: object) &
|
||||||
|
('watch/providers' extends T[number]
|
||||||
|
? { 'watch/providers': Omit<WatchProviders, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('aggregate_credits' extends T[number]
|
||||||
|
? { aggregate_credits: Omit<Credits, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('episode_groups' extends T[number]
|
||||||
|
? { episode_groups: Omit<EpisodeGroups, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('screened_theatrically' extends T[number]
|
||||||
|
? { screened_theatrically: Omit<ScreenedTheatrically, 'id'> }
|
||||||
|
: object) &
|
||||||
|
('similar' extends T[number]
|
||||||
|
? {
|
||||||
|
similar: Media extends 'movie'
|
||||||
|
? SimilarMovies
|
||||||
: Media extends 'tvShow'
|
: Media extends 'tvShow'
|
||||||
? TvShowChangeValue
|
? SimilarTvShows
|
||||||
: Media extends 'tvSeason'
|
: unknown;
|
||||||
? TvSeasonChangeValue
|
}
|
||||||
: TvEpisodeChangeValue
|
: object) &
|
||||||
>;
|
('content_ratings' extends T[number]
|
||||||
}
|
? { content_ratings: Omit<ContentRatings, 'id'> }
|
||||||
: object) &
|
: object) &
|
||||||
('keywords' extends T[number]
|
('movie_credits' extends T[number]
|
||||||
? { keywords: Omit<Keywords, 'id'> }
|
? { movie_credits: Omit<PersonMovieCredit, 'id'> }
|
||||||
: object) &
|
: object) &
|
||||||
('lists' extends T[number]
|
('tv_credits' extends T[number]
|
||||||
? { lists: Omit<MovieLists, 'id'> }
|
? { tv_credits: Omit<PersonTvShowCredit, 'id'> }
|
||||||
: object) &
|
: object) &
|
||||||
('release_dates' extends T[number]
|
('combined_credits' extends T[number]
|
||||||
? { release_dates: Omit<ReleaseDates, 'id'> }
|
? { combined_credits: Omit<PersonCombinedCredits, 'id'> }
|
||||||
: object) &
|
: object) &
|
||||||
('alternative_titles' extends T[number]
|
('tagged_images' extends T[number]
|
||||||
? { alternative_titles: Omit<AlternativeTitles, 'id'> }
|
? { tagged_images: TaggedImages }
|
||||||
: object) &
|
: object)
|
||||||
('external_ids' extends T[number]
|
: never);
|
||||||
? { external_ids: Omit<ExternalIds, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('translations' extends T[number]
|
|
||||||
? {
|
|
||||||
translations: Omit<
|
|
||||||
Media extends 'person'
|
|
||||||
? PersonTranslations
|
|
||||||
: Media extends 'tvEpisode'
|
|
||||||
? TvEpisodeTranslations
|
|
||||||
: Translations,
|
|
||||||
'id'
|
|
||||||
>;
|
|
||||||
}
|
|
||||||
: object) &
|
|
||||||
('watch/providers' extends T[number]
|
|
||||||
? { 'watch/providers': Omit<WatchProviders, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('aggregate_credits' extends T[number]
|
|
||||||
? { aggregate_credits: Omit<Credits, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('episode_groups' extends T[number]
|
|
||||||
? { episode_groups: Omit<EpisodeGroups, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('screened_theatrically' extends T[number]
|
|
||||||
? { screened_theatrically: Omit<ScreenedTheatrically, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('similar' extends T[number]
|
|
||||||
? {
|
|
||||||
similar: Media extends 'movie'
|
|
||||||
? SimilarMovies
|
|
||||||
: Media extends 'tvShow'
|
|
||||||
? SimilarTvShows
|
|
||||||
: unknown;
|
|
||||||
}
|
|
||||||
: object) &
|
|
||||||
('content_ratings' extends T[number]
|
|
||||||
? { content_ratings: Omit<ContentRatings, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('movie_credits' extends T[number]
|
|
||||||
? { movie_credits: Omit<PersonMovieCredit, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('tv_credits' extends T[number]
|
|
||||||
? { tv_credits: Omit<PersonTvShowCredit, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('combined_credits' extends T[number]
|
|
||||||
? { combined_credits: Omit<PersonCombinedCredits, 'id'> }
|
|
||||||
: object) &
|
|
||||||
('tagged_images' extends T[number]
|
|
||||||
? { tagged_images: TaggedImages }
|
|
||||||
: object)
|
|
||||||
: never);
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Image, Movie, Person, TV } from '.';
|
import { CountryCode, Image, Movie, Person, TV } from '.';
|
||||||
|
|
||||||
interface Cast {
|
interface Cast {
|
||||||
character: string;
|
character: string;
|
||||||
@@ -104,7 +104,7 @@ export type PersonChangeValue =
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface PopularPersons {
|
export interface PopularPeople {
|
||||||
page: number;
|
page: number;
|
||||||
results: Person[];
|
results: Person[];
|
||||||
total_results: number;
|
total_results: number;
|
||||||
@@ -140,7 +140,7 @@ export interface TaggedImages {
|
|||||||
export interface PersonTranslations {
|
export interface PersonTranslations {
|
||||||
id: number;
|
id: number;
|
||||||
translations: {
|
translations: {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
name: string;
|
name: string;
|
||||||
english_name: string;
|
english_name: string;
|
||||||
|
|||||||
7
src/types/regions.ts
Normal file
7
src/types/regions.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { CountryCode } from '../types';
|
||||||
|
|
||||||
|
export interface Region {
|
||||||
|
iso_3166_1: CountryCode;
|
||||||
|
english_name: string;
|
||||||
|
native_name: string;
|
||||||
|
}
|
||||||
@@ -15,10 +15,10 @@ export type TrendingMediaType = MediaType | 'all';
|
|||||||
type TrendingResult<T extends TrendingMediaType> = T extends 'tv'
|
type TrendingResult<T extends TrendingMediaType> = T extends 'tv'
|
||||||
? TV
|
? TV
|
||||||
: T extends 'movie'
|
: T extends 'movie'
|
||||||
? Movie
|
? Movie
|
||||||
: T extends 'person'
|
: T extends 'person'
|
||||||
? Person
|
? Person
|
||||||
: TVWithMediaType | MovieWithMediaType | PersonWithMediaType;
|
: TVWithMediaType | MovieWithMediaType | PersonWithMediaType;
|
||||||
|
|
||||||
export interface TrendingResults<T extends TrendingMediaType> {
|
export interface TrendingResults<T extends TrendingMediaType> {
|
||||||
page: number;
|
page: number;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Credits, Crew } from '.';
|
import { CountryCode, Credits, Crew } from '.';
|
||||||
|
|
||||||
export interface EpisodeSelection {
|
export interface EpisodeSelection {
|
||||||
tvShowID: number;
|
tvShowID: number;
|
||||||
@@ -44,7 +44,7 @@ export interface TvEpisodeCredit extends Credits {
|
|||||||
export interface TvEpisodeTranslations {
|
export interface TvEpisodeTranslations {
|
||||||
id: number;
|
id: number;
|
||||||
translations: {
|
translations: {
|
||||||
iso_3166_1: string;
|
iso_3166_1: CountryCode;
|
||||||
iso_639_1: string;
|
iso_639_1: string;
|
||||||
name: string;
|
name: string;
|
||||||
english_name: string;
|
english_name: string;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
import { Region } from './regions';
|
||||||
|
import { CountryCode } from '../types';
|
||||||
|
|
||||||
|
export interface WatchProvider {
|
||||||
|
display_priorities: { [K in CountryCode]: number };
|
||||||
|
display_priority: number;
|
||||||
|
logo_path: string;
|
||||||
|
provider_id: number;
|
||||||
|
provider_name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegionResult {
|
||||||
|
results: Array<Region>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchProviderResult {
|
||||||
|
results: Array<WatchProvider>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Flatrate {
|
export interface Flatrate {
|
||||||
display_priority: number;
|
display_priority: number;
|
||||||
logo_path: string;
|
logo_path: string;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const getFullImagePath = (
|
|||||||
baseUrl: string,
|
baseUrl: string,
|
||||||
fileSize: string,
|
fileSize: string,
|
||||||
imagePath: string,
|
imagePath: string,
|
||||||
svg = false
|
svg: boolean = false
|
||||||
): string => {
|
): string => {
|
||||||
const imagePathArr = imagePath.split('.');
|
const imagePathArr = imagePath.split('.');
|
||||||
const imageFormat = svg ? 'svg' : imagePathArr[1];
|
const imageFormat = svg ? 'svg' : imagePathArr[1];
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
export function parseOptions(options?: Record<string, any>): string {
|
export function parseOptions(options?: Record<string, any>): string {
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
return options
|
||||||
return options ? new URLSearchParams(Object.entries(options)).toString() : '';
|
? new URLSearchParams(
|
||||||
|
Object.entries(options).filter(([, v]) => v) // remove undefined
|
||||||
|
).toString()
|
||||||
|
: '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
||||||
"module": "CommonJS" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
"module": "CommonJS" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||||
"moduleResolution": "node16",
|
"moduleResolution": "bundler",
|
||||||
"sourceMap": true /* Generates corresponding '.map' file. */,
|
"sourceMap": true /* Generates corresponding '.map' file. */,
|
||||||
"outDir": "dist" /* Redirect output structure to the directory. */,
|
"outDir": "dist" /* Redirect output structure to the directory. */,
|
||||||
"strict": true /* Enable all strict type-checking options. */,
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
||||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||||
"typeRoots": ["./src/types"]
|
"typeRoots": ["./src/types", "./node_modules/@types"]
|
||||||
},
|
},
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
|
|||||||
Reference in New Issue
Block a user