Skip to content

Instantly share code, notes, and snippets.

@herisulistiyanto
Created November 8, 2019 05:49
Show Gist options
  • Save herisulistiyanto/d978746082a8e5f4beb6924ac2316848 to your computer and use it in GitHub Desktop.
Save herisulistiyanto/d978746082a8e5f4beb6924ac2316848 to your computer and use it in GitHub Desktop.
class MovieRemoteDataSource(private val movieApiService: MovieApiService) : BaseDataSource() {
fun discoverAllMovies(scope: CoroutineScope): LiveData<ResponseResult<ResponseWrapper<MovieResponse>>> = resultLiveData(scope) {
getResult {
movieApiService.discoverAllMovies()
}
}
fun getMovieDetails(movieId: Int, scope: CoroutineScope): LiveData<ResponseResult<ResponseWrapper<MovieDetailResponse>>> = resultLiveData(scope) {
getResult {
movieApiService.getMovieDetail(movieId)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment