Learn R Programming

civis (version 3.0.0)

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.

...

Arguments passed to fn.

See Also

Other pagination: fetch_all()

Examples

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

Run the code above in your browser using DataLab