@tdanks2000/tmdb-wrapper 1.1.1 → 1.2.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.
Files changed (130) hide show
  1. package/LICENSE +21 -0
  2. package/dist/@types/endpoints/account.d.ts +16 -0
  3. package/dist/@types/endpoints/account.d.ts.map +1 -0
  4. package/dist/@types/endpoints/certification.d.ts +19 -0
  5. package/dist/@types/endpoints/certification.d.ts.map +1 -0
  6. package/dist/@types/endpoints/changes.d.ts +26 -0
  7. package/dist/@types/endpoints/changes.d.ts.map +1 -0
  8. package/dist/@types/endpoints/collection.d.ts +21 -0
  9. package/dist/@types/endpoints/collection.d.ts.map +1 -0
  10. package/dist/@types/endpoints/companies.d.ts +29 -0
  11. package/dist/@types/endpoints/companies.d.ts.map +1 -0
  12. package/dist/@types/endpoints/configuration.d.ts +106 -0
  13. package/dist/@types/endpoints/configuration.d.ts.map +1 -0
  14. package/dist/@types/endpoints/configuration.js +99 -0
  15. package/dist/@types/endpoints/credits.d.ts +135 -0
  16. package/dist/@types/endpoints/credits.d.ts.map +1 -0
  17. package/dist/@types/endpoints/discover.d.ts +68 -0
  18. package/dist/@types/endpoints/discover.d.ts.map +1 -0
  19. package/dist/@types/endpoints/find.d.ts +20 -0
  20. package/dist/@types/endpoints/find.d.ts.map +1 -0
  21. package/dist/@types/endpoints/genre.d.ts +7 -0
  22. package/dist/@types/endpoints/genre.d.ts.map +1 -0
  23. package/dist/@types/endpoints/index.d.ts +23 -0
  24. package/dist/@types/endpoints/index.d.ts.map +1 -0
  25. package/dist/@types/endpoints/keywords.d.ts +21 -0
  26. package/dist/@types/endpoints/keywords.d.ts.map +1 -0
  27. package/dist/@types/endpoints/movies.d.ts +150 -0
  28. package/dist/@types/endpoints/movies.d.ts.map +1 -0
  29. package/dist/@types/endpoints/networks.d.ts +14 -0
  30. package/dist/@types/endpoints/networks.d.ts.map +1 -0
  31. package/dist/@types/endpoints/options.d.ts +71 -0
  32. package/dist/@types/endpoints/options.d.ts.map +1 -0
  33. package/dist/@types/endpoints/people.d.ts +135 -0
  34. package/dist/@types/endpoints/people.d.ts.map +1 -0
  35. package/dist/@types/endpoints/review.d.ts +8 -0
  36. package/dist/@types/endpoints/review.d.ts.map +1 -0
  37. package/dist/@types/endpoints/search.d.ts +32 -0
  38. package/dist/@types/endpoints/search.d.ts.map +1 -0
  39. package/dist/@types/endpoints/trending.d.ts +12 -0
  40. package/dist/@types/endpoints/trending.d.ts.map +1 -0
  41. package/dist/@types/endpoints/tvEpisode.d.ts +65 -0
  42. package/dist/@types/endpoints/tvEpisode.d.ts.map +1 -0
  43. package/dist/@types/endpoints/tvSeasons.d.ts +31 -0
  44. package/dist/@types/endpoints/tvSeasons.d.ts.map +1 -0
  45. package/dist/@types/endpoints/tvShows.d.ts +260 -0
  46. package/dist/@types/endpoints/tvShows.d.ts.map +1 -0
  47. package/dist/@types/endpoints/watchProviders.d.ts +303 -0
  48. package/dist/@types/endpoints/watchProviders.d.ts.map +1 -0
  49. package/dist/@types/index.d.ts +4 -0
  50. package/dist/@types/index.d.ts.map +1 -0
  51. package/dist/@types/models/baseEndpoint.d.ts +8 -0
  52. package/dist/@types/models/baseEndpoint.d.ts.map +1 -0
  53. package/dist/@types/models/baseEndpoint.js +3 -3
  54. package/dist/@types/models/index.d.ts +2 -0
  55. package/dist/@types/models/index.d.ts.map +1 -0
  56. package/dist/@types/types.d.ts +179 -0
  57. package/dist/@types/types.d.ts.map +1 -0
  58. package/dist/endpoints/account.d.ts +18 -0
  59. package/dist/endpoints/account.d.ts.map +1 -0
  60. package/dist/endpoints/account.js +2 -1
  61. package/dist/endpoints/certification.d.ts +23 -0
  62. package/dist/endpoints/certification.d.ts.map +1 -0
  63. package/dist/endpoints/certification.js +2 -2
  64. package/dist/endpoints/changes.d.ts +31 -0
  65. package/dist/endpoints/changes.d.ts.map +1 -0
  66. package/dist/endpoints/changes.js +3 -3
  67. package/dist/endpoints/collections.d.ts +34 -0
  68. package/dist/endpoints/collections.d.ts.map +1 -0
  69. package/dist/endpoints/collections.js +2 -2
  70. package/dist/endpoints/companies.d.ts +31 -0
  71. package/dist/endpoints/companies.d.ts.map +1 -0
  72. package/dist/endpoints/configuration.d.ts +18 -0
  73. package/dist/endpoints/configuration.d.ts.map +1 -0
  74. package/dist/endpoints/credits.d.ts +19 -0
  75. package/dist/endpoints/credits.d.ts.map +1 -0
  76. package/dist/endpoints/discover.d.ts +25 -0
  77. package/dist/endpoints/discover.d.ts.map +1 -0
  78. package/dist/endpoints/discover.js +2 -1
  79. package/dist/endpoints/find.d.ts +20 -0
  80. package/dist/endpoints/find.d.ts.map +1 -0
  81. package/dist/endpoints/find.js +1 -0
  82. package/dist/endpoints/genre.d.ts +25 -0
  83. package/dist/endpoints/genre.d.ts.map +1 -0
  84. package/dist/endpoints/genre.js +2 -2
  85. package/dist/endpoints/index.d.ts +22 -0
  86. package/dist/endpoints/index.d.ts.map +1 -0
  87. package/dist/endpoints/keywords.d.ts +26 -0
  88. package/dist/endpoints/keywords.d.ts.map +1 -0
  89. package/dist/endpoints/keywords.js +2 -1
  90. package/dist/endpoints/movies.d.ts +142 -0
  91. package/dist/endpoints/movies.d.ts.map +1 -0
  92. package/dist/endpoints/movies.js +5 -3
  93. package/dist/endpoints/networks.d.ts +31 -0
  94. package/dist/endpoints/networks.d.ts.map +1 -0
  95. package/dist/endpoints/people.d.ts +85 -0
  96. package/dist/endpoints/people.d.ts.map +1 -0
  97. package/dist/endpoints/people.js +5 -2
  98. package/dist/endpoints/review.d.ts +19 -0
  99. package/dist/endpoints/review.d.ts.map +1 -0
  100. package/dist/endpoints/review.js +1 -0
  101. package/dist/endpoints/search.d.ts +58 -0
  102. package/dist/endpoints/search.d.ts.map +1 -0
  103. package/dist/endpoints/search.js +1 -1
  104. package/dist/endpoints/trending.d.ts +22 -0
  105. package/dist/endpoints/trending.d.ts.map +1 -0
  106. package/dist/endpoints/trending.js +1 -0
  107. package/dist/endpoints/tvEpisodes.d.ts +62 -0
  108. package/dist/endpoints/tvEpisodes.d.ts.map +1 -0
  109. package/dist/endpoints/tvEpisodes.js +6 -3
  110. package/dist/endpoints/tvSeasons.d.ts +71 -0
  111. package/dist/endpoints/tvSeasons.d.ts.map +1 -0
  112. package/dist/endpoints/tvSeasons.js +6 -3
  113. package/dist/endpoints/tvShows.d.ts +164 -0
  114. package/dist/endpoints/tvShows.d.ts.map +1 -0
  115. package/dist/endpoints/tvShows.js +6 -4
  116. package/dist/endpoints/watchProviders.d.ts +33 -0
  117. package/dist/endpoints/watchProviders.d.ts.map +1 -0
  118. package/dist/endpoints/watchProviders.js +5 -5
  119. package/dist/index.d.ts +30 -0
  120. package/dist/index.d.ts.map +1 -0
  121. package/dist/index.js +22 -22
  122. package/dist/utils/api.d.ts +14 -0
  123. package/dist/utils/api.d.ts.map +1 -0
  124. package/dist/utils/api.js +42 -9
  125. package/dist/utils/getimagePath.d.ts +32 -0
  126. package/dist/utils/getimagePath.d.ts.map +1 -0
  127. package/dist/utils/getimagePath.js +13 -13
  128. package/dist/utils/index.d.ts +3 -0
  129. package/dist/utils/index.d.ts.map +1 -0
  130. package/package.json +61 -57
