https://kotlinlang.org logo
#ktor
Title
# ktor
z

zt

10/14/2022, 6:26 AM
I'm working with an API that returns several items per page and to get more you have to do another request with the next page number. Is there a way I could simplify this so it just provides a flow that automatically makes the requests until it runs out of items?
s

Sam

10/14/2022, 6:42 AM
Yes! Perfect use case for flows. Just use a normal
flow { ... }
builder and write the body as a loop where you emit the result of each successive call.
4 Views