fetch_until will retrieve paginated results until a condition is met. This is useful when searching for a particular value or record.

fetch_until(fn, .until, ...)

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.

...

Arguments passed to fn.

Value

A list with the concatenated results of each page of fn.

See also

Other pagination: fetch_all()

Examples

if (FALSE) { columns <- fetch_until(tables_list_columns, .until = function(x) x == "voterbase_id") }