@@ -0,0 +1,71 @@
1
+ import { AggregateCredits, AppendToResponse, AppendToResponseTvSeasonKey, BaseEndpoint, ChangeOption, Changes, Credits, ExternalIds, Images, LanguageOption, SeasonDetails, SeasonSelection, TokenType, Translations, TvSeasonChangeValue, TvSeasonImageSearchOptions, TvSeasonVideoSearchOptions, Videos } from "../@types";
2
+ /**
3
+ * Represents an endpoint for accessing TV season-related information.
4
+ */
5
+ export declare class TvSeasonsEndpoint extends BaseEndpoint {
6
+ protected readonly access_token: TokenType;
7
+ /**
8
+ * Constructs a new TvSeasonsEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
11
+ constructor(access_token: TokenType);
12
+ /**
13
+ * Retrieves details of a specific TV season asynchronously.
14
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
15
+ * @param {AppendToResponseTvSeasonKey[]} [appendToResponse] - Additional data to append to the response.
16
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
17
+ * @returns {Promise<AppendToResponse<SeasonDetails, AppendToResponseTvSeasonKey[], 'tvSeason'>>}
18
+ * A Promise that resolves with the details of the TV season.
19
+ */
20
+ details<T extends AppendToResponseTvSeasonKey[] | undefined>(seasonSelection: SeasonSelection, appendToResponse?: T, options?: LanguageOption): Promise<AppendToResponse<SeasonDetails, T, "tvSeason">>;
21
+ /**
22
+ * Retrieves aggregate credits for a specific TV season asynchronously.
23
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
24
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
25
+ * @returns {Promise<AggregateCredits>} A Promise that resolves with the aggregate credits for the TV season.
26
+ */
27
+ aggregateCredits(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<AggregateCredits>;
28
+ /**
29
+ * Retrieves changes related to a specific TV season asynchronously.
30
+ * @param {number} seasonId - The ID of the TV season.
31
+ * @param {ChangeOption} [options] - Optional parameters for specifying changes.
32
+ * @returns {Promise<Changes<TvSeasonChangeValue>>} A Promise that resolves with the changes related to the TV season.
33
+ */
34
+ changes(seasonId: number, options?: ChangeOption): Promise<Changes<TvSeasonChangeValue>>;
35
+ /**
36
+ * Retrieves credits for a specific TV season asynchronously.
37
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
38
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
39
+ * @returns {Promise<Credits>} A Promise that resolves with the credits for the TV season.
40
+ */
41
+ credits(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<Credits>;
42
+ /**
43
+ * Retrieves external IDs for a specific TV season asynchronously.
44
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
45
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
46
+ * @returns {Promise<ExternalIds>} A Promise that resolves with the external IDs for the TV season.
47
+ */
48
+ externalIds(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<ExternalIds>;
49
+ /**
50
+ * Retrieves images for a specific TV season asynchronously.
51
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
52
+ * @param {TvSeasonImageSearchOptions} [options] - Optional parameters for specifying image search options.
53
+ * @returns {Promise<Images>} A Promise that resolves with the images for the TV season.
54
+ */
55
+ images(seasonSelection: SeasonSelection, options?: TvSeasonImageSearchOptions): Promise<Images>;
56
+ /**
57
+ * Retrieves videos for a specific TV season asynchronously.
58
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
59
+ * @param {TvSeasonVideoSearchOptions} [options] - Optional parameters for specifying video search options.
60
+ * @returns {Promise<Videos>} A Promise that resolves with the videos for the TV season.
61
+ */
62
+ videos(seasonSelection: SeasonSelection, options?: TvSeasonVideoSearchOptions): Promise<Videos>;
63
+ /**
64
+ * Retrieves translations for a specific TV season asynchronously.
65
+ * @param {SeasonSelection} seasonSelection - The selection criteria for the TV season.
66
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
67
+ * @returns {Promise<Translations>} A Promise that resolves with the translations for the TV season.
68
+ */
69
+ translations(seasonSelection: SeasonSelection, options?: LanguageOption): Promise<Translations>;
70
+ }
71
+ //# 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,EACN,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,EACN,MAAM,WAAW,CAAC;AAMnB;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IAKtC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS;IAJtD;;;OAGG;gBAC4B,YAAY,EAAE,SAAS;IAItD;;;;;;;OAOG;IACG,OAAO,CAAC,CAAC,SAAS,2BAA2B,EAAE,GAAG,SAAS,EAChE,eAAe,EAAE,eAAe,EAChC,gBAAgB,CAAC,EAAE,CAAC,EACpB,OAAO,CAAC,EAAE,cAAc;IAezB;;;;;OAKG;IACG,gBAAgB,CACrB,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,cAAc;IAQzB;;;;;OAKG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAOtD;;;;;OAKG;IACG,OAAO,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc;IAOxE;;;;;OAKG;IACG,WAAW,CAChB,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,cAAc;IAQzB;;;;;OAKG;IACG,MAAM,CACX,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,0BAA0B;IAYrC;;;;;OAKG;IACG,MAAM,CACX,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,0BAA0B;IAYrC;;;;;OAKG;IACG,YAAY,CACjB,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,cAAc;CAOzB"}
@@ -15,6 +15,7 @@ class TvSeasonsEndpoint extends _types_1.BaseEndpoint {
15
15
  */
16
16
  constructor(access_token) {
17
17
  super(access_token);
18
+ this.access_token = access_token;
18
19
  }
19
20
  /**
20
21
  * Retrieves details of a specific TV season asynchronously.
@@ -26,7 +27,9 @@ class TvSeasonsEndpoint extends _types_1.BaseEndpoint {
26
27
  */
27
28
  async details(seasonSelection, appendToResponse, options) {
28
29
  const combinedOptions = {
29
- append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
30
+ append_to_response: appendToResponse
31
+ ? appendToResponse.join(",")
32
+ : undefined,
30
33
  ...options,
31
34
  };
32
35
  return await this.api.get(`${BASE_SEASON(seasonSelection)}`, combinedOptions);
@@ -75,7 +78,7 @@ class TvSeasonsEndpoint extends _types_1.BaseEndpoint {
75
78
  */
76
79
  async images(seasonSelection, options) {
77
80
  const computedOptions = {
78
- include_image_language: options?.include_image_language?.join(','),
81
+ include_image_language: options?.include_image_language?.join(","),
79
82
  language: options?.language,
80
83
  };
81
84
  return await this.api.get(`${BASE_SEASON(seasonSelection)}/images`, computedOptions);
@@ -88,7 +91,7 @@ class TvSeasonsEndpoint extends _types_1.BaseEndpoint {
88
91
  */
89
92
  async videos(seasonSelection, options) {
90
93
  const computedOptions = {
91
- include_video_language: options?.include_video_language?.join(','),
94
+ include_video_language: options?.include_video_language?.join(","),
92
95
  language: options?.language,
93
96
  };
94
97
  return await this.api.get(`${BASE_SEASON(seasonSelection)}/videos`, computedOptions);
@@ -0,0 +1,164 @@
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, TokenType, TopRatedtv, Translations, TvShowChangeValue, TvShowDetails, TvShowImageOptions, TvShowVideoOptions, tvAiringToday, Videos, WatchProviders } from "../@types";
2
+ /**
3
+ * Represents an endpoint for accessing TV show-related information.
4
+ */
5
+ export declare class TvShowsEndpoint extends BaseEndpoint {
6
+ protected readonly access_token: TokenType;
7
+ /**
8
+ * Constructs a new TvShowsEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
11
+ constructor(access_token: TokenType);
12
+ /**
13
+ * Retrieves details of a specific TV show asynchronously.
14
+ * @param {number} id - The ID of the TV show.
15
+ * @param {AppendToResponseTvKey[]} [appendToResponse] - Additional data to append to the response.
16
+ * @param {string} [language] - The language for the response.
17
+ * @returns {Promise<AppendToResponse<TvShowDetails, AppendToResponseTvKey[], 'tvShow'>>}
18
+ * A Promise that resolves with the details of the TV show.
19
+ */
20
+ details<T extends AppendToResponseTvKey[] | undefined>(id: number, appendToResponse?: T, language?: string): Promise<AppendToResponse<TvShowDetails, T, "tvShow">>;
21
+ /**
22
+ * Retrieves alternative titles of a specific TV show asynchronously.
23
+ * @param {number} id - The ID of the TV show.
24
+ * @returns {Promise<AlternativeTitles>} A Promise that resolves with the alternative titles of the TV show.
25
+ */
26
+ alternativeTitles(id: number): Promise<AlternativeTitles>;
27
+ /**
28
+ * Retrieves changes for a specific TV show asynchronously.
29
+ * @param {number} id - The ID of the TV show.
30
+ * @param {ChangeOption} [options] - Additional options for the request.
31
+ * @returns {Promise<Changes<TvShowChangeValue>>}
32
+ * A Promise that resolves with the changes for the TV show.
33
+ */
34
+ changes(id: number, options?: ChangeOption): Promise<Changes<TvShowChangeValue>>;
35
+ /**
36
+ * Retrieves content ratings for a specific TV show asynchronously.
37
+ * @param {number} id - The ID of the TV show.
38
+ * @returns {Promise<ContentRatings>} A Promise that resolves with the content ratings of the TV show.
39
+ */
40
+ contentRatings(id: number): Promise<ContentRatings>;
41
+ /**
42
+ * Retrieves aggregate credits for a specific TV show asynchronously.
43
+ * @param {number} id - The ID of the TV show.
44
+ * @param {LanguageOption} [options] - Additional options for the request.
45
+ * @returns {Promise<AggregateCredits>} A Promise that resolves with the aggregate credits of the TV show.
46
+ */
47
+ aggregateCredits(id: number, options?: LanguageOption): Promise<AggregateCredits>;
48
+ /**
49
+ * Retrieves credits for a specific TV show asynchronously.
50
+ * @param {number} id - The ID of the TV show.
51
+ * @param {LanguageOption} [options] - Additional options for the request.
52
+ * @returns {Promise<Credits>} A Promise that resolves with the credits of the TV show.
53
+ */
54
+ credits(id: number, options?: LanguageOption): Promise<Credits>;
55
+ /**
56
+ * Retrieves details of a specific season of a TV show asynchronously.
57
+ * @param {number} tvId - The ID of the TV show.
58
+ * @param {number} seasonNumber - The season number.
59
+ * @returns {Promise<SeasonDetails>} A Promise that resolves with the details of the season.
60
+ */
61
+ season(tvId: number, seasonNumber: number): Promise<SeasonDetails>;
62
+ /**
63
+ * Retrieves episode groups for a specific TV show asynchronously.
64
+ * @param {number} id - The ID of the TV show.
65
+ * @returns {Promise<EpisodeGroups>} A Promise that resolves with the episode groups of the TV show.
66
+ */
67
+ episodeGroups(id: number): Promise<EpisodeGroups>;
68
+ /**
69
+ * Retrieves external IDs for a specific TV show asynchronously.
70
+ * @param {number} id - The ID of the TV show.
71
+ * @returns {Promise<ExternalIds>} A Promise that resolves with the external IDs of the TV show.
72
+ */
73
+ externalIds(id: number): Promise<ExternalIds>;
74
+ /**
75
+ * Retrieves images for a specific TV show asynchronously.
76
+ * @param {number} id - The ID of the TV show.
77
+ * @param {TvShowImageOptions} [options] - Additional options for the request.
78
+ * @returns {Promise<Images>} A Promise that resolves with the images of the TV show.
79
+ */
80
+ images(id: number, options?: TvShowImageOptions): Promise<Images>;
81
+ /**
82
+ * Retrieves keywords for a specific TV show asynchronously.
83
+ * @param {number} id - The ID of the TV show.
84
+ * @returns {Promise<Keywords>} A Promise that resolves with the keywords of the TV show.
85
+ */
86
+ keywords(id: number): Promise<Keywords>;
87
+ /**
88
+ * Retrieves recommendations for a specific TV show asynchronously.
89
+ * @param {number} id - The ID of the TV show.
90
+ * @param {LanguageOption & PageOption} [options] - Additional options for the request.
91
+ * @returns {Promise<Recommendations>} A Promise that resolves with the recommendations for the TV show.
92
+ */
93
+ recommendations(id: number, options?: LanguageOption & PageOption): Promise<Recommendations>;
94
+ /**
95
+ * Retrieves reviews for a specific TV show asynchronously.
96
+ * @param {number} id - The ID of the TV show.
97
+ * @param {LanguageOption & PageOption} [options] - Additional options for the request.
98
+ * @returns {Promise<Reviews>} A Promise that resolves with the reviews of the TV show.
99
+ */
100
+ reviews(id: number, options?: LanguageOption & PageOption): Promise<Reviews>;
101
+ /**
102
+ * Retrieves information about whether the TV show was screened theatrically asynchronously.
103
+ * @param {number} id - The ID of the TV show.
104
+ * @returns {Promise<ScreenedTheatrically>} A Promise that resolves with information about theatrical screenings.
105
+ */
106
+ screenedTheatrically(id: number): Promise<ScreenedTheatrically>;
107
+ /**
108
+ * Retrieves similar TV shows for a specific TV show asynchronously.
109
+ * @param {number} id - The ID of the TV show.
110
+ * @param {LanguageOption & PageOption} [options] - Additional options for the request.
111
+ * @returns {Promise<Similartv>} A Promise that resolves with the similar TV shows.
112
+ */
113
+ similar(id: number, options?: LanguageOption & PageOption): Promise<Similartv>;
114
+ /**
115
+ * Retrieves translations for a specific TV show asynchronously.
116
+ * @param {number} id - The ID of the TV show.
117
+ * @returns {Promise<Translations>} A Promise that resolves with the translations of the TV show.
118
+ */
119
+ translations(id: number): Promise<Translations>;
120
+ /**
121
+ * Retrieves videos for a specific TV show asynchronously.
122
+ * @param {number} id - The ID of the TV show.
123
+ * @param {TvShowVideoOptions} [options] - Additional options for the request.
124
+ * @returns {Promise<Videos>} A Promise that resolves with the videos of the TV show.
125
+ */
126
+ videos(id: number, options?: TvShowVideoOptions): Promise<Videos>;
127
+ /**
128
+ * Retrieves watch providers for a specific TV show asynchronously.
129
+ * Powered by JustWatch.
130
+ * @param {number} id - The ID of the TV show.
131
+ * @returns {Promise<WatchProviders>} A Promise that resolves with the watch providers of the TV show.
132
+ */
133
+ watchProviders(id: number): Promise<WatchProviders>;
134
+ /**
135
+ * Retrieves the latest TV show asynchronously.
136
+ * @returns {Promise<Latesttv>} A Promise that resolves with the latest TV show.
137
+ */
138
+ latest(): Promise<Latesttv>;
139
+ /**
140
+ * Retrieves TV shows that are currently on the air asynchronously.
141
+ * @param {PageOption & LanguageOption & TimezoneOption} [options] - Additional options for the request.
142
+ * @returns {Promise<OnTheAir>} A Promise that resolves with TV shows currently on the air.
143
+ */
144
+ onTheAir(options?: PageOption & LanguageOption & TimezoneOption): Promise<OnTheAir>;
145
+ /**
146
+ * Retrieves TV shows that are airing today asynchronously.
147
+ * @param {PageOption & LanguageOption & TimezoneOption} [options] - Additional options for the request.
148
+ * @returns {Promise<tvAiringToday>} A Promise that resolves with TV shows airing today.
149
+ */
150
+ airingToday(options?: PageOption & LanguageOption & TimezoneOption): Promise<tvAiringToday>;
151
+ /**
152
+ * Retrieves popular TV shows asynchronously.
153
+ * @param {PageOption & LanguageOption} [options] - Additional options for the request.
154
+ * @returns {Promise<Populartv>} A Promise that resolves with popular TV shows.
155
+ */
156
+ popular(options?: PageOption & LanguageOption): Promise<Populartv>;
157
+ /**
158
+ * Retrieves top-rated TV shows asynchronously.
159
+ * @param {PageOption & LanguageOption} [options] - Additional options for the request.
160
+ * @returns {Promise<TopRatedtv>} A Promise that resolves with top-rated TV shows.
161
+ */
162
+ topRated(options?: PageOption & LanguageOption): Promise<TopRatedtv>;
163
+ }
164
+ //# 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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"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TvShowsEndpoint = void 0;
4
4
  const _types_1 = require("../@types");
5
- const BASE_TV = '/tv';
5
+ const BASE_TV = "/tv";
6
6
  /**
7
7
  * Represents an endpoint for accessing TV show-related information.
8
8
  */
@@ -25,7 +25,9 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
25
25
  */
26
26
  async details(id, appendToResponse, language) {
27
27
  const options = {
28
- append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
28
+ append_to_response: appendToResponse
29
+ ? appendToResponse.join(",")
30
+ : undefined,
29
31
  language: language,
30
32
  };
31
33
  return await this.api.get(`${BASE_TV}/${id}`, options);
@@ -107,7 +109,7 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
107
109
  */
108
110
  async images(id, options) {
109
111
  const computedOptions = {
110
- include_image_language: options?.include_image_language?.join(','),
112
+ include_image_language: options?.include_image_language?.join(","),
111
113
  language: options?.language,
112
114
  };
113
115
  return await this.api.get(`${BASE_TV}/${id}/images`, computedOptions);
@@ -171,7 +173,7 @@ class TvShowsEndpoint extends _types_1.BaseEndpoint {
171
173
  */
172
174
  async videos(id, options) {
173
175
  const computedOptions = {
174
- include_video_language: options?.include_video_language?.join(','),
176
+ include_video_language: options?.include_video_language?.join(","),
175
177
  language: options?.language,
176
178
  };
177
179
  return await this.api.get(`${BASE_TV}/${id}/videos`, computedOptions);
@@ -0,0 +1,33 @@
1
+ import { BaseEndpoint, TokenType, WatchProviders, WatchRegionsResponse } from "../@types";
2
+ /**
3
+ * Represents an endpoint for accessing watch provider information.
4
+ */
5
+ export declare class WatchProvidersEndpoint extends BaseEndpoint {
6
+ protected readonly access_token: TokenType;
7
+ /**
8
+ * Constructs a new WatchProvidersEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
11
+ constructor(access_token: TokenType);
12
+ /**
13
+ * Retrieves a list of all available watch providers (streaming services).
14
+ * @returns {Promise<WatchProviders>} A Promise that resolves with the list of watch providers.
15
+ */
16
+ available(): Promise<WatchProviders>;
17
+ /**
18
+ * Retrieves a list of available regions for watch providers.
19
+ * @returns {Promise<WatchRegionsResponse>} A Promise that resolves with the list of available regions.
20
+ */
21
+ regions(): Promise<WatchRegionsResponse>;
22
+ /**
23
+ * Retrieves a list of watch providers for movies.
24
+ * @returns {Promise<WatchProviders>} A Promise that resolves with the list of movie watch providers.
25
+ */
26
+ movie(): Promise<WatchProviders>;
27
+ /**
28
+ * Retrieves a list of watch providers for TV shows.
29
+ * @returns {Promise<WatchProviders>} A Promise that resolves with the list of TV watch providers.
30
+ */
31
+ tv(): Promise<WatchProviders>;
32
+ }
33
+ //# sourceMappingURL=watchProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchProviders.d.ts","sourceRoot":"","sources":["../../src/endpoints/watchProviders.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,YAAY;IAK3C,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS;IAJtD;;;OAGG;gBAC4B,YAAY,EAAE,SAAS;IAItD;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC;IAI1C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI9C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC;IAItC;;;OAGG;IACG,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC;CAGnC"}
@@ -19,28 +19,28 @@ class WatchProvidersEndpoint extends _types_1.BaseEndpoint {
19
19
  * @returns {Promise<WatchProviders>} A Promise that resolves with the list of watch providers.
20
20
  */
21
21
  async available() {
22
- return await this.api.get('/watch/providers/movie');
22
+ return await this.api.get("/watch/providers/movie");
23
23
  }
24
24
  /**
25
25
  * Retrieves a list of available regions for watch providers.
26
- * @returns {Promise<any>} A Promise that resolves with the list of available regions.
26
+ * @returns {Promise<WatchRegionsResponse>} A Promise that resolves with the list of available regions.
27
27
  */
28
28
  async regions() {
29
- return await this.api.get('/watch/providers/regions');
29
+ return await this.api.get("/watch/providers/regions");
30
30
  }
31
31
  /**
32
32
  * Retrieves a list of watch providers for movies.
33
33
  * @returns {Promise<WatchProviders>} A Promise that resolves with the list of movie watch providers.
34
34
  */
35
35
  async movie() {
36
- return await this.api.get('/watch/providers/movie');
36
+ return await this.api.get("/watch/providers/movie");
37
37
  }
38
38
  /**
39
39
  * Retrieves a list of watch providers for TV shows.
40
40
  * @returns {Promise<WatchProviders>} A Promise that resolves with the list of TV watch providers.
41
41
  */
42
42
  async tv() {
43
- return await this.api.get('/watch/providers/tv');
43
+ return await this.api.get("/watch/providers/tv");
44
44
  }
45
45
  }
46
46
  exports.WatchProvidersEndpoint = WatchProvidersEndpoint;
@@ -0,0 +1,30 @@
1
+ import { TokenType } from "./@types";
2
+ import { AccountEndpoint, CertificationEndpoint, ChangeEndpoint, CollectionsEndpoint, CompaniesEndpoint, ConfigurationEndpoint, CreditsEndpoint, DiscoverEndpoint, FindEndpoint, GenreEndpoint, KeywordsEndpoint, MoviesEndpoint, NetworksEndpoint, PeopleEndpoint, ReviewEndpoint, SearchEndpoint, TrendingEndpoint, TvEpisodesEndpoint, TvSeasonsEndpoint, TvShowsEndpoint, WatchProvidersEndpoint } from "./endpoints";
3
+ declare class TMDB {
4
+ constructor(auth: TokenType);
5
+ account: AccountEndpoint;
6
+ certification: CertificationEndpoint;
7
+ changes: ChangeEndpoint;
8
+ collections: CollectionsEndpoint;
9
+ companies: CompaniesEndpoint;
10
+ configuration: ConfigurationEndpoint;
11
+ credits: CreditsEndpoint;
12
+ discover: DiscoverEndpoint;
13
+ find: FindEndpoint;
14
+ genre: GenreEndpoint;
15
+ keywords: KeywordsEndpoint;
16
+ movies: MoviesEndpoint;
17
+ networks: NetworksEndpoint;
18
+ people: PeopleEndpoint;
19
+ review: ReviewEndpoint;
20
+ search: SearchEndpoint;
21
+ trending: TrendingEndpoint;
22
+ tvEpisodes: TvEpisodesEndpoint;
23
+ tvSeasons: TvSeasonsEndpoint;
24
+ tvShows: TvShowsEndpoint;
25
+ watchProviders: WatchProvidersEndpoint;
26
+ }
27
+ export * from "./@types";
28
+ export * from "./utils";
29
+ export { TMDB };
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACN,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAErB,cAAM,IAAI;gBACG,IAAI,EAAE,SAAS;IAwB3B,OAAO,EAAE,eAAe,CAAC;IACzB,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,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,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,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;IACzB,cAAc,EAAE,sBAAsB,CAAC;CACvC;AAED,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -17,28 +17,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.TMDB = void 0;
18
18
  const endpoints_1 = require("./endpoints");
19
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.companies = new endpoints_1.CompaniesEndpoint(access_token);
26
- this.configuration = new endpoints_1.ConfigurationEndpoint(access_token);
27
- this.credits = new endpoints_1.CreditsEndpoint(access_token);
28
- this.discover = new endpoints_1.DiscoverEndpoint(access_token);
29
- this.find = new endpoints_1.FindEndpoint(access_token);
30
- this.genre = new endpoints_1.GenreEndpoint(access_token);
31
- this.keywords = new endpoints_1.KeywordsEndpoint(access_token);
32
- this.movies = new endpoints_1.MoviesEndpoint(access_token);
33
- this.networks = new endpoints_1.NetworksEndpoint(access_token);
34
- this.people = new endpoints_1.PeopleEndpoint(access_token);
35
- this.review = new endpoints_1.ReviewEndpoint(access_token);
36
- this.search = new endpoints_1.SearchEndpoint(access_token);
37
- this.trending = new endpoints_1.TrendingEndpoint(access_token);
38
- this.tvEpisodes = new endpoints_1.TvEpisodesEndpoint(access_token);
39
- this.tvSeasons = new endpoints_1.TvSeasonsEndpoint(access_token);
40
- this.tvShows = new endpoints_1.TvShowsEndpoint(access_token);
41
- this.watchProviders = new endpoints_1.WatchProvidersEndpoint(access_token);
20
+ constructor(auth) {
21
+ this.account = new endpoints_1.AccountEndpoint(auth);
22
+ this.certification = new endpoints_1.CertificationEndpoint(auth);
23
+ this.changes = new endpoints_1.ChangeEndpoint(auth);
24
+ this.collections = new endpoints_1.CollectionsEndpoint(auth);
25
+ this.companies = new endpoints_1.CompaniesEndpoint(auth);
26
+ this.configuration = new endpoints_1.ConfigurationEndpoint(auth);
27
+ this.credits = new endpoints_1.CreditsEndpoint(auth);
28
+ this.discover = new endpoints_1.DiscoverEndpoint(auth);
29
+ this.find = new endpoints_1.FindEndpoint(auth);
30
+ this.genre = new endpoints_1.GenreEndpoint(auth);
31
+ this.keywords = new endpoints_1.KeywordsEndpoint(auth);
32
+ this.movies = new endpoints_1.MoviesEndpoint(auth);
33
+ this.networks = new endpoints_1.NetworksEndpoint(auth);
34
+ this.people = new endpoints_1.PeopleEndpoint(auth);
35
+ this.review = new endpoints_1.ReviewEndpoint(auth);
36
+ this.search = new endpoints_1.SearchEndpoint(auth);
37
+ this.trending = new endpoints_1.TrendingEndpoint(auth);
38
+ this.tvEpisodes = new endpoints_1.TvEpisodesEndpoint(auth);
39
+ this.tvSeasons = new endpoints_1.TvSeasonsEndpoint(auth);
40
+ this.tvShows = new endpoints_1.TvShowsEndpoint(auth);
41
+ this.watchProviders = new endpoints_1.WatchProvidersEndpoint(auth);
42
42
  }
43
43
  }
44
44
  exports.TMDB = TMDB;
@@ -0,0 +1,14 @@
1
+ import { TokenType } from "../@types";
2
+ export declare class API {
3
+ private apiKey?;
4
+ private accessToken?;
5
+ constructor(auth: TokenType);
6
+ /**
7
+ * Generic GET:
8
+ * @template T — response type
9
+ * @template O — options (query params) type
10
+ */
11
+ get<T, O extends Record<string, unknown> = Record<string, unknown>>(path: string, options?: O): Promise<T>;
12
+ }
13
+ export declare const parseOptions: (options?: Record<string, unknown>) => string;
14
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,WAAW,CAAC;AAIrD,qBAAa,GAAG;IACf,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAS;gBAEjB,IAAI,EAAE,SAAS;IAS3B;;;;OAIG;IACG,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,CAAC,GACT,OAAO,CAAC,CAAC,CAAC;CAyBb;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAkBhE,CAAC"}
package/dist/utils/api.js CHANGED
@@ -1,28 +1,61 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseOptions = exports.API = void 0;
4
- const BASE_URL_V3 = 'https://api.themoviedb.org/3';
4
+ const BASE_URL_V3 = "https://api.themoviedb.org/3";
5
5
  class API {
6
- constructor(access_token) {
7
- this.access_token = access_token;
6
+ constructor(auth) {
7
+ if (typeof auth === "string") {
8
+ this.accessToken = auth;
9
+ }
10
+ else {
11
+ this.apiKey = auth.apiKey;
12
+ this.accessToken = auth.accessToken;
13
+ }
8
14
  }
15
+ /**
16
+ * Generic GET:
17
+ * @template T — response type
18
+ * @template O — options (query params) type
19
+ */
9
20
  async get(path, options) {
10
- const params = (0, exports.parseOptions)(options);
21
+ const rawOptions = {
22
+ ...(options ?? {}),
23
+ ...(this.apiKey ? { api_key: this.apiKey } : {}),
24
+ };
25
+ const params = (0, exports.parseOptions)(rawOptions);
11
26
  const response = await fetch(`${BASE_URL_V3}${path}?${params}`, {
12
- method: 'GET',
27
+ method: "GET",
13
28
  headers: {
14
- Authorization: `Bearer ${this.access_token}`,
15
- 'Content-Type': 'application/json;charset=utf-8',
29
+ ...(this.accessToken
30
+ ? { Authorization: `Bearer ${this.accessToken}` }
31
+ : {}),
32
+ "Content-Type": "application/json;charset=utf-8",
16
33
  },
17
34
  });
18
35
  if (!response.ok) {
19
- return Promise.reject((await response.json()));
36
+ const error = (await response.json());
37
+ return Promise.reject(error);
20
38
  }
21
39
  return (await response.json());
22
40
  }
23
41
  }
24
42
  exports.API = API;
25
43
  const parseOptions = (options) => {
26
- return options ? new URLSearchParams(Object.entries(options)).toString() : '';
44
+ if (!options)
45
+ return "";
46
+ const entries = [];
47
+ for (const [key, value] of Object.entries(options)) {
48
+ if (value === undefined || value === null)
49
+ continue;
50
+ if (Array.isArray(value)) {
51
+ for (const item of value) {
52
+ entries.push([key, String(item)]);
53
+ }
54
+ }
55
+ else {
56
+ entries.push([key, String(value)]);
57
+ }
58
+ }
59
+ return new URLSearchParams(entries).toString();
27
60
  };
28
61
  exports.parseOptions = parseOptions;
@@ -0,0 +1,32 @@
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 (e.g., 'https://image.tmdb.org/t/p/')
7
+ * @param {string} fileSize file size (e.g., 'original', 'w500')
8
+ * @param {string} imagePath raw image path
9
+ * @param {string} format override image format (e.g., 'svg', 'png', 'jpg')
10
+ * @returns {string} The complete image URL
11
+ */
12
+ export declare const getFullImagePath: (baseUrl: string, fileSize: string, imagePath: string, format?: string) => string;
13
+ /**
14
+ * Common image sizes available in TMDB
15
+ */
16
+ export declare const ImageSizes: {
17
+ ORIGINAL: string;
18
+ W500: string;
19
+ W300: string;
20
+ W185: string;
21
+ W92: string;
22
+ H632: string;
23
+ };
24
+ /**
25
+ * Image formats supported by TMDB
26
+ */
27
+ export declare const ImageFormats: {
28
+ JPG: string;
29
+ PNG: string;
30
+ SVG: string;
31
+ };
32
+ //# sourceMappingURL=getimagePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getimagePath.d.ts","sourceRoot":"","sources":["../../src/utils/getimagePath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAC5B,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,WAAW,MAAM,EACjB,SAAS,MAAM,KACb,MAeF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;CAOtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}