Skip to content

Instantly share code, notes, and snippets.

@navi25
Last active January 25, 2019 21:25
Show Gist options
  • Save navi25/538d179bd6635949efc1fc22485fd744 to your computer and use it in GitHub Desktop.
Save navi25/538d179bd6635949efc1fc22485fd744 to your computer and use it in GitHub Desktop.
class MovieRepository(private val api : TmdbApi) : BaseRepository() {
fun getPopularMovies() : MutableList<TmdbMovie>?{
//safeApiCall is defined in BaseRepository.kt (https://gist.github.com/navi25/67176730f5595b3f1fb5095062a92f15)
val movieResponse = safeApiCall(
call = {api.getPopularMovie().await()},
errorMessage = "Error Fetching Popular Movies"
)
return movieResponse?.results.toMutableList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment