Pagination in API responses is always really annoying to handle. It would be good to extract the logic for handling that since you have to use it a few times.
Or similar (I haven't run the example). I think it makes the intent clearer, especially if you extracted the lambda in the map into something with a descriptive name.
Pagination in API responses is always really annoying to handle. It would be good to extract the logic for handling that since you have to use it a few times.
The
processPage
here seems like a useful starter.Also, rather than
You could try using
map
like:Or similar (I haven't run the example). I think it makes the intent clearer, especially if you extracted the lambda in the map into something with a descriptive name.