Compare commits
1 Commits
chore/add-
...
feat/git_a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb4e707ff9 |
18
.github/workflows/github-actions-demo.yml
vendored
Normal file
18
.github/workflows/github-actions-demo.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: GitHub Actions Demo
|
||||||
|
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
Explore-GitHub-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||||
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||||
|
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||||
|
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ${{ github.workspace }}
|
||||||
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
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}}
|
|
||||||
@@ -14,10 +14,8 @@ Installation:
|
|||||||
npm install --save tmdb-ts
|
npm install --save tmdb-ts
|
||||||
``
|
``
|
||||||
|
|
||||||
Version 1.0 removed the default import so make sure you update accordingly!
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { TMDB } from 'tmdb-ts';
|
import TMDB from 'tmdb-ts';
|
||||||
|
|
||||||
const tmdb = new TMDB('accessToken');
|
const tmdb = new TMDB('accessToken');
|
||||||
|
|
||||||
|
|||||||
294
package-lock.json
generated
294
package-lock.json
generated
@@ -1,18 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "tmdb-ts",
|
"name": "tmdb-ts",
|
||||||
"version": "1.6.1",
|
"version": "0.1.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "tmdb-ts",
|
"name": "tmdb-ts",
|
||||||
"version": "1.6.1",
|
"version": "0.1.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "^3.1.4"
|
"cross-fetch": "^3.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.15.11",
|
"@types/node": "^15.3.0",
|
||||||
"@types/node-fetch": "^2.5.10",
|
"@types/node-fetch": "^2.5.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@@ -23,22 +23,10 @@
|
|||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@cspotcode/source-map-support": {
|
|
||||||
"version": "0.8.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
|
||||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@jridgewell/trace-mapping": "0.3.9"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@eslint-community/eslint-utils": {
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
||||||
@@ -155,31 +143,6 @@
|
|||||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/resolve-uri": {
|
|
||||||
"version": "3.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
|
|
||||||
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@jridgewell/sourcemap-codec": {
|
|
||||||
"version": "1.4.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
|
||||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@jridgewell/trace-mapping": {
|
|
||||||
"version": "0.3.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
|
||||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@jridgewell/resolve-uri": "^3.0.3",
|
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nodelib/fs.scandir": {
|
"node_modules/@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||||
@@ -215,30 +178,6 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tsconfig/node10": {
|
|
||||||
"version": "1.0.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
|
||||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@tsconfig/node12": {
|
|
||||||
"version": "1.0.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
|
||||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@tsconfig/node14": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@tsconfig/node16": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/json-schema": {
|
"node_modules/@types/json-schema": {
|
||||||
"version": "7.0.11",
|
"version": "7.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
||||||
@@ -253,9 +192,9 @@
|
|||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.15.11",
|
"version": "15.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.3.0.tgz",
|
||||||
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
"integrity": "sha512-8/bnjSZD86ZfpBsDlCIkNXIvm+h6wi9g7IqL+kmFkQ+Wvu3JrasgLElfiPgoo8V8vVfnEi0QVS12gbl94h9YsQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node-fetch": {
|
"node_modules/@types/node-fetch": {
|
||||||
@@ -472,10 +411,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.8.2",
|
"version": "7.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -492,15 +432,6 @@
|
|||||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/acorn-walk": {
|
|
||||||
"version": "8.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
|
||||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ajv": {
|
"node_modules/ajv": {
|
||||||
"version": "6.12.6",
|
"version": "6.12.6",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||||
@@ -673,6 +604,12 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/buffer-from": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/call-bind": {
|
"node_modules/call-bind": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||||
@@ -1360,6 +1297,18 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/espree/node_modules/acorn": {
|
||||||
|
"version": "8.8.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||||
|
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/esquery": {
|
"node_modules/esquery": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
|
||||||
@@ -2715,6 +2664,25 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/source-map-support": {
|
||||||
|
"version": "0.5.19",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||||
|
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-from": "^1.0.0",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/string.prototype.trim": {
|
"node_modules/string.prototype.trim": {
|
||||||
"version": "1.2.7",
|
"version": "1.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
||||||
@@ -2843,46 +2811,29 @@
|
|||||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||||
},
|
},
|
||||||
"node_modules/ts-node": {
|
"node_modules/ts-node": {
|
||||||
"version": "10.9.1",
|
"version": "9.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
|
||||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cspotcode/source-map-support": "^0.8.0",
|
|
||||||
"@tsconfig/node10": "^1.0.7",
|
|
||||||
"@tsconfig/node12": "^1.0.7",
|
|
||||||
"@tsconfig/node14": "^1.0.0",
|
|
||||||
"@tsconfig/node16": "^1.0.2",
|
|
||||||
"acorn": "^8.4.1",
|
|
||||||
"acorn-walk": "^8.1.1",
|
|
||||||
"arg": "^4.1.0",
|
"arg": "^4.1.0",
|
||||||
"create-require": "^1.1.0",
|
"create-require": "^1.1.0",
|
||||||
"diff": "^4.0.1",
|
"diff": "^4.0.1",
|
||||||
"make-error": "^1.1.1",
|
"make-error": "^1.1.1",
|
||||||
"v8-compile-cache-lib": "^3.0.1",
|
"source-map-support": "^0.5.17",
|
||||||
"yn": "3.1.1"
|
"yn": "3.1.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"ts-node": "dist/bin.js",
|
"ts-node": "dist/bin.js",
|
||||||
"ts-node-cwd": "dist/bin-cwd.js",
|
|
||||||
"ts-node-esm": "dist/bin-esm.js",
|
|
||||||
"ts-node-script": "dist/bin-script.js",
|
"ts-node-script": "dist/bin-script.js",
|
||||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||||
"ts-script": "dist/bin-script-deprecated.js"
|
"ts-script": "dist/bin-script-deprecated.js"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"engines": {
|
||||||
"@swc/core": ">=1.2.50",
|
"node": ">=10.0.0"
|
||||||
"@swc/wasm": ">=1.2.50",
|
|
||||||
"@types/node": "*",
|
|
||||||
"typescript": ">=2.7"
|
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependencies": {
|
||||||
"@swc/core": {
|
"typescript": ">=2.7"
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@swc/wasm": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tsconfig-paths": {
|
"node_modules/tsconfig-paths": {
|
||||||
@@ -2994,12 +2945,6 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/v8-compile-cache-lib": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/webidl-conversions": {
|
"node_modules/webidl-conversions": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||||
@@ -3109,15 +3054,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cspotcode/source-map-support": {
|
|
||||||
"version": "0.8.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
|
||||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@jridgewell/trace-mapping": "0.3.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@eslint-community/eslint-utils": {
|
"@eslint-community/eslint-utils": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
||||||
@@ -3202,28 +3138,6 @@
|
|||||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@jridgewell/resolve-uri": {
|
|
||||||
"version": "3.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
|
|
||||||
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@jridgewell/sourcemap-codec": {
|
|
||||||
"version": "1.4.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
|
||||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@jridgewell/trace-mapping": {
|
|
||||||
"version": "0.3.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
|
||||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@jridgewell/resolve-uri": "^3.0.3",
|
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@nodelib/fs.scandir": {
|
"@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||||
@@ -3250,30 +3164,6 @@
|
|||||||
"fastq": "^1.6.0"
|
"fastq": "^1.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tsconfig/node10": {
|
|
||||||
"version": "1.0.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
|
||||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@tsconfig/node12": {
|
|
||||||
"version": "1.0.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
|
||||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@tsconfig/node14": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@tsconfig/node16": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@types/json-schema": {
|
"@types/json-schema": {
|
||||||
"version": "7.0.11",
|
"version": "7.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
||||||
@@ -3288,9 +3178,9 @@
|
|||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "18.15.11",
|
"version": "15.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.3.0.tgz",
|
||||||
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
"integrity": "sha512-8/bnjSZD86ZfpBsDlCIkNXIvm+h6wi9g7IqL+kmFkQ+Wvu3JrasgLElfiPgoo8V8vVfnEi0QVS12gbl94h9YsQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node-fetch": {
|
"@types/node-fetch": {
|
||||||
@@ -3417,10 +3307,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "8.8.2",
|
"version": "7.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"acorn-jsx": {
|
"acorn-jsx": {
|
||||||
"version": "5.3.2",
|
"version": "5.3.2",
|
||||||
@@ -3429,12 +3320,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"acorn-walk": {
|
|
||||||
"version": "8.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
|
||||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.12.6",
|
"version": "6.12.6",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||||
@@ -3561,6 +3446,12 @@
|
|||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"buffer-from": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"call-bind": {
|
"call-bind": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||||
@@ -4078,6 +3969,14 @@
|
|||||||
"acorn": "^8.8.0",
|
"acorn": "^8.8.0",
|
||||||
"acorn-jsx": "^5.3.2",
|
"acorn-jsx": "^5.3.2",
|
||||||
"eslint-visitor-keys": "^3.4.0"
|
"eslint-visitor-keys": "^3.4.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"acorn": {
|
||||||
|
"version": "8.8.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||||
|
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"esquery": {
|
"esquery": {
|
||||||
@@ -5028,6 +4927,22 @@
|
|||||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"source-map-support": {
|
||||||
|
"version": "0.5.19",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||||
|
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"buffer-from": "^1.0.0",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"string.prototype.trim": {
|
"string.prototype.trim": {
|
||||||
"version": "1.2.7",
|
"version": "1.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
||||||
@@ -5120,23 +5035,16 @@
|
|||||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||||
},
|
},
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"version": "10.9.1",
|
"version": "9.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
|
||||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@cspotcode/source-map-support": "^0.8.0",
|
|
||||||
"@tsconfig/node10": "^1.0.7",
|
|
||||||
"@tsconfig/node12": "^1.0.7",
|
|
||||||
"@tsconfig/node14": "^1.0.0",
|
|
||||||
"@tsconfig/node16": "^1.0.2",
|
|
||||||
"acorn": "^8.4.1",
|
|
||||||
"acorn-walk": "^8.1.1",
|
|
||||||
"arg": "^4.1.0",
|
"arg": "^4.1.0",
|
||||||
"create-require": "^1.1.0",
|
"create-require": "^1.1.0",
|
||||||
"diff": "^4.0.1",
|
"diff": "^4.0.1",
|
||||||
"make-error": "^1.1.1",
|
"make-error": "^1.1.1",
|
||||||
"v8-compile-cache-lib": "^3.0.1",
|
"source-map-support": "^0.5.17",
|
||||||
"yn": "3.1.1"
|
"yn": "3.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -5221,12 +5129,6 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"v8-compile-cache-lib": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"webidl-conversions": {
|
"webidl-conversions": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||||
|
|||||||
17
package.json
17
package.json
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "tmdb-ts",
|
"name": "tmdb-ts",
|
||||||
"version": "1.6.1",
|
"version": "0.1.9",
|
||||||
"description": "TMDB v3 library wrapper",
|
"description": "TMDB v3 library wrapper",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "rm -rf dist && tsc -d",
|
"compile": "rm -rf dist && tsc -d && npm run copy-types",
|
||||||
"lint": "eslint --ext .ts src/",
|
"lint": "eslint --ext .ts src/",
|
||||||
"lint:fix": "eslint --ext .ts src/ --fix",
|
"lint:fix": "eslint --ext .ts src/ --fix",
|
||||||
"format": "npx prettier --write src",
|
"format": "npx prettier --write src",
|
||||||
"pre-commit": "npm run lint"
|
"pre-commit": "npm run lint",
|
||||||
|
"copy-types": "mkdir dist/types && cp src/types/*.d.ts dist/types"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/blakejoy/tmdb-ts/issues",
|
"url": "https://github.com/blakejoy/tmdb-ts/issues",
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
"author": "Blake Joynes",
|
"author": "Blake Joynes",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.15.11",
|
"@types/node": "^15.3.0",
|
||||||
"@types/node-fetch": "^2.5.10",
|
"@types/node-fetch": "^2.5.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@@ -40,16 +41,16 @@
|
|||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "^3.1.4"
|
"cross-fetch": "^3.1.4"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "18.16.0",
|
"node": "15.13.0",
|
||||||
"yarn": "1.22.4",
|
"yarn": "1.19.2",
|
||||||
"npm": "9.5.1"
|
"npm": "7.12.1"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|||||||
14
src/api.ts
14
src/api.ts
@@ -1,28 +1,20 @@
|
|||||||
import fetch from 'cross-fetch';
|
import fetch from 'cross-fetch';
|
||||||
import { parseOptions } from './utils';
|
|
||||||
import { ErrorResponse } from './types';
|
|
||||||
|
|
||||||
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
||||||
|
|
||||||
export class Api {
|
export default class Api {
|
||||||
constructor(private accessToken: string) {
|
constructor(private accessToken: string) {
|
||||||
this.accessToken = accessToken;
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
async get<T>(path: string, options?: Record<string, any>): Promise<T> {
|
async get<T>(path: string): Promise<T> {
|
||||||
const params = parseOptions(options);
|
const response = await fetch(`${BASE_URL_V3}${path}`, {
|
||||||
const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.accessToken}`,
|
Authorization: `Bearer ${this.accessToken}`,
|
||||||
'Content-Type': 'application/json;charset=utf-8',
|
'Content-Type': 'application/json;charset=utf-8',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
return Promise.reject((await response.json()) as ErrorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (await response.json()) as T;
|
return (await response.json()) as T;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Api } from '../api';
|
import Api from '../api';
|
||||||
|
|
||||||
export class BaseEndpoint {
|
export class BaseEndpoint {
|
||||||
protected api: Api;
|
protected api: Api;
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
import { ChangeOption, MediaChanges } from '../types';
|
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
import { ChangeOptions, Changes } from '../types/changes';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
|
|
||||||
export class ChangeEndpoint extends BaseEndpoint {
|
export class ChangeEndpoint extends BaseEndpoint {
|
||||||
constructor(protected readonly accessToken: string) {
|
constructor(protected readonly accessToken: string) {
|
||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async movies(options?: ChangeOption): Promise<MediaChanges> {
|
async movies(options?: ChangeOptions): Promise<Changes> {
|
||||||
return await this.api.get<MediaChanges>(`/movie/changes`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<Changes>(`/movie/changes?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async tvShows(options?: ChangeOption): Promise<MediaChanges> {
|
async tvShows(options?: ChangeOptions): Promise<Changes> {
|
||||||
return await this.api.get<MediaChanges>(`/tv/changes`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<Changes>(`/tv/changes?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async person(options?: ChangeOption): Promise<MediaChanges> {
|
async person(options?: ChangeOptions): Promise<Changes> {
|
||||||
return await this.api.get<MediaChanges>(`/person/change`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<Changes>(`/person/changes${params}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
CollectionImageOptions,
|
|
||||||
DetailedCollection,
|
DetailedCollection,
|
||||||
ImageCollection,
|
ImageCollection,
|
||||||
LanguageOption,
|
LanguageOption,
|
||||||
Translations,
|
Translations,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
const BASE_COLLECTION = '/collection';
|
const BASE_COLLECTION = '/collection';
|
||||||
@@ -18,23 +18,16 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
|||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption
|
options?: LanguageOption
|
||||||
): Promise<DetailedCollection> {
|
): Promise<DetailedCollection> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<DetailedCollection>(
|
return await this.api.get<DetailedCollection>(
|
||||||
`${BASE_COLLECTION}/${id}`,
|
`${BASE_COLLECTION}/${id}?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async images(
|
async images(id: number, options?: LanguageOption): Promise<ImageCollection> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: CollectionImageOptions
|
|
||||||
): Promise<ImageCollection> {
|
|
||||||
const computedOptions = {
|
|
||||||
include_image_language: options?.include_image_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<ImageCollection>(
|
return await this.api.get<ImageCollection>(
|
||||||
`${BASE_COLLECTION}/${id}/images`,
|
`${BASE_COLLECTION}/${id}/images?${params}`
|
||||||
computedOptions
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,9 +35,9 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
|||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption
|
options?: LanguageOption
|
||||||
): Promise<Translations> {
|
): Promise<Translations> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Translations>(
|
return await this.api.get<Translations>(
|
||||||
`${BASE_COLLECTION}/${id}/translations`,
|
`${BASE_COLLECTION}/${id}/translations?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
import {
|
|
||||||
CompanyDetails,
|
|
||||||
AlternativeNames,
|
|
||||||
CompanyImages,
|
|
||||||
} from './../types/companies';
|
|
||||||
import { BaseEndpoint } from './base';
|
|
||||||
|
|
||||||
export class CompaniesEndpoint extends BaseEndpoint {
|
|
||||||
constructor(protected readonly accessToken: string) {
|
|
||||||
super(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
async details(id: number): Promise<CompanyDetails> {
|
|
||||||
return await this.api.get<CompanyDetails>(`/company/${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
async alternativeNames(id: number): Promise<AlternativeNames> {
|
|
||||||
return await this.api.get<AlternativeNames>(
|
|
||||||
`/company/${id}/alternative_names`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async images(id: number): Promise<CompanyImages> {
|
|
||||||
return await this.api.get<CompanyImages>(`/company/${id}/images`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
SortOption,
|
SortOption,
|
||||||
TvShowDiscoverResult,
|
TvShowDiscoverResult,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
const BASE_DISCOVER = '/discover';
|
const BASE_DISCOVER = '/discover';
|
||||||
@@ -69,16 +70,16 @@ export class DiscoverEndpoint extends BaseEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult> {
|
async movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<MovieDiscoverResult>(
|
return await this.api.get<MovieDiscoverResult>(
|
||||||
`${BASE_DISCOVER}/movie`,
|
`${BASE_DISCOVER}/movie?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async tvShow(options?: TvShowQueryOptions): Promise<TvShowDiscoverResult> {
|
async tvShow(options?: TvShowQueryOptions): Promise<TvShowDiscoverResult> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<TvShowDiscoverResult>(
|
return await this.api.get<TvShowDiscoverResult>(
|
||||||
`${BASE_DISCOVER}/tv`,
|
`${BASE_DISCOVER}/tv?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import { ExternalIdOptions, FindResult } from '../types';
|
import { ExternalIdOptions, FindResult } from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
|
|
||||||
export class FindEndpoint extends BaseEndpoint {
|
export class FindEndpoint extends BaseEndpoint {
|
||||||
constructor(accessToken: string) {
|
constructor(accessToken: string) {
|
||||||
@@ -10,6 +11,7 @@ export class FindEndpoint extends BaseEndpoint {
|
|||||||
externalId: string,
|
externalId: string,
|
||||||
options: ExternalIdOptions
|
options: ExternalIdOptions
|
||||||
): Promise<FindResult> {
|
): Promise<FindResult> {
|
||||||
return await this.api.get<FindResult>(`/find/${externalId}`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<FindResult>(`/find/${externalId}?${params}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { LanguageOption } from '../types';
|
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
export interface Genres {
|
export interface Genres {
|
||||||
@@ -10,11 +9,11 @@ export class GenreEndpoint extends BaseEndpoint {
|
|||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async movies(options?: LanguageOption): Promise<Genres> {
|
async movies(): Promise<Genres> {
|
||||||
return await this.api.get<Genres>('/genre/movie/list', options);
|
return await this.api.get<Genres>('/genre/movie/list');
|
||||||
}
|
}
|
||||||
|
|
||||||
async tvShows(options?: LanguageOption): Promise<Genres> {
|
async tvShows(): Promise<Genres> {
|
||||||
return await this.api.get<Genres>('/genre/tv/list', options);
|
return await this.api.get<Genres>('/genre/tv/list');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,5 +14,3 @@ export * from './trending';
|
|||||||
export * from './find';
|
export * from './find';
|
||||||
export * from './keywords';
|
export * from './keywords';
|
||||||
export * from './collections';
|
export * from './collections';
|
||||||
export * from './tv-seasons';
|
|
||||||
export * from './tv-episode';
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import { BelongingMovies, Keyword, KeywordsOptions } from '../types';
|
import { BelongingMovies, Keyword, KeywordsOptions } from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
|
|
||||||
const BASE_Keyword = '/keyword';
|
const BASE_Keyword = '/keyword';
|
||||||
|
|
||||||
@@ -16,9 +17,9 @@ export class KeywordsEndpoint extends BaseEndpoint {
|
|||||||
keywordId: number,
|
keywordId: number,
|
||||||
options?: KeywordsOptions
|
options?: KeywordsOptions
|
||||||
): Promise<BelongingMovies> {
|
): Promise<BelongingMovies> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<BelongingMovies>(
|
return await this.api.get<BelongingMovies>(
|
||||||
`${BASE_Keyword}/${keywordId}/movies`,
|
`${BASE_Keyword}/${keywordId}/movies?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import {
|
import {
|
||||||
AlternativeTitles,
|
AlternativeTitles,
|
||||||
AppendToResponse,
|
ChangeOptions,
|
||||||
AppendToResponseMovieKey,
|
|
||||||
ChangeOption,
|
|
||||||
Changes,
|
|
||||||
Credits,
|
Credits,
|
||||||
ExternalIds,
|
ExternalIds,
|
||||||
Images,
|
Images,
|
||||||
Keywords,
|
Keywords,
|
||||||
LanguageOption,
|
LanguageOption,
|
||||||
LatestMovie,
|
LatestMovie,
|
||||||
MovieChangeValue,
|
MovieChanges,
|
||||||
MovieDetails,
|
MovieDetails,
|
||||||
MovieLists,
|
MovieLists,
|
||||||
MoviesPlayingNow,
|
MoviesPlayingNow,
|
||||||
@@ -28,37 +25,17 @@ import {
|
|||||||
Videos,
|
Videos,
|
||||||
WatchProviders,
|
WatchProviders,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
|
|
||||||
const BASE_MOVIE = '/movie';
|
const BASE_MOVIE = '/movie';
|
||||||
|
|
||||||
export interface MoviesImageSearchOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_image_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MoviesEndpoint extends BaseEndpoint {
|
export class MoviesEndpoint extends BaseEndpoint {
|
||||||
constructor(protected readonly accessToken: string) {
|
constructor(protected readonly accessToken: string) {
|
||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async details<T extends AppendToResponseMovieKey[] | undefined>(
|
async details(id: number): Promise<MovieDetails> {
|
||||||
id: number,
|
return await this.api.get<MovieDetails>(`${BASE_MOVIE}/${id}`);
|
||||||
appendToResponse?: T,
|
|
||||||
language?: string
|
|
||||||
) {
|
|
||||||
const options = {
|
|
||||||
append_to_response: appendToResponse
|
|
||||||
? appendToResponse.join(',')
|
|
||||||
: undefined,
|
|
||||||
language: language,
|
|
||||||
};
|
|
||||||
|
|
||||||
return await this.api.get<AppendToResponse<MovieDetails, T, 'movie'>>(
|
|
||||||
`${BASE_MOVIE}/${id}`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async alternativeTitles(id: number): Promise<AlternativeTitles> {
|
async alternativeTitles(id: number): Promise<AlternativeTitles> {
|
||||||
@@ -67,36 +44,23 @@ export class MoviesEndpoint extends BaseEndpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async changes(
|
async changes(id: number, options?: ChangeOptions): Promise<MovieChanges> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: ChangeOption
|
return await this.api.get<MovieChanges>(
|
||||||
): Promise<Changes<MovieChangeValue>> {
|
`${BASE_MOVIE}/${id}/changes?${params}`
|
||||||
return await this.api.get<Changes<MovieChangeValue>>(
|
|
||||||
`${BASE_MOVIE}/${id}/changes`,
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async credits(id: number, options?: LanguageOption): Promise<Credits> {
|
async credits(id: number): Promise<Credits> {
|
||||||
return await this.api.get<Credits>(`${BASE_MOVIE}/${id}/credits`, options);
|
return await this.api.get<Credits>(`${BASE_MOVIE}/${id}/credits`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async externalIds(id: number): Promise<ExternalIds> {
|
async externalIds(id: number): Promise<ExternalIds> {
|
||||||
return await this.api.get<ExternalIds>(`${BASE_MOVIE}/${id}/external_ids`);
|
return await this.api.get<ExternalIds>(`${BASE_MOVIE}/${id}/external_ids`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async images(
|
async images(id: number): Promise<Images> {
|
||||||
id: number,
|
return await this.api.get<Images>(`${BASE_MOVIE}/${id}/images`);
|
||||||
options?: MoviesImageSearchOptions
|
|
||||||
): Promise<Images> {
|
|
||||||
const computedOptions = {
|
|
||||||
include_image_language: options?.include_image_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Images>(
|
|
||||||
`${BASE_MOVIE}/${id}/images`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async keywords(id: number): Promise<Keywords> {
|
async keywords(id: number): Promise<Keywords> {
|
||||||
@@ -105,18 +69,21 @@ export class MoviesEndpoint extends BaseEndpoint {
|
|||||||
|
|
||||||
async lists(
|
async lists(
|
||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption & PageOption
|
options?: LanguageOption | PageOption
|
||||||
): Promise<MovieLists> {
|
): Promise<MovieLists> {
|
||||||
return await this.api.get<MovieLists>(`${BASE_MOVIE}/${id}/lists`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<MovieLists>(
|
||||||
|
`${BASE_MOVIE}/${id}/lists?${params}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async recommendations(
|
async recommendations(
|
||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption & PageOption
|
options?: PageOption
|
||||||
): Promise<Recommendations> {
|
): Promise<Recommendations> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Recommendations>(
|
return await this.api.get<Recommendations>(
|
||||||
`${BASE_MOVIE}/${id}/recommendations`,
|
`${BASE_MOVIE}/${id}/recommendations?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,20 +93,15 @@ export class MoviesEndpoint extends BaseEndpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reviews(
|
async reviews(id: number, options?: PageOption): Promise<Reviews> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: LanguageOption & PageOption
|
return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews?${params}`);
|
||||||
): Promise<Reviews> {
|
|
||||||
return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews`, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async similar(
|
async similar(id: number, options?: PageOption): Promise<SimilarMovies> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: LanguageOption & PageOption
|
|
||||||
): Promise<SimilarMovies> {
|
|
||||||
return await this.api.get<SimilarMovies>(
|
return await this.api.get<SimilarMovies>(
|
||||||
`${BASE_MOVIE}/${id}/similar`,
|
`${BASE_MOVIE}/${id}/similar?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,8 +109,8 @@ export class MoviesEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<Translations>(`${BASE_MOVIE}/${id}/translations`);
|
return await this.api.get<Translations>(`${BASE_MOVIE}/${id}/translations`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async videos(id: number, options?: LanguageOption): Promise<Videos> {
|
async videos(id: number): Promise<Videos> {
|
||||||
return await this.api.get<Videos>(`${BASE_MOVIE}/${id}/videos`, options);
|
return await this.api.get<Videos>(`${BASE_MOVIE}/${id}/videos`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,31 +130,32 @@ export class MoviesEndpoint extends BaseEndpoint {
|
|||||||
async nowPlaying(
|
async nowPlaying(
|
||||||
options?: PageOption & LanguageOption & RegionOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<MoviesPlayingNow> {
|
): Promise<MoviesPlayingNow> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<MoviesPlayingNow>(
|
return await this.api.get<MoviesPlayingNow>(
|
||||||
`${BASE_MOVIE}/now_playing`,
|
`${BASE_MOVIE}/now_playing?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async popular(options?: LanguageOption & PageOption): Promise<PopularMovies> {
|
async popular(options?: PageOption): Promise<PopularMovies> {
|
||||||
return await this.api.get<PopularMovies>(`${BASE_MOVIE}/popular`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<PopularMovies>(`${BASE_MOVIE}/popular?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async topRated(
|
async topRated(
|
||||||
options?: PageOption & LanguageOption & RegionOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<TopRatedMovies> {
|
): Promise<TopRatedMovies> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<TopRatedMovies>(
|
return await this.api.get<TopRatedMovies>(
|
||||||
`${BASE_MOVIE}/top_rated`,
|
`${BASE_MOVIE}/top_rated?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async upcoming(
|
async upcoming(
|
||||||
options?: PageOption & LanguageOption & RegionOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<UpcomingMovies> {
|
): Promise<UpcomingMovies> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<UpcomingMovies>(
|
return await this.api.get<UpcomingMovies>(
|
||||||
`${BASE_MOVIE}/upcoming`,
|
`${BASE_MOVIE}/upcoming?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import { NetworkDetails, NetworkImages } from '..';
|
|
||||||
import { AlternativeNames } from './../types/companies';
|
|
||||||
import { BaseEndpoint } from './base';
|
|
||||||
|
|
||||||
export class NetworksEndpoint extends BaseEndpoint {
|
|
||||||
constructor(protected readonly accessToken: string) {
|
|
||||||
super(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
async details(id: number): Promise<NetworkDetails> {
|
|
||||||
return await this.api.get<NetworkDetails>(`/network/${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
async alternativeNames(id: number): Promise<AlternativeNames> {
|
|
||||||
return await this.api.get<AlternativeNames>(
|
|
||||||
`/network/${id}/alternative_names`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async images(id: number): Promise<NetworkImages> {
|
|
||||||
return await this.api.get<NetworkImages>(`/network/${id}/images`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,18 @@
|
|||||||
import {
|
import {
|
||||||
AppendToResponse,
|
ChangeOptions,
|
||||||
AppendToResponsePersonKey,
|
|
||||||
ChangeOption,
|
|
||||||
ExternalIds,
|
ExternalIds,
|
||||||
|
Image,
|
||||||
PageOption,
|
PageOption,
|
||||||
PeopleImages,
|
PeopleTranslations,
|
||||||
PersonTranslations,
|
PersonChanges,
|
||||||
PersonCombinedCredits,
|
PersonCombinedCredits,
|
||||||
PersonDetails,
|
PersonDetail,
|
||||||
PersonMovieCredit,
|
PersonMovieCredit,
|
||||||
PersonTvShowCredit,
|
PersonTvShowCredit,
|
||||||
PopularPersons,
|
PopularPersons,
|
||||||
TaggedImages,
|
TaggedImages,
|
||||||
Changes,
|
|
||||||
PersonChangeValue,
|
|
||||||
LanguageOption,
|
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
const BASE_PERSON = '/person';
|
const BASE_PERSON = '/person';
|
||||||
@@ -25,60 +22,32 @@ export class PeopleEndpoint extends BaseEndpoint {
|
|||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async details<T extends AppendToResponsePersonKey[] | undefined>(
|
async details(id: number): Promise<PersonDetail> {
|
||||||
id: number,
|
return await this.api.get<PersonDetail>(`${BASE_PERSON}/${id}`);
|
||||||
appendToResponse?: T,
|
}
|
||||||
language?: string
|
|
||||||
) {
|
async changes(id: number, options?: ChangeOptions): Promise<PersonChanges> {
|
||||||
const options = {
|
const params = parseOptions(options);
|
||||||
append_to_response: appendToResponse
|
return await this.api.get<PersonChanges>(
|
||||||
? appendToResponse.join(',')
|
`${BASE_PERSON}/${id}/changes?${params}`
|
||||||
: undefined,
|
|
||||||
language: language,
|
|
||||||
};
|
|
||||||
return await this.api.get<AppendToResponse<PersonDetails, T, 'person'>>(
|
|
||||||
`${BASE_PERSON}/${id}`,
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async changes(
|
async movieCredits(id: number): Promise<PersonMovieCredit> {
|
||||||
id: number,
|
|
||||||
options?: ChangeOption
|
|
||||||
): Promise<Changes<PersonChangeValue>> {
|
|
||||||
return await this.api.get<Changes<PersonChangeValue>>(
|
|
||||||
`${BASE_PERSON}/${id}/changes`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async movieCredits(
|
|
||||||
id: number,
|
|
||||||
options?: LanguageOption
|
|
||||||
): Promise<PersonMovieCredit> {
|
|
||||||
return await this.api.get<PersonMovieCredit>(
|
return await this.api.get<PersonMovieCredit>(
|
||||||
`${BASE_PERSON}/${id}/movie_credits`,
|
`${BASE_PERSON}/${id}/movie_credits`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async tvShowCredits(
|
async tvShowCredits(id: number): Promise<PersonTvShowCredit> {
|
||||||
id: number,
|
|
||||||
options?: LanguageOption
|
|
||||||
): Promise<PersonTvShowCredit> {
|
|
||||||
return await this.api.get<PersonTvShowCredit>(
|
return await this.api.get<PersonTvShowCredit>(
|
||||||
`${BASE_PERSON}/${id}/tv_credits`,
|
`${BASE_PERSON}/${id}/tv_credits`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async combinedCredits(
|
async combinedCredits(id: number): Promise<PersonCombinedCredits> {
|
||||||
id: number,
|
|
||||||
options?: LanguageOption
|
|
||||||
): Promise<PersonCombinedCredits> {
|
|
||||||
return await this.api.get<PersonCombinedCredits>(
|
return await this.api.get<PersonCombinedCredits>(
|
||||||
`${BASE_PERSON}/${id}/combined_credits`,
|
`${BASE_PERSON}/${id}/combined_credits`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,33 +55,33 @@ export class PeopleEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
|
return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async images(id: number): Promise<PeopleImages> {
|
async images(id: number): Promise<{ id: number; profiles: Image[] }> {
|
||||||
return await this.api.get<PeopleImages>(`${BASE_PERSON}/${id}/images`);
|
return await this.api.get<{ id: number; profiles: Image[] }>(
|
||||||
}
|
`${BASE_PERSON}/${id}/images`
|
||||||
|
|
||||||
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
|
|
||||||
return await this.api.get<TaggedImages>(
|
|
||||||
`${BASE_PERSON}/${id}/tagged_images`,
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async translation(id: number): Promise<PersonTranslations> {
|
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
|
||||||
return await this.api.get<PersonTranslations>(
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<TaggedImages>(
|
||||||
|
`${BASE_PERSON}/${id}/tagged_images?${params}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async translation(id: number): Promise<PeopleTranslations> {
|
||||||
|
return await this.api.get<PeopleTranslations>(
|
||||||
`${BASE_PERSON}/${id}/translations`
|
`${BASE_PERSON}/${id}/translations`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async latest(): Promise<PersonDetails> {
|
async latest(): Promise<PersonDetail> {
|
||||||
return await this.api.get<PersonDetails>(`${BASE_PERSON}/latest`);
|
return await this.api.get<PersonDetail>(`${BASE_PERSON}/latest`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async popular(
|
async popular(options?: PageOption): Promise<PopularPersons> {
|
||||||
options?: LanguageOption & PageOption
|
const params = parseOptions(options);
|
||||||
): Promise<PopularPersons> {
|
|
||||||
return await this.api.get<PopularPersons>(
|
return await this.api.get<PopularPersons>(
|
||||||
`${BASE_PERSON}/popular`,
|
`${BASE_PERSON}/popular?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import { MultiSearchResult, Search } from '../types/search';
|
import { Search } from '../types/search';
|
||||||
import {
|
import { Collection, Company, Movie, Person, TV } from '../types';
|
||||||
Collection,
|
import { parseOptions } from '../utils';
|
||||||
Company,
|
|
||||||
LanguageOption,
|
|
||||||
Movie,
|
|
||||||
PageOption,
|
|
||||||
Person,
|
|
||||||
RegionOption,
|
|
||||||
TV,
|
|
||||||
} from '../types';
|
|
||||||
|
|
||||||
const BASE_SEARCH = '/search';
|
const BASE_SEARCH = '/search';
|
||||||
|
|
||||||
@@ -18,44 +10,18 @@ export interface SearchOptions {
|
|||||||
page?: number;
|
page?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MovieSearchOptions
|
export interface MovieSearchOptions extends SearchOptions {
|
||||||
extends SearchOptions,
|
|
||||||
LanguageOption,
|
|
||||||
PageOption,
|
|
||||||
RegionOption {
|
|
||||||
include_adult?: boolean;
|
include_adult?: boolean;
|
||||||
year?: number;
|
year?: number;
|
||||||
primary_release_year?: number;
|
primary_release_year?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollectionSearchOptions
|
export interface TvSearchOptions extends SearchOptions {
|
||||||
extends SearchOptions,
|
|
||||||
LanguageOption,
|
|
||||||
PageOption,
|
|
||||||
RegionOption {
|
|
||||||
include_adult?: boolean;
|
include_adult?: boolean;
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvSearchOptions
|
|
||||||
extends SearchOptions,
|
|
||||||
LanguageOption,
|
|
||||||
PageOption {
|
|
||||||
include_adult?: boolean;
|
|
||||||
year?: number;
|
|
||||||
first_air_date_year?: number;
|
first_air_date_year?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeopleSearchOptions
|
export interface PeopleSearchOptions extends SearchOptions {
|
||||||
extends SearchOptions,
|
|
||||||
LanguageOption,
|
|
||||||
PageOption {
|
|
||||||
include_adult?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MultiSearchOptions
|
|
||||||
extends SearchOptions,
|
|
||||||
LanguageOption,
|
|
||||||
PageOption {
|
|
||||||
include_adult?: boolean;
|
include_adult?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,44 +31,44 @@ export class SearchEndpoint extends BaseEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async companies(options: SearchOptions): Promise<Search<Company>> {
|
async companies(options: SearchOptions): Promise<Search<Company>> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Search<Company>>(
|
return await this.api.get<Search<Company>>(
|
||||||
`${BASE_SEARCH}/company`,
|
`${BASE_SEARCH}/company?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async collections(options: SearchOptions): Promise<Search<Collection>> {
|
async collections(options: SearchOptions): Promise<Search<Collection>> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Search<Collection>>(
|
return await this.api.get<Search<Collection>>(
|
||||||
`${BASE_SEARCH}/collection`,
|
`${BASE_SEARCH}/collection?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async keywords(
|
async keywords(
|
||||||
options: SearchOptions
|
options: SearchOptions
|
||||||
): Promise<Search<{ id: string; name: string }>> {
|
): Promise<Search<{ id: string; name: string }>> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Search<{ id: string; name: string }>>(
|
return await this.api.get<Search<{ id: string; name: string }>>(
|
||||||
`${BASE_SEARCH}/keyword`,
|
`${BASE_SEARCH}/keyword?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async movies(options: MovieSearchOptions): Promise<Search<Movie>> {
|
async movies(options: MovieSearchOptions): Promise<Search<Movie>> {
|
||||||
return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async people(options: PeopleSearchOptions): Promise<Search<Person>> {
|
async people(options: PeopleSearchOptions): Promise<Search<Person>> {
|
||||||
return await this.api.get<Search<Person>>(`${BASE_SEARCH}/person`, options);
|
const params = parseOptions(options);
|
||||||
}
|
return await this.api.get<Search<Person>>(
|
||||||
|
`${BASE_SEARCH}/person?${params}`
|
||||||
async tvShows(options: TvSearchOptions): Promise<Search<TV>> {
|
|
||||||
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv`, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
async multi(options: MultiSearchOptions): Promise<Search<MultiSearchResult>> {
|
|
||||||
return await this.api.get<Search<MultiSearchResult>>(
|
|
||||||
`${BASE_SEARCH}/multi`,
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Multi search
|
||||||
|
|
||||||
|
async tvShows(options: TvSearchOptions): Promise<Search<TV>> {
|
||||||
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv?${params}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { MediaType, TimeWindow, TrendingResults } from '../types';
|
||||||
TrendingMediaType,
|
|
||||||
TimeWindow,
|
|
||||||
TrendingResults,
|
|
||||||
LanguageOption,
|
|
||||||
} from '../types';
|
|
||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
|
|
||||||
export class TrendingEndpoint extends BaseEndpoint {
|
export class TrendingEndpoint extends BaseEndpoint {
|
||||||
@@ -11,14 +6,12 @@ export class TrendingEndpoint extends BaseEndpoint {
|
|||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async trending<T extends TrendingMediaType>(
|
async trending<T extends MediaType>(
|
||||||
mediaType: T,
|
mediaType: T,
|
||||||
timeWindow: TimeWindow,
|
timeWindow: TimeWindow
|
||||||
options?: LanguageOption
|
|
||||||
): Promise<TrendingResults<T>> {
|
): Promise<TrendingResults<T>> {
|
||||||
return await this.api.get<TrendingResults<T>>(
|
return await this.api.get<TrendingResults<T>>(
|
||||||
`/trending/${mediaType}/${timeWindow}`,
|
`/trending/${mediaType}/${timeWindow}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
import {
|
|
||||||
Episode,
|
|
||||||
EpisodeSelection,
|
|
||||||
LanguageOption,
|
|
||||||
ChangeOption,
|
|
||||||
TvEpisodeCredit,
|
|
||||||
ExternalIds,
|
|
||||||
Images,
|
|
||||||
TvEpisodeTranslations,
|
|
||||||
Videos,
|
|
||||||
AppendToResponse,
|
|
||||||
Changes,
|
|
||||||
TvEpisodeChangeValue,
|
|
||||||
AppendToResponseTvEpisodeKey,
|
|
||||||
} from '..';
|
|
||||||
import { BaseEndpoint } from './base';
|
|
||||||
|
|
||||||
const BASE_EPISODE = (episodeSelection: EpisodeSelection): string => {
|
|
||||||
return `/tv/${episodeSelection.tvShowID}/season/${episodeSelection.seasonNumber}/episode/${episodeSelection.episodeNumber}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface TvEpisodeImageSearchOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_image_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvEpisodeVideoSearchOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_video_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TvEpisodesEndpoint extends BaseEndpoint {
|
|
||||||
constructor(accessToken: string) {
|
|
||||||
super(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
async details<T extends AppendToResponseTvEpisodeKey[] | undefined>(
|
|
||||||
episodeSelection: EpisodeSelection,
|
|
||||||
appendToResponse?: T,
|
|
||||||
options?: LanguageOption
|
|
||||||
) {
|
|
||||||
const combinedOptions = {
|
|
||||||
append_to_response: appendToResponse
|
|
||||||
? appendToResponse.join(',')
|
|
||||||
: undefined,
|
|
||||||
...options,
|
|
||||||
};
|
|
||||||
|
|
||||||
return await this.api.get<
|
|
||||||
AppendToResponse<Omit<Episode, 'show_id'>, T, 'tvEpisode'>
|
|
||||||
>(`${BASE_EPISODE(episodeSelection)}`, combinedOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
async changes(episodeID: number, options?: ChangeOption) {
|
|
||||||
return await this.api.get<Changes<TvEpisodeChangeValue>>(
|
|
||||||
`/tv/episode/${episodeID}/changes`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async credits(episodeSelection: EpisodeSelection, options?: LanguageOption) {
|
|
||||||
return await this.api.get<TvEpisodeCredit>(
|
|
||||||
`${BASE_EPISODE(episodeSelection)}/credits`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async externalIds(episodeSelection: EpisodeSelection) {
|
|
||||||
return await this.api.get<ExternalIds>(
|
|
||||||
`${BASE_EPISODE(episodeSelection)}/external_ids`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async images(
|
|
||||||
episodeSelection: EpisodeSelection,
|
|
||||||
options?: TvEpisodeImageSearchOptions
|
|
||||||
) {
|
|
||||||
const computedOptions = {
|
|
||||||
include_image_language: options?.include_image_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Images>(
|
|
||||||
`${BASE_EPISODE(episodeSelection)}/images`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async translations(episodeSelection: EpisodeSelection) {
|
|
||||||
return await this.api.get<TvEpisodeTranslations>(
|
|
||||||
`${BASE_EPISODE(episodeSelection)}/translations`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async videos(
|
|
||||||
episodeSelection: EpisodeSelection,
|
|
||||||
options?: TvEpisodeVideoSearchOptions
|
|
||||||
) {
|
|
||||||
const computedOptions = {
|
|
||||||
include_video_language: options?.include_video_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Videos>(
|
|
||||||
`${BASE_EPISODE(episodeSelection)}/videos`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
import {
|
|
||||||
ChangeOption,
|
|
||||||
Changes,
|
|
||||||
Credits,
|
|
||||||
ExternalIds,
|
|
||||||
Images,
|
|
||||||
LanguageOption,
|
|
||||||
TvSeasonChangeValue,
|
|
||||||
SeasonDetails,
|
|
||||||
SeasonSelection,
|
|
||||||
Translations,
|
|
||||||
Videos,
|
|
||||||
AppendToResponseTvSeasonKey,
|
|
||||||
AppendToResponse,
|
|
||||||
AggregateCredits,
|
|
||||||
} from '..';
|
|
||||||
import { BaseEndpoint } from './base';
|
|
||||||
|
|
||||||
const BASE_SEASON = (seasonSelection: SeasonSelection): string => {
|
|
||||||
return `/tv/${seasonSelection.tvShowID}/season/${seasonSelection.seasonNumber}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface TvSeasonImageSearchOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_image_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvSeasonVideoSearchOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_video_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TvSeasonsEndpoint extends BaseEndpoint {
|
|
||||||
constructor(accessToken: string) {
|
|
||||||
super(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
async details<T extends AppendToResponseTvSeasonKey[] | undefined>(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
appendToResponse?: T,
|
|
||||||
options?: LanguageOption
|
|
||||||
) {
|
|
||||||
const combinedOptions = {
|
|
||||||
append_to_response: appendToResponse
|
|
||||||
? appendToResponse.join(',')
|
|
||||||
: undefined,
|
|
||||||
...options,
|
|
||||||
};
|
|
||||||
|
|
||||||
return await this.api.get<AppendToResponse<SeasonDetails, T, 'tvSeason'>>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}`,
|
|
||||||
combinedOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async aggregateCredits(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
options?: LanguageOption
|
|
||||||
) {
|
|
||||||
return await this.api.get<AggregateCredits>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/aggregate_credits`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async changes(seasonId: number, options?: ChangeOption) {
|
|
||||||
return await this.api.get<Changes<TvSeasonChangeValue>>(
|
|
||||||
`/tv/season/${seasonId}/changes`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async credits(seasonSelection: SeasonSelection, options?: LanguageOption) {
|
|
||||||
return await this.api.get<Credits>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/credits`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async externalIds(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
options?: LanguageOption
|
|
||||||
) {
|
|
||||||
return await this.api.get<ExternalIds>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/external_ids`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async images(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
options?: TvSeasonImageSearchOptions
|
|
||||||
) {
|
|
||||||
const computedOptions = {
|
|
||||||
include_image_language: options?.include_image_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Images>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/images`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async videos(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
options?: TvSeasonVideoSearchOptions
|
|
||||||
) {
|
|
||||||
const computedOptions = {
|
|
||||||
include_video_language: options?.include_video_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Videos>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/videos`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async translations(
|
|
||||||
seasonSelection: SeasonSelection,
|
|
||||||
options?: LanguageOption
|
|
||||||
) {
|
|
||||||
return await this.api.get<Translations>(
|
|
||||||
`${BASE_SEASON(seasonSelection)}/translations`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
import { BaseEndpoint } from './base';
|
import { BaseEndpoint } from './base';
|
||||||
import {
|
import {
|
||||||
AggregateCredits,
|
|
||||||
AlternativeTitles,
|
AlternativeTitles,
|
||||||
AppendToResponse,
|
ChangeOptions,
|
||||||
AppendToResponseTvKey,
|
|
||||||
ChangeOption,
|
|
||||||
Changes,
|
|
||||||
ContentRatings,
|
ContentRatings,
|
||||||
Credits,
|
Credits,
|
||||||
EpisodeGroups,
|
EpisodeGroups,
|
||||||
@@ -18,21 +14,20 @@ import {
|
|||||||
PageOption,
|
PageOption,
|
||||||
PopularTvShows,
|
PopularTvShows,
|
||||||
Recommendations,
|
Recommendations,
|
||||||
|
RegionOption,
|
||||||
Reviews,
|
Reviews,
|
||||||
ScreenedTheatrically,
|
ScreenedTheatrically,
|
||||||
SeasonDetails,
|
SeasonDetails,
|
||||||
SimilarTvShows,
|
SimilarTvShows,
|
||||||
TimezoneOption,
|
|
||||||
TopRatedTvShows,
|
TopRatedTvShows,
|
||||||
Translations,
|
Translations,
|
||||||
TvShowImageOptions,
|
TvShowChanges,
|
||||||
TvShowVideoOptions,
|
|
||||||
TvShowChangeValue,
|
|
||||||
TvShowDetails,
|
TvShowDetails,
|
||||||
TvShowsAiringToday,
|
TvShowsAiringToday,
|
||||||
Videos,
|
Videos,
|
||||||
WatchProviders,
|
WatchProviders,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
import { parseOptions } from '../utils';
|
||||||
|
|
||||||
const BASE_TV = '/tv';
|
const BASE_TV = '/tv';
|
||||||
|
|
||||||
@@ -41,21 +36,8 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
super(accessToken);
|
super(accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async details<T extends AppendToResponseTvKey[] | undefined>(
|
async details(id: number): Promise<TvShowDetails> {
|
||||||
id: number,
|
return await this.api.get<TvShowDetails>(`${BASE_TV}/${id}`);
|
||||||
appendToResponse?: T,
|
|
||||||
language?: string
|
|
||||||
) {
|
|
||||||
const options = {
|
|
||||||
append_to_response: appendToResponse
|
|
||||||
? appendToResponse.join(',')
|
|
||||||
: undefined,
|
|
||||||
language: language,
|
|
||||||
};
|
|
||||||
return await this.api.get<AppendToResponse<TvShowDetails, T, 'tvShow'>>(
|
|
||||||
`${BASE_TV}/${id}`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async alternativeTitles(id: number): Promise<AlternativeTitles> {
|
async alternativeTitles(id: number): Promise<AlternativeTitles> {
|
||||||
@@ -64,13 +46,10 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async changes(
|
async changes(id: number, options?: ChangeOptions): Promise<TvShowChanges> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: ChangeOption
|
return await this.api.get<TvShowChanges>(
|
||||||
): Promise<Changes<TvShowChangeValue>> {
|
`${BASE_TV}/${id}/changes?${params}`
|
||||||
return await this.api.get<Changes<TvShowChangeValue>>(
|
|
||||||
`${BASE_TV}/${id}/changes`,
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,18 +59,8 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async aggregateCredits(
|
async credits(id: number): Promise<Credits> {
|
||||||
id: number,
|
return await this.api.get<Credits>(`${BASE_TV}/${id}/credits`);
|
||||||
options?: LanguageOption
|
|
||||||
): Promise<AggregateCredits> {
|
|
||||||
return await this.api.get<AggregateCredits>(
|
|
||||||
`${BASE_TV}/${id}/aggregate_credits`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async credits(id: number, options?: LanguageOption): Promise<Credits> {
|
|
||||||
return await this.api.get<Credits>(`${BASE_TV}/${id}/credits`, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async season(tvId: number, seasonNumber: number): Promise<SeasonDetails> {
|
async season(tvId: number, seasonNumber: number): Promise<SeasonDetails> {
|
||||||
@@ -108,15 +77,8 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<ExternalIds>(`${BASE_TV}/${id}/external_ids`);
|
return await this.api.get<ExternalIds>(`${BASE_TV}/${id}/external_ids`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async images(id: number, options?: TvShowImageOptions): Promise<Images> {
|
async images(id: number): Promise<Images> {
|
||||||
const computedOptions = {
|
return await this.api.get<Images>(`${BASE_TV}/${id}/images`);
|
||||||
include_image_language: options?.include_image_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Images>(
|
|
||||||
`${BASE_TV}/${id}/images`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async keywords(id: number): Promise<Keywords> {
|
async keywords(id: number): Promise<Keywords> {
|
||||||
@@ -125,19 +87,17 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
|
|
||||||
async recommendations(
|
async recommendations(
|
||||||
id: number,
|
id: number,
|
||||||
options?: LanguageOption & PageOption
|
options?: PageOption
|
||||||
): Promise<Recommendations> {
|
): Promise<Recommendations> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<Recommendations>(
|
return await this.api.get<Recommendations>(
|
||||||
`${BASE_TV}/${id}/recommendations`,
|
`${BASE_TV}/${id}/recommendations?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reviews(
|
async reviews(id: number, options?: PageOption): Promise<Reviews> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: LanguageOption & PageOption
|
return await this.api.get<Reviews>(`${BASE_TV}/${id}/reviews?${params}`);
|
||||||
): Promise<Reviews> {
|
|
||||||
return await this.api.get<Reviews>(`${BASE_TV}/${id}/reviews`, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async screenedTheatrically(id: number): Promise<ScreenedTheatrically> {
|
async screenedTheatrically(id: number): Promise<ScreenedTheatrically> {
|
||||||
@@ -146,13 +106,10 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async similar(
|
async similar(id: number, options?: PageOption): Promise<SimilarTvShows> {
|
||||||
id: number,
|
const params = parseOptions(options);
|
||||||
options?: LanguageOption & PageOption
|
|
||||||
): Promise<SimilarTvShows> {
|
|
||||||
return await this.api.get<SimilarTvShows>(
|
return await this.api.get<SimilarTvShows>(
|
||||||
`${BASE_TV}/${id}/similar`,
|
`${BASE_TV}/${id}/similar?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,15 +117,8 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<Translations>(`${BASE_TV}/${id}/translations`);
|
return await this.api.get<Translations>(`${BASE_TV}/${id}/translations`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async videos(id: number, options?: TvShowVideoOptions): Promise<Videos> {
|
async videos(id: number): Promise<Videos> {
|
||||||
const computedOptions = {
|
return await this.api.get<Videos>(`${BASE_TV}/${id}/videos`);
|
||||||
include_video_language: options?.include_video_language?.join(','),
|
|
||||||
language: options?.language,
|
|
||||||
};
|
|
||||||
return await this.api.get<Videos>(
|
|
||||||
`${BASE_TV}/${id}/videos`,
|
|
||||||
computedOptions
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,30 +135,32 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
|||||||
return await this.api.get<LatestTvShows>(`${BASE_TV}/latest`);
|
return await this.api.get<LatestTvShows>(`${BASE_TV}/latest`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onTheAir(
|
async onTheAir(): Promise<OnTheAir> {
|
||||||
options?: PageOption & LanguageOption & TimezoneOption
|
return await this.api.get<OnTheAir>(`${BASE_TV}/on_the_air`);
|
||||||
): Promise<OnTheAir> {
|
|
||||||
return await this.api.get<OnTheAir>(`${BASE_TV}/on_the_air`, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async airingToday(
|
async airingToday(
|
||||||
options?: PageOption & LanguageOption & TimezoneOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<TvShowsAiringToday> {
|
): Promise<TvShowsAiringToday> {
|
||||||
|
const params = parseOptions(options);
|
||||||
return await this.api.get<TvShowsAiringToday>(
|
return await this.api.get<TvShowsAiringToday>(
|
||||||
`${BASE_TV}/airing_today`,
|
`${BASE_TV}/airing_today?${params}`
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async popular(
|
async popular(
|
||||||
options?: PageOption & LanguageOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<PopularTvShows> {
|
): Promise<PopularTvShows> {
|
||||||
return await this.api.get<PopularTvShows>(`${BASE_TV}/popular`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<PopularTvShows>(`${BASE_TV}/popular?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async topRated(
|
async topRated(
|
||||||
options?: PageOption & LanguageOption
|
options?: PageOption & LanguageOption & RegionOption
|
||||||
): Promise<TopRatedTvShows> {
|
): Promise<TopRatedTvShows> {
|
||||||
return await this.api.get<TopRatedTvShows>(`${BASE_TV}/top_rated`, options);
|
const params = parseOptions(options);
|
||||||
|
return await this.api.get<TopRatedTvShows>(
|
||||||
|
`${BASE_TV}/top_rated?${params}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { TMDB } from './tmdb';
|
import TMDB from './tmdb';
|
||||||
|
|
||||||
export * from './types';
|
export * from './types';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
|
|
||||||
export { TMDB };
|
export default TMDB;
|
||||||
|
|||||||
22
src/tmdb.ts
22
src/tmdb.ts
@@ -15,13 +15,9 @@ import {
|
|||||||
FindEndpoint,
|
FindEndpoint,
|
||||||
KeywordsEndpoint,
|
KeywordsEndpoint,
|
||||||
CollectionsEndpoint,
|
CollectionsEndpoint,
|
||||||
TvSeasonsEndpoint,
|
|
||||||
TvEpisodesEndpoint,
|
|
||||||
} from './endpoints';
|
} from './endpoints';
|
||||||
import { CompaniesEndpoint } from './endpoints/companies';
|
|
||||||
import { NetworksEndpoint } from './endpoints/networks';
|
|
||||||
|
|
||||||
export class TMDB {
|
export default class TMDB {
|
||||||
private readonly accessToken: string;
|
private readonly accessToken: string;
|
||||||
|
|
||||||
constructor(accessToken: string) {
|
constructor(accessToken: string) {
|
||||||
@@ -48,14 +44,6 @@ export class TMDB {
|
|||||||
return new CreditsEndpoint(this.accessToken);
|
return new CreditsEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get companies(): CompaniesEndpoint {
|
|
||||||
return new CompaniesEndpoint(this.accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
get networks(): NetworksEndpoint {
|
|
||||||
return new NetworksEndpoint(this.accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
get search(): SearchEndpoint {
|
get search(): SearchEndpoint {
|
||||||
return new SearchEndpoint(this.accessToken);
|
return new SearchEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
@@ -72,10 +60,6 @@ export class TMDB {
|
|||||||
return new TvShowsEndpoint(this.accessToken);
|
return new TvShowsEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get tvEpisode(): TvEpisodesEndpoint {
|
|
||||||
return new TvEpisodesEndpoint(this.accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
get discover(): DiscoverEndpoint {
|
get discover(): DiscoverEndpoint {
|
||||||
return new DiscoverEndpoint(this.accessToken);
|
return new DiscoverEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
@@ -103,8 +87,4 @@ export class TMDB {
|
|||||||
get collections(): CollectionsEndpoint {
|
get collections(): CollectionsEndpoint {
|
||||||
return new CollectionsEndpoint(this.accessToken);
|
return new CollectionsEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get tvSeasons(): TvSeasonsEndpoint {
|
|
||||||
return new TvSeasonsEndpoint(this.accessToken);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
export interface MediaChange {
|
export interface Change {
|
||||||
id: number;
|
id: number;
|
||||||
adult: boolean | undefined;
|
adult: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MediaChanges {
|
export interface Changes {
|
||||||
results: MediaChange[];
|
results: Change[];
|
||||||
page: number;
|
page: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
total_results: number;
|
total_results: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Changes<T> {
|
export interface ChangeOptions {
|
||||||
changes: Change<T>[];
|
end_date?: string;
|
||||||
}
|
start_date?: string;
|
||||||
|
page?: number;
|
||||||
export interface Change<T> {
|
|
||||||
key: string;
|
|
||||||
items: ChangeItem<T>[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ChangeItem<T> {
|
|
||||||
id: string;
|
|
||||||
action: string;
|
|
||||||
time: string;
|
|
||||||
value: T;
|
|
||||||
iso_639_1: string;
|
|
||||||
original_value: T;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { LanguageOption, Movie } from '.';
|
import { Movie } from '.';
|
||||||
|
|
||||||
export interface Collection {
|
export interface Collection {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -14,10 +14,3 @@ export interface Collection {
|
|||||||
export interface DetailedCollection extends Collection {
|
export interface DetailedCollection extends Collection {
|
||||||
parts: Movie[];
|
parts: Movie[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollectionImageOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_image_language?: string[];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
import { Image } from '.';
|
|
||||||
|
|
||||||
export interface CompanyDetails {
|
|
||||||
description: string;
|
|
||||||
headquarters: string;
|
|
||||||
homepage: string;
|
|
||||||
id: number;
|
|
||||||
logo_path: string;
|
|
||||||
name: string;
|
|
||||||
origin_country: string;
|
|
||||||
parent_company: ParentCompany;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ParentCompany {
|
|
||||||
name: string;
|
|
||||||
id: number;
|
|
||||||
logo_path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AlternativeNames {
|
|
||||||
id: number;
|
|
||||||
results: Name[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Name {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CompanyImages {
|
|
||||||
id: number;
|
|
||||||
logos: Image[];
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface ImageConfiguration {
|
export interface Images {
|
||||||
base_url: string;
|
base_url: string;
|
||||||
secure_base_url: string;
|
secure_base_url: string;
|
||||||
backdrop_sizes: BackdropSizes[];
|
backdrop_sizes: BackdropSizes[];
|
||||||
@@ -9,7 +9,7 @@ export interface ImageConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Configuration {
|
export interface Configuration {
|
||||||
images: ImageConfiguration;
|
images: Images;
|
||||||
change_keys: ChangeKeys[];
|
change_keys: ChangeKeys[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,49 +101,3 @@ export interface Videos {
|
|||||||
id: number;
|
id: number;
|
||||||
results: Video[];
|
results: Video[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AggregateCredits {
|
|
||||||
id: number;
|
|
||||||
cast: AggregateCast[];
|
|
||||||
crew: AggregateCrew[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CastRole {
|
|
||||||
credit_id: string;
|
|
||||||
character: string;
|
|
||||||
episode_count: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AggregateCast {
|
|
||||||
adult: boolean;
|
|
||||||
gender: number;
|
|
||||||
id: number;
|
|
||||||
known_for_department: string;
|
|
||||||
name: string;
|
|
||||||
original_name: string;
|
|
||||||
popularity: number;
|
|
||||||
profile_path: string;
|
|
||||||
roles: CastRole[];
|
|
||||||
total_episode_count: number;
|
|
||||||
order: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CrewJob {
|
|
||||||
credit_id: string;
|
|
||||||
job: string;
|
|
||||||
episode_count: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AggregateCrew {
|
|
||||||
adult: boolean;
|
|
||||||
gender: number;
|
|
||||||
id: number;
|
|
||||||
known_for_department: string;
|
|
||||||
name: string;
|
|
||||||
original_name: string;
|
|
||||||
popularity: number;
|
|
||||||
profile_path: string;
|
|
||||||
jobs: CrewJob[];
|
|
||||||
department: string;
|
|
||||||
total_episode_count: number;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
export * from './options';
|
export * from './options';
|
||||||
export * from './certification';
|
export * from './certification';
|
||||||
export * from './credits';
|
export * from './credits';
|
||||||
export * from './companies';
|
|
||||||
export * from './networks';
|
|
||||||
export * from './configuration';
|
export * from './configuration';
|
||||||
export * from './changes';
|
export * from './changes';
|
||||||
export * from './movies';
|
export * from './movies';
|
||||||
@@ -16,16 +14,6 @@ export * from './trending';
|
|||||||
export * from './find';
|
export * from './find';
|
||||||
export * from './keywords';
|
export * from './keywords';
|
||||||
export * from './collections';
|
export * from './collections';
|
||||||
export * from './tv-episode';
|
|
||||||
export * from './tv-seasons';
|
|
||||||
|
|
||||||
export interface ErrorResponse {
|
|
||||||
status_code: number;
|
|
||||||
status_message: string;
|
|
||||||
success: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type MediaType = 'movie' | 'tv' | 'person';
|
|
||||||
|
|
||||||
export interface AuthorDetails {
|
export interface AuthorDetails {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -34,7 +22,23 @@ export interface AuthorDetails {
|
|||||||
rating?: number;
|
rating?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type KnownFor = MovieWithMediaType | TVWithMediaType;
|
export interface KnownFor {
|
||||||
|
id: number;
|
||||||
|
overview: string;
|
||||||
|
release_date: string;
|
||||||
|
video: boolean;
|
||||||
|
adult: boolean;
|
||||||
|
backdrop_path: string;
|
||||||
|
media_type: string;
|
||||||
|
genre_ids: number[];
|
||||||
|
title: string;
|
||||||
|
original_language: string;
|
||||||
|
original_title: string;
|
||||||
|
poster_path: string;
|
||||||
|
vote_count: number;
|
||||||
|
vote_average: number;
|
||||||
|
popularity: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Person {
|
export interface Person {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -47,10 +51,6 @@ export interface Person {
|
|||||||
popularity: number;
|
popularity: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonWithMediaType extends Person {
|
|
||||||
media_type: 'person';
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Movie {
|
export interface Movie {
|
||||||
id: number;
|
id: number;
|
||||||
poster_path: string;
|
poster_path: string;
|
||||||
@@ -68,10 +68,6 @@ export interface Movie {
|
|||||||
vote_average: number;
|
vote_average: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MovieWithMediaType extends Movie {
|
|
||||||
media_type: 'movie';
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Company {
|
export interface Company {
|
||||||
id: number;
|
id: number;
|
||||||
logo_path: string;
|
logo_path: string;
|
||||||
@@ -95,10 +91,6 @@ export interface TV {
|
|||||||
vote_average: number;
|
vote_average: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TVWithMediaType extends TV {
|
|
||||||
media_type: 'tv';
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Genre {
|
export interface Genre {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -136,7 +128,6 @@ export interface ContentRatings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ContentRatingsResult {
|
export interface ContentRatingsResult {
|
||||||
descriptor: unknown[];
|
|
||||||
iso_3166_1: string;
|
iso_3166_1: string;
|
||||||
rating: string;
|
rating: string;
|
||||||
}
|
}
|
||||||
@@ -211,10 +202,3 @@ export interface Image {
|
|||||||
vote_count: number;
|
vote_count: number;
|
||||||
width: number;
|
width: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Images {
|
|
||||||
id: number;
|
|
||||||
backdrops: Image[];
|
|
||||||
logos: Image[];
|
|
||||||
posters: Image[];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Movie } from '.';
|
import { Movie } from '.';
|
||||||
import { PageOption } from './options';
|
|
||||||
|
|
||||||
export interface KeywordsOptions extends PageOption {
|
export interface KeywordsOptions {
|
||||||
include_adult?: boolean;
|
include_adult?: boolean;
|
||||||
language?: string;
|
language?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,24 @@ export interface MovieLists {
|
|||||||
total_results: number;
|
total_results: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MovieChangeItem {
|
||||||
|
id: string;
|
||||||
|
action: string;
|
||||||
|
time: string;
|
||||||
|
iso_639_1: string;
|
||||||
|
value: string;
|
||||||
|
original_value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MovieChange {
|
||||||
|
key: string;
|
||||||
|
items: MovieChangeItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MovieChanges {
|
||||||
|
changes: MovieChange[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface LatestMovie {
|
export interface LatestMovie {
|
||||||
adult: boolean;
|
adult: boolean;
|
||||||
backdrop_path?: string;
|
backdrop_path?: string;
|
||||||
@@ -155,14 +173,3 @@ export interface UpcomingMovies {
|
|||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MovieChangeValue =
|
|
||||||
| string
|
|
||||||
| {
|
|
||||||
person_id: number;
|
|
||||||
character: string;
|
|
||||||
order: number;
|
|
||||||
cast_id: number;
|
|
||||||
credit_id: string;
|
|
||||||
}
|
|
||||||
| unknown;
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import { Image } from '.';
|
|
||||||
|
|
||||||
export interface NetworkDetails {
|
|
||||||
headquarters: string;
|
|
||||||
homepage: string;
|
|
||||||
id: number;
|
|
||||||
logo_path: string;
|
|
||||||
name: string;
|
|
||||||
origin_country: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NetworkImages {
|
|
||||||
id: number;
|
|
||||||
logos: Image[];
|
|
||||||
}
|
|
||||||
@@ -1,37 +1,3 @@
|
|||||||
import {
|
|
||||||
AlternativeTitles,
|
|
||||||
Changes,
|
|
||||||
ContentRatings,
|
|
||||||
Credits,
|
|
||||||
EpisodeGroups,
|
|
||||||
ExternalIds,
|
|
||||||
Images,
|
|
||||||
Keywords,
|
|
||||||
MovieLists,
|
|
||||||
PeopleImages,
|
|
||||||
PersonTranslations,
|
|
||||||
PersonCombinedCredits,
|
|
||||||
PersonMovieCredit,
|
|
||||||
PersonTvShowCredit,
|
|
||||||
Recommendations,
|
|
||||||
ReleaseDates,
|
|
||||||
Reviews,
|
|
||||||
ScreenedTheatrically,
|
|
||||||
SimilarMovies,
|
|
||||||
SimilarTvShows,
|
|
||||||
TaggedImages,
|
|
||||||
Translations,
|
|
||||||
Videos,
|
|
||||||
WatchProviders,
|
|
||||||
PersonChangeValue,
|
|
||||||
MovieChangeValue,
|
|
||||||
TvShowChangeValue,
|
|
||||||
TvEpisodeChangeValue,
|
|
||||||
TvEpisodeCredit,
|
|
||||||
TvEpisodeTranslations,
|
|
||||||
TvSeasonChangeValue,
|
|
||||||
} from '.';
|
|
||||||
|
|
||||||
export interface LanguageOption {
|
export interface LanguageOption {
|
||||||
language?: string;
|
language?: string;
|
||||||
}
|
}
|
||||||
@@ -40,201 +6,6 @@ export interface RegionOption {
|
|||||||
region?: string;
|
region?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TimezoneOption {
|
|
||||||
timezone?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PageOption {
|
export interface PageOption {
|
||||||
page?: number;
|
page?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChangeOption extends PageOption {
|
|
||||||
start_date?: Date;
|
|
||||||
end_date?: Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AppendToResponseMovieKey =
|
|
||||||
| 'images'
|
|
||||||
| 'videos'
|
|
||||||
| 'credits'
|
|
||||||
| 'recommendations'
|
|
||||||
| 'reviews'
|
|
||||||
| 'changes'
|
|
||||||
| 'similar'
|
|
||||||
| 'lists'
|
|
||||||
| 'release_dates'
|
|
||||||
| 'alternative_titles'
|
|
||||||
| 'external_ids'
|
|
||||||
| 'translations'
|
|
||||||
| 'watch/providers'
|
|
||||||
| 'keywords';
|
|
||||||
|
|
||||||
export type AppendToResponseTvKey =
|
|
||||||
| 'content_ratings'
|
|
||||||
| 'images'
|
|
||||||
| 'videos'
|
|
||||||
| 'credits'
|
|
||||||
| 'recommendations'
|
|
||||||
| 'reviews'
|
|
||||||
| 'changes'
|
|
||||||
| 'similar'
|
|
||||||
| 'alternative_titles'
|
|
||||||
| 'external_ids'
|
|
||||||
| 'translations'
|
|
||||||
| 'watch/providers'
|
|
||||||
| 'aggregate_credits'
|
|
||||||
| 'episode_groups'
|
|
||||||
| 'screened_theatrically'
|
|
||||||
| 'keywords';
|
|
||||||
|
|
||||||
export type AppendToResponsePersonKey =
|
|
||||||
| 'images'
|
|
||||||
| 'changes'
|
|
||||||
| 'movie_credits'
|
|
||||||
| 'tv_credits'
|
|
||||||
| 'combined_credits'
|
|
||||||
| 'external_ids'
|
|
||||||
| 'tagged_images'
|
|
||||||
| 'translations';
|
|
||||||
|
|
||||||
export type AppendToResponseTvEpisodeKey =
|
|
||||||
| 'images'
|
|
||||||
| 'credits'
|
|
||||||
| 'external_ids'
|
|
||||||
| 'videos'
|
|
||||||
| 'translations';
|
|
||||||
|
|
||||||
export type AppendToResponseTvSeasonKey =
|
|
||||||
| 'images'
|
|
||||||
| 'credits'
|
|
||||||
| 'external_ids'
|
|
||||||
| 'videos'
|
|
||||||
| 'aggregate_credits'
|
|
||||||
| 'translations';
|
|
||||||
|
|
||||||
type AppendToResponseAllKeys =
|
|
||||||
| AppendToResponseTvKey
|
|
||||||
| AppendToResponseMovieKey
|
|
||||||
| AppendToResponseTvEpisodeKey
|
|
||||||
| AppendToResponseTvSeasonKey
|
|
||||||
| AppendToResponsePersonKey;
|
|
||||||
|
|
||||||
export type AppendToResponseMediaType =
|
|
||||||
| 'movie'
|
|
||||||
| 'tvShow'
|
|
||||||
| 'person'
|
|
||||||
| 'tvSeason'
|
|
||||||
| 'tvEpisode';
|
|
||||||
|
|
||||||
export type AppendToResponse<
|
|
||||||
K,
|
|
||||||
T extends AppendToResponseAllKeys[] | undefined,
|
|
||||||
Media extends AppendToResponseMediaType
|
|
||||||
> = K &
|
|
||||||
(T extends undefined
|
|
||||||
? object
|
|
||||||
: T extends Array<unknown>
|
|
||||||
? ('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<
|
|
||||||
Media extends 'person' ? PeopleImages : Images,
|
|
||||||
'id'
|
|
||||||
>;
|
|
||||||
}
|
|
||||||
: object) &
|
|
||||||
('recommendations' extends T[number]
|
|
||||||
? { recommendations: Recommendations }
|
|
||||||
: object) &
|
|
||||||
('reviews' extends T[number]
|
|
||||||
? { 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'
|
|
||||||
? 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 { Movie, Person, TV } from '.';
|
||||||
|
|
||||||
interface Cast {
|
interface Cast {
|
||||||
character: string;
|
character: string;
|
||||||
@@ -79,7 +79,7 @@ export interface PersonCombinedCredits {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonDetails {
|
export interface PersonDetail {
|
||||||
birthday: string;
|
birthday: string;
|
||||||
known_for_department: string;
|
known_for_department: string;
|
||||||
deathday: string;
|
deathday: string;
|
||||||
@@ -96,13 +96,22 @@ export interface PersonDetails {
|
|||||||
homepage: string;
|
homepage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PersonChangeValue =
|
export interface PersonChange {
|
||||||
| string
|
id: string;
|
||||||
| {
|
action: string;
|
||||||
profile: {
|
time: string;
|
||||||
file_path: string;
|
iso_639_1: string;
|
||||||
};
|
iso_3166_1: string;
|
||||||
};
|
value: string | { profile: { file_path: string } };
|
||||||
|
original_value: string | { profile: { file_path: string } };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PersonChanges {
|
||||||
|
changes: {
|
||||||
|
key: string;
|
||||||
|
items: PersonChange[];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface PopularPersons {
|
export interface PopularPersons {
|
||||||
page: number;
|
page: number;
|
||||||
@@ -111,11 +120,6 @@ export interface PopularPersons {
|
|||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeopleImages {
|
|
||||||
id: number;
|
|
||||||
profiles: Image[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TaggedImage {
|
export interface TaggedImage {
|
||||||
aspect_ratio: number;
|
aspect_ratio: number;
|
||||||
file_path: string;
|
file_path: string;
|
||||||
@@ -137,7 +141,7 @@ export interface TaggedImages {
|
|||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonTranslations {
|
export interface PeopleTranslations {
|
||||||
id: number;
|
id: number;
|
||||||
translations: {
|
translations: {
|
||||||
iso_3166_1: string;
|
iso_3166_1: string;
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
import { MovieWithMediaType, PersonWithMediaType, TVWithMediaType } from '.';
|
|
||||||
|
|
||||||
export interface Search<T> {
|
export interface Search<T> {
|
||||||
page: number;
|
page: number;
|
||||||
results: T[];
|
results: T[];
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
total_results: number;
|
total_results: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MultiSearchResult =
|
|
||||||
| MovieWithMediaType
|
|
||||||
| TVWithMediaType
|
|
||||||
| PersonWithMediaType;
|
|
||||||
|
|||||||
@@ -1,28 +1,19 @@
|
|||||||
import {
|
import { Movie, Person, TV } from '.';
|
||||||
Movie,
|
export type MediaType = 'all' | 'movie' | 'tv' | 'person';
|
||||||
Person,
|
|
||||||
TV,
|
|
||||||
MediaType,
|
|
||||||
MovieWithMediaType,
|
|
||||||
TVWithMediaType,
|
|
||||||
PersonWithMediaType,
|
|
||||||
} from '.';
|
|
||||||
|
|
||||||
export type TimeWindow = 'day' | 'week';
|
export type TimeWindow = 'day' | 'week';
|
||||||
|
|
||||||
export type TrendingMediaType = MediaType | 'all';
|
type TrendingResult<T extends MediaType> = 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;
|
: TV | Movie | Person;
|
||||||
|
|
||||||
export interface TrendingResults<T extends TrendingMediaType> {
|
export interface TrendingResults<T extends MediaType> {
|
||||||
page: number;
|
page: number;
|
||||||
results: TrendingResult<T>[];
|
results: (TrendingResult<T> & { media_type: MediaType })[];
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
total_results: number;
|
total_results: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
import { Credits, Crew } from '.';
|
|
||||||
|
|
||||||
export interface EpisodeSelection {
|
|
||||||
tvShowID: number;
|
|
||||||
seasonNumber: number;
|
|
||||||
episodeNumber: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Episode {
|
|
||||||
air_date: string;
|
|
||||||
episode_number: number;
|
|
||||||
crew: Crew[];
|
|
||||||
guest_stars: GuestStar[];
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
overview: string;
|
|
||||||
production_code: string;
|
|
||||||
season_number: number;
|
|
||||||
still_path: string;
|
|
||||||
vote_average: number;
|
|
||||||
vote_count: number;
|
|
||||||
runtime: number;
|
|
||||||
show_id: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GuestStar {
|
|
||||||
credit_id: string;
|
|
||||||
order: number;
|
|
||||||
character: string;
|
|
||||||
adult: boolean;
|
|
||||||
gender: number | null;
|
|
||||||
id: number;
|
|
||||||
known_for_department: string;
|
|
||||||
name: string;
|
|
||||||
original_name: string;
|
|
||||||
popularity: number;
|
|
||||||
profile_path: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvEpisodeCredit extends Credits {
|
|
||||||
guest_stars: GuestStar[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvEpisodeTranslations {
|
|
||||||
id: number;
|
|
||||||
translations: {
|
|
||||||
iso_3166_1: string;
|
|
||||||
iso_639_1: string;
|
|
||||||
name: string;
|
|
||||||
english_name: string;
|
|
||||||
data: {
|
|
||||||
name: string;
|
|
||||||
overview: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TvEpisodeChangeValue = string | unknown;
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { Episode } from '.';
|
|
||||||
|
|
||||||
export interface SeasonSelection {
|
|
||||||
tvShowID: number;
|
|
||||||
seasonNumber: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SeasonDetails {
|
|
||||||
air_date: string;
|
|
||||||
episodes: Episode[];
|
|
||||||
name: string;
|
|
||||||
overview: string;
|
|
||||||
id: number;
|
|
||||||
poster_path: string | null;
|
|
||||||
season_number: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TvSeasonChangeValue =
|
|
||||||
| string
|
|
||||||
| {
|
|
||||||
episode_id: number;
|
|
||||||
episode_number: number;
|
|
||||||
};
|
|
||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
ProductionCompany,
|
ProductionCompany,
|
||||||
ProductionCountry,
|
ProductionCountry,
|
||||||
SpokenLanguage,
|
SpokenLanguage,
|
||||||
LanguageOption,
|
Crew,
|
||||||
} from './';
|
} from './';
|
||||||
|
|
||||||
export interface CreatedBy {
|
export interface CreatedBy {
|
||||||
@@ -93,6 +93,65 @@ export interface TvShowDetails {
|
|||||||
vote_count: number;
|
vote_count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GuestStar {
|
||||||
|
credit_id: string;
|
||||||
|
order: number;
|
||||||
|
character: string;
|
||||||
|
adult: boolean;
|
||||||
|
gender: number | null;
|
||||||
|
id: number;
|
||||||
|
known_for_department: string;
|
||||||
|
name: string;
|
||||||
|
original_name: string;
|
||||||
|
popularity: number;
|
||||||
|
profile_path: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Episode {
|
||||||
|
air_date: string;
|
||||||
|
episode_number: number;
|
||||||
|
crew: Crew[];
|
||||||
|
guest_stars: GuestStar[];
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
overview: string;
|
||||||
|
production_code: string;
|
||||||
|
season_number: number;
|
||||||
|
still_path: string;
|
||||||
|
vote_average: number;
|
||||||
|
vote_count: number;
|
||||||
|
show_id: number;
|
||||||
|
runtime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SeasonDetails {
|
||||||
|
air_date: string;
|
||||||
|
episodes: Episode[];
|
||||||
|
name: string;
|
||||||
|
overview: string;
|
||||||
|
id: number;
|
||||||
|
poster_path: string | null;
|
||||||
|
season_number: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TvShowItem {
|
||||||
|
id: string;
|
||||||
|
action: string;
|
||||||
|
time: string;
|
||||||
|
value: Array<number>;
|
||||||
|
iso_639_1: string;
|
||||||
|
original_value: Array<number>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TvShowChange {
|
||||||
|
key: string;
|
||||||
|
items: TvShowItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TvShowChanges {
|
||||||
|
changes: TvShowChange[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface Network {
|
export interface Network {
|
||||||
id: number;
|
id: number;
|
||||||
logo_path: string;
|
logo_path: string;
|
||||||
@@ -269,22 +328,3 @@ export interface TopRatedTvShows {
|
|||||||
total_results: number;
|
total_results: number;
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TvShowChangeValue {
|
|
||||||
season_id: number;
|
|
||||||
season_number: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvShowImageOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_image_language?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TvShowVideoOptions extends LanguageOption {
|
|
||||||
/**
|
|
||||||
* a list of ISO-639-1 values to query
|
|
||||||
*/
|
|
||||||
include_video_language?: string[];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function parseOptions(options?: Record<string, any>): string {
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
export function parseOptions(options?: { [s: string]: any }): string {
|
||||||
return options ? new URLSearchParams(Object.entries(options)).toString() : '';
|
return options ? new URLSearchParams(Object.entries(options)).toString() : '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,28 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
"target": "es2020" /* 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",
|
|
||||||
"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. */,
|
||||||
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"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'. */,
|
||||||
|
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
||||||
|
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
||||||
"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"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"include": ["src"],
|
"include": [
|
||||||
"exclude": ["node_modules", "dist", "./src/types/*.ts"]
|
"src"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"./src/types/*.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user