Skip to content

Instantly share code, notes, and snippets.

@luks91
Created October 16, 2017 01:15
Show Gist options
  • Save luks91/bc8b4e98d37803ed25a593f308dccd62 to your computer and use it in GitHub Desktop.
Save luks91/bc8b4e98d37803ed25a593f308dccd62 to your computer and use it in GitHub Desktop.
fun sampleCall(api: ServerApi) {
pagedDataOf { start -> api.getStrings(start, pageLimit = 20) }
.subscribeOn(Schedulers.io())
.subscribe(object: Subscriber<List<String>> {
override fun onSubscribe(subscription: Subscription) {
subscription.request(2)
}
override fun onNext(nextPage: List<String>) = System.out.println(nextPage)
override fun onError(t: Throwable) {}
override fun onComplete() {}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment