@tdanks2000/tmdb-wrapper 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -148
- package/dist/endpoints/account.js +2 -13
- package/dist/endpoints/certification.js +4 -17
- package/dist/endpoints/changes.js +6 -21
- package/dist/endpoints/collections.js +10 -26
- package/dist/endpoints/companies.js +6 -21
- package/dist/endpoints/configuration.js +2 -13
- package/dist/endpoints/credits.js +2 -13
- package/dist/endpoints/discover.js +4 -17
- package/dist/endpoints/find.js +2 -13
- package/dist/endpoints/genre.js +4 -17
- package/dist/endpoints/index.js +3 -0
- package/dist/endpoints/keywords.js +4 -17
- package/dist/endpoints/movies.js +48 -98
- package/dist/endpoints/networks.js +6 -21
- package/dist/endpoints/people.js +26 -57
- package/dist/endpoints/review.js +2 -13
- package/dist/endpoints/search.js +14 -37
- package/dist/endpoints/trending.js +2 -13
- package/dist/endpoints/tvEpisodes.js +26 -48
- package/dist/endpoints/tvSeasons.js +28 -52
- package/dist/endpoints/tvShows.js +58 -115
- package/dist/endpoints/watchProviders.js +46 -0
- package/dist/index.js +3 -0
- package/dist/utils/api.js +12 -23
- package/dist/utils/getimagePath.js +39 -8
- package/package.json +59 -41
- package/.github/workflows/npm-publish.yml +0 -33
- package/dist/@types/endpoints/account.d.ts +0 -16
- package/dist/@types/endpoints/account.d.ts.map +0 -1
- package/dist/@types/endpoints/certification.d.ts +0 -19
- package/dist/@types/endpoints/certification.d.ts.map +0 -1
- package/dist/@types/endpoints/changes.d.ts +0 -26
- package/dist/@types/endpoints/changes.d.ts.map +0 -1
- package/dist/@types/endpoints/collection.d.ts +0 -21
- package/dist/@types/endpoints/collection.d.ts.map +0 -1
- package/dist/@types/endpoints/companies.d.ts +0 -29
- package/dist/@types/endpoints/companies.d.ts.map +0 -1
- package/dist/@types/endpoints/configuration.d.ts +0 -106
- package/dist/@types/endpoints/configuration.d.ts.map +0 -1
- package/dist/@types/endpoints/credits.d.ts +0 -135
- package/dist/@types/endpoints/credits.d.ts.map +0 -1
- package/dist/@types/endpoints/discover.d.ts +0 -68
- package/dist/@types/endpoints/discover.d.ts.map +0 -1
- package/dist/@types/endpoints/find.d.ts +0 -20
- package/dist/@types/endpoints/find.d.ts.map +0 -1
- package/dist/@types/endpoints/genre.d.ts +0 -7
- package/dist/@types/endpoints/genre.d.ts.map +0 -1
- package/dist/@types/endpoints/index.d.ts +0 -23
- package/dist/@types/endpoints/index.d.ts.map +0 -1
- package/dist/@types/endpoints/keywords.d.ts +0 -21
- package/dist/@types/endpoints/keywords.d.ts.map +0 -1
- package/dist/@types/endpoints/movies.d.ts +0 -150
- package/dist/@types/endpoints/movies.d.ts.map +0 -1
- package/dist/@types/endpoints/networks.d.ts +0 -14
- package/dist/@types/endpoints/networks.d.ts.map +0 -1
- package/dist/@types/endpoints/options.d.ts +0 -73
- package/dist/@types/endpoints/options.d.ts.map +0 -1
- package/dist/@types/endpoints/people.d.ts +0 -135
- package/dist/@types/endpoints/people.d.ts.map +0 -1
- package/dist/@types/endpoints/review.d.ts +0 -8
- package/dist/@types/endpoints/review.d.ts.map +0 -1
- package/dist/@types/endpoints/search.d.ts +0 -32
- package/dist/@types/endpoints/search.d.ts.map +0 -1
- package/dist/@types/endpoints/trending.d.ts +0 -12
- package/dist/@types/endpoints/trending.d.ts.map +0 -1
- package/dist/@types/endpoints/tvEpisode.d.ts +0 -65
- package/dist/@types/endpoints/tvEpisode.d.ts.map +0 -1
- package/dist/@types/endpoints/tvSeasons.d.ts +0 -31
- package/dist/@types/endpoints/tvSeasons.d.ts.map +0 -1
- package/dist/@types/endpoints/tvShows.d.ts +0 -260
- package/dist/@types/endpoints/tvShows.d.ts.map +0 -1
- package/dist/@types/endpoints/watchProviders.d.ts +0 -295
- package/dist/@types/endpoints/watchProviders.d.ts.map +0 -1
- package/dist/@types/index.d.ts +0 -4
- package/dist/@types/index.d.ts.map +0 -1
- package/dist/@types/models/baseEndpoint.d.ts +0 -7
- package/dist/@types/models/baseEndpoint.d.ts.map +0 -1
- package/dist/@types/models/index.d.ts +0 -2
- package/dist/@types/models/index.d.ts.map +0 -1
- package/dist/@types/types.d.ts +0 -174
- package/dist/@types/types.d.ts.map +0 -1
- package/dist/endpoints/account.d.ts +0 -17
- package/dist/endpoints/account.d.ts.map +0 -1
- package/dist/endpoints/certification.d.ts +0 -23
- package/dist/endpoints/certification.d.ts.map +0 -1
- package/dist/endpoints/changes.d.ts +0 -31
- package/dist/endpoints/changes.d.ts.map +0 -1
- package/dist/endpoints/collections.d.ts +0 -34
- package/dist/endpoints/collections.d.ts.map +0 -1
- package/dist/endpoints/companies.d.ts +0 -31
- package/dist/endpoints/companies.d.ts.map +0 -1
- package/dist/endpoints/configuration.d.ts +0 -18
- package/dist/endpoints/configuration.d.ts.map +0 -1
- package/dist/endpoints/credits.d.ts +0 -19
- package/dist/endpoints/credits.d.ts.map +0 -1
- package/dist/endpoints/discover.d.ts +0 -24
- package/dist/endpoints/discover.d.ts.map +0 -1
- package/dist/endpoints/find.d.ts +0 -19
- package/dist/endpoints/find.d.ts.map +0 -1
- package/dist/endpoints/genre.d.ts +0 -25
- package/dist/endpoints/genre.d.ts.map +0 -1
- package/dist/endpoints/index.d.ts +0 -19
- package/dist/endpoints/index.d.ts.map +0 -1
- package/dist/endpoints/keywords.d.ts +0 -25
- package/dist/endpoints/keywords.d.ts.map +0 -1
- package/dist/endpoints/movies.d.ts +0 -142
- package/dist/endpoints/movies.d.ts.map +0 -1
- package/dist/endpoints/networks.d.ts +0 -31
- package/dist/endpoints/networks.d.ts.map +0 -1
- package/dist/endpoints/people.d.ts +0 -84
- package/dist/endpoints/people.d.ts.map +0 -1
- package/dist/endpoints/review.d.ts +0 -18
- package/dist/endpoints/review.d.ts.map +0 -1
- package/dist/endpoints/search.d.ts +0 -58
- package/dist/endpoints/search.d.ts.map +0 -1
- package/dist/endpoints/trending.d.ts +0 -21
- package/dist/endpoints/trending.d.ts.map +0 -1
- package/dist/endpoints/tvEpisodes.d.ts +0 -61
- package/dist/endpoints/tvEpisodes.d.ts.map +0 -1
- package/dist/endpoints/tvSeasons.d.ts +0 -70
- package/dist/endpoints/tvSeasons.d.ts.map +0 -1
- package/dist/endpoints/tvShows.d.ts +0 -164
- package/dist/endpoints/tvShows.d.ts.map +0 -1
- package/dist/index.d.ts +0 -26
- package/dist/index.d.ts.map +0 -1
- package/dist/utils/api.d.ts +0 -7
- package/dist/utils/api.d.ts.map +0 -1
- package/dist/utils/getimagePath.d.ts +0 -12
- package/dist/utils/getimagePath.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/src/@types/endpoints/account.ts +0 -17
- package/src/@types/endpoints/certification.ts +0 -19
- package/src/@types/endpoints/changes.ts +0 -29
- package/src/@types/endpoints/collection.ts +0 -23
- package/src/@types/endpoints/companies.ts +0 -33
- package/src/@types/endpoints/configuration.ts +0 -112
- package/src/@types/endpoints/credits.ts +0 -149
- package/src/@types/endpoints/discover.ts +0 -87
- package/src/@types/endpoints/find.ts +0 -28
- package/src/@types/endpoints/genre.ts +0 -3
- package/src/@types/endpoints/index.ts +0 -22
- package/src/@types/endpoints/keywords.ts +0 -24
- package/src/@types/endpoints/movies.ts +0 -169
- package/src/@types/endpoints/networks.ts +0 -15
- package/src/@types/endpoints/options.ts +0 -189
- package/src/@types/endpoints/people.ts +0 -151
- package/src/@types/endpoints/review.ts +0 -8
- package/src/@types/endpoints/search.ts +0 -39
- package/src/@types/endpoints/trending.ts +0 -20
- package/src/@types/endpoints/tvEpisode.ts +0 -72
- package/src/@types/endpoints/tvSeasons.ts +0 -37
- package/src/@types/endpoints/tvShows.ts +0 -284
- package/src/@types/endpoints/watchProviders.ts +0 -298
- package/src/@types/index.ts +0 -3
- package/src/@types/models/baseEndpoint.ts +0 -9
- package/src/@types/models/index.ts +0 -1
- package/src/@types/types.ts +0 -199
- package/src/endpoints/account.ts +0 -22
- package/src/endpoints/certification.ts +0 -30
- package/src/endpoints/changes.ts +0 -41
- package/src/endpoints/collections.ts +0 -57
- package/src/endpoints/companies.ts +0 -41
- package/src/endpoints/configuration.ts +0 -22
- package/src/endpoints/credits.ts +0 -23
- package/src/endpoints/discover.ts +0 -40
- package/src/endpoints/find.ts +0 -24
- package/src/endpoints/genre.ts +0 -32
- package/src/endpoints/index.ts +0 -18
- package/src/endpoints/keywords.ts +0 -35
- package/src/endpoints/movies.ts +0 -244
- package/src/endpoints/networks.ts +0 -41
- package/src/endpoints/people.ts +0 -147
- package/src/endpoints/review.ts +0 -23
- package/src/endpoints/search.ts +0 -93
- package/src/endpoints/trending.ts +0 -30
- package/src/endpoints/tvEpisodes.ts +0 -125
- package/src/endpoints/tvSeasons.ts +0 -138
- package/src/endpoints/tvShows.ts +0 -286
- package/src/index.ts +0 -66
- package/src/utils/api.ts +0 -31
- package/src/utils/getimagePath.ts +0 -16
- package/src/utils/index.ts +0 -2
- package/tsconfig.json +0 -101
package/README.md
CHANGED
|
@@ -1,148 +1,334 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
TMDB Api Wrapper
|
|
3
|
-
</h1>
|
|
4
|
-
|
|
5
|
-
<p align="center">
|
|
6
|
-
<a href="https://www.npmjs.com/package/@tdanks2000/tmdb-wrapper">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
###
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
TMDB Api Wrapper
|
|
3
|
+
</h1>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@tdanks2000/tmdb-wrapper"><img alt="npm version" src="https://img.shields.io/npm/v/@tdanks2000/tmdb-wrapper"></a>
|
|
7
|
+
<a href="https://github.com/tdanks2000/tmdb-wrapper/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/@tdanks2000/tmdb-wrapper"></a>
|
|
8
|
+
<a href="https://github.com/tdanks2000/tmdb-wrapper"><img alt="GitHub stars" src="https://img.shields.io/github/stars/tdanks2000/tmdb-wrapper?style=social"></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<b>A powerful and easy-to-use TypeScript wrapper for The Movie Database (TMDb) API</b>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
The TMDB Api Wrapper simplifies the process of making API requests to The Movie Database (TMDb), a comprehensive database for movies and TV shows. It encapsulates functionality related to various API endpoints, such as account, certifications, changes, collections, configuration, credits, discover, find, genres, keywords, movies, people, reviews, search, trending, TV episodes, TV seasons, TV shows, companies, networks, and watch providers. With this wrapper, developers can quickly integrate TMDB functionality into their TypeScript projects.
|
|
18
|
+
|
|
19
|
+
## Table of Contents
|
|
20
|
+
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Usage](#usage)
|
|
23
|
+
- [Authentication](#authentication)
|
|
24
|
+
- [Functionality](#functionality)
|
|
25
|
+
- [Movies](#movies)
|
|
26
|
+
- [TV Shows](#tv-shows)
|
|
27
|
+
- [People](#people)
|
|
28
|
+
- [Companies](#companies)
|
|
29
|
+
- [Networks](#networks)
|
|
30
|
+
- [Watch Providers](#watch-providers)
|
|
31
|
+
- [Other Endpoints](#other-endpoints)
|
|
32
|
+
- [Image Handling](#image-handling)
|
|
33
|
+
- [Examples](#examples)
|
|
34
|
+
- [Troubleshooting](#troubleshooting)
|
|
35
|
+
- [API Reference](#api-reference)
|
|
36
|
+
- [Contributing](#contributing)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
To install the TMDB TypeScript Wrapper, follow these steps:
|
|
42
|
+
|
|
43
|
+
1. Run the following command in your project directory:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// npm
|
|
47
|
+
npm install @tdanks2000/tmdb-wrapper
|
|
48
|
+
// yarn
|
|
49
|
+
yarn add @tdanks2000/tmdb-wrapper
|
|
50
|
+
// pnpm
|
|
51
|
+
pnpm i @tdanks2000/tmdb-wrapper
|
|
52
|
+
// bun
|
|
53
|
+
bun add @tdanks2000/tmdb-wrapper
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
To use the TMDB TypeScript API Wrapper in your TypeScript project, import the necessary classes and functions:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { TMDB } from '@tdanks2000/tmdb-wrapper';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then, create an instance of the TMDB class, optionally providing an access token. Access tokens can be obtained from [TMDb API Settings](https://www.themoviedb.org/settings/api) under read access token.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const tmdb = new TMDB('YOUR_ACCESS_TOKEN');
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
You can now use the `tmdb` object to access various functionalities of the TMDB API. The wrapper provides access to all major TMDB API endpoints including Movies, TV Shows, People, Companies, Networks, and Watch Providers.
|
|
71
|
+
|
|
72
|
+
## Authentication
|
|
73
|
+
|
|
74
|
+
To use the TMDB API, you need to obtain an API key from [TMDb API Settings](https://www.themoviedb.org/settings/api). The wrapper supports both API key authentication and read access token authentication.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Using API key
|
|
78
|
+
const tmdb = new TMDB({ apiKey: 'YOUR_API_KEY' });
|
|
79
|
+
|
|
80
|
+
// Using read access token (recommended)
|
|
81
|
+
const tmdb = new TMDB('YOUR_ACCESS_TOKEN');
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Functionality
|
|
85
|
+
|
|
86
|
+
The TMDB Api Wrapper provides access to the following endpoints:
|
|
87
|
+
|
|
88
|
+
### Movies
|
|
89
|
+
|
|
90
|
+
Access comprehensive information about movies, including details, credits, reviews, and more.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Get popular movies
|
|
94
|
+
const popularMovies = await tmdb.movies.getPopular();
|
|
95
|
+
|
|
96
|
+
// Get movie details
|
|
97
|
+
const movieDetails = await tmdb.movies.getDetails(550); // Fight Club
|
|
98
|
+
|
|
99
|
+
// Get movie credits
|
|
100
|
+
const movieCredits = await tmdb.movies.getCredits(550);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### TV Shows
|
|
104
|
+
|
|
105
|
+
Retrieve information about TV shows, seasons, and episodes.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Get popular TV shows
|
|
109
|
+
const popularShows = await tmdb.tvShows.getPopular();
|
|
110
|
+
|
|
111
|
+
// Get TV show details
|
|
112
|
+
const showDetails = await tmdb.tvShows.getDetails(1396); // Breaking Bad
|
|
113
|
+
|
|
114
|
+
// Get season details
|
|
115
|
+
const seasonDetails = await tmdb.tvSeasons.getDetails(1396, 1);
|
|
116
|
+
|
|
117
|
+
// Get episode details
|
|
118
|
+
const episodeDetails = await tmdb.tvEpisodes.getDetails(1396, 1, 1);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### People
|
|
122
|
+
|
|
123
|
+
Access information about actors, directors, and other people involved in movies and TV shows.
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Get popular people
|
|
127
|
+
const popularPeople = await tmdb.people.getPopular();
|
|
128
|
+
|
|
129
|
+
// Get person details
|
|
130
|
+
const personDetails = await tmdb.people.getDetails(287); // Brad Pitt
|
|
131
|
+
|
|
132
|
+
// Get person movie credits
|
|
133
|
+
const personMovieCredits = await tmdb.people.getMovieCredits(287);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Companies
|
|
137
|
+
|
|
138
|
+
Retrieve information about production companies.
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Get company details
|
|
142
|
+
const companyDetails = await tmdb.companies.getDetails(1); // Lucasfilm
|
|
143
|
+
|
|
144
|
+
// Get company movies
|
|
145
|
+
const companyMovies = await tmdb.companies.getMovies(1);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Networks
|
|
149
|
+
|
|
150
|
+
Access information about TV networks.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Get network details
|
|
154
|
+
const networkDetails = await tmdb.networks.getDetails(213); // Netflix
|
|
155
|
+
|
|
156
|
+
// Get alternative names
|
|
157
|
+
const alternativeNames = await tmdb.networks.getAlternativeNames(213);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Watch Providers
|
|
161
|
+
|
|
162
|
+
Retrieve information about streaming platforms and availability.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Get available regions
|
|
166
|
+
const regions = await tmdb.watchProviders.getAvailableRegions();
|
|
167
|
+
|
|
168
|
+
// Get movie providers
|
|
169
|
+
const movieProviders = await tmdb.watchProviders.getMovieProviders();
|
|
170
|
+
|
|
171
|
+
// Get TV providers
|
|
172
|
+
const tvProviders = await tmdb.watchProviders.getTvProviders();
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Other Endpoints
|
|
176
|
+
|
|
177
|
+
The wrapper also provides access to these additional endpoints:
|
|
178
|
+
|
|
179
|
+
- **Account**: Manage account details and settings
|
|
180
|
+
- **Certifications**: Retrieve certification information for movies and TV shows
|
|
181
|
+
- **Changes**: Get information about changes to the database
|
|
182
|
+
- **Collections**: Access information about movie collections
|
|
183
|
+
- **Configuration**: Retrieve configuration information for the API
|
|
184
|
+
- **Credits**: Get credits information for movies and TV shows
|
|
185
|
+
- **Discover**: Discover movies and TV shows based on various criteria
|
|
186
|
+
- **Find**: Find movies and TV shows by external IDs
|
|
187
|
+
- **Genres**: Retrieve information about movie and TV show genres
|
|
188
|
+
- **Keywords**: Access information about movie keywords
|
|
189
|
+
- **Reviews**: Get reviews for movies and TV shows
|
|
190
|
+
- **Search**: Search for movies, TV shows, and people
|
|
191
|
+
- **Trending**: Get trending movies and TV shows
|
|
192
|
+
|
|
193
|
+
## Image Handling
|
|
194
|
+
|
|
195
|
+
The wrapper provides enhanced utilities for handling TMDB images:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import { getFullImagePath, ImageSizes, ImageFormats } from '@tdanks2000/tmdb-wrapper';
|
|
199
|
+
|
|
200
|
+
// Example usage for movie poster
|
|
201
|
+
const posterUrl = getFullImagePath(
|
|
202
|
+
'https://image.tmdb.org/t/p/',
|
|
203
|
+
ImageSizes.W500,
|
|
204
|
+
'/wwemzKWzjKYJFfCeiB57q3r4Bcm',
|
|
205
|
+
ImageFormats.JPG
|
|
206
|
+
);
|
|
207
|
+
// Results in: https://image.tmdb.org/t/p/w500/wwemzKWzjKYJFfCeiB57q3r4Bcm.jpg
|
|
208
|
+
|
|
209
|
+
// Example usage for profile image
|
|
210
|
+
const profileUrl = getFullImagePath(
|
|
211
|
+
'https://image.tmdb.org/t/p/',
|
|
212
|
+
ImageSizes.W185,
|
|
213
|
+
'/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg',
|
|
214
|
+
ImageFormats.JPG
|
|
215
|
+
);
|
|
216
|
+
// Results in: https://image.tmdb.org/t/p/w185/5XBzD5WuTyVQZeS4VI25z2moMeY.jpg
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The utility supports all TMDB image sizes and formats:
|
|
220
|
+
|
|
221
|
+
- **Sizes**: W45, W92, W154, W185, W300, W342, W500, W780, W1280, Original
|
|
222
|
+
- **Formats**: JPG, PNG, SVG
|
|
223
|
+
|
|
224
|
+
## Examples
|
|
225
|
+
|
|
226
|
+
### Searching for Content
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// Search for movies
|
|
230
|
+
const movieResults = await tmdb.search.searchMovies('Inception');
|
|
231
|
+
|
|
232
|
+
// Search for TV shows
|
|
233
|
+
const tvResults = await tmdb.search.searchTvShows('Breaking Bad');
|
|
234
|
+
|
|
235
|
+
// Search for people
|
|
236
|
+
const peopleResults = await tmdb.search.searchPeople('Brad Pitt');
|
|
237
|
+
|
|
238
|
+
// Multi-search (movies, TV shows, and people)
|
|
239
|
+
const multiResults = await tmdb.search.searchMulti('Marvel');
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Getting Trending Content
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// Get trending movies (day)
|
|
246
|
+
const trendingMoviesDay = await tmdb.trending.getTrendingMovies('day');
|
|
247
|
+
|
|
248
|
+
// Get trending TV shows (week)
|
|
249
|
+
const trendingTvWeek = await tmdb.trending.getTrendingTvShows('week');
|
|
250
|
+
|
|
251
|
+
// Get trending people (day)
|
|
252
|
+
const trendingPeopleDay = await tmdb.trending.getTrendingPeople('day');
|
|
253
|
+
|
|
254
|
+
// Get all trending content (week)
|
|
255
|
+
const trendingAllWeek = await tmdb.trending.getTrendingAll('week');
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Using Discover
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// Discover movies by genre
|
|
262
|
+
const actionMovies = await tmdb.discover.discoverMovies({
|
|
263
|
+
with_genres: '28', // Action genre ID
|
|
264
|
+
sort_by: 'popularity.desc'
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// Discover TV shows by network
|
|
268
|
+
const netflixShows = await tmdb.discover.discoverTvShows({
|
|
269
|
+
with_networks: '213', // Netflix network ID
|
|
270
|
+
sort_by: 'vote_average.desc'
|
|
271
|
+
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Troubleshooting
|
|
275
|
+
|
|
276
|
+
### Rate Limiting
|
|
277
|
+
|
|
278
|
+
TMDb API has rate limiting in place. If you encounter rate limiting issues, consider implementing a delay between requests or using a caching mechanism.
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
// Example of implementing a delay between requests
|
|
282
|
+
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
|
283
|
+
|
|
284
|
+
async function fetchWithDelay() {
|
|
285
|
+
const result1 = await tmdb.movies.getPopular();
|
|
286
|
+
await delay(250); // Wait 250ms between requests
|
|
287
|
+
const result2 = await tmdb.tvShows.getPopular();
|
|
288
|
+
return { movies: result1, tvShows: result2 };
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Authentication Issues
|
|
293
|
+
|
|
294
|
+
If you're experiencing authentication issues, ensure your API key or access token is valid and correctly formatted.
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// Check if your token is valid
|
|
298
|
+
try {
|
|
299
|
+
const accountDetails = await tmdb.account.getDetails();
|
|
300
|
+
console.log('Authentication successful:', accountDetails);
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.error('Authentication failed:', error);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## API Reference
|
|
307
|
+
|
|
308
|
+
For a complete list of available methods and parameters, please refer to the [TMDB API Documentation](https://developers.themoviedb.org/3/getting-started/introduction).
|
|
309
|
+
|
|
310
|
+
This wrapper aims to provide a 1:1 mapping to the official TMDB API, with TypeScript types for improved developer experience.
|
|
311
|
+
|
|
312
|
+
## Contributing
|
|
313
|
+
|
|
314
|
+
Contributions are welcome! For bug reports, feature requests, or any other questions, please open an issue on the [GitHub repository](https://github.com/tdanks2000/tmdb-wrapper).
|
|
315
|
+
|
|
316
|
+
1. Fork the repository
|
|
317
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
318
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
319
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
320
|
+
5. Open a Pull Request
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/tdanks2000/tmdb-wrapper/blob/main/LICENSE) file for details.
|
|
325
|
+
|
|
326
|
+
<br/>
|
|
327
|
+
|
|
328
|
+
# ❤️
|
|
329
|
+
|
|
330
|
+
<p align="center">
|
|
331
|
+
<a target="_blank" href="https://tdanks.com/mental-health/quote">
|
|
332
|
+
❤️ Reminder that <strong><i>you are great, you are enough, and your presence is valued.</i></strong> If you are struggling with your mental health, please reach out to someone you love and consult a professional. You are not alone. ❤️
|
|
333
|
+
</a>
|
|
334
|
+
</p>
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AccountEndpoint = void 0;
|
|
13
4
|
const _types_1 = require("../@types");
|
|
@@ -26,10 +17,8 @@ class AccountEndpoint extends _types_1.BaseEndpoint {
|
|
|
26
17
|
* Retrieves account details asynchronously.
|
|
27
18
|
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
|
|
28
19
|
*/
|
|
29
|
-
details() {
|
|
30
|
-
return
|
|
31
|
-
return yield this.api.get('/account');
|
|
32
|
-
});
|
|
20
|
+
async details() {
|
|
21
|
+
return await this.api.get('/account');
|
|
33
22
|
}
|
|
34
23
|
}
|
|
35
24
|
exports.AccountEndpoint = AccountEndpoint;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.CertificationEndpoint = void 0;
|
|
13
4
|
const _types_1 = require("../@types");
|
|
@@ -27,19 +18,15 @@ class CertificationEndpoint extends _types_1.BaseEndpoint {
|
|
|
27
18
|
* Retrieves certifications for movies asynchronously.
|
|
28
19
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
|
|
29
20
|
*/
|
|
30
|
-
movies() {
|
|
31
|
-
return
|
|
32
|
-
return yield this.api.get('/certification/movie/list');
|
|
33
|
-
});
|
|
21
|
+
async movies() {
|
|
22
|
+
return await this.api.get('/certification/movie/list');
|
|
34
23
|
}
|
|
35
24
|
/**
|
|
36
25
|
* Retrieves certifications for TV shows asynchronously.
|
|
37
26
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
|
|
38
27
|
*/
|
|
39
|
-
tv() {
|
|
40
|
-
return
|
|
41
|
-
return yield this.api.get('/certification/tv/list');
|
|
42
|
-
});
|
|
28
|
+
async tv() {
|
|
29
|
+
return await this.api.get('/certification/tv/list');
|
|
43
30
|
}
|
|
44
31
|
}
|
|
45
32
|
exports.CertificationEndpoint = CertificationEndpoint;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.ChangeEndpoint = void 0;
|
|
13
4
|
const _types_1 = require("../@types");
|
|
@@ -28,30 +19,24 @@ class ChangeEndpoint extends _types_1.BaseEndpoint {
|
|
|
28
19
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
29
20
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
|
|
30
21
|
*/
|
|
31
|
-
movies(options) {
|
|
32
|
-
return
|
|
33
|
-
return yield this.api.get('/movie/changes', options);
|
|
34
|
-
});
|
|
22
|
+
async movies(options) {
|
|
23
|
+
return await this.api.get('/movie/changes', options);
|
|
35
24
|
}
|
|
36
25
|
/**
|
|
37
26
|
* Retrieves changes in TV shows asynchronously.
|
|
38
27
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
39
28
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
|
|
40
29
|
*/
|
|
41
|
-
tv(options) {
|
|
42
|
-
return
|
|
43
|
-
return yield this.api.get('/tv/changes', options);
|
|
44
|
-
});
|
|
30
|
+
async tv(options) {
|
|
31
|
+
return await this.api.get('/tv/changes', options);
|
|
45
32
|
}
|
|
46
33
|
/**
|
|
47
34
|
* Retrieves changes related to persons asynchronously.
|
|
48
35
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
49
36
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
|
|
50
37
|
*/
|
|
51
|
-
person(options) {
|
|
52
|
-
return
|
|
53
|
-
return yield this.api.get('/person/change', options);
|
|
54
|
-
});
|
|
38
|
+
async person(options) {
|
|
39
|
+
return await this.api.get('/person/change', options);
|
|
55
40
|
}
|
|
56
41
|
}
|
|
57
42
|
exports.ChangeEndpoint = ChangeEndpoint;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.CollectionsEndpoint = void 0;
|
|
13
4
|
const _types_1 = require("../@types");
|
|
@@ -30,10 +21,8 @@ class CollectionsEndpoint extends _types_1.BaseEndpoint {
|
|
|
30
21
|
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
31
22
|
* @returns {Promise<DetailedCollection>} A Promise that resolves with the detailed information of the collection.
|
|
32
23
|
*/
|
|
33
|
-
details(id, options) {
|
|
34
|
-
return
|
|
35
|
-
return yield this.api.get(`${BASE_COLLECTION}/${id}`, options);
|
|
36
|
-
});
|
|
24
|
+
async details(id, options) {
|
|
25
|
+
return await this.api.get(`${BASE_COLLECTION}/${id}`, options);
|
|
37
26
|
}
|
|
38
27
|
/**
|
|
39
28
|
* Retrieves images associated with a specific collection asynchronously.
|
|
@@ -41,15 +30,12 @@ class CollectionsEndpoint extends _types_1.BaseEndpoint {
|
|
|
41
30
|
* @param {CollectionImageOptions} [options] - Optional parameters for specifying image options.
|
|
42
31
|
* @returns {Promise<ImageCollection>} A Promise that resolves with the collection images.
|
|
43
32
|
*/
|
|
44
|
-
images(id, options) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
return yield this.api.get(`${BASE_COLLECTION}/${id}/images`, computedOptions);
|
|
52
|
-
});
|
|
33
|
+
async images(id, options) {
|
|
34
|
+
const computedOptions = {
|
|
35
|
+
include_image_language: options?.include_image_language?.join(','),
|
|
36
|
+
language: options?.language,
|
|
37
|
+
};
|
|
38
|
+
return await this.api.get(`${BASE_COLLECTION}/${id}/images`, computedOptions);
|
|
53
39
|
}
|
|
54
40
|
/**
|
|
55
41
|
* Retrieves translations for a specific collection asynchronously.
|
|
@@ -57,10 +43,8 @@ class CollectionsEndpoint extends _types_1.BaseEndpoint {
|
|
|
57
43
|
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
58
44
|
* @returns {Promise<Translations>} A Promise that resolves with the translations of the collection.
|
|
59
45
|
*/
|
|
60
|
-
translations(id, options) {
|
|
61
|
-
return
|
|
62
|
-
return yield this.api.get(`${BASE_COLLECTION}/${id}/translations`, options);
|
|
63
|
-
});
|
|
46
|
+
async translations(id, options) {
|
|
47
|
+
return await this.api.get(`${BASE_COLLECTION}/${id}/translations`, options);
|
|
64
48
|
}
|
|
65
49
|
}
|
|
66
50
|
exports.CollectionsEndpoint = CollectionsEndpoint;
|