@tdanks2000/tmdb-wrapper 1.0.0 → 1.0.2

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 (112) hide show
  1. package/README.md +11 -0
  2. package/dist/@types/endpoints/configuration.d.ts +1 -0
  3. package/dist/@types/endpoints/configuration.d.ts.map +1 -1
  4. package/dist/@types/endpoints/discover.d.ts +53 -0
  5. package/dist/@types/endpoints/discover.d.ts.map +1 -1
  6. package/dist/@types/endpoints/genre.d.ts +7 -0
  7. package/dist/@types/endpoints/genre.d.ts.map +1 -0
  8. package/dist/@types/endpoints/genre.js +2 -0
  9. package/dist/@types/endpoints/index.d.ts +1 -0
  10. package/dist/@types/endpoints/index.d.ts.map +1 -1
  11. package/dist/@types/endpoints/index.js +1 -0
  12. package/dist/@types/endpoints/movies.d.ts +7 -1
  13. package/dist/@types/endpoints/movies.d.ts.map +1 -1
  14. package/dist/@types/endpoints/search.d.ts +24 -1
  15. package/dist/@types/endpoints/search.d.ts.map +1 -1
  16. package/dist/@types/endpoints/tvEpisode.d.ts +13 -1
  17. package/dist/@types/endpoints/tvEpisode.d.ts.map +1 -1
  18. package/dist/@types/endpoints/tvSeasons.d.ts +13 -1
  19. package/dist/@types/endpoints/tvSeasons.d.ts.map +1 -1
  20. package/dist/@types/models/baseEndpoint.d.ts +1 -1
  21. package/dist/@types/models/baseEndpoint.js +1 -1
  22. package/dist/endpoints/account.d.ts +12 -1
  23. package/dist/endpoints/account.d.ts.map +1 -1
  24. package/dist/endpoints/account.js +12 -1
  25. package/dist/endpoints/certification.d.ts +16 -1
  26. package/dist/endpoints/certification.d.ts.map +1 -1
  27. package/dist/endpoints/certification.js +16 -1
  28. package/dist/endpoints/changes.d.ts +23 -1
  29. package/dist/endpoints/changes.d.ts.map +1 -1
  30. package/dist/endpoints/changes.js +26 -4
  31. package/dist/endpoints/collections.d.ts +26 -1
  32. package/dist/endpoints/collections.d.ts.map +1 -1
  33. package/dist/endpoints/collections.js +26 -1
  34. package/dist/endpoints/companies.d.ts +23 -1
  35. package/dist/endpoints/companies.d.ts.map +1 -1
  36. package/dist/endpoints/companies.js +23 -1
  37. package/dist/endpoints/configuration.d.ts +12 -1
  38. package/dist/endpoints/configuration.d.ts.map +1 -1
  39. package/dist/endpoints/configuration.js +12 -1
  40. package/dist/endpoints/credits.d.ts +13 -1
  41. package/dist/endpoints/credits.d.ts.map +1 -1
  42. package/dist/endpoints/credits.js +13 -1
  43. package/dist/endpoints/discover.d.ts +18 -55
  44. package/dist/endpoints/discover.d.ts.map +1 -1
  45. package/dist/endpoints/discover.js +18 -1
  46. package/dist/endpoints/find.d.ts +14 -1
  47. package/dist/endpoints/find.d.ts.map +1 -1
  48. package/dist/endpoints/find.js +14 -1
  49. package/dist/endpoints/genre.d.ts +18 -7
  50. package/dist/endpoints/genre.d.ts.map +1 -1
  51. package/dist/endpoints/genre.js +18 -1
  52. package/dist/endpoints/keywords.d.ts +19 -1
  53. package/dist/endpoints/keywords.d.ts.map +1 -1
  54. package/dist/endpoints/keywords.js +22 -4
  55. package/dist/endpoints/movies.d.ts +115 -9
  56. package/dist/endpoints/movies.d.ts.map +1 -1
  57. package/dist/endpoints/movies.js +115 -3
  58. package/dist/endpoints/networks.d.ts +23 -1
  59. package/dist/endpoints/networks.d.ts.map +1 -1
  60. package/dist/endpoints/networks.js +23 -1
  61. package/dist/endpoints/people.d.ts +69 -1
  62. package/dist/endpoints/people.d.ts.map +1 -1
  63. package/dist/endpoints/people.js +69 -1
  64. package/dist/endpoints/review.d.ts +13 -1
  65. package/dist/endpoints/review.d.ts.map +1 -1
  66. package/dist/endpoints/review.js +13 -1
  67. package/dist/endpoints/search.d.ts +43 -24
  68. package/dist/endpoints/search.d.ts.map +1 -1
  69. package/dist/endpoints/search.js +43 -1
  70. package/dist/endpoints/trending.d.ts +17 -2
  71. package/dist/endpoints/trending.d.ts.map +1 -1
  72. package/dist/endpoints/trending.js +16 -1
  73. package/dist/endpoints/tvEpisodes.d.ts +48 -11
  74. package/dist/endpoints/tvEpisodes.d.ts.map +1 -1
  75. package/dist/endpoints/tvEpisodes.js +50 -1
  76. package/dist/endpoints/tvSeasons.d.ts +56 -11
  77. package/dist/endpoints/tvSeasons.d.ts.map +1 -1
  78. package/dist/endpoints/tvSeasons.js +58 -1
  79. package/dist/endpoints/tvShows.d.ts +135 -4
  80. package/dist/endpoints/tvShows.d.ts.map +1 -1
  81. package/dist/endpoints/tvShows.js +134 -3
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.js +1 -1
  84. package/package.json +4 -3
  85. package/src/@types/endpoints/configuration.ts +1 -0
  86. package/src/@types/endpoints/discover.ts +56 -0
  87. package/src/@types/endpoints/genre.ts +3 -0
  88. package/src/@types/endpoints/index.ts +1 -0
  89. package/src/@types/endpoints/movies.ts +8 -1
  90. package/src/@types/endpoints/search.ts +30 -1
  91. package/src/@types/endpoints/tvEpisode.ts +15 -1
  92. package/src/@types/endpoints/tvSeasons.ts +15 -1
  93. package/src/endpoints/account.ts +11 -0
  94. package/src/endpoints/certification.ts +15 -0
  95. package/src/endpoints/changes.ts +25 -3
  96. package/src/endpoints/collections.ts +25 -0
  97. package/src/endpoints/companies.ts +22 -0
  98. package/src/endpoints/configuration.ts +11 -0
  99. package/src/endpoints/credits.ts +12 -0
  100. package/src/endpoints/discover.ts +24 -57
  101. package/src/endpoints/find.ts +13 -0
  102. package/src/endpoints/genre.ts +18 -5
  103. package/src/endpoints/keywords.ts +21 -3
  104. package/src/endpoints/movies.ts +114 -8
  105. package/src/endpoints/networks.ts +22 -0
  106. package/src/endpoints/people.ts +68 -0
  107. package/src/endpoints/review.ts +12 -0
  108. package/src/endpoints/search.ts +47 -32
  109. package/src/endpoints/trending.ts +17 -2
  110. package/src/endpoints/tvEpisodes.ts +50 -13
  111. package/src/endpoints/tvSeasons.ts +58 -13
  112. package/src/endpoints/tvShows.ts +138 -3
