List the collections of a library with their paths
zotCollections.RdReads every collection and derives each one's path from the root, joined
with / exactly as ztCollectionTree() names the collections it returns.
Arguments
- config
A
zotConfig()object.- library
"user"or a group id.
Value
A data.table in API order with collectionKey, name,
parentCollection (NA at the root), path, numItems and version.
Examples
Collections <- list(
list(key = "ROOT", version = 3L, meta = list(numItems = 2L),
data = list(name = "Projects", parentCollection = FALSE)),
list(key = "LEAF", version = 4L, meta = list(numItems = 1L),
data = list(name = "2026", parentCollection = "ROOT"))
)
Performer <- function(config, method, path, query, body, version) {
list(status = 200L, headers = list(`total-results` = "2"),
body = Collections)
}
Config <- structure(
list(userID = "42", key = "example", apiBase = "https://example.invalid",
performer = Performer),
class = "zotConfig"
)
zotCollections(Config)
#> collectionKey name parentCollection path numItems version
#> <char> <char> <char> <char> <int> <int>
#> 1: ROOT Projects <NA> Projects 2 3
#> 2: LEAF 2026 ROOT Projects/2026 1 4