@tdanks2000/tmdb-wrapper 1.0.2 → 1.1.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 (94) hide show
  1. package/README.md +334 -148
  2. package/dist/@types/models/baseEndpoint.d.ts.map +1 -1
  3. package/dist/endpoints/account.d.ts.map +1 -1
  4. package/dist/endpoints/certification.d.ts.map +1 -1
  5. package/dist/endpoints/changes.d.ts.map +1 -1
  6. package/dist/endpoints/collections.d.ts.map +1 -1
  7. package/dist/endpoints/collections.js +1 -1
  8. package/dist/endpoints/companies.d.ts.map +1 -1
  9. package/dist/endpoints/configuration.d.ts.map +1 -1
  10. package/dist/endpoints/credits.d.ts.map +1 -1
  11. package/dist/endpoints/discover.d.ts.map +1 -1
  12. package/dist/endpoints/find.d.ts.map +1 -1
  13. package/dist/endpoints/genre.d.ts.map +1 -1
  14. package/dist/endpoints/index.d.ts +3 -0
  15. package/dist/endpoints/index.d.ts.map +1 -1
  16. package/dist/endpoints/index.js +3 -0
  17. package/dist/endpoints/keywords.d.ts.map +1 -1
  18. package/dist/endpoints/movies.d.ts.map +1 -1
  19. package/dist/endpoints/movies.js +1 -1
  20. package/dist/endpoints/networks.d.ts.map +1 -1
  21. package/dist/endpoints/people.d.ts.map +1 -1
  22. package/dist/endpoints/review.d.ts.map +1 -1
  23. package/dist/endpoints/search.d.ts.map +1 -1
  24. package/dist/endpoints/trending.d.ts.map +1 -1
  25. package/dist/endpoints/tvEpisodes.d.ts.map +1 -1
  26. package/dist/endpoints/tvEpisodes.js +2 -2
  27. package/dist/endpoints/tvSeasons.d.ts.map +1 -1
  28. package/dist/endpoints/tvSeasons.js +2 -2
  29. package/dist/endpoints/tvShows.d.ts.map +1 -1
  30. package/dist/endpoints/tvShows.js +2 -2
  31. package/dist/endpoints/watchProviders.d.ts +33 -0
  32. package/dist/endpoints/watchProviders.d.ts.map +1 -0
  33. package/dist/endpoints/watchProviders.js +63 -0
  34. package/dist/index.d.ts +4 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/utils/api.d.ts.map +1 -1
  38. package/dist/utils/getimagePath.d.ts +24 -4
  39. package/dist/utils/getimagePath.d.ts.map +1 -1
  40. package/dist/utils/getimagePath.js +39 -8
  41. package/package.json +28 -10
  42. package/src/@types/endpoints/account.ts +0 -17
  43. package/src/@types/endpoints/certification.ts +0 -19
  44. package/src/@types/endpoints/changes.ts +0 -29
  45. package/src/@types/endpoints/collection.ts +0 -23
  46. package/src/@types/endpoints/companies.ts +0 -33
  47. package/src/@types/endpoints/configuration.ts +0 -112
  48. package/src/@types/endpoints/credits.ts +0 -149
  49. package/src/@types/endpoints/discover.ts +0 -87
  50. package/src/@types/endpoints/find.ts +0 -28
  51. package/src/@types/endpoints/genre.ts +0 -3
  52. package/src/@types/endpoints/index.ts +0 -22
  53. package/src/@types/endpoints/keywords.ts +0 -24
  54. package/src/@types/endpoints/movies.ts +0 -169
  55. package/src/@types/endpoints/networks.ts +0 -15
  56. package/src/@types/endpoints/options.ts +0 -189
  57. package/src/@types/endpoints/people.ts +0 -151
  58. package/src/@types/endpoints/review.ts +0 -8
  59. package/src/@types/endpoints/search.ts +0 -39
  60. package/src/@types/endpoints/trending.ts +0 -20
  61. package/src/@types/endpoints/tvEpisode.ts +0 -72
  62. package/src/@types/endpoints/tvSeasons.ts +0 -37
  63. package/src/@types/endpoints/tvShows.ts +0 -284
  64. package/src/@types/endpoints/watchProviders.ts +0 -298
  65. package/src/@types/index.ts +0 -3
  66. package/src/@types/models/baseEndpoint.ts +0 -9
  67. package/src/@types/models/index.ts +0 -1
  68. package/src/@types/types.ts +0 -199
  69. package/src/endpoints/account.ts +0 -22
  70. package/src/endpoints/certification.ts +0 -30
  71. package/src/endpoints/changes.ts +0 -41
  72. package/src/endpoints/collections.ts +0 -57
  73. package/src/endpoints/companies.ts +0 -41
  74. package/src/endpoints/configuration.ts +0 -22
  75. package/src/endpoints/credits.ts +0 -23
  76. package/src/endpoints/discover.ts +0 -40
  77. package/src/endpoints/find.ts +0 -24
  78. package/src/endpoints/genre.ts +0 -32
  79. package/src/endpoints/index.ts +0 -18
  80. package/src/endpoints/keywords.ts +0 -35
  81. package/src/endpoints/movies.ts +0 -244
  82. package/src/endpoints/networks.ts +0 -41
  83. package/src/endpoints/people.ts +0 -147
  84. package/src/endpoints/review.ts +0 -23
  85. package/src/endpoints/search.ts +0 -93
  86. package/src/endpoints/trending.ts +0 -30
  87. package/src/endpoints/tvEpisodes.ts +0 -125
  88. package/src/endpoints/tvSeasons.ts +0 -138
  89. package/src/endpoints/tvShows.ts +0 -286
  90. package/src/index.ts +0 -66
  91. package/src/utils/api.ts +0 -31
  92. package/src/utils/getimagePath.ts +0 -16
  93. package/src/utils/index.ts +0 -2
  94. package/tsconfig.json +0 -108
