|
7 | 7 | # nolint end |
8 | 8 | #' |
9 | 9 | #' @param workspace_uuid UUID of workspace |
10 | | -#' @param type List of asset types to return. Defaults to all types; |
11 | | -#' document, folder and link. |
| 10 | +#' @param type List of asset types to return. Default returns all types; |
| 11 | +#' "document", "folder" and "link". |
| 12 | +#' |
| 13 | +#' List must be empty (default, returns all asset types), or length 1 (e.g. |
| 14 | +#' `list("document")`). This is a temporary measure while a bug in the |
| 15 | +#' underlying API is outstanding (see |
| 16 | +#' [objr#53](https://github.com/ScotGovAnalysis/objr/issues/53)). |
| 17 | +#' |
12 | 18 | #' @inheritParams objr |
13 | 19 | #' @inheritParams workspaces |
14 | 20 | #' |
|
17 | 23 | #' @export |
18 | 24 |
|
19 | 25 | assets <- function(workspace_uuid, |
20 | | - type = list("document", "folder", "link"), |
| 26 | + type = list(), |
21 | 27 | page = NULL, |
22 | 28 | size = NULL, |
23 | 29 | use_proxy = FALSE) { |
24 | 30 |
|
25 | 31 | check_list(type) |
26 | 32 |
|
| 33 | + if (length(type) > 1) { |
| 34 | + cli::cli_abort(c( |
| 35 | + "x" = "{.arg type} must be a list of length 0 or 1, not {length(type)}.", |
| 36 | + "i" = paste( |
| 37 | + "There is currently a bug in the underlying API preventing", |
| 38 | + "users from selecting more than one asset type. See", |
| 39 | + "{.href [objr#53](https://github.com/ScotGovAnalysis/objr/issues/53)}", |
| 40 | + "for more information."), |
| 41 | + "i" = paste("To return all assets, use `type = list()` (default)."), |
| 42 | + "i" = paste("To return one asset type only, e.g. documents, use", |
| 43 | + "`type = list(\"document\")`. See `?assets` for all", |
| 44 | + "options.") |
| 45 | + )) |
| 46 | + } |
| 47 | + |
27 | 48 | type <- paste(toupper(type), collapse = "|") |
28 | 49 |
|
29 | 50 | response <- objr( |
|
0 commit comments