You want to interact with The Movie Database's API, and you want to use Typescript? Oh, you are in for a treat. Jtmdb is the library to do just that.
npm i jtmdb
Jtmdb will only work with your API Read Access Token (v4 auth).
import { Jtmdb } from 'jtmdb';
const jtmdb = new Jtmdb({
v4AccessToken: 'yourTmdbV4AccessToken'
})
Jtmdb has three generic methods (get
, post
, and delete
) to handle interacting with endpoints not yet implemented.
let results = await jtmdb.get('/version/resource', {
query: 'parameters'
})
results = await jtmdb.post('/version/resource', {
body: 'values'
}, {
query: 'parameters'
})
results = await jtmdb.delete('/version/resource', {
query: 'parameters'
})
The intention for Jtmdb is to have all TMDb endpoints implemented with the following format:
jtmdb.{module}.{method}
For example:
const results = await jtmdb.search.multi({
query: 'Fight Club'
})
Currently, the following modules of TMDb API are implemented:
- List (v4) -
jtmdb.list
- Movies (v3) -
jtmdb.movies
- People (v3) -
jtmdb.people
- Search (v3) -
jtmdb.search