Created
June 12, 2019 08:05
-
-
Save Syex/300fd540a3e4352d37afeece35503b51 to your computer and use it in GitHub Desktop.
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
class GetPopularMovies(private val moviesApi: MoviesApi) | |
: UseCase<PopularMovies, UseCase.None>() { | |
override suspend fun run(params: None): Either<Exception, PopularMovies> { | |
return try { | |
val movies = moviesApi.getPopularMovies().toModel() | |
Success(movies) | |
} catch (e: Exception) { | |
Failure(e) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment