Compare commits
1 Commits
v1
...
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}}
|
||||
294
package-lock.json
generated
294
package-lock.json
generated
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "tmdb-ts",
|
||||
"version": "0.2.0",
|
||||
"version": "0.1.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tmdb-ts",
|
||||
"version": "0.2.0",
|
||||
"version": "0.1.8",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/node": "^15.3.0",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||
"@typescript-eslint/parser": "^5.58.0",
|
||||
@@ -23,22 +23,10 @@
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"husky": "^8.0.3",
|
||||
"prettier": "^2.8.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"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": {
|
||||
"version": "4.4.0",
|
||||
"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==",
|
||||
"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": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@@ -215,30 +178,6 @@
|
||||
"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": {
|
||||
"version": "7.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
||||
@@ -253,9 +192,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.15.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
||||
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
||||
"version": "15.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.3.0.tgz",
|
||||
"integrity": "sha512-8/bnjSZD86ZfpBsDlCIkNXIvm+h6wi9g7IqL+kmFkQ+Wvu3JrasgLElfiPgoo8V8vVfnEi0QVS12gbl94h9YsQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
@@ -472,10 +411,11 @@
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -492,15 +432,6 @@
|
||||
"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": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
@@ -673,6 +604,12 @@
|
||||
"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": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
@@ -1360,6 +1297,18 @@
|
||||
"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": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
|
||||
@@ -2715,6 +2664,25 @@
|
||||
"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": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
||||
@@ -2843,46 +2811,29 @@
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"version": "9.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
|
||||
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
|
||||
"dev": true,
|
||||
"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",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"source-map-support": "^0.5.17",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"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-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
"peerDependencies": {
|
||||
"typescript": ">=2.7"
|
||||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
@@ -2994,12 +2945,6 @@
|
||||
"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": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
@@ -3109,15 +3054,6 @@
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"version": "4.4.0",
|
||||
"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==",
|
||||
"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": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@@ -3250,30 +3164,6 @@
|
||||
"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": {
|
||||
"version": "7.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
||||
@@ -3288,9 +3178,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.15.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
||||
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
||||
"version": "15.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.3.0.tgz",
|
||||
"integrity": "sha512-8/bnjSZD86ZfpBsDlCIkNXIvm+h6wi9g7IqL+kmFkQ+Wvu3JrasgLElfiPgoo8V8vVfnEi0QVS12gbl94h9YsQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
@@ -3417,10 +3307,11 @@
|
||||
}
|
||||
},
|
||||
"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
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "5.3.2",
|
||||
@@ -3429,12 +3320,6 @@
|
||||
"dev": true,
|
||||
"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": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
@@ -3561,6 +3446,12 @@
|
||||
"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": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
@@ -4078,6 +3969,14 @@
|
||||
"acorn": "^8.8.0",
|
||||
"acorn-jsx": "^5.3.2",
|
||||
"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": {
|
||||
@@ -5028,6 +4927,22 @@
|
||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
||||
"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": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
||||
@@ -5120,23 +5035,16 @@
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"version": "9.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
|
||||
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
|
||||
"dev": true,
|
||||
"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",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"source-map-support": "^0.5.17",
|
||||
"yn": "3.1.1"
|
||||
}
|
||||
},
|
||||
@@ -5221,12 +5129,6 @@
|
||||
"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": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tmdb-ts",
|
||||
"version": "1.0.0",
|
||||
"version": "0.1.9",
|
||||
"description": "TMDB v3 library wrapper",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -30,7 +30,7 @@
|
||||
"author": "Blake Joynes",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/node": "^15.3.0",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||
"@typescript-eslint/parser": "^5.58.0",
|
||||
@@ -41,16 +41,16 @@
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"husky": "^8.0.3",
|
||||
"prettier": "^2.8.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"volta": {
|
||||
"node": "18.16.0",
|
||||
"yarn": "1.22.4",
|
||||
"npm": "9.5.1"
|
||||
"node": "15.13.0",
|
||||
"yarn": "1.19.2",
|
||||
"npm": "7.12.1"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import fetch from 'cross-fetch';
|
||||
import { parseOptions } from './utils';
|
||||
|
||||
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
||||
|
||||
export class Api {
|
||||
export default class Api {
|
||||
constructor(private accessToken: string) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
async get<T>(path: string, options?: Record<string, any>): Promise<T> {
|
||||
const params = parseOptions(options);
|
||||
const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
|
||||
async get<T>(path: string): Promise<T> {
|
||||
const response = await fetch(`${BASE_URL_V3}${path}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.accessToken}`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Api } from '../api';
|
||||
import Api from '../api';
|
||||
|
||||
export class BaseEndpoint {
|
||||
protected api: Api;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseEndpoint } from './base';
|
||||
import { ChangeOptions, Changes } from '../types/changes';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
export class ChangeEndpoint extends BaseEndpoint {
|
||||
constructor(protected readonly accessToken: string) {
|
||||
@@ -7,14 +8,17 @@ export class ChangeEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async movies(options?: ChangeOptions): Promise<Changes> {
|
||||
return await this.api.get<Changes>(`/movie/changes`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Changes>(`/movie/changes?${params}`);
|
||||
}
|
||||
|
||||
async tvShows(options?: ChangeOptions): Promise<Changes> {
|
||||
return await this.api.get<Changes>(`/tv/changes`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Changes>(`/tv/changes?${params}`);
|
||||
}
|
||||
|
||||
async person(options?: ChangeOptions): Promise<Changes> {
|
||||
return await this.api.get<Changes>(`/person/change`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Changes>(`/person/changes${params}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
LanguageOption,
|
||||
Translations,
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
import { BaseEndpoint } from './base';
|
||||
|
||||
const BASE_COLLECTION = '/collection';
|
||||
@@ -17,16 +18,16 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
||||
id: number,
|
||||
options?: LanguageOption
|
||||
): Promise<DetailedCollection> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<DetailedCollection>(
|
||||
`${BASE_COLLECTION}/${id}`,
|
||||
options
|
||||
`${BASE_COLLECTION}/${id}?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async images(id: number, options?: LanguageOption): Promise<ImageCollection> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<ImageCollection>(
|
||||
`${BASE_COLLECTION}/${id}/images`,
|
||||
options
|
||||
`${BASE_COLLECTION}/${id}/images?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,9 +35,9 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
||||
id: number,
|
||||
options?: LanguageOption
|
||||
): Promise<Translations> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Translations>(
|
||||
`${BASE_COLLECTION}/${id}/translations`,
|
||||
options
|
||||
`${BASE_COLLECTION}/${id}/translations?${params}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
SortOption,
|
||||
TvShowDiscoverResult,
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
import { BaseEndpoint } from './base';
|
||||
|
||||
const BASE_DISCOVER = '/discover';
|
||||
@@ -69,16 +70,16 @@ export class DiscoverEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<MovieDiscoverResult>(
|
||||
`${BASE_DISCOVER}/movie`,
|
||||
options
|
||||
`${BASE_DISCOVER}/movie?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async tvShow(options?: TvShowQueryOptions): Promise<TvShowDiscoverResult> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TvShowDiscoverResult>(
|
||||
`${BASE_DISCOVER}/tv`,
|
||||
options
|
||||
`${BASE_DISCOVER}/tv?${params}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseEndpoint } from './base';
|
||||
import { ExternalIdOptions, FindResult } from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
export class FindEndpoint extends BaseEndpoint {
|
||||
constructor(accessToken: string) {
|
||||
@@ -10,6 +11,7 @@ export class FindEndpoint extends BaseEndpoint {
|
||||
externalId: string,
|
||||
options: ExternalIdOptions
|
||||
): 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,5 +1,6 @@
|
||||
import { BaseEndpoint } from './base';
|
||||
import { BelongingMovies, Keyword, KeywordsOptions } from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
const BASE_Keyword = '/keyword';
|
||||
|
||||
@@ -16,9 +17,9 @@ export class KeywordsEndpoint extends BaseEndpoint {
|
||||
keywordId: number,
|
||||
options?: KeywordsOptions
|
||||
): Promise<BelongingMovies> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<BelongingMovies>(
|
||||
`${BASE_Keyword}/${keywordId}/movies`,
|
||||
options
|
||||
`${BASE_Keyword}/${keywordId}/movies?${params}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
Videos,
|
||||
WatchProviders,
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
const BASE_MOVIE = '/movie';
|
||||
|
||||
@@ -44,9 +45,9 @@ export class MoviesEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async changes(id: number, options?: ChangeOptions): Promise<MovieChanges> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<MovieChanges>(
|
||||
`${BASE_MOVIE}/${id}/changes`,
|
||||
options
|
||||
`${BASE_MOVIE}/${id}/changes?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,16 +71,19 @@ export class MoviesEndpoint extends BaseEndpoint {
|
||||
id: number,
|
||||
options?: LanguageOption | PageOption
|
||||
): 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(
|
||||
id: number,
|
||||
options?: PageOption
|
||||
): Promise<Recommendations> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Recommendations>(
|
||||
`${BASE_MOVIE}/${id}/recommendations`,
|
||||
options
|
||||
`${BASE_MOVIE}/${id}/recommendations?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,13 +94,14 @@ export class MoviesEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async reviews(id: number, options?: PageOption): Promise<Reviews> {
|
||||
return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews?${params}`);
|
||||
}
|
||||
|
||||
async similar(id: number, options?: PageOption): Promise<SimilarMovies> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<SimilarMovies>(
|
||||
`${BASE_MOVIE}/${id}/similar`,
|
||||
options
|
||||
`${BASE_MOVIE}/${id}/similar?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,31 +130,32 @@ export class MoviesEndpoint extends BaseEndpoint {
|
||||
async nowPlaying(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): Promise<MoviesPlayingNow> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<MoviesPlayingNow>(
|
||||
`${BASE_MOVIE}/now_playing`,
|
||||
options
|
||||
`${BASE_MOVIE}/now_playing?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): Promise<TopRatedMovies> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TopRatedMovies>(
|
||||
`${BASE_MOVIE}/top_rated`,
|
||||
options
|
||||
`${BASE_MOVIE}/top_rated?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async upcoming(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): Promise<UpcomingMovies> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<UpcomingMovies>(
|
||||
`${BASE_MOVIE}/upcoming`,
|
||||
options
|
||||
`${BASE_MOVIE}/upcoming?${params}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
PopularPersons,
|
||||
TaggedImages,
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
import { BaseEndpoint } from './base';
|
||||
|
||||
const BASE_PERSON = '/person';
|
||||
@@ -26,9 +27,9 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async changes(id: number, options?: ChangeOptions): Promise<PersonChanges> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<PersonChanges>(
|
||||
`${BASE_PERSON}/${id}/changes`,
|
||||
options
|
||||
`${BASE_PERSON}/${id}/changes?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,9 +62,9 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TaggedImages>(
|
||||
`${BASE_PERSON}/${id}/tagged_images`,
|
||||
options
|
||||
`${BASE_PERSON}/${id}/tagged_images?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,9 +79,9 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async popular(options?: PageOption): Promise<PopularPersons> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<PopularPersons>(
|
||||
`${BASE_PERSON}/popular`,
|
||||
options
|
||||
`${BASE_PERSON}/popular?${params}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BaseEndpoint } from './base';
|
||||
import { Search } from '../types/search';
|
||||
import { Collection, Company, Movie, Person, TV } from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
const BASE_SEARCH = '/search';
|
||||
|
||||
@@ -30,39 +31,44 @@ export class SearchEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async companies(options: SearchOptions): Promise<Search<Company>> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Search<Company>>(
|
||||
`${BASE_SEARCH}/company`,
|
||||
options
|
||||
`${BASE_SEARCH}/company?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async collections(options: SearchOptions): Promise<Search<Collection>> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Search<Collection>>(
|
||||
`${BASE_SEARCH}/collection`,
|
||||
options
|
||||
`${BASE_SEARCH}/collection?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async keywords(
|
||||
options: SearchOptions
|
||||
): Promise<Search<{ id: string; name: string }>> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Search<{ id: string; name: string }>>(
|
||||
`${BASE_SEARCH}/keyword`,
|
||||
options
|
||||
`${BASE_SEARCH}/keyword?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
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>> {
|
||||
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}`
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Multi search
|
||||
|
||||
async tvShows(options: TvSearchOptions): Promise<Search<TV>> {
|
||||
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv?${params}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
Videos,
|
||||
WatchProviders,
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
|
||||
const BASE_TV = '/tv';
|
||||
|
||||
@@ -46,9 +47,9 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async changes(id: number, options?: ChangeOptions): Promise<TvShowChanges> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TvShowChanges>(
|
||||
`${BASE_TV}/${id}/changes`,
|
||||
options
|
||||
`${BASE_TV}/${id}/changes?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,14 +89,15 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
||||
id: number,
|
||||
options?: PageOption
|
||||
): Promise<Recommendations> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Recommendations>(
|
||||
`${BASE_TV}/${id}/recommendations`,
|
||||
options
|
||||
`${BASE_TV}/${id}/recommendations?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async reviews(id: number, options?: PageOption): Promise<Reviews> {
|
||||
return await this.api.get<Reviews>(`${BASE_TV}/${id}/reviews`, options);
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<Reviews>(`${BASE_TV}/${id}/reviews?${params}`);
|
||||
}
|
||||
|
||||
async screenedTheatrically(id: number): Promise<ScreenedTheatrically> {
|
||||
@@ -105,9 +107,9 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async similar(id: number, options?: PageOption): Promise<SimilarTvShows> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<SimilarTvShows>(
|
||||
`${BASE_TV}/${id}/similar`,
|
||||
options
|
||||
`${BASE_TV}/${id}/similar?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -140,21 +142,25 @@ export class TvShowsEndpoint extends BaseEndpoint {
|
||||
async airingToday(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): Promise<TvShowsAiringToday> {
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TvShowsAiringToday>(
|
||||
`${BASE_TV}/airing_today`,
|
||||
options
|
||||
`${BASE_TV}/airing_today?${params}`
|
||||
);
|
||||
}
|
||||
|
||||
async popular(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): 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(
|
||||
options?: PageOption & LanguageOption & RegionOption
|
||||
): 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 './utils';
|
||||
|
||||
export { TMDB };
|
||||
export default TMDB;
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
CollectionsEndpoint,
|
||||
} from './endpoints';
|
||||
|
||||
export class TMDB {
|
||||
export default class TMDB {
|
||||
private readonly accessToken: string;
|
||||
|
||||
constructor(accessToken: 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() : '';
|
||||
}
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022" /* 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'. */,
|
||||
"moduleResolution": "node16",
|
||||
"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'. */,
|
||||
"sourceMap": true /* Generates corresponding '.map' file. */,
|
||||
"outDir": "dist" /* Redirect output structure to the directory. */,
|
||||
"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"],
|
||||
"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. */,
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||
"typeRoots": ["./src/types"]
|
||||
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
||||
"typeRoots": [
|
||||
"./src/types"
|
||||
]
|
||||
},
|
||||
"types": ["node"],
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist", "./src/types/*.ts"]
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"./src/types/*.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user