fetch_until {civis}R Documentation

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, ...)

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

## Not run: 
columns <- fetch_until(tables_list_columns,
                       .until = function(x) x == "voterbase_id")

## End(Not run)

[Package civis version 3.0.0 Index]