@@ -94,6 +94,18 @@ public protocol MovieService {
94
94
func fetchSimilar( toMovie movieID: Movie . ID , page: Int ? ,
95
95
completion: @escaping ( _ result: Result < MoviePageableList , TMDbError > ) -> Void )
96
96
97
+ /// Publishes a list of currently playing movies.
98
+ ///
99
+ /// - Note: [TMDb API - Movie: Now Playing](https://developers.themoviedb.org/3/movies/get-now-playing)
100
+ ///
101
+ /// - precondition: `page` can be between `1` and `1000`.
102
+ ///
103
+ /// - Parameters:
104
+ /// - page: The page of results to return.
105
+ /// - completion: Completion handler.
106
+ /// - result: Current popular movies as a pageable list.
107
+ func fetchNowPlaying( page: Int ? , completion: @escaping ( _ result: Result < MoviePageableList , TMDbError > ) -> Void )
108
+
97
109
/// Publishes a list of current popular movies.
98
110
///
99
111
/// - Note: [TMDb API - Movie: Popular](https://developers.themoviedb.org/3/movies/get-popular-movies)
@@ -105,6 +117,30 @@ public protocol MovieService {
105
117
/// - completion: Completion handler.
106
118
/// - result: Current popular movies as a pageable list.
107
119
func fetchPopular( page: Int ? , completion: @escaping ( _ result: Result < MoviePageableList , TMDbError > ) -> Void )
120
+
121
+ /// Publishes a list of top rated movies.
122
+ ///
123
+ /// - Note: [TMDb API - Movie: Top Rated](https://developers.themoviedb.org/3/movies/get-top-rated-movies)
124
+ ///
125
+ /// - precondition: `page` can be between `1` and `1000`.
126
+ ///
127
+ /// - Parameters:
128
+ /// - page: The page of results to return.
129
+ /// - completion: Completion handler.
130
+ /// - result: Current popular movies as a pageable list.
131
+ func fetchTopRated( page: Int ? , completion: @escaping ( _ result: Result < MoviePageableList , TMDbError > ) -> Void )
132
+
133
+ /// Publishes a list of upcoming movies.
134
+ ///
135
+ /// - Note: [TMDb API - Movie: Upcoming](https://developers.themoviedb.org/3/movies/get-upcoming)
136
+ ///
137
+ /// - precondition: `page` can be between `1` and `1000`.
138
+ ///
139
+ /// - Parameters:
140
+ /// - page: The page of results to return.
141
+ /// - completion: Completion handler.
142
+ /// - result: Current popular movies as a pageable list.
143
+ func fetchUpcoming( page: Int ? , completion: @escaping ( _ result: Result < MoviePageableList , TMDbError > ) -> Void )
108
144
109
145
#if canImport(Combine)
110
146
/// Publishes the primary information about a movie.
@@ -195,6 +231,19 @@ public protocol MovieService {
195
231
@available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
196
232
func similarPublisher( toMovie movieID: Movie . ID , page: Int ? ) -> AnyPublisher < MoviePageableList , TMDbError >
197
233
234
+ /// Publishes a list of currently playing movies.
235
+ ///
236
+ /// - Note: [TMDb API - Movie: Now Playing](https://developers.themoviedb.org/3/movies/get-now-playing)
237
+ ///
238
+ /// - precondition: `page` can be between `1` and `1000`.
239
+ ///
240
+ /// - Parameters:
241
+ /// - page: The page of results to return.
242
+ ///
243
+ /// - Returns: A publisher with currently playing movies as a pageable list.
244
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
245
+ func nowPlayingPublisher( page: Int ? ) -> AnyPublisher < MoviePageableList , TMDbError >
246
+
198
247
/// Publishes a list of current popular movies.
199
248
///
200
249
/// - Note: [TMDb API - Movie: Popular](https://developers.themoviedb.org/3/movies/get-popular-movies)
@@ -207,6 +256,32 @@ public protocol MovieService {
207
256
/// - Returns: A publisher with current popular movies as a pageable list.
208
257
@available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
209
258
func popularPublisher( page: Int ? ) -> AnyPublisher < MoviePageableList , TMDbError >
259
+
260
+ /// Publishes a list of top rated movies.
261
+ ///
262
+ /// - Note: [TMDb API - Movie: Top Rated](https://developers.themoviedb.org/3/movies/get-top-rated-movies)
263
+ ///
264
+ /// - precondition: `page` can be between `1` and `1000`.
265
+ ///
266
+ /// - Parameters:
267
+ /// - page: The page of results to return.
268
+ ///
269
+ /// - Returns: A publisher with top rated movies as a pageable list.
270
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
271
+ func topRatedPublisher( page: Int ? ) -> AnyPublisher < MoviePageableList , TMDbError >
272
+
273
+ /// Publishes a list of upcoming movies.
274
+ ///
275
+ /// - Note: [TMDb API - Movie: Upcoming](https://developers.themoviedb.org/3/movies/get-upcoming)
276
+ ///
277
+ /// - precondition: `page` can be between `1` and `1000`.
278
+ ///
279
+ /// - Parameters:
280
+ /// - page: The page of results to return.
281
+ ///
282
+ /// - Returns: A publisher with upcoming movies as a pageable list.
283
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
284
+ func upcomingPublisher( page: Int ? ) -> AnyPublisher < MoviePageableList , TMDbError >
210
285
#endif
211
286
212
287
}
@@ -227,10 +302,22 @@ public extension MovieService {
227
302
completion: @escaping ( Result < MoviePageableList , TMDbError > ) -> Void ) {
228
303
fetchSimilar ( toMovie: movieID, page: page, completion: completion)
229
304
}
230
-
305
+
306
+ func fetchNowPlaying( page: Int ? = nil , completion: @escaping ( Result < MoviePageableList , TMDbError > ) -> Void ) {
307
+ fetchNowPlaying ( page: page, completion: completion)
308
+ }
309
+
231
310
func fetchPopular( page: Int ? = nil , completion: @escaping ( Result < MoviePageableList , TMDbError > ) -> Void ) {
232
311
fetchPopular ( page: page, completion: completion)
233
312
}
313
+
314
+ func fetchTopRated( page: Int ? = nil , completion: @escaping ( Result < MoviePageableList , TMDbError > ) -> Void ) {
315
+ fetchTopRated ( page: page, completion: completion)
316
+ }
317
+
318
+ func fetchUpcoming( page: Int ? = nil , completion: @escaping ( Result < MoviePageableList , TMDbError > ) -> Void ) {
319
+ fetchUpcoming ( page: page, completion: completion)
320
+ }
234
321
235
322
}
236
323
@@ -253,10 +340,25 @@ public extension MovieService {
253
340
similarPublisher ( toMovie: movieID, page: page)
254
341
}
255
342
343
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
344
+ func nowPlayingPublisher( page: Int ? = nil ) -> AnyPublisher < MoviePageableList , TMDbError > {
345
+ nowPlayingPublisher ( page: page)
346
+ }
347
+
256
348
@available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
257
349
func popularPublisher( page: Int ? = nil ) -> AnyPublisher < MoviePageableList , TMDbError > {
258
350
popularPublisher ( page: page)
259
351
}
352
+
353
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
354
+ func topRatedPublisher( page: Int ? = nil ) -> AnyPublisher < MoviePageableList , TMDbError > {
355
+ topRatedPublisher ( page: page)
356
+ }
357
+
358
+ @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , * )
359
+ func upcomingPublisher( page: Int ? = nil ) -> AnyPublisher < MoviePageableList , TMDbError > {
360
+ upcomingPublisher ( page: page)
361
+ }
260
362
261
363
}
262
364
#endif
0 commit comments