Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.