Skip to contents

Follows Total-Results with start/limit pagination and returns the concatenated item list.

Usage

zotGetAll(config, path, query = list(), limit = 100L)

Arguments

config

A zotConfig() object.

path

API path starting at the host root (see zotLibraryPath()).

query

Named list of query parameters.

limit

Page size.

Value

A list of parsed items.

See also

Examples

Performer <- function(config, method, path, query, body, version) {
  Page <- if (query$start == 0L) {
    list(list(key = "A"), list(key = "B"))
  } else {
    list(list(key = "C"))
  }
  list(status = 200L, headers = list(`total-results` = "3"), body = Page)
}
Config <- structure(
  list(userID = "42", key = "example", apiBase = "https://example.invalid",
       performer = Performer),
  class = "zotConfig"
)
Items <- zotGetAll(Config, path = "/users/42/items", limit = 2L)
vapply(Items, function(Item) Item$key, character(1L))
#> [1] "A" "B" "C"