@@ -1,244 +0,0 @@
1
- import {
2
- AlternativeTitles,
3
- AppendToResponse,
4
- AppendToResponseMovieKey,
5
- BaseEndpoint,
6
- ChangeOption,
7
- Changes,
8
- Credits,
9
- ExternalIds,
10
- Images,
11
- Keywords,
12
- LanguageOption,
13
- LatestMovie,
14
- MovieChangeValue,
15
- MovieDetails,
16
- MovieLists,
17
- MoviesImageSearchOptions,
18
- MoviesPlayingNow,
19
- PageOption,
20
- PopularMovies,
21
- Recommendations,
22
- RegionOption,
23
- ReleaseDates,
24
- Reviews,
25
- SimilarMovies,
26
- TopRatedMovies,
27
- Translations,
28
- UpcomingMovies,
29
- Videos,
30
- WatchProviders,
31
- } from '@/@types';
32
-
33
- const BASE_MOVIE = '/movie';
34
-
35
- /**
36
- * Represents an endpoint for accessing movie-related information.
37
- */
38
- export class MoviesEndpoint extends BaseEndpoint {
39
- /**
40
- * Constructs a new MoviesEndpoint instance.
41
- * @param {string} access_token - The access token used for authentication.
42
- */
43
- constructor(protected readonly access_token: string) {
44
- super(access_token);
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
- */
54
- async details<T extends AppendToResponseMovieKey[] | undefined>(id: number, appendToResponse?: T, language?: string) {
55
- const options = {
56
- append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
57
- language: language,
58
- };
59
-
60
- return await this.api.get<AppendToResponse<MovieDetails, T, 'movie'>>(`${BASE_MOVIE}/${id}`, options);
61
- }
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
- */
68
- async alternativeTitles(id: number): Promise<AlternativeTitles> {
69
- return await this.api.get<AlternativeTitles>(`${BASE_MOVIE}/${id}/alternative_titles`);
70
- }
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
- */
78
- async changes(id: number, options?: ChangeOption): Promise<Changes<MovieChangeValue>> {
79
- return await this.api.get<Changes<MovieChangeValue>>(`${BASE_MOVIE}/${id}/changes`, options);
80
- }
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
- */
88
- async credits(id: number, options?: LanguageOption): Promise<Credits> {
89
- return await this.api.get<Credits>(`${BASE_MOVIE}/${id}/credits`, options);
90
- }
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
- */
97
- async externalIds(id: number): Promise<ExternalIds> {
98
- return await this.api.get<ExternalIds>(`${BASE_MOVIE}/${id}/external_ids`);
99
- }
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
- */
107
- async images(id: number, options?: MoviesImageSearchOptions): Promise<Images> {
108
- const computedOptions = {
109
- include_image_language: options?.include_image_language?.join(','),
110
- language: options?.language,
111
- };
112
- return await this.api.get<Images>(`${BASE_MOVIE}/${id}/images`, computedOptions);
113
- }
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
- */
120
- async keywords(id: number): Promise<Keywords> {
121
- return await this.api.get<Keywords>(`${BASE_MOVIE}/${id}/keywords`);
122
- }
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
- */
130
- async lists(id: number, options?: LanguageOption & PageOption): Promise<MovieLists> {
131
- return await this.api.get<MovieLists>(`${BASE_MOVIE}/${id}/lists`, options);
132
- }
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
- */
140
- async recommendations(id: number, options?: LanguageOption & PageOption): Promise<Recommendations> {
141
- return await this.api.get<Recommendations>(`${BASE_MOVIE}/${id}/recommendations`, options);
142
- }
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
- */
149
- async releaseDates(id: number): Promise<ReleaseDates> {
150
- return await this.api.get<ReleaseDates>(`${BASE_MOVIE}/${id}/release_dates`);
151
- }
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
- */
159
- async reviews(id: number, options?: LanguageOption & PageOption): Promise<Reviews> {
160
- return await this.api.get<Reviews>(`${BASE_MOVIE}/${id}/reviews`, options);
161
- }
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
- */
169
- async similar(id: number, options?: LanguageOption & PageOption): Promise<SimilarMovies> {
170
- return await this.api.get<SimilarMovies>(`${BASE_MOVIE}/${id}/similar`, options);
171
- }
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
- */
178
- async translations(id: number): Promise<Translations> {
179
- return await this.api.get<Translations>(`${BASE_MOVIE}/${id}/translations`);
180
- }
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
- */
188
- async videos(id: number, options?: LanguageOption): Promise<Videos> {
189
- return await this.api.get<Videos>(`${BASE_MOVIE}/${id}/videos`, options);
190
- }
191
-
192
- /**
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.
196
- */
197
- async watchProviders(id: number): Promise<WatchProviders> {
198
- return await this.api.get<WatchProviders>(`${BASE_MOVIE}/${id}/watch/providers`);
199
- }
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
- */
205
- async latest(): Promise<LatestMovie> {
206
- return await this.api.get<LatestMovie>(`${BASE_MOVIE}/latest`);
207
- }
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
- */
214
- async nowPlaying(options?: PageOption & LanguageOption & RegionOption): Promise<MoviesPlayingNow> {
215
- return await this.api.get<MoviesPlayingNow>(`${BASE_MOVIE}/now_playing`, options);
216
- }
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
- */
223
- async popular(options?: LanguageOption & PageOption): Promise<PopularMovies> {
224
- return await this.api.get<PopularMovies>(`${BASE_MOVIE}/popular`, options);
225
- }
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
- */
232
- async topRated(options?: PageOption & LanguageOption & RegionOption): Promise<TopRatedMovies> {
233
- return await this.api.get<TopRatedMovies>(`${BASE_MOVIE}/top_rated`, options);
234
- }
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
- */
241
- async upcoming(options?: PageOption & LanguageOption & RegionOption): Promise<UpcomingMovies> {
242
- return await this.api.get<UpcomingMovies>(`${BASE_MOVIE}/upcoming`, options);
243
- }
244
- }
@@ -1,41 +0,0 @@
1
- import { AlternativeNames, BaseEndpoint, NetworkDetails, NetworkImages } from '@/@types';
2
-
3
- /**
4
- * Represents an endpoint for accessing network details.
5
- */
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
- */
11
- constructor(protected readonly access_token: string) {
12
- super(access_token);
13
- }
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
- */
20
- async details(id: number): Promise<NetworkDetails> {
21
- return await this.api.get<NetworkDetails>(`/network/${id}`);
22
- }
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
- */
29
- async alternativeNames(id: number): Promise<AlternativeNames> {
30
- return await this.api.get<AlternativeNames>(`/network/${id}/alternative_names`);
31
- }
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
- */
38
- async images(id: number): Promise<NetworkImages> {
39
- return await this.api.get<NetworkImages>(`/network/${id}/images`);
40
- }
41
- }
@@ -1,147 +0,0 @@
1
- import {
2
- AppendToResponse,
3
- AppendToResponsePersonKey,
4
- BaseEndpoint,
5
- ChangeOption,
6
- Changes,
7
- ExternalIds,
8
- LanguageOption,
9
- PageOption,
10
- PeopleImages,
11
- PersonChangeValue,
12
- PersonCombinedCredits,
13
- PersonDetails,
14
- PersonMovieCredit,
15
- PersonTranslations,
16
- PersonTvShowCredit,
17
- PopularPersons,
18
- TaggedImages,
19
- } from '@/@types';
20
-
21
- const BASE_PERSON = '/person';
22
-
23
- /**
24
- * Represents an endpoint for accessing information about people.
25
- */
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
- */
31
- constructor(access_token: string) {
32
- super(access_token);
33
- }
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
- */
42
- async details<T extends AppendToResponsePersonKey[] | undefined>(
43
- id: number,
44
- appendToResponse?: T,
45
- language?: string,
46
- ) {
47
- const options = {
48
- append_to_response: appendToResponse ? appendToResponse.join(',') : undefined,
49
- language: language,
50
- };
51
- return await this.api.get<AppendToResponse<PersonDetails, T, 'person'>>(`${BASE_PERSON}/${id}`, options);
52
- }
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
- */
60
- async changes(id: number, options?: ChangeOption): Promise<Changes<PersonChangeValue>> {
61
- return await this.api.get<Changes<PersonChangeValue>>(`${BASE_PERSON}/${id}/changes`, options);
62
- }
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
- */
70
- async movieCredits(id: number, options?: LanguageOption): Promise<PersonMovieCredit> {
71
- return await this.api.get<PersonMovieCredit>(`${BASE_PERSON}/${id}/movie_credits`, options);
72
- }
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
- */
80
- async tvShowCredits(id: number, options?: LanguageOption): Promise<PersonTvShowCredit> {
81
- return await this.api.get<PersonTvShowCredit>(`${BASE_PERSON}/${id}/tv_credits`, options);
82
- }
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
- */
90
- async combinedCredits(id: number, options?: LanguageOption): Promise<PersonCombinedCredits> {
91
- return await this.api.get<PersonCombinedCredits>(`${BASE_PERSON}/${id}/combined_credits`, options);
92
- }
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
- */
99
- async externalId(id: number): Promise<ExternalIds> {
100
- return await this.api.get<ExternalIds>(`${BASE_PERSON}/${id}/external_ids`);
101
- }
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
- */
108
- async images(id: number): Promise<PeopleImages> {
109
- return await this.api.get<PeopleImages>(`${BASE_PERSON}/${id}/images`);
110
- }
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
- */
118
- async taggedImages(id: number, options?: PageOption): Promise<TaggedImages> {
119
- return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images`, options);
120
- }
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
- */
127
- async translation(id: number): Promise<PersonTranslations> {
128
- return await this.api.get<PersonTranslations>(`${BASE_PERSON}/${id}/translations`);
129
- }
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
- */
135
- async latest(): Promise<PersonDetails> {
136
- return await this.api.get<PersonDetails>(`${BASE_PERSON}/latest`);
137
- }
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
- */
144
- async popular(options?: LanguageOption & PageOption): Promise<PopularPersons> {
145
- return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular`, options);
146
- }
147
- }
@@ -1,23 +0,0 @@
1
- import { BaseEndpoint, ReviewDetails } from '@/@types';
2
-
3
- /**
4
- * Represents an endpoint for accessing review details.
5
- */
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
- */
11
- constructor(access_token: string) {
12
- super(access_token);
13
- }
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
- */
20
- async details(id: string): Promise<ReviewDetails> {
21
- return await this.api.get<ReviewDetails>(`/review/${id}`);
22
- }
23
- }
@@ -1,93 +0,0 @@
1
- import {
2
- BaseEndpoint,
3
- Collection,
4
- Company,
5
- Movie,
6
- MovieSearchOptions,
7
- MultiSearchOptions,
8
- MultiSearchResult,
9
- PeopleSearchOptions,
10
- Person,
11
- Search,
12
- SearchOptions,
13
- TV,
14
- TvSearchOptions,
15
- } from '@/@types';
16
-
17
- const BASE_SEARCH = '/search';
18
-
19
- /**
20
- * Represents an endpoint for performing various search operations.
21
- */
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
- */
27
- constructor(protected readonly access_token: string) {
28
- super(access_token);
29
- }
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
- */
36
- async companies(options: SearchOptions): Promise<Search<Company>> {
37
- return await this.api.get<Search<Company>>(`${BASE_SEARCH}/company`, options);
38
- }
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
- */
45
- async collections(options: SearchOptions): Promise<Search<Collection>> {
46
- return await this.api.get<Search<Collection>>(`${BASE_SEARCH}/collection`, options);
47
- }
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
- */
54
- async keywords(options: SearchOptions): Promise<Search<{ id: string; name: string }>> {
55
- return await this.api.get<Search<{ id: string; name: string }>>(`${BASE_SEARCH}/keyword`, options);
56
- }
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
- async movies(options: MovieSearchOptions): Promise<Search<Movie>> {
64
- return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie`, options);
65
- }
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
- */
72
- async people(options: PeopleSearchOptions): Promise<Search<Person>> {
73
- return await this.api.get<Search<Person>>(`${BASE_SEARCH}/person`, options);
74
- }
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
- */
81
- async tv(options: TvSearchOptions): Promise<Search<TV>> {
82
- return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv`, options);
83
- }
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
- */
90
- async multi(options: MultiSearchOptions): Promise<Search<MultiSearchResult>> {
91
- return await this.api.get<Search<MultiSearchResult>>(`${BASE_SEARCH}/multi`, options);
92
- }
93
- }
@@ -1,30 +0,0 @@
1
- import { BaseEndpoint, LanguageOption, PageOption, TimeWindow, TrendingMediaType, TrendingResults } from '@/@types';
2
-
3
- /**
4
- * Represents an endpoint for retrieving trending content.
5
- */
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
- */
11
- constructor(access_token: string) {
12
- super(access_token);
13
- }
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
- */
23
- async trending<T extends TrendingMediaType>(
24
- mediaType: T,
25
- timeWindow: TimeWindow,
26
- options?: LanguageOption & PageOption,
27
- ): Promise<TrendingResults<T>> {
28
- return await this.api.get<TrendingResults<T>>(`/trending/${mediaType}/${timeWindow}`, options);
29
- }
30
- }