Skip to contents

Fetches the current API record of each key in batches of fifty, the maximum the itemKey filter accepts. Keys the API does not return are reported in missing; absence is a verdict, not an error.

Usage

zotItems(config, keys, library = "user", includeTrashed = FALSE, fields = NULL)

Arguments

config

A zotConfig() object.

keys

Character vector of item keys, without duplicates.

library

"user" or a group id.

includeTrashed

Whether items in the Trash are returned.

fields

Optional character vector: keep only these data fields.

Value

A list: items (named by key, in the order of keys), missing and version (the library's Last-Modified-Version).

Examples

Performer <- function(config, method, path, query, body, version) {
  list(status = 200L, headers = list(`last-modified-version` = "9"),
       body = list(list(key = "K1", version = 1L,
                        data = list(title = "One", abstractNote = "…"))))
}
Config <- structure(
  list(userID = "42", key = "example", apiBase = "https://example.invalid",
       performer = Performer),
  class = "zotConfig"
)
Read <- zotItems(Config, keys = c("K1", "K2"), fields = "title")
names(Read$items)
#> [1] "K1"
Read$missing
#> [1] "K2"