@@ -14,6 +14,7 @@ import {
14
14
  MovieChangeValue,
15
15
  MovieDetails,
16
16
  MovieLists,
17
+ MoviesImageSearchOptions,
17
18
  MoviesPlayingNow,
18
19
  PageOption,
19
20
  PopularMovies,
@@ -31,18 +32,25 @@ import {
31
32
 
32
33
  const BASE_MOVIE = '/movie';
33
34
 
34
- export interface MoviesImageSearchOptions extends LanguageOption {
35
+ /**
36
+ * Represents an endpoint for accessing movie-related information.
37
+ */
38
+ export class MoviesEndpoint extends BaseEndpoint {
35
39
  /**
36
- * a list of ISO-639-1 values to query
40
+ * Constructs a new MoviesEndpoint instance.
41
+ * @param {string} access_token - The access token used for authentication.
37
42
  */
38
- include_image_language?: string[];
39
- }
40
-
41
- export class MoviesEndpoint extends BaseEndpoint {
42
43
  constructor(protected readonly access_token: string) {
43
44
  super(access_token);
44
45
  }
45
46
 
47
+ /**
48
+ * Retrieves details of a specific movie asynchronously.
49
+ * @param {number} id - The ID of the movie.
50
+ * @param {AppendToResponseMovieKey[]} [appendToResponse] - Optional keys to append to the response.
51
+ * @param {string} [language] - Optional parameter for specifying the language.
52
+ * @returns {Promise<AppendToResponse<MovieDetails, AppendToResponseMovieKey[], 'movie'>>} A Promise that resolves with the details of the movie.
53
+ */
46
54
  async details<T extends AppendToResponseMovieKey[] | undefined>(id: number, appendToResponse?: T, language?: string) {
47
55
  const options = {
48
56
  append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
@@ -52,22 +60,50 @@ export class MoviesEndpoint extends BaseEndpoint {
52
60
  return await this.api.get<AppendToResponse<MovieDetails, T, 'movie'>>(`${BASE_MOVIE}/${id}`, options);
53
61
  }
54
62
 
63
+ /**
64
+ * Retrieves alternative titles of a specific movie asynchronously.
65
+ * @param {number} id - The ID of the movie.
66
+ * @returns {Promise<AlternativeTitles>} A Promise that resolves with the alternative titles of the movie.
67
+ */
55
68
  async alternativeTitles(id: number): Promise<AlternativeTitles> {
56
69
  return await this.api.get<AlternativeTitles>(`${BASE_MOVIE}/${id}/alternative_titles`);
57
70
  }
58
71
 
72
+ /**
73
+ * Retrieves changes made to a specific movie asynchronously.
74
+ * @param {number} id - The ID of the movie.
75
+ * @param {ChangeOption} [options] - Optional parameters for filtering changes.
76
+ * @returns {Promise<Changes<MovieChangeValue>>} A Promise that resolves with the changes made to the movie.
77
+ */
59
78
  async changes(id: number, options?: ChangeOption): Promise<Changes<MovieChangeValue>> {
60
79
  return await this.api.get<Changes<MovieChangeValue>>(`${BASE_MOVIE}/${id}/changes`, options);
61
80
  }
62
81
 
82
+ /**
83
+ * Retrieves credits of a specific movie asynchronously.
84
+ * @param {number} id - The ID of the movie.
85
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
86
+ * @returns {Promise<Credits>} A Promise that resolves with the credits of the movie.
87
+ */
63
88
  async credits(id: number, options?: LanguageOption): Promise<Credits> {
64
89
  return await this.api.get<Credits>(`${BASE_MOVIE}/${id}/credits`, options);
65
90
  }
66
91
 
92
+ /**
93
+ * Retrieves external IDs of a specific movie asynchronously.
94
+ * @param {number} id - The ID of the movie.
95
+ * @returns {Promise<ExternalIds>} A Promise that resolves with the external IDs of the movie.
96
+ */
67
97
  async externalIds(id: number): Promise<ExternalIds> {
68
98
  return await this.api.get<ExternalIds>(`${BASE_MOVIE}/${id}/external_ids`);
69
99
  }
70
100
 
101
+ /**
102
+ * Retrieves images of a specific movie asynchronously.
103
+ * @param {number} id - The ID of the movie.
104
+ * @param {MoviesImageSearchOptions} [options] - Optional parameters for specifying image search options.
105
+ * @returns {Promise<Images>} A Promise that resolves with the images of the movie.
106
+ */
71
107
  async images(id: number, options?: MoviesImageSearchOptions): Promise<Images> {
72
108
  const computedOptions = {
73
109
  include_image_language: options?.include_image_language?.join(','),
@@ -76,62 +112,132 @@ export class MoviesEndpoint extends BaseEndpoint {
76
112
  return await this.api.get<Images>(`${BASE_MOVIE}/${id}/images`, computedOptions);
77
113
  }
78
114
 
115
+ /**
116
+ * Retrieves keywords of a specific movie asynchronously.
117
+ * @param {number} id - The ID of the movie.
118
+ * @returns {Promise<Keywords>} A Promise that resolves with the keywords of the movie.
119
+ */
79
120
  async keywords(id: number): Promise<Keywords> {
80
121
  return await this.api.get<Keywords>(`${BASE_MOVIE}/${id}/keywords`);
81
122
  }
82
123
 
124
+ /**
125
+ * Retrieves lists containing a specific movie asynchronously.
126
+ * @param {number} id - The ID of the movie.
127
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
128
+ * @returns {Promise<MovieLists>} A Promise that resolves with the lists containing the movie.
129
+ */
83
130
  async lists(id: number, options?: LanguageOption & PageOption): Promise<MovieLists> {
84
131
  return await this.api.get<MovieLists>(`${BASE_MOVIE}/${id}/lists`, options);
85
132
  }
86
133
 
134
+ /**
135
+ * Retrieves recommendations for a specific movie asynchronously.
136
+ * @param {number} id - The ID of the movie.
137
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
138
+ * @returns {Promise<Recommendations>} A Promise that resolves with the recommendations for the movie.
139
+ */
87
140
  async recommendations(id: number, options?: LanguageOption & PageOption): Promise<Recommendations> {
88
141
  return await this.api.get<Recommendations>(`${BASE_MOVIE}/${id}/recommendations`, options);
89
142
  }
90
143
 
144
+ /**
145
+ * Retrieves release dates of a specific movie asynchronously.
146
+ * @param {number} id - The ID of the movie.
147
+ * @returns {Promise<ReleaseDates>} A Promise that resolves with the release dates of the movie.
148
+ */
91
149
  async releaseDates(id: number): Promise<ReleaseDates> {
92
150
  return await this.api.get<ReleaseDates>(`${BASE_MOVIE}/${id}/release_dates`);
93
151
  }
94
152
 
153
+ /**
154
+ * Retrieves reviews for a specific movie asynchronously.
155
+ * @param {number} id - The ID of the movie.
156
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
157
+ * @returns {Promise<Reviews>} A Promise that resolves with the reviews for the movie.
158
+ */
95
159
  async reviews(id: number, options?: LanguageOption & PageOption): Promise<Reviews> {
96
160
  return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews`, options);
97
161
  }
98
162
 
163
+ /**
164
+ * Retrieves similar movies for a specific movie asynchronously.
165
+ * @param {number} id - The ID of the movie.
166
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
167
+ * @returns {Promise<SimilarMovies>} A Promise that resolves with the similar movies for the movie.
168
+ */
99
169
  async similar(id: number, options?: LanguageOption & PageOption): Promise<SimilarMovies> {
100
170
  return await this.api.get<SimilarMovies>(`${BASE_MOVIE}/${id}/similar`, options);
101
171
  }
102
172
 
173
+ /**
174
+ * Retrieves translations of a specific movie asynchronously.
175
+ * @param {number} id - The ID of the movie.
176
+ * @returns {Promise<Translations>} A Promise that resolves with the translations of the movie.
177
+ */
103
178
  async translations(id: number): Promise<Translations> {
104
179
  return await this.api.get<Translations>(`${BASE_MOVIE}/${id}/translations`);
105
180
  }
106
181
 
182
+ /**
183
+ * Retrieves videos of a specific movie asynchronously.
184
+ * @param {number} id - The ID of the movie.
185
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
186
+ * @returns {Promise<Videos>} A Promise that resolves with the videos of the movie.
187
+ */
107
188
  async videos(id: number, options?: LanguageOption): Promise<Videos> {
108
189
  return await this.api.get<Videos>(`${BASE_MOVIE}/${id}/videos`, options);
109
190
  }
110
191
 
111
192
  /**
112
- * Powered by JustWatch
113
- * @param id
193
+ * Retrieves watch providers of a specific movie asynchronously.
194
+ * @param {number} id - The ID of the movie.
195
+ * @returns {Promise<WatchProviders>} A Promise that resolves with the watch providers of the movie.
114
196
  */
115
197
  async watchProviders(id: number): Promise<WatchProviders> {
116
198
  return await this.api.get<WatchProviders>(`${BASE_MOVIE}/${id}/watch/providers`);
117
199
  }
118
200
 
201
+ /**
202
+ * Retrieves details of the latest movie asynchronously.
203
+ * @returns {Promise<LatestMovie>} A Promise that resolves with the details of the latest movie.
204
+ */
119
205
  async latest(): Promise<LatestMovie> {
120
206
  return await this.api.get<LatestMovie>(`${BASE_MOVIE}/latest`);
121
207
  }
122
208
 
209
+ /**
210
+ * Retrieves movies playing now asynchronously.
211
+ * @param {PageOption & LanguageOption & RegionOption} [options] - Optional parameters for specifying language, region, and pagination options.
212
+ * @returns {Promise<MoviesPlayingNow>} A Promise that resolves with the movies playing now.
213
+ */
123
214
  async nowPlaying(options?: PageOption & LanguageOption & RegionOption): Promise<MoviesPlayingNow> {
124
215
  return await this.api.get<MoviesPlayingNow>(`${BASE_MOVIE}/now_playing`, options);
125
216
  }
126
217
 
218
+ /**
219
+ * Retrieves popular movies asynchronously.
220
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
221
+ * @returns {Promise<PopularMovies>} A Promise that resolves with the popular movies.
222
+ */
127
223
  async popular(options?: LanguageOption & PageOption): Promise<PopularMovies> {
128
224
  return await this.api.get<PopularMovies>(`${BASE_MOVIE}/popular`, options);
129
225
  }
130
226
 
227
+ /**
228
+ * Retrieves top rated movies asynchronously.
229
+ * @param {PageOption & LanguageOption & RegionOption} [options] - Optional parameters for specifying language, region, and pagination options.
230
+ * @returns {Promise<TopRatedMovies>} A Promise that resolves with the top rated movies.
231
+ */
131
232
  async topRated(options?: PageOption & LanguageOption & RegionOption): Promise<TopRatedMovies> {
132
233
  return await this.api.get<TopRatedMovies>(`${BASE_MOVIE}/top_rated`, options);
133
234
  }
134
235
 
236
+ /**
237
+ * Retrieves upcoming movies asynchronously.
238
+ * @param {PageOption & LanguageOption & RegionOption} [options] - Optional parameters for specifying language, region, and pagination options.
239
+ * @returns {Promise<UpcomingMovies>} A Promise that resolves with the upcoming movies.
240
+ */
135
241
  async upcoming(options?: PageOption & LanguageOption & RegionOption): Promise<UpcomingMovies> {
136
242
  return await this.api.get<UpcomingMovies>(`${BASE_MOVIE}/upcoming`, options);
137
243
  }
@@ -1,18 +1,40 @@
1
1
  import { AlternativeNames, BaseEndpoint, NetworkDetails, NetworkImages } from '@/@types';
2
2
 
3
+ /**
4
+ * Represents an endpoint for accessing network details.
5
+ */
3
6
  export class NetworksEndpoint extends BaseEndpoint {
7
+ /**
8
+ * Constructs a new NetworksEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
4
11
  constructor(protected readonly access_token: string) {
5
12
  super(access_token);
6
13
  }
7
14
 
15
+ /**
16
+ * Retrieves details of a specific network asynchronously.
17
+ * @param {number} id - The ID of the network.
18
+ * @returns {Promise<NetworkDetails>} A Promise that resolves with the details of the network.
19
+ */
8
20
  async details(id: number): Promise<NetworkDetails> {
9
21
  return await this.api.get<NetworkDetails>(`/network/${id}`);
10
22
  }
11
23
 
24
+ /**
25
+ * Retrieves alternative names of a specific network asynchronously.
26
+ * @param {number} id - The ID of the network.
27
+ * @returns {Promise<AlternativeNames>} A Promise that resolves with the alternative names of the network.
28
+ */
12
29
  async alternativeNames(id: number): Promise<AlternativeNames> {
13
30
  return await this.api.get<AlternativeNames>(`/network/${id}/alternative_names`);
14
31
  }
15
32
 
33
+ /**
34
+ * Retrieves images of a specific network asynchronously.
35
+ * @param {number} id - The ID of the network.
36
+ * @returns {Promise<NetworkImages>} A Promise that resolves with the images of the network.
37
+ */
16
38
  async images(id: number): Promise<NetworkImages> {
17
39
  return await this.api.get<NetworkImages>(`/network/${id}/images`);
18
40
  }
@@ -20,11 +20,25 @@ import {
20
20
 
21
21
  const BASE_PERSON = '/person';
22
22
 
23
+ /**
24
+ * Represents an endpoint for accessing information about people.
25
+ */
23
26
  export class PeopleEndpoint extends BaseEndpoint {
27
+ /**
28
+ * Constructs a new PeopleEndpoint instance.
29
+ * @param {string} access_token - The access token used for authentication.
30
+ */
24
31
  constructor(access_token: string) {
25
32
  super(access_token);
26
33
  }
27
34
 
35
+ /**
36
+ * Retrieves details of a specific person asynchronously.
37
+ * @param {number} id - The ID of the person.
38
+ * @param {AppendToResponsePersonKey[]} [appendToResponse] - Optional keys to append to the response.
39
+ * @param {string} [language] - Optional parameter for specifying the language.
40
+ * @returns {Promise<AppendToResponse<PersonDetails, AppendToResponsePersonKey[], 'person'>>} A Promise that resolves with the details of the person.
41
+ */
28
42
  async details<T extends AppendToResponsePersonKey[] | undefined>(
29
43
  id: number,
30
44
  appendToResponse?: T,
@@ -37,42 +51,96 @@ export class PeopleEndpoint extends BaseEndpoint {
37
51
  return await this.api.get<AppendToResponse<PersonDetails, T, 'person'>>(`${BASE_PERSON}/${id}`, options);
38
52
  }
39
53
 
54
+ /**
55
+ * Retrieves changes made to a specific person asynchronously.
56
+ * @param {number} id - The ID of the person.
57
+ * @param {ChangeOption} [options] - Optional parameters for filtering changes.
58
+ * @returns {Promise<Changes<PersonChangeValue>>} A Promise that resolves with the changes made to the person.
59
+ */
40
60
  async changes(id: number, options?: ChangeOption): Promise<Changes<PersonChangeValue>> {
41
61
  return await this.api.get<Changes<PersonChangeValue>>(`${BASE_PERSON}/${id}/changes`, options);
42
62
  }
43
63
 
64
+ /**
65
+ * Retrieves movie credits of a specific person asynchronously.
66
+ * @param {number} id - The ID of the person.
67
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
68
+ * @returns {Promise<PersonMovieCredit>} A Promise that resolves with the movie credits of the person.
69
+ */
44
70
  async movieCredits(id: number, options?: LanguageOption): Promise<PersonMovieCredit> {
45
71
  return await this.api.get<PersonMovieCredit>(`${BASE_PERSON}/${id}/movie_credits`, options);
46
72
  }
47
73
 
74
+ /**
75
+ * Retrieves TV show credits of a specific person asynchronously.
76
+ * @param {number} id - The ID of the person.
77
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
78
+ * @returns {Promise<PersonTvShowCredit>} A Promise that resolves with the TV show credits of the person.
79
+ */
48
80
  async tvShowCredits(id: number, options?: LanguageOption): Promise<PersonTvShowCredit> {
49
81
  return await this.api.get<PersonTvShowCredit>(`${BASE_PERSON}/${id}/tv_credits`, options);
50
82
  }
51
83
 
84
+ /**
85
+ * Retrieves combined credits of a specific person asynchronously.
86
+ * @param {number} id - The ID of the person.
87
+ * @param {LanguageOption} [options] - Optional parameters for specifying the language.
88
+ * @returns {Promise<PersonCombinedCredits>} A Promise that resolves with the combined credits of the person.
89
+ */
52
90
  async combinedCredits(id: number, options?: LanguageOption): Promise<PersonCombinedCredits> {
53
91
  return await this.api.get<PersonCombinedCredits>(`${BASE_PERSON}/${id}/combined_credits`, options);
54
92
  }
55
93
 
94
+ /**
95
+ * Retrieves external IDs of a specific person asynchronously.
96
+ * @param {number} id - The ID of the person.
97
+ * @returns {Promise<ExternalIds>} A Promise that resolves with the external IDs of the person.
98
+ */
56
99
  async externalId(id: number): Promise<ExternalIds> {
57
100
  return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
58
101
  }
59
102
 
103
+ /**
104
+ * Retrieves images of a specific person asynchronously.
105
+ * @param {number} id - The ID of the person.
106
+ * @returns {Promise<PeopleImages>} A Promise that resolves with the images of the person.
107
+ */
60
108
  async images(id: number): Promise<PeopleImages> {
61
109
  return await this.api.get<PeopleImages>(`${BASE_PERSON}/${id}/images`);
62
110
  }
63
111
 
112
+ /**
113
+ * Retrieves tagged images of a specific person asynchronously.
114
+ * @param {number} id - The ID of the person.
115
+ * @param {PageOption} [options] - Optional parameters for specifying pagination options.
116
+ * @returns {Promise<TaggedImages>} A Promise that resolves with the tagged images of the person.
117
+ */
64
118
  async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
65
119
  return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images`, options);
66
120
  }
67
121
 
122
+ /**
123
+ * Retrieves translations of a specific person asynchronously.
124
+ * @param {number} id - The ID of the person.
125
+ * @returns {Promise<PersonTranslations>} A Promise that resolves with the translations of the person.
126
+ */
68
127
  async translation(id: number): Promise<PersonTranslations> {
69
128
  return await this.api.get<PersonTranslations>(`${BASE_PERSON}/${id}/translations`);
70
129
  }
71
130
 
131
+ /**
132
+ * Retrieves details of the latest person asynchronously.
133
+ * @returns {Promise<PersonDetails>} A Promise that resolves with the details of the latest person.
134
+ */
72
135
  async latest(): Promise<PersonDetails> {
73
136
  return await this.api.get<PersonDetails>(`${BASE_PERSON}/latest`);
74
137
  }
75
138
 
139
+ /**
140
+ * Retrieves popular persons asynchronously.
141
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying language and pagination options.
142
+ * @returns {Promise<PopularPersons>} A Promise that resolves with the popular persons.
143
+ */
76
144
  async popular(options?: LanguageOption & PageOption): Promise<PopularPersons> {
77
145
  return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular`, options);
78
146
  }
@@ -1,10 +1,22 @@
1
1
  import { BaseEndpoint, ReviewDetails } from '@/@types';
2
2
 
3
+ /**
4
+ * Represents an endpoint for accessing review details.
5
+ */
3
6
  export class ReviewEndpoint extends BaseEndpoint {
7
+ /**
8
+ * Constructs a new ReviewEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
4
11
  constructor(access_token: string) {
5
12
  super(access_token);
6
13
  }
7
14
 
15
+ /**
16
+ * Retrieves details of a specific review asynchronously.
17
+ * @param {string} id - The ID of the review.
18
+ * @returns {Promise<ReviewDetails>} A Promise that resolves with the details of the review.
19
+ */
8
20
  async details(id: string): Promise<ReviewDetails> {
9
21
  return await this.api.get<ReviewDetails>(`/review/${id}`);
10
22
  }
@@ -2,76 +2,91 @@ import {
2
2
  BaseEndpoint,
3
3
  Collection,
4
4
  Company,
5
- LanguageOption,
6
5
  Movie,
6
+ MovieSearchOptions,
7
+ MultiSearchOptions,
7
8
  MultiSearchResult,
8
- PageOption,
9
+ PeopleSearchOptions,
9
10
  Person,
10
- RegionOption,
11
11
  Search,
12
+ SearchOptions,
12
13
  TV,
14
+ TvSearchOptions,
13
15
  } from '@/@types';
14
16
 
15
17
  const BASE_SEARCH = '/search';
16
18
 
17
- export interface SearchOptions {
18
- query: string;
19
- page?: number;
20
- }
21
-
22
- export interface MovieSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
23
- include_adult?: boolean;
24
- year?: number;
25
- primary_release_year?: number;
26
- }
27
-
28
- export interface CollectionSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
29
- include_adult?: boolean;
30
- }
31
-
32
- export interface TvSearchOptions extends SearchOptions, LanguageOption, PageOption {
33
- include_adult?: boolean;
34
- year?: number;
35
- first_air_date_year?: number;
36
- }
37
-
38
- export interface PeopleSearchOptions extends SearchOptions, LanguageOption, PageOption {
39
- include_adult?: boolean;
40
- }
41
-
42
- export interface MultiSearchOptions extends SearchOptions, LanguageOption, PageOption {
43
- include_adult?: boolean;
44
- }
45
-
19
+ /**
20
+ * Represents an endpoint for performing various search operations.
21
+ */
46
22
  export class SearchEndpoint extends BaseEndpoint {
23
+ /**
24
+ * Constructs a new SearchEndpoint instance.
25
+ * @param {string} access_token - The access token used for authentication.
26
+ */
47
27
  constructor(protected readonly access_token: string) {
48
28
  super(access_token);
49
29
  }
50
30
 
31
+ /**
32
+ * Searches for companies asynchronously.
33
+ * @param {SearchOptions} options - The search options.
34
+ * @returns {Promise<Search<Company>>} A Promise that resolves with the search results for companies.
35
+ */
51
36
  async companies(options: SearchOptions): Promise<Search<Company>> {
52
37
  return await this.api.get<Search<Company>>(`${BASE_SEARCH}/company`, options);
53
38
  }
54
39
 
40
+ /**
41
+ * Searches for collections asynchronously.
42
+ * @param {SearchOptions} options - The search options.
43
+ * @returns {Promise<Search<Collection>>} A Promise that resolves with the search results for collections.
44
+ */
55
45
  async collections(options: SearchOptions): Promise<Search<Collection>> {
56
46
  return await this.api.get<Search<Collection>>(`${BASE_SEARCH}/collection`, options);
57
47
  }
58
48
 
49
+ /**
50
+ * Searches for keywords asynchronously.
51
+ * @param {SearchOptions} options - The search options.
52
+ * @returns {Promise<Search<{ id: string; name: string }>>} A Promise that resolves with the search results for keywords.
53
+ */
59
54
  async keywords(options: SearchOptions): Promise<Search<{ id: string; name: string }>> {
60
55
  return await this.api.get<Search<{ id: string; name: string }>>(`${BASE_SEARCH}/keyword`, options);
61
56
  }
62
57
 
58
+ /**
59
+ * Searches for movies asynchronously.
60
+ * @param {MovieSearchOptions} options - The search options.
61
+ * @returns {Promise<Search<Movie>>} A Promise that resolves with the search results for movies.
62
+ */
63
63
  async movies(options: MovieSearchOptions): Promise<Search<Movie>> {
64
64
  return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie`, options);
65
65
  }
66
66
 
67
+ /**
68
+ * Searches for people asynchronously.
69
+ * @param {PeopleSearchOptions} options - The search options.
70
+ * @returns {Promise<Search<Person>>} A Promise that resolves with the search results for people.
71
+ */
67
72
  async people(options: PeopleSearchOptions): Promise<Search<Person>> {
68
73
  return await this.api.get<Search<Person>>(`${BASE_SEARCH}/person`, options);
69
74
  }
70
75
 
76
+ /**
77
+ * Searches for TV shows asynchronously.
78
+ * @param {TvSearchOptions} options - The search options.
79
+ * @returns {Promise<Search<TV>>} A Promise that resolves with the search results for TV shows.
80
+ */
71
81
  async tv(options: TvSearchOptions): Promise<Search<TV>> {
72
82
  return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv`, options);
73
83
  }
74
84
 
85
+ /**
86
+ * Performs a multi-search asynchronously.
87
+ * @param {MultiSearchOptions} options - The search options.
88
+ * @returns {Promise<Search<MultiSearchResult>>} A Promise that resolves with the multi-search results.
89
+ */
75
90
  async multi(options: MultiSearchOptions): Promise<Search<MultiSearchResult>> {
76
91
  return await this.api.get<Search<MultiSearchResult>>(`${BASE_SEARCH}/multi`, options);
77
92
  }
@@ -1,14 +1,29 @@
1
- import { BaseEndpoint, LanguageOption, TimeWindow, TrendingMediaType, TrendingResults } from '@/@types';
1
+ import { BaseEndpoint, LanguageOption, PageOption, TimeWindow, TrendingMediaType, TrendingResults } from '@/@types';
2
2
 
3
+ /**
4
+ * Represents an endpoint for retrieving trending content.
5
+ */
3
6
  export class TrendingEndpoint extends BaseEndpoint {
7
+ /**
8
+ * Constructs a new TrendingEndpoint instance.
9
+ * @param {string} access_token - The access token used for authentication.
10
+ */
4
11
  constructor(access_token: string) {
5
12
  super(access_token);
6
13
  }
7
14
 
15
+ /**
16
+ * Retrieves trending content asynchronously based on media type and time window.
17
+ * @param {TrendingMediaType} mediaType - The type of media (e.g., 'all', 'movie', 'tv').
18
+ * @param {TimeWindow} timeWindow - The time window for trending content (e.g., 'day', 'week').
19
+ * @param {LanguageOption & PageOption} [options] - Optional parameters for specifying the language and pagination.
20
+ * @returns {Promise<TrendingResults<T>>} A Promise that resolves with the trending results.
21
+ * @template T - The type of media being searched for (e.g., 'movie', 'tv').
22
+ */
8
23
  async trending<T extends TrendingMediaType>(
9
24
  mediaType: T,
10
25
  timeWindow: TimeWindow,
11
- options?: LanguageOption,
26
+ options?: LanguageOption & PageOption,
12
27
  ): Promise<TrendingResults<T>> {
13
28
  return await this.api.get<TrendingResults<T>>(`/trending/${mediaType}/${timeWindow}`, options);
14
29
  }