Skip to content

Instantly share code, notes, and snippets.

@Syex
Created June 12, 2019 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Syex/300fd540a3e4352d37afeece35503b51 to your computer and use it in GitHub Desktop.
Save Syex/300fd540a3e4352d37afeece35503b51 to your computer and use it in GitHub Desktop.
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