Fetch the field template of an item type
ztTemplate.RdReads the empty item the API returns for a type and the creator types it accepts. The field names are the complete set a create payload may carry; the template values show each field's shape (text, array or object).
Arguments
- config
A
zotConfig()object.- itemType
An API item type such as
"book"or"journalArticle".
Examples
Performer <- function(config, method, path, query, body, version) {
if (path == "/items/new") {
return(list(status = 200L, headers = list(),
body = list(itemType = "book", title = "", creators = list(),
tags = list(), collections = list())))
}
list(status = 200L, headers = list(),
body = list(list(creatorType = "author", localized = "Author")))
}
Config <- structure(
list(userID = "42", key = "example", apiBase = "https://example.invalid",
performer = Performer),
class = "zotConfig"
)
ztTemplate(Config, itemType = "book")$fields
#> [1] "itemType" "title" "creators" "tags" "collections"