I have API that returns the data by page, something like this:
{
"count": 100,
"offset": 0,
"limit": 25,
"result": [{}, {}, {}...]
}
I need to get all pages - All data (to execute queries with a different "offset":).
Observable<MyResponse> call = RetrofitProvider.get().create(MyApi.class).getData(0, 25); // limit and offset
call.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.newThread())
.doOnNext(<saving data>)
.subscribe(result -> {
}, error -> {
});
I'm trying to use RxAndroid and Retrofit. What is the best way this?