@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
|
@@ -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.TvShowsEndpoint = void 0;
|
|
13
4
|
const _types_1 = require("../@types");
|
|
@@ -32,24 +23,20 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
32
23
|
* @returns {Promise<AppendToResponse<TvShowDetails, AppendToResponseTvKey[], 'tvShow'>>}
|
|
33
24
|
* A Promise that resolves with the details of the TV show.
|
|
34
25
|
*/
|
|
35
|
-
details(id, appendToResponse, language) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return yield this.api.get(`${BASE_TV}/${id}`, options);
|
|
42
|
-
});
|
|
26
|
+
async details(id, appendToResponse, language) {
|
|
27
|
+
const options = {
|
|
28
|
+
append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
|
|
29
|
+
language: language,
|
|
30
|
+
};
|
|
31
|
+
return await this.api.get(`${BASE_TV}/${id}`, options);
|
|
43
32
|
}
|
|
44
33
|
/**
|
|
45
34
|
* Retrieves alternative titles of a specific TV show asynchronously.
|
|
46
35
|
* @param {number} id - The ID of the TV show.
|
|
47
36
|
* @returns {Promise<AlternativeTitles>} A Promise that resolves with the alternative titles of the TV show.
|
|
48
37
|
*/
|
|
49
|
-
alternativeTitles(id) {
|
|
50
|
-
return
|
|
51
|
-
return yield this.api.get(`${BASE_TV}/${id}/alternative_titles`);
|
|
52
|
-
});
|
|
38
|
+
async alternativeTitles(id) {
|
|
39
|
+
return await this.api.get(`${BASE_TV}/${id}/alternative_titles`);
|
|
53
40
|
}
|
|
54
41
|
/**
|
|
55
42
|
* Retrieves changes for a specific TV show asynchronously.
|
|
@@ -58,20 +45,16 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
58
45
|
* @returns {Promise<Changes<TvShowChangeValue>>}
|
|
59
46
|
* A Promise that resolves with the changes for the TV show.
|
|
60
47
|
*/
|
|
61
|
-
changes(id, options) {
|
|
62
|
-
return
|
|
63
|
-
return yield this.api.get(`${BASE_TV}/${id}/changes`, options);
|
|
64
|
-
});
|
|
48
|
+
async changes(id, options) {
|
|
49
|
+
return await this.api.get(`${BASE_TV}/${id}/changes`, options);
|
|
65
50
|
}
|
|
66
51
|
/**
|
|
67
52
|
* Retrieves content ratings for a specific TV show asynchronously.
|
|
68
53
|
* @param {number} id - The ID of the TV show.
|
|
69
54
|
* @returns {Promise<ContentRatings>} A Promise that resolves with the content ratings of the TV show.
|
|
70
55
|
*/
|
|
71
|
-
contentRatings(id) {
|
|
72
|
-
return
|
|
73
|
-
return yield this.api.get(`${BASE_TV}/${id}/content_ratings`);
|
|
74
|
-
});
|
|
56
|
+
async contentRatings(id) {
|
|
57
|
+
return await this.api.get(`${BASE_TV}/${id}/content_ratings`);
|
|
75
58
|
}
|
|
76
59
|
/**
|
|
77
60
|
* Retrieves aggregate credits for a specific TV show asynchronously.
|
|
@@ -79,10 +62,8 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
79
62
|
* @param {LanguageOption} [options] - Additional options for the request.
|
|
80
63
|
* @returns {Promise<AggregateCredits>} A Promise that resolves with the aggregate credits of the TV show.
|
|
81
64
|
*/
|
|
82
|
-
aggregateCredits(id, options) {
|
|
83
|
-
return
|
|
84
|
-
return yield this.api.get(`${BASE_TV}/${id}/aggregate_credits`, options);
|
|
85
|
-
});
|
|
65
|
+
async aggregateCredits(id, options) {
|
|
66
|
+
return await this.api.get(`${BASE_TV}/${id}/aggregate_credits`, options);
|
|
86
67
|
}
|
|
87
68
|
/**
|
|
88
69
|
* Retrieves credits for a specific TV show asynchronously.
|
|
@@ -90,10 +71,8 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
90
71
|
* @param {LanguageOption} [options] - Additional options for the request.
|
|
91
72
|
* @returns {Promise<Credits>} A Promise that resolves with the credits of the TV show.
|
|
92
73
|
*/
|
|
93
|
-
credits(id, options) {
|
|
94
|
-
return
|
|
95
|
-
return yield this.api.get(`${BASE_TV}/${id}/credits`, options);
|
|
96
|
-
});
|
|
74
|
+
async credits(id, options) {
|
|
75
|
+
return await this.api.get(`${BASE_TV}/${id}/credits`, options);
|
|
97
76
|
}
|
|
98
77
|
/**
|
|
99
78
|
* Retrieves details of a specific season of a TV show asynchronously.
|
|
@@ -101,30 +80,24 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
101
80
|
* @param {number} seasonNumber - The season number.
|
|
102
81
|
* @returns {Promise<SeasonDetails>} A Promise that resolves with the details of the season.
|
|
103
82
|
*/
|
|
104
|
-
season(tvId, seasonNumber) {
|
|
105
|
-
return
|
|
106
|
-
return yield this.api.get(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
|
|
107
|
-
});
|
|
83
|
+
async season(tvId, seasonNumber) {
|
|
84
|
+
return await this.api.get(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
|
|
108
85
|
}
|
|
109
86
|
/**
|
|
110
87
|
* Retrieves episode groups for a specific TV show asynchronously.
|
|
111
88
|
* @param {number} id - The ID of the TV show.
|
|
112
89
|
* @returns {Promise<EpisodeGroups>} A Promise that resolves with the episode groups of the TV show.
|
|
113
90
|
*/
|
|
114
|
-
episodeGroups(id) {
|
|
115
|
-
return
|
|
116
|
-
return yield this.api.get(`${BASE_TV}/${id}/episode_groups`);
|
|
117
|
-
});
|
|
91
|
+
async episodeGroups(id) {
|
|
92
|
+
return await this.api.get(`${BASE_TV}/${id}/episode_groups`);
|
|
118
93
|
}
|
|
119
94
|
/**
|
|
120
95
|
* Retrieves external IDs for a specific TV show asynchronously.
|
|
121
96
|
* @param {number} id - The ID of the TV show.
|
|
122
97
|
* @returns {Promise<ExternalIds>} A Promise that resolves with the external IDs of the TV show.
|
|
123
98
|
*/
|
|
124
|
-
externalIds(id) {
|
|
125
|
-
return
|
|
126
|
-
return yield this.api.get(`${BASE_TV}/${id}/external_ids`);
|
|
127
|
-
});
|
|
99
|
+
async externalIds(id) {
|
|
100
|
+
return await this.api.get(`${BASE_TV}/${id}/external_ids`);
|
|
128
101
|
}
|
|
129
102
|
/**
|
|
130
103
|
* Retrieves images for a specific TV show asynchronously.
|
|
@@ -132,25 +105,20 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
132
105
|
* @param {TvShowImageOptions} [options] - Additional options for the request.
|
|
133
106
|
* @returns {Promise<Images>} A Promise that resolves with the images of the TV show.
|
|
134
107
|
*/
|
|
135
|
-
images(id, options) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
};
|
|
142
|
-
return yield this.api.get(`${BASE_TV}/${id}/images`, computedOptions);
|
|
143
|
-
});
|
|
108
|
+
async images(id, options) {
|
|
109
|
+
const computedOptions = {
|
|
110
|
+
include_image_language: options?.include_image_language?.join(','),
|
|
111
|
+
language: options?.language,
|
|
112
|
+
};
|
|
113
|
+
return await this.api.get(`${BASE_TV}/${id}/images`, computedOptions);
|
|
144
114
|
}
|
|
145
115
|
/**
|
|
146
116
|
* Retrieves keywords for a specific TV show asynchronously.
|
|
147
117
|
* @param {number} id - The ID of the TV show.
|
|
148
118
|
* @returns {Promise<Keywords>} A Promise that resolves with the keywords of the TV show.
|
|
149
119
|
*/
|
|
150
|
-
keywords(id) {
|
|
151
|
-
return
|
|
152
|
-
return yield this.api.get(`${BASE_TV}/${id}/keywords`);
|
|
153
|
-
});
|
|
120
|
+
async keywords(id) {
|
|
121
|
+
return await this.api.get(`${BASE_TV}/${id}/keywords`);
|
|
154
122
|
}
|
|
155
123
|
/**
|
|
156
124
|
* Retrieves recommendations for a specific TV show asynchronously.
|
|
@@ -158,10 +126,8 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
158
126
|
* @param {LanguageOption & PageOption} [options] - Additional options for the request.
|
|
159
127
|
* @returns {Promise<Recommendations>} A Promise that resolves with the recommendations for the TV show.
|
|
160
128
|
*/
|
|
161
|
-
recommendations(id, options) {
|
|
162
|
-
return
|
|
163
|
-
return yield this.api.get(`${BASE_TV}/${id}/recommendations`, options);
|
|
164
|
-
});
|
|
129
|
+
async recommendations(id, options) {
|
|
130
|
+
return await this.api.get(`${BASE_TV}/${id}/recommendations`, options);
|
|
165
131
|
}
|
|
166
132
|
/**
|
|
167
133
|
* Retrieves reviews for a specific TV show asynchronously.
|
|
@@ -169,20 +135,16 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
169
135
|
* @param {LanguageOption & PageOption} [options] - Additional options for the request.
|
|
170
136
|
* @returns {Promise<Reviews>} A Promise that resolves with the reviews of the TV show.
|
|
171
137
|
*/
|
|
172
|
-
reviews(id, options) {
|
|
173
|
-
return
|
|
174
|
-
return yield this.api.get(`${BASE_TV}/${id}/reviews`, options);
|
|
175
|
-
});
|
|
138
|
+
async reviews(id, options) {
|
|
139
|
+
return await this.api.get(`${BASE_TV}/${id}/reviews`, options);
|
|
176
140
|
}
|
|
177
141
|
/**
|
|
178
142
|
* Retrieves information about whether the TV show was screened theatrically asynchronously.
|
|
179
143
|
* @param {number} id - The ID of the TV show.
|
|
180
144
|
* @returns {Promise<ScreenedTheatrically>} A Promise that resolves with information about theatrical screenings.
|
|
181
145
|
*/
|
|
182
|
-
screenedTheatrically(id) {
|
|
183
|
-
return
|
|
184
|
-
return yield this.api.get(`${BASE_TV}/${id}/screened_theatrically`);
|
|
185
|
-
});
|
|
146
|
+
async screenedTheatrically(id) {
|
|
147
|
+
return await this.api.get(`${BASE_TV}/${id}/screened_theatrically`);
|
|
186
148
|
}
|
|
187
149
|
/**
|
|
188
150
|
* Retrieves similar TV shows for a specific TV show asynchronously.
|
|
@@ -190,20 +152,16 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
190
152
|
* @param {LanguageOption & PageOption} [options] - Additional options for the request.
|
|
191
153
|
* @returns {Promise<Similartv>} A Promise that resolves with the similar TV shows.
|
|
192
154
|
*/
|
|
193
|
-
similar(id, options) {
|
|
194
|
-
return
|
|
195
|
-
return yield this.api.get(`${BASE_TV}/${id}/similar`, options);
|
|
196
|
-
});
|
|
155
|
+
async similar(id, options) {
|
|
156
|
+
return await this.api.get(`${BASE_TV}/${id}/similar`, options);
|
|
197
157
|
}
|
|
198
158
|
/**
|
|
199
159
|
* Retrieves translations for a specific TV show asynchronously.
|
|
200
160
|
* @param {number} id - The ID of the TV show.
|
|
201
161
|
* @returns {Promise<Translations>} A Promise that resolves with the translations of the TV show.
|
|
202
162
|
*/
|
|
203
|
-
translations(id) {
|
|
204
|
-
return
|
|
205
|
-
return yield this.api.get(`${BASE_TV}/${id}/translations`);
|
|
206
|
-
});
|
|
163
|
+
async translations(id) {
|
|
164
|
+
return await this.api.get(`${BASE_TV}/${id}/translations`);
|
|
207
165
|
}
|
|
208
166
|
/**
|
|
209
167
|
* Retrieves videos for a specific TV show asynchronously.
|
|
@@ -211,15 +169,12 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
211
169
|
* @param {TvShowVideoOptions} [options] - Additional options for the request.
|
|
212
170
|
* @returns {Promise<Videos>} A Promise that resolves with the videos of the TV show.
|
|
213
171
|
*/
|
|
214
|
-
videos(id, options) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
};
|
|
221
|
-
return yield this.api.get(`${BASE_TV}/${id}/videos`, computedOptions);
|
|
222
|
-
});
|
|
172
|
+
async videos(id, options) {
|
|
173
|
+
const computedOptions = {
|
|
174
|
+
include_video_language: options?.include_video_language?.join(','),
|
|
175
|
+
language: options?.language,
|
|
176
|
+
};
|
|
177
|
+
return await this.api.get(`${BASE_TV}/${id}/videos`, computedOptions);
|
|
223
178
|
}
|
|
224
179
|
/**
|
|
225
180
|
* Retrieves watch providers for a specific TV show asynchronously.
|
|
@@ -227,59 +182,47 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
|
227
182
|
* @param {number} id - The ID of the TV show.
|
|
228
183
|
* @returns {Promise<WatchProviders>} A Promise that resolves with the watch providers of the TV show.
|
|
229
184
|
*/
|
|
230
|
-
watchProviders(id) {
|
|
231
|
-
return
|
|
232
|
-
return yield this.api.get(`${BASE_TV}/${id}/watch/providers`);
|
|
233
|
-
});
|
|
185
|
+
async watchProviders(id) {
|
|
186
|
+
return await this.api.get(`${BASE_TV}/${id}/watch/providers`);
|
|
234
187
|
}
|
|
235
188
|
/**
|
|
236
189
|
* Retrieves the latest TV show asynchronously.
|
|
237
190
|
* @returns {Promise<Latesttv>} A Promise that resolves with the latest TV show.
|
|
238
191
|
*/
|
|
239
|
-
latest() {
|
|
240
|
-
return
|
|
241
|
-
return yield this.api.get(`${BASE_TV}/latest`);
|
|
242
|
-
});
|
|
192
|
+
async latest() {
|
|
193
|
+
return await this.api.get(`${BASE_TV}/latest`);
|
|
243
194
|
}
|
|
244
195
|
/**
|
|
245
196
|
* Retrieves TV shows that are currently on the air asynchronously.
|
|
246
197
|
* @param {PageOption & LanguageOption & TimezoneOption} [options] - Additional options for the request.
|
|
247
198
|
* @returns {Promise<OnTheAir>} A Promise that resolves with TV shows currently on the air.
|
|
248
199
|
*/
|
|
249
|
-
onTheAir(options) {
|
|
250
|
-
return
|
|
251
|
-
return yield this.api.get(`${BASE_TV}/on_the_air`, options);
|
|
252
|
-
});
|
|
200
|
+
async onTheAir(options) {
|
|
201
|
+
return await this.api.get(`${BASE_TV}/on_the_air`, options);
|
|
253
202
|
}
|
|
254
203
|
/**
|
|
255
204
|
* Retrieves TV shows that are airing today asynchronously.
|
|
256
205
|
* @param {PageOption & LanguageOption & TimezoneOption} [options] - Additional options for the request.
|
|
257
206
|
* @returns {Promise<tvAiringToday>} A Promise that resolves with TV shows airing today.
|
|
258
207
|
*/
|
|
259
|
-
airingToday(options) {
|
|
260
|
-
return
|
|
261
|
-
return yield this.api.get(`${BASE_TV}/airing_today`, options);
|
|
262
|
-
});
|
|
208
|
+
async airingToday(options) {
|
|
209
|
+
return await this.api.get(`${BASE_TV}/airing_today`, options);
|
|
263
210
|
}
|
|
264
211
|
/**
|
|
265
212
|
* Retrieves popular TV shows asynchronously.
|
|
266
213
|
* @param {PageOption & LanguageOption} [options] - Additional options for the request.
|
|
267
214
|
* @returns {Promise<Populartv>} A Promise that resolves with popular TV shows.
|
|
268
215
|
*/
|
|
269
|
-
popular(options) {
|
|
270
|
-
return
|
|
271
|
-
return yield this.api.get(`${BASE_TV}/popular`, options);
|
|
272
|
-
});
|
|
216
|
+
async popular(options) {
|
|
217
|
+
return await this.api.get(`${BASE_TV}/popular`, options);
|
|
273
218
|
}
|
|
274
219
|
/**
|
|
275
220
|
* Retrieves top-rated TV shows asynchronously.
|
|
276
221
|
* @param {PageOption & LanguageOption} [options] - Additional options for the request.
|
|
277
222
|
* @returns {Promise<TopRatedtv>} A Promise that resolves with top-rated TV shows.
|
|
278
223
|
*/
|
|
279
|
-
topRated(options) {
|
|
280
|
-
return
|
|
281
|
-
return yield this.api.get(`${BASE_TV}/top_rated`, options);
|
|
282
|
-
});
|
|
224
|
+
async topRated(options) {
|
|
225
|
+
return await this.api.get(`${BASE_TV}/top_rated`, options);
|
|
283
226
|
}
|
|
284
227
|
}
|
|
285
228
|
exports.TvShowsEndpoint = TvShowsEndpoint;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WatchProvidersEndpoint = void 0;
|
|
4
|
+
const _types_1 = require("../@types");
|
|
5
|
+
/**
|
|
6
|
+
* Represents an endpoint for accessing watch provider information.
|
|
7
|
+
*/
|
|
8
|
+
class WatchProvidersEndpoint extends _types_1.BaseEndpoint {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new WatchProvidersEndpoint instance.
|
|
11
|
+
* @param {string} access_token - The access token used for authentication.
|
|
12
|
+
*/
|
|
13
|
+
constructor(access_token) {
|
|
14
|
+
super(access_token);
|
|
15
|
+
this.access_token = access_token;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a list of all available watch providers (streaming services).
|
|
19
|
+
* @returns {Promise<WatchProviders>} A Promise that resolves with the list of watch providers.
|
|
20
|
+
*/
|
|
21
|
+
async available() {
|
|
22
|
+
return await this.api.get('/watch/providers/movie');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves a list of available regions for watch providers.
|
|
26
|
+
* @returns {Promise<any>} A Promise that resolves with the list of available regions.
|
|
27
|
+
*/
|
|
28
|
+
async regions() {
|
|
29
|
+
return await this.api.get('/watch/providers/regions');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves a list of watch providers for movies.
|
|
33
|
+
* @returns {Promise<WatchProviders>} A Promise that resolves with the list of movie watch providers.
|
|
34
|
+
*/
|
|
35
|
+
async movie() {
|
|
36
|
+
return await this.api.get('/watch/providers/movie');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves a list of watch providers for TV shows.
|
|
40
|
+
* @returns {Promise<WatchProviders>} A Promise that resolves with the list of TV watch providers.
|
|
41
|
+
*/
|
|
42
|
+
async tv() {
|
|
43
|
+
return await this.api.get('/watch/providers/tv');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.WatchProvidersEndpoint = WatchProvidersEndpoint;
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ class TMDB {
|
|
|
22
22
|
this.certification = new endpoints_1.CertificationEndpoint(access_token);
|
|
23
23
|
this.changes = new endpoints_1.ChangeEndpoint(access_token);
|
|
24
24
|
this.collections = new endpoints_1.CollectionsEndpoint(access_token);
|
|
25
|
+
this.companies = new endpoints_1.CompaniesEndpoint(access_token);
|
|
25
26
|
this.configuration = new endpoints_1.ConfigurationEndpoint(access_token);
|
|
26
27
|
this.credits = new endpoints_1.CreditsEndpoint(access_token);
|
|
27
28
|
this.discover = new endpoints_1.DiscoverEndpoint(access_token);
|
|
@@ -29,6 +30,7 @@ class TMDB {
|
|
|
29
30
|
this.genre = new endpoints_1.GenreEndpoint(access_token);
|
|
30
31
|
this.keywords = new endpoints_1.KeywordsEndpoint(access_token);
|
|
31
32
|
this.movies = new endpoints_1.MoviesEndpoint(access_token);
|
|
33
|
+
this.networks = new endpoints_1.NetworksEndpoint(access_token);
|
|
32
34
|
this.people = new endpoints_1.PeopleEndpoint(access_token);
|
|
33
35
|
this.review = new endpoints_1.ReviewEndpoint(access_token);
|
|
34
36
|
this.search = new endpoints_1.SearchEndpoint(access_token);
|
|
@@ -36,6 +38,7 @@ class TMDB {
|
|
|
36
38
|
this.tvEpisodes = new endpoints_1.TvEpisodesEndpoint(access_token);
|
|
37
39
|
this.tvSeasons = new endpoints_1.TvSeasonsEndpoint(access_token);
|
|
38
40
|
this.tvShows = new endpoints_1.TvShowsEndpoint(access_token);
|
|
41
|
+
this.watchProviders = new endpoints_1.WatchProvidersEndpoint(access_token);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
exports.TMDB = TMDB;
|
package/dist/utils/api.js
CHANGED
|
@@ -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.parseOptions = exports.API = void 0;
|
|
13
4
|
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
|
@@ -15,21 +6,19 @@ class API {
|
|
|
15
6
|
constructor(access_token) {
|
|
16
7
|
this.access_token = access_token;
|
|
17
8
|
}
|
|
18
|
-
get(path, options) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
return Promise.reject((yield response.json()));
|
|
30
|
-
}
|
|
31
|
-
return (yield response.json());
|
|
9
|
+
async get(path, options) {
|
|
10
|
+
const params = (0, exports.parseOptions)(options);
|
|
11
|
+
const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${this.access_token}`,
|
|
15
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
16
|
+
},
|
|
32
17
|
});
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
return Promise.reject((await response.json()));
|
|
20
|
+
}
|
|
21
|
+
return (await response.json());
|
|
33
22
|
}
|
|
34
23
|
}
|
|
35
24
|
exports.API = API;
|
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFullImagePath = void 0;
|
|
3
|
+
exports.ImageFormats = exports.ImageSizes = exports.getFullImagePath = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Utility method to construct full url for image
|
|
6
6
|
* based on configuration
|
|
7
7
|
*
|
|
8
8
|
* https://developers.themoviedb.org/3/getting-started/images
|
|
9
|
-
* @param {string} baseUrl base image url
|
|
10
|
-
* @param {string} fileSize file size
|
|
9
|
+
* @param {string} baseUrl base image url (e.g., 'https://image.tmdb.org/t/p/')
|
|
10
|
+
* @param {string} fileSize file size (e.g., 'original', 'w500')
|
|
11
11
|
* @param {string} imagePath raw image path
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {string} format override image format (e.g., 'svg', 'png', 'jpg')
|
|
13
|
+
* @returns {string} The complete image URL
|
|
13
14
|
*/
|
|
14
|
-
const getFullImagePath = (baseUrl, fileSize, imagePath,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const getFullImagePath = (baseUrl, fileSize, imagePath, format) => {
|
|
16
|
+
if (!imagePath)
|
|
17
|
+
return '';
|
|
18
|
+
// Handle case where imagePath doesn't have an extension
|
|
19
|
+
const hasExtension = imagePath.includes('.');
|
|
20
|
+
if (hasExtension) {
|
|
21
|
+
const imagePathArr = imagePath.split('.');
|
|
22
|
+
const imageFormat = format || imagePathArr[1];
|
|
23
|
+
return `${baseUrl}${fileSize}${imagePathArr[0]}.${imageFormat}`;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// If no extension in path, use provided format or default to jpg
|
|
27
|
+
const imageFormat = format || 'jpg';
|
|
28
|
+
return `${baseUrl}${fileSize}${imagePath}.${imageFormat}`;
|
|
29
|
+
}
|
|
18
30
|
};
|
|
19
31
|
exports.getFullImagePath = getFullImagePath;
|
|
32
|
+
/**
|
|
33
|
+
* Common image sizes available in TMDB
|
|
34
|
+
*/
|
|
35
|
+
exports.ImageSizes = {
|
|
36
|
+
ORIGINAL: 'original',
|
|
37
|
+
W500: 'w500',
|
|
38
|
+
W300: 'w300',
|
|
39
|
+
W185: 'w185',
|
|
40
|
+
W92: 'w92',
|
|
41
|
+
H632: 'h632'
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Image formats supported by TMDB
|
|
45
|
+
*/
|
|
46
|
+
exports.ImageFormats = {
|
|
47
|
+
JPG: 'jpg',
|
|
48
|
+
PNG: 'png',
|
|
49
|
+
SVG: 'svg'
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,41 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tdanks2000/tmdb-wrapper",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"tmdb
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
],
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@tdanks2000/tmdb-wrapper",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "A powerful and easy-to-use TypeScript wrapper for The Movie Database (TMDb) API",
|
|
5
|
+
"module": "./src/index.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/tdanks2000/tmdb-wrapper.git"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/tdanks2000/tmdb-wrapper#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/tdanks2000/tmdb-wrapper/issues"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**/*",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"tmdb",
|
|
26
|
+
"tmdbWrapper",
|
|
27
|
+
"tmdb wrapper",
|
|
28
|
+
"tmdb-wrapper",
|
|
29
|
+
"api wrapper",
|
|
30
|
+
"node",
|
|
31
|
+
"typescript",
|
|
32
|
+
"movies",
|
|
33
|
+
"tv shows",
|
|
34
|
+
"movie database",
|
|
35
|
+
"themoviedb",
|
|
36
|
+
"tmdb api",
|
|
37
|
+
"entertainment",
|
|
38
|
+
"media"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=16"
|
|
42
|
+
},
|
|
43
|
+
"author": "TDanks2000",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"private": false,
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"release": "npm run build && npm version patch && npm publish",
|
|
49
|
+
"release:minor": "npm run build && npm version minor && npm publish",
|
|
50
|
+
"release:major": "npm run build && npm version major && npm publish",
|
|
51
|
+
"preversion": "npm run build"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^22.15.3",
|
|
55
|
+
"ts-node": "^10.9.2",
|
|
56
|
+
"tsc-alias": "^1.8.15",
|
|
57
|
+
"typescript": "^5.8.3"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
- uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: 16
|
|
18
|
-
- run: npm ci
|
|
19
|
-
- run: npm test
|
|
20
|
-
|
|
21
|
-
publish-npm:
|
|
22
|
-
needs: build
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v3
|
|
26
|
-
- uses: actions/setup-node@v3
|
|
27
|
-
with:
|
|
28
|
-
node-version: 16
|
|
29
|
-
registry-url: https://registry.npmjs.org/
|
|
30
|
-
- run: npm ci
|
|
31
|
-
- run: npm publish
|
|
32
|
-
env:
|
|
33
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface Gravatar {
|
|
2
|
-
hash: string;
|
|
3
|
-
}
|
|
4
|
-
export interface Avatar {
|
|
5
|
-
gravatar: Gravatar;
|
|
6
|
-
}
|
|
7
|
-
export interface AccountDetails {
|
|
8
|
-
avatar: Avatar;
|
|
9
|
-
id: number;
|
|
10
|
-
include_adult: boolean;
|
|
11
|
-
iso_3166_1: string;
|
|
12
|
-
iso_639_1: string;
|
|
13
|
-
name: string;
|
|
14
|
-
username: string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=account.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/@types/endpoints/account.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|