Skip to content

Instantly share code, notes, and snippets.

@ramonrabello
Created February 12, 2019 22:49
Show Gist options
  • Save ramonrabello/8bc25288fb35fc911e14c8efd956c30d to your computer and use it in GitHub Desktop.
Save ramonrabello/8bc25288fb35fc911e14c8efd956c30d to your computer and use it in GitHub Desktop.
PeopleRepository using RxJava
tmdbApi.loadPeople()
.map { movie -> movie.urls }
.map { url -> tmdbApi.movieDetails(url) }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(onSuccess = { details -> view. showMovieDetails(details) },
onError = { view. showErrorMessage() })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment