Move items to the recoverable Trash
zotTrash.RdThe only removal zot implements: deleted = 1 through a minimal
conditional PATCH. Permanent deletion is not part of this package;
emptying Trash is not provided by this package.
Arguments
- config
A
zotConfig()object.- keys
Character vector of item keys.
- library
"user"or a group id (seezotLibraryPath()).
Value
A data.table with one row per key: itemKey, status
("trashed", "already", "missing" or "failed").
See also
zotPatch(), zotPreview(), and zotExecute().
Examples
Store <- new.env(parent = emptyenv())
Store$version <- 1L
Store$deleted <- 0L
Performer <- function(config, method, path, query, body, version) {
if (method == "GET") {
return(list(
status = 200L,
headers = list(),
body = list(version = Store$version,
data = list(deleted = Store$deleted))
))
}
Store$deleted <- body$deleted
Store$version <- Store$version + 1L
list(status = 204L, headers = list(), body = NULL)
}
Config <- structure(
list(userID = "42", key = "example", apiBase = "https://example.invalid",
performer = Performer),
class = "zotConfig"
)
zotTrash(Config, keys = "ABCD1234")
#> Index: <itemKey>
#> itemKey status
#> <char> <char>
#> 1: ABCD1234 trashed