fetch_until: Retrieve some results from a paginated endpoint
Description
fetch_until will retrieve paginated results until a condition is met.
This is useful when searching for a particular value or record.
Usage
fetch_until(fn, .until, ...)
Value
A list with the concatenated results of each page of fn.
Arguments
fn
The API function to be called.
.until
A function which returns a boolean value.
.until will be called with each item from the API response. When
.until returns TRUE iteration will stop and fetch_until
will return all responses accumulated so far.