@tdanks2000/tmdb-wrapper 1.0.0
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 +137 -0
- package/dist/@types/endpoints/account.d.ts +16 -0
- package/dist/@types/endpoints/account.d.ts.map +1 -0
- package/dist/@types/endpoints/account.js +2 -0
- package/dist/@types/endpoints/certification.d.ts +19 -0
- package/dist/@types/endpoints/certification.d.ts.map +1 -0
- package/dist/@types/endpoints/certification.js +2 -0
- package/dist/@types/endpoints/changes.d.ts +26 -0
- package/dist/@types/endpoints/changes.d.ts.map +1 -0
- package/dist/@types/endpoints/changes.js +2 -0
- package/dist/@types/endpoints/collection.d.ts +21 -0
- package/dist/@types/endpoints/collection.d.ts.map +1 -0
- package/dist/@types/endpoints/collection.js +2 -0
- package/dist/@types/endpoints/companies.d.ts +29 -0
- package/dist/@types/endpoints/companies.d.ts.map +1 -0
- package/dist/@types/endpoints/companies.js +2 -0
- package/dist/@types/endpoints/configuration.d.ts +105 -0
- package/dist/@types/endpoints/configuration.d.ts.map +1 -0
- package/dist/@types/endpoints/configuration.js +2 -0
- package/dist/@types/endpoints/credits.d.ts +135 -0
- package/dist/@types/endpoints/credits.d.ts.map +1 -0
- package/dist/@types/endpoints/credits.js +2 -0
- package/dist/@types/endpoints/discover.d.ts +15 -0
- package/dist/@types/endpoints/discover.d.ts.map +1 -0
- package/dist/@types/endpoints/discover.js +2 -0
- package/dist/@types/endpoints/find.d.ts +20 -0
- package/dist/@types/endpoints/find.d.ts.map +1 -0
- package/dist/@types/endpoints/find.js +2 -0
- package/dist/@types/endpoints/index.d.ts +22 -0
- package/dist/@types/endpoints/index.d.ts.map +1 -0
- package/dist/@types/endpoints/index.js +37 -0
- package/dist/@types/endpoints/keywords.d.ts +21 -0
- package/dist/@types/endpoints/keywords.d.ts.map +1 -0
- package/dist/@types/endpoints/keywords.js +2 -0
- package/dist/@types/endpoints/movies.d.ts +144 -0
- package/dist/@types/endpoints/movies.d.ts.map +1 -0
- package/dist/@types/endpoints/movies.js +12 -0
- package/dist/@types/endpoints/networks.d.ts +14 -0
- package/dist/@types/endpoints/networks.d.ts.map +1 -0
- package/dist/@types/endpoints/networks.js +2 -0
- package/dist/@types/endpoints/options.d.ts +73 -0
- package/dist/@types/endpoints/options.d.ts.map +1 -0
- package/dist/@types/endpoints/options.js +2 -0
- package/dist/@types/endpoints/people.d.ts +135 -0
- package/dist/@types/endpoints/people.d.ts.map +1 -0
- package/dist/@types/endpoints/people.js +2 -0
- package/dist/@types/endpoints/review.d.ts +8 -0
- package/dist/@types/endpoints/review.d.ts.map +1 -0
- package/dist/@types/endpoints/review.js +2 -0
- package/dist/@types/endpoints/search.d.ts +9 -0
- package/dist/@types/endpoints/search.d.ts.map +1 -0
- package/dist/@types/endpoints/search.js +2 -0
- package/dist/@types/endpoints/trending.d.ts +12 -0
- package/dist/@types/endpoints/trending.d.ts.map +1 -0
- package/dist/@types/endpoints/trending.js +2 -0
- package/dist/@types/endpoints/tvEpisode.d.ts +53 -0
- package/dist/@types/endpoints/tvEpisode.d.ts.map +1 -0
- package/dist/@types/endpoints/tvEpisode.js +2 -0
- package/dist/@types/endpoints/tvSeasons.d.ts +19 -0
- package/dist/@types/endpoints/tvSeasons.d.ts.map +1 -0
- package/dist/@types/endpoints/tvSeasons.js +2 -0
- package/dist/@types/endpoints/tvShows.d.ts +260 -0
- package/dist/@types/endpoints/tvShows.d.ts.map +1 -0
- package/dist/@types/endpoints/tvShows.js +2 -0
- package/dist/@types/endpoints/watchProviders.d.ts +295 -0
- package/dist/@types/endpoints/watchProviders.d.ts.map +1 -0
- package/dist/@types/endpoints/watchProviders.js +2 -0
- package/dist/@types/index.d.ts +4 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/index.js +19 -0
- package/dist/@types/models/baseEndpoint.d.ts +7 -0
- package/dist/@types/models/baseEndpoint.d.ts.map +1 -0
- package/dist/@types/models/baseEndpoint.js +11 -0
- package/dist/@types/models/index.d.ts +2 -0
- package/dist/@types/models/index.d.ts.map +1 -0
- package/dist/@types/models/index.js +17 -0
- package/dist/@types/types.d.ts +174 -0
- package/dist/@types/types.d.ts.map +1 -0
- package/dist/@types/types.js +2 -0
- package/dist/endpoints/account.d.ts +6 -0
- package/dist/endpoints/account.d.ts.map +1 -0
- package/dist/endpoints/account.js +24 -0
- package/dist/endpoints/certification.d.ts +8 -0
- package/dist/endpoints/certification.d.ts.map +1 -0
- package/dist/endpoints/certification.js +30 -0
- package/dist/endpoints/changes.d.ts +9 -0
- package/dist/endpoints/changes.d.ts.map +1 -0
- package/dist/endpoints/changes.js +35 -0
- package/dist/endpoints/collections.d.ts +9 -0
- package/dist/endpoints/collections.d.ts.map +1 -0
- package/dist/endpoints/collections.js +41 -0
- package/dist/endpoints/companies.d.ts +9 -0
- package/dist/endpoints/companies.d.ts.map +1 -0
- package/dist/endpoints/companies.js +35 -0
- package/dist/endpoints/configuration.d.ts +7 -0
- package/dist/endpoints/configuration.d.ts.map +1 -0
- package/dist/endpoints/configuration.js +25 -0
- package/dist/endpoints/credits.d.ts +7 -0
- package/dist/endpoints/credits.d.ts.map +1 -0
- package/dist/endpoints/credits.js +25 -0
- package/dist/endpoints/discover.d.ts +61 -0
- package/dist/endpoints/discover.d.ts.map +1 -0
- package/dist/endpoints/discover.js +30 -0
- package/dist/endpoints/find.d.ts +6 -0
- package/dist/endpoints/find.d.ts.map +1 -0
- package/dist/endpoints/find.js +24 -0
- package/dist/endpoints/genre.d.ts +14 -0
- package/dist/endpoints/genre.d.ts.map +1 -0
- package/dist/endpoints/genre.js +30 -0
- package/dist/endpoints/index.d.ts +19 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/index.js +34 -0
- package/dist/endpoints/keywords.d.ts +7 -0
- package/dist/endpoints/keywords.d.ts.map +1 -0
- package/dist/endpoints/keywords.js +30 -0
- package/dist/endpoints/movies.d.ts +36 -0
- package/dist/endpoints/movies.d.ts.map +1 -0
- package/dist/endpoints/movies.js +134 -0
- package/dist/endpoints/networks.d.ts +9 -0
- package/dist/endpoints/networks.d.ts.map +1 -0
- package/dist/endpoints/networks.js +35 -0
- package/dist/endpoints/people.d.ts +16 -0
- package/dist/endpoints/people.d.ts.map +1 -0
- package/dist/endpoints/people.js +79 -0
- package/dist/endpoints/review.d.ts +6 -0
- package/dist/endpoints/review.d.ts.map +1 -0
- package/dist/endpoints/review.js +24 -0
- package/dist/endpoints/search.d.ts +39 -0
- package/dist/endpoints/search.d.ts.map +1 -0
- package/dist/endpoints/search.js +56 -0
- package/dist/endpoints/trending.d.ts +6 -0
- package/dist/endpoints/trending.d.ts.map +1 -0
- package/dist/endpoints/trending.js +24 -0
- package/dist/endpoints/tvEpisodes.d.ts +24 -0
- package/dist/endpoints/tvEpisodes.d.ts.map +1 -0
- package/dist/endpoints/tvEpisodes.js +68 -0
- package/dist/endpoints/tvSeasons.d.ts +25 -0
- package/dist/endpoints/tvSeasons.d.ts.map +1 -0
- package/dist/endpoints/tvSeasons.js +73 -0
- package/dist/endpoints/tvShows.d.ts +33 -0
- package/dist/endpoints/tvShows.d.ts.map +1 -0
- package/dist/endpoints/tvShows.js +154 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/utils/api.d.ts +7 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +39 -0
- package/dist/utils/getimagePath.d.ts +12 -0
- package/dist/utils/getimagePath.d.ts.map +1 -0
- package/dist/utils/getimagePath.js +19 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/package.json +40 -0
- package/src/@types/endpoints/account.ts +17 -0
- package/src/@types/endpoints/certification.ts +19 -0
- package/src/@types/endpoints/changes.ts +29 -0
- package/src/@types/endpoints/collection.ts +23 -0
- package/src/@types/endpoints/companies.ts +33 -0
- package/src/@types/endpoints/configuration.ts +111 -0
- package/src/@types/endpoints/credits.ts +149 -0
- package/src/@types/endpoints/discover.ts +31 -0
- package/src/@types/endpoints/find.ts +28 -0
- package/src/@types/endpoints/index.ts +21 -0
- package/src/@types/endpoints/keywords.ts +24 -0
- package/src/@types/endpoints/movies.ts +162 -0
- package/src/@types/endpoints/networks.ts +15 -0
- package/src/@types/endpoints/options.ts +189 -0
- package/src/@types/endpoints/people.ts +151 -0
- package/src/@types/endpoints/review.ts +8 -0
- package/src/@types/endpoints/search.ts +10 -0
- package/src/@types/endpoints/trending.ts +20 -0
- package/src/@types/endpoints/tvEpisode.ts +58 -0
- package/src/@types/endpoints/tvSeasons.ts +23 -0
- package/src/@types/endpoints/tvShows.ts +284 -0
- package/src/@types/endpoints/watchProviders.ts +298 -0
- package/src/@types/index.ts +3 -0
- package/src/@types/models/baseEndpoint.ts +9 -0
- package/src/@types/models/index.ts +1 -0
- package/src/@types/types.ts +199 -0
- package/src/endpoints/account.ts +11 -0
- package/src/endpoints/certification.ts +15 -0
- package/src/endpoints/changes.ts +19 -0
- package/src/endpoints/collections.ts +32 -0
- package/src/endpoints/companies.ts +19 -0
- package/src/endpoints/configuration.ts +11 -0
- package/src/endpoints/credits.ts +11 -0
- package/src/endpoints/discover.ts +73 -0
- package/src/endpoints/find.ts +11 -0
- package/src/endpoints/genre.ts +19 -0
- package/src/endpoints/index.ts +18 -0
- package/src/endpoints/keywords.ts +17 -0
- package/src/endpoints/movies.ts +138 -0
- package/src/endpoints/networks.ts +19 -0
- package/src/endpoints/people.ts +79 -0
- package/src/endpoints/review.ts +11 -0
- package/src/endpoints/search.ts +78 -0
- package/src/endpoints/trending.ts +15 -0
- package/src/endpoints/tvEpisodes.ts +88 -0
- package/src/endpoints/tvSeasons.ts +93 -0
- package/src/endpoints/tvShows.ts +151 -0
- package/src/index.ts +66 -0
- package/src/utils/api.ts +31 -0
- package/src/utils/getimagePath.ts +16 -0
- package/src/utils/index.ts +2 -0
- package/tsconfig.json +108 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AppendToResponse, AppendToResponseTvEpisodeKey, BaseEndpoint, ChangeOption, Changes, Episode, EpisodeSelection, ExternalIds, Images, LanguageOption, TvEpisodeCredit, TvEpisodeTranslations, Videos } from '@/@types';
|
|
2
|
+
export interface TvEpisodeImageSearchOptions extends LanguageOption {
|
|
3
|
+
/**
|
|
4
|
+
* a list of ISO-639-1 values to query
|
|
5
|
+
*/
|
|
6
|
+
include_image_language?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface TvEpisodeVideoSearchOptions extends LanguageOption {
|
|
9
|
+
/**
|
|
10
|
+
* a list of ISO-639-1 values to query
|
|
11
|
+
*/
|
|
12
|
+
include_video_language?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare class TvEpisodesEndpoint extends BaseEndpoint {
|
|
15
|
+
constructor(access_token: string);
|
|
16
|
+
details<T extends AppendToResponseTvEpisodeKey[] | undefined>(episodeSelection: EpisodeSelection, appendToResponse?: T, options?: LanguageOption): Promise<AppendToResponse<Omit<Episode, "show_id">, T, "tvEpisode">>;
|
|
17
|
+
changes(episodeID: number, options?: ChangeOption): Promise<Changes<unknown>>;
|
|
18
|
+
credits(episodeSelection: EpisodeSelection, options?: LanguageOption): Promise<TvEpisodeCredit>;
|
|
19
|
+
externalIds(episodeSelection: EpisodeSelection): Promise<ExternalIds>;
|
|
20
|
+
images(episodeSelection: EpisodeSelection, options?: TvEpisodeImageSearchOptions): Promise<Images>;
|
|
21
|
+
translations(episodeSelection: EpisodeSelection): Promise<TvEpisodeTranslations>;
|
|
22
|
+
videos(episodeSelection: EpisodeSelection, options?: TvEpisodeVideoSearchOptions): Promise<Videos>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=tvEpisodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tvEpisodes.d.ts","sourceRoot":"","sources":["../../src/endpoints/tvEpisodes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,cAAc,EAEd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACP,MAAM,UAAU,CAAC;AAMlB,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IACjE;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IACjE;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC;AAED,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,YAAY,EAAE,MAAM;IAI1B,OAAO,CAAC,CAAC,SAAS,4BAA4B,EAAE,GAAG,SAAS,EAChE,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,CAAC,EAAE,CAAC,EACpB,OAAO,CAAC,EAAE,cAAc;IAapB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAIjD,OAAO,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc;IAIpE,WAAW,CAAC,gBAAgB,EAAE,gBAAgB;IAI9C,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,2BAA2B;IAQhF,YAAY,CAAC,gBAAgB,EAAE,gBAAgB;IAI/C,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,2BAA2B;CAOvF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TvEpisodesEndpoint = void 0;
|
|
13
|
+
const _types_1 = require("@/@types");
|
|
14
|
+
const BASE_EPISODE = (episodeSelection) => {
|
|
15
|
+
return `/tv/${episodeSelection.tvShowID}/season/${episodeSelection.seasonNumber}/episode/${episodeSelection.episodeNumber}`;
|
|
16
|
+
};
|
|
17
|
+
class TvEpisodesEndpoint extends _types_1.BaseEndpoint {
|
|
18
|
+
constructor(access_token) {
|
|
19
|
+
super(access_token);
|
|
20
|
+
}
|
|
21
|
+
details(episodeSelection, appendToResponse, options) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const combinedOptions = Object.assign({ append_to_response: appendToResponse ? appendToResponse.join(',') : undefined }, options);
|
|
24
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}`, combinedOptions);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
changes(episodeID, options) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.api.get(`/tv/episode/${episodeID}/changes`, options);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
credits(episodeSelection, options) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}/credits`, options);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
externalIds(episodeSelection) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}/external_ids`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
images(episodeSelection, options) {
|
|
43
|
+
var _a;
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const computedOptions = {
|
|
46
|
+
include_image_language: (_a = options === null || options === void 0 ? void 0 : options.include_image_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
47
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
48
|
+
};
|
|
49
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}/images`, computedOptions);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
translations(episodeSelection) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}/translations`);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
videos(episodeSelection, options) {
|
|
58
|
+
var _a;
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const computedOptions = {
|
|
61
|
+
include_video_language: (_a = options === null || options === void 0 ? void 0 : options.include_video_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
62
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
63
|
+
};
|
|
64
|
+
return yield this.api.get(`${BASE_EPISODE(episodeSelection)}/videos`, computedOptions);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.TvEpisodesEndpoint = TvEpisodesEndpoint;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AggregateCredits, AppendToResponse, AppendToResponseTvSeasonKey, BaseEndpoint, ChangeOption, Changes, Credits, ExternalIds, Images, LanguageOption, SeasonDetails, SeasonSelection, Translations, TvSeasonChangeValue, Videos } from '@/@types';
|
|
2
|
+
export interface TvSeasonImageSearchOptions extends LanguageOption {
|
|
3
|
+
/**
|
|
4
|
+
* a list of ISO-639-1 values to query
|
|
5
|
+
*/
|
|
6
|
+
include_image_language?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface TvSeasonVideoSearchOptions extends LanguageOption {
|
|
9
|
+
/**
|
|
10
|
+
* a list of ISO-639-1 values to query
|
|
11
|
+
*/
|
|
12
|
+
include_video_language?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare class TvSeasonsEndpoint extends BaseEndpoint {
|
|
15
|
+
constructor(access_token: string);
|
|
16
|
+
details<T extends AppendToResponseTvSeasonKey[] | undefined>(seasonSelection: SeasonSelection, appendToResponse?: T, options?: LanguageOption): Promise<AppendToResponse<SeasonDetails, T, "tvSeason">>;
|
|
17
|
+
aggregateCredits(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<AggregateCredits>;
|
|
18
|
+
changes(seasonId: number, options?: ChangeOption): Promise<Changes<TvSeasonChangeValue>>;
|
|
19
|
+
credits(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<Credits>;
|
|
20
|
+
externalIds(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<ExternalIds>;
|
|
21
|
+
images(seasonSelection: SeasonSelection, options?: TvSeasonImageSearchOptions): Promise<Images>;
|
|
22
|
+
videos(seasonSelection: SeasonSelection, options?: TvSeasonVideoSearchOptions): Promise<Videos>;
|
|
23
|
+
translations(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<Translations>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=tvSeasons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tvSeasons.d.ts","sourceRoot":"","sources":["../../src/endpoints/tvSeasons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACP,MAAM,UAAU,CAAC;AAMlB,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAChE;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAChE;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,YAAY,EAAE,MAAM;IAI1B,OAAO,CAAC,CAAC,SAAS,2BAA2B,EAAE,GAAG,SAAS,EAC/D,eAAe,EAAE,eAAe,EAChC,gBAAgB,CAAC,EAAE,CAAC,EACpB,OAAO,CAAC,EAAE,cAAc;IAapB,gBAAgB,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc;IAI3E,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAIhD,OAAO,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc;IAIlE,WAAW,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc;IAItE,MAAM,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,0BAA0B;IAQ7E,MAAM,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,0BAA0B;IAQ7E,YAAY,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc;CAG9E"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TvSeasonsEndpoint = void 0;
|
|
13
|
+
const _types_1 = require("@/@types");
|
|
14
|
+
const BASE_SEASON = (seasonSelection) => {
|
|
15
|
+
return `/tv/${seasonSelection.tvShowID}/season/${seasonSelection.seasonNumber}`;
|
|
16
|
+
};
|
|
17
|
+
class TvSeasonsEndpoint extends _types_1.BaseEndpoint {
|
|
18
|
+
constructor(access_token) {
|
|
19
|
+
super(access_token);
|
|
20
|
+
}
|
|
21
|
+
details(seasonSelection, appendToResponse, options) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const combinedOptions = Object.assign({ append_to_response: appendToResponse ? appendToResponse.join(',') : undefined }, options);
|
|
24
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}`, combinedOptions);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
aggregateCredits(seasonSelection, options) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/aggregate_credits`, options);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
changes(seasonId, options) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return yield this.api.get(`/tv/season/${seasonId}/changes`, options);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
credits(seasonSelection, options) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/credits`, options);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
externalIds(seasonSelection, options) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/external_ids`, options);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
images(seasonSelection, options) {
|
|
48
|
+
var _a;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const computedOptions = {
|
|
51
|
+
include_image_language: (_a = options === null || options === void 0 ? void 0 : options.include_image_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
52
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
53
|
+
};
|
|
54
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/images`, computedOptions);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
videos(seasonSelection, options) {
|
|
58
|
+
var _a;
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const computedOptions = {
|
|
61
|
+
include_video_language: (_a = options === null || options === void 0 ? void 0 : options.include_video_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
62
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
63
|
+
};
|
|
64
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/videos`, computedOptions);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
translations(seasonSelection, options) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return yield this.api.get(`${BASE_SEASON(seasonSelection)}/translations`, options);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.TvSeasonsEndpoint = TvSeasonsEndpoint;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AggregateCredits, AlternativeTitles, AppendToResponse, AppendToResponseTvKey, BaseEndpoint, ChangeOption, Changes, ContentRatings, Credits, EpisodeGroups, ExternalIds, Images, Keywords, LanguageOption, Latesttv, OnTheAir, PageOption, Populartv, Recommendations, Reviews, ScreenedTheatrically, SeasonDetails, Similartv, TimezoneOption, TopRatedtv, Translations, TvShowChangeValue, TvShowDetails, TvShowImageOptions, TvShowVideoOptions, Videos, WatchProviders, tvAiringToday } from '@/@types';
|
|
2
|
+
export declare class TvShowsEndpoint extends BaseEndpoint {
|
|
3
|
+
protected readonly access_token: string;
|
|
4
|
+
constructor(access_token: string);
|
|
5
|
+
details<T extends AppendToResponseTvKey[] | undefined>(id: number, appendToResponse?: T, language?: string): Promise<AppendToResponse<TvShowDetails, T, "tvShow">>;
|
|
6
|
+
alternativeTitles(id: number): Promise<AlternativeTitles>;
|
|
7
|
+
changes(id: number, options?: ChangeOption): Promise<Changes<TvShowChangeValue>>;
|
|
8
|
+
contentRatings(id: number): Promise<ContentRatings>;
|
|
9
|
+
aggregateCredits(id: number, options?: LanguageOption): Promise<AggregateCredits>;
|
|
10
|
+
credits(id: number, options?: LanguageOption): Promise<Credits>;
|
|
11
|
+
season(tvId: number, seasonNumber: number): Promise<SeasonDetails>;
|
|
12
|
+
episodeGroups(id: number): Promise<EpisodeGroups>;
|
|
13
|
+
externalIds(id: number): Promise<ExternalIds>;
|
|
14
|
+
images(id: number, options?: TvShowImageOptions): Promise<Images>;
|
|
15
|
+
keywords(id: number): Promise<Keywords>;
|
|
16
|
+
recommendations(id: number, options?: LanguageOption & PageOption): Promise<Recommendations>;
|
|
17
|
+
reviews(id: number, options?: LanguageOption & PageOption): Promise<Reviews>;
|
|
18
|
+
screenedTheatrically(id: number): Promise<ScreenedTheatrically>;
|
|
19
|
+
similar(id: number, options?: LanguageOption & PageOption): Promise<Similartv>;
|
|
20
|
+
translations(id: number): Promise<Translations>;
|
|
21
|
+
videos(id: number, options?: TvShowVideoOptions): Promise<Videos>;
|
|
22
|
+
/**
|
|
23
|
+
* Powered by JustWatch
|
|
24
|
+
* @param id
|
|
25
|
+
*/
|
|
26
|
+
watchProviders(id: number): Promise<WatchProviders>;
|
|
27
|
+
latest(): Promise<Latesttv>;
|
|
28
|
+
onTheAir(options?: PageOption & LanguageOption & TimezoneOption): Promise<OnTheAir>;
|
|
29
|
+
airingToday(options?: PageOption & LanguageOption & TimezoneOption): Promise<tvAiringToday>;
|
|
30
|
+
popular(options?: PageOption & LanguageOption): Promise<Populartv>;
|
|
31
|
+
topRated(options?: PageOption & LanguageOption): Promise<TopRatedtv>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tvShows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tvShows.d.ts","sourceRoot":"","sources":["../../src/endpoints/tvShows.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TvShowsEndpoint = void 0;
|
|
13
|
+
const _types_1 = require("@/@types");
|
|
14
|
+
const BASE_TV = '/tv';
|
|
15
|
+
class TvShowsEndpoint extends _types_1.BaseEndpoint {
|
|
16
|
+
constructor(access_token) {
|
|
17
|
+
super(access_token);
|
|
18
|
+
this.access_token = access_token;
|
|
19
|
+
}
|
|
20
|
+
details(id, appendToResponse, language) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const options = {
|
|
23
|
+
append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
|
|
24
|
+
language: language,
|
|
25
|
+
};
|
|
26
|
+
return yield this.api.get(`${BASE_TV}/${id}`, options);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
alternativeTitles(id) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return yield this.api.get(`${BASE_TV}/${id}/alternative_titles`);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
changes(id, options) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return yield this.api.get(`${BASE_TV}/${id}/changes`, options);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
contentRatings(id) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return yield this.api.get(`${BASE_TV}/${id}/content_ratings`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
aggregateCredits(id, options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return yield this.api.get(`${BASE_TV}/${id}/aggregate_credits`, options);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
credits(id, options) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return yield this.api.get(`${BASE_TV}/${id}/credits`, options);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
season(tvId, seasonNumber) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return yield this.api.get(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
episodeGroups(id) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield this.api.get(`${BASE_TV}/${id}/episode_groups`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
externalIds(id) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
return yield this.api.get(`${BASE_TV}/${id}/external_ids`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
images(id, options) {
|
|
70
|
+
var _a;
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const computedOptions = {
|
|
73
|
+
include_image_language: (_a = options === null || options === void 0 ? void 0 : options.include_image_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
74
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
75
|
+
};
|
|
76
|
+
return yield this.api.get(`${BASE_TV}/${id}/images`, computedOptions);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
keywords(id) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return yield this.api.get(`${BASE_TV}/${id}/keywords`);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
recommendations(id, options) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
return yield this.api.get(`${BASE_TV}/${id}/recommendations`, options);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
reviews(id, options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return yield this.api.get(`${BASE_TV}/${id}/reviews`, options);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
screenedTheatrically(id) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
return yield this.api.get(`${BASE_TV}/${id}/screened_theatrically`);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
similar(id, options) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
return yield this.api.get(`${BASE_TV}/${id}/similar`, options);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
translations(id) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
return yield this.api.get(`${BASE_TV}/${id}/translations`);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
videos(id, options) {
|
|
110
|
+
var _a;
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const computedOptions = {
|
|
113
|
+
include_video_language: (_a = options === null || options === void 0 ? void 0 : options.include_video_language) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
114
|
+
language: options === null || options === void 0 ? void 0 : options.language,
|
|
115
|
+
};
|
|
116
|
+
return yield this.api.get(`${BASE_TV}/${id}/videos`, computedOptions);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Powered by JustWatch
|
|
121
|
+
* @param id
|
|
122
|
+
*/
|
|
123
|
+
watchProviders(id) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
return yield this.api.get(`${BASE_TV}/${id}/watch/providers`);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
latest() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return yield this.api.get(`${BASE_TV}/latest`);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
onTheAir(options) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
return yield this.api.get(`${BASE_TV}/on_the_air`, options);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
airingToday(options) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
return yield this.api.get(`${BASE_TV}/airing_today`, options);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
popular(options) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
return yield this.api.get(`${BASE_TV}/popular`, options);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
topRated(options) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
return yield this.api.get(`${BASE_TV}/top_rated`, options);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.TvShowsEndpoint = TvShowsEndpoint;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AccountEndpoint, CertificationEndpoint, ChangeEndpoint, CollectionsEndpoint, ConfigurationEndpoint, CreditsEndpoint, DiscoverEndpoint, FindEndpoint, GenreEndpoint, KeywordsEndpoint, MoviesEndpoint, PeopleEndpoint, ReviewEndpoint, SearchEndpoint, TrendingEndpoint, TvEpisodesEndpoint, TvSeasonsEndpoint, TvShowsEndpoint } from '@/endpoints';
|
|
2
|
+
declare class TMDB {
|
|
3
|
+
constructor(access_token: string);
|
|
4
|
+
account: AccountEndpoint;
|
|
5
|
+
certification: CertificationEndpoint;
|
|
6
|
+
changes: ChangeEndpoint;
|
|
7
|
+
collections: CollectionsEndpoint;
|
|
8
|
+
configuration: ConfigurationEndpoint;
|
|
9
|
+
credits: CreditsEndpoint;
|
|
10
|
+
discover: DiscoverEndpoint;
|
|
11
|
+
find: FindEndpoint;
|
|
12
|
+
genre: GenreEndpoint;
|
|
13
|
+
keywords: KeywordsEndpoint;
|
|
14
|
+
movies: MoviesEndpoint;
|
|
15
|
+
people: PeopleEndpoint;
|
|
16
|
+
review: ReviewEndpoint;
|
|
17
|
+
search: SearchEndpoint;
|
|
18
|
+
trending: TrendingEndpoint;
|
|
19
|
+
tvEpisodes: TvEpisodesEndpoint;
|
|
20
|
+
tvSeasons: TvSeasonsEndpoint;
|
|
21
|
+
tvShows: TvShowsEndpoint;
|
|
22
|
+
}
|
|
23
|
+
export * from './@types';
|
|
24
|
+
export * from './utils';
|
|
25
|
+
export { TMDB };
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,cAAM,IAAI;gBACI,YAAY,EAAE,MAAM;IAqBhC,OAAO,EAAE,eAAe,CAAC;IACzB,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC;IACjC,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.TMDB = void 0;
|
|
18
|
+
const endpoints_1 = require("@/endpoints");
|
|
19
|
+
class TMDB {
|
|
20
|
+
constructor(access_token) {
|
|
21
|
+
this.account = new endpoints_1.AccountEndpoint(access_token);
|
|
22
|
+
this.certification = new endpoints_1.CertificationEndpoint(access_token);
|
|
23
|
+
this.changes = new endpoints_1.ChangeEndpoint(access_token);
|
|
24
|
+
this.collections = new endpoints_1.CollectionsEndpoint(access_token);
|
|
25
|
+
this.configuration = new endpoints_1.ConfigurationEndpoint(access_token);
|
|
26
|
+
this.credits = new endpoints_1.CreditsEndpoint(access_token);
|
|
27
|
+
this.discover = new endpoints_1.DiscoverEndpoint(access_token);
|
|
28
|
+
this.find = new endpoints_1.FindEndpoint(access_token);
|
|
29
|
+
this.genre = new endpoints_1.GenreEndpoint(access_token);
|
|
30
|
+
this.keywords = new endpoints_1.KeywordsEndpoint(access_token);
|
|
31
|
+
this.movies = new endpoints_1.MoviesEndpoint(access_token);
|
|
32
|
+
this.people = new endpoints_1.PeopleEndpoint(access_token);
|
|
33
|
+
this.review = new endpoints_1.ReviewEndpoint(access_token);
|
|
34
|
+
this.search = new endpoints_1.SearchEndpoint(access_token);
|
|
35
|
+
this.trending = new endpoints_1.TrendingEndpoint(access_token);
|
|
36
|
+
this.tvEpisodes = new endpoints_1.TvEpisodesEndpoint(access_token);
|
|
37
|
+
this.tvSeasons = new endpoints_1.TvSeasonsEndpoint(access_token);
|
|
38
|
+
this.tvShows = new endpoints_1.TvShowsEndpoint(access_token);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.TMDB = TMDB;
|
|
42
|
+
__exportStar(require("./@types"), exports);
|
|
43
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class API {
|
|
2
|
+
private access_token;
|
|
3
|
+
constructor(access_token: string);
|
|
4
|
+
get<T>(path: string, options?: Record<string, any>): Promise<T>;
|
|
5
|
+
}
|
|
6
|
+
export declare const parseOptions: (options?: Record<string, any>) => string;
|
|
7
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAIA,qBAAa,GAAG;IACd,OAAO,CAAC,YAAY,CAAS;gBACjB,YAAY,EAAE,MAAM;IAI1B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAgBtE;AAED,eAAO,MAAM,YAAY,aAAc,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,MAE5D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.parseOptions = exports.API = void 0;
|
|
13
|
+
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
|
14
|
+
class API {
|
|
15
|
+
constructor(access_token) {
|
|
16
|
+
this.access_token = access_token;
|
|
17
|
+
}
|
|
18
|
+
get(path, options) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const params = (0, exports.parseOptions)(options);
|
|
21
|
+
const response = yield fetch(`${BASE_URL_V3}${path}?${params}`, {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: `Bearer ${this.access_token}`,
|
|
25
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
return Promise.reject((yield response.json()));
|
|
30
|
+
}
|
|
31
|
+
return (yield response.json());
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.API = API;
|
|
36
|
+
const parseOptions = (options) => {
|
|
37
|
+
return options ? new URLSearchParams(Object.entries(options)).toString() : '';
|
|
38
|
+
};
|
|
39
|
+
exports.parseOptions = parseOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility method to construct full url for image
|
|
3
|
+
* based on configuration
|
|
4
|
+
*
|
|
5
|
+
* https://developers.themoviedb.org/3/getting-started/images
|
|
6
|
+
* @param {string} baseUrl base image url
|
|
7
|
+
* @param {string} fileSize file size
|
|
8
|
+
* @param {string} imagePath raw image path
|
|
9
|
+
* @param {boolean} svg get svg version if true
|
|
10
|
+
*/
|
|
11
|
+
export declare const getFullImagePath: (baseUrl: string, fileSize: string, imagePath: string, svg?: boolean) => string;
|
|
12
|
+
//# sourceMappingURL=getimagePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getimagePath.d.ts","sourceRoot":"","sources":["../../src/utils/getimagePath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,YAAa,MAAM,YAAY,MAAM,aAAa,MAAM,oBAAgB,MAKpG,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFullImagePath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility method to construct full url for image
|
|
6
|
+
* based on configuration
|
|
7
|
+
*
|
|
8
|
+
* https://developers.themoviedb.org/3/getting-started/images
|
|
9
|
+
* @param {string} baseUrl base image url
|
|
10
|
+
* @param {string} fileSize file size
|
|
11
|
+
* @param {string} imagePath raw image path
|
|
12
|
+
* @param {boolean} svg get svg version if true
|
|
13
|
+
*/
|
|
14
|
+
const getFullImagePath = (baseUrl, fileSize, imagePath, svg = false) => {
|
|
15
|
+
const imagePathArr = imagePath.split('.');
|
|
16
|
+
const imageFormat = svg ? 'svg' : imagePathArr[1];
|
|
17
|
+
return `${baseUrl}${fileSize}${imagePathArr[0]}.${imageFormat}`;
|
|
18
|
+
};
|
|
19
|
+
exports.getFullImagePath = getFullImagePath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./getimagePath"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tdanks2000/tmdb-wrapper",
|
|
3
|
+
"module": "./src/index.ts",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/tdanks2000/tmdb-wrapper"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"tmdb",
|
|
16
|
+
"tmdbWrapper",
|
|
17
|
+
"tmdb wrapper",
|
|
18
|
+
"tmdb-wrapper",
|
|
19
|
+
"api wrapper",
|
|
20
|
+
"node",
|
|
21
|
+
"typescript"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16"
|
|
25
|
+
},
|
|
26
|
+
"author": "TDanks2000",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"private": false,
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "yarn tsc",
|
|
31
|
+
"release": "yarn version && npm publish",
|
|
32
|
+
"preversion": "yarn tsc"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.11.20",
|
|
36
|
+
"ts-node": "^10.9.2",
|
|
37
|
+
"typescript": "^5.3.3"
|
|
38
|
+
},
|
|
39
|
+
"version": "1.0.0"
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Gravatar {
|
|
2
|
+
hash: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface Avatar {
|
|
6
|
+
gravatar: Gravatar;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AccountDetails {
|
|
10
|
+
avatar: Avatar;
|
|
11
|
+
id: number;
|
|
12
|
+
include_adult: boolean;
|
|
13
|
+
iso_3166_1: string;
|
|
14
|
+
iso_639_1: string;
|
|
15
|
+
name: string;
|
|
16
|
+
username: string;
|
|
17
|
+
}
|