Last active
July 23, 2020 08:33
-
-
Save jamesrochabrun/613caa74f009034475c579b08c137c0d to your computer and use it in GitHub Desktop.
MovieClient fetches movies from Movies API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class MovieClient: CombineAPI { | |
// 1 | |
let session: URLSession | |
// 2 | |
init(configuration: URLSessionConfiguration) { | |
self.session = URLSession(configuration: configuration) | |
} | |
convenience init() { | |
self.init(configuration: .default) | |
} | |
// 3 | |
func getFeed(_ feedKind: MovieFeed) -> AnyPublisher<MovieFeedResult, Error> { | |
// 4 | |
execute(feedKind.request, decodingType: MovieFeedResult.self, retries: 2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment