diff --git a/R/boxr_add_description.R b/R/boxr_add_description.R index fa9ed85..a57c414 100644 --- a/R/boxr_add_description.R +++ b/R/boxr_add_description.R @@ -12,6 +12,8 @@ #' #' @export box_add_description <- function(file_id, description) { + + file_id <- as_box_id(file_id) file_id <- handle_file_id(file_id) req <- httr::RETRY( diff --git a/R/boxr_collab.R b/R/boxr_collab.R index ee6a880..1ba0ff3 100644 --- a/R/boxr_collab.R +++ b/R/boxr_collab.R @@ -66,6 +66,11 @@ box_collab_create <- function(dir_id = NULL, user_id = NULL, file_id = NULL, group_id = NULL, login = NULL, role = "editor", can_view_path = FALSE) { + dir_id <- as_box_id(dir_id) + user_id <- as_box_id(user_id) + file_id <- as_box_id(file_id) + group_id <- as_box_id(group_id) + # if login is provided, ignore user_id if (!is_void(login)) { user_id <- NULL @@ -177,6 +182,9 @@ box_dir_invite <- function(dir_id, user_id, login = NULL, role = "viewer", can_view_path = FALSE) { .Deprecated("box_collab_create") + dir_id <- as_box_id(dir_id) + user_id <- as_box_id(user_id) + # if login is provided, ignore user_id if (!is_void(login)) { user_id <- NULL @@ -218,7 +226,10 @@ box_dir_invite <- function(dir_id, user_id, login = NULL, role = "viewer", #' @export #' box_collab_get <- function(dir_id = NULL, file_id = NULL) { - + + dir_id <- as_box_id(dir_id) + file_id <- as_box_id(file_id) + # detect item type for API call item_id <- dir_id %|0|% file_id @@ -275,6 +286,8 @@ box_collab_get <- function(dir_id = NULL, file_id = NULL) { #' box_collab_delete <- function(collab_id) { + collab_id <- as_box_id(collab_id) + url <- glue::glue("https://api.box.com/2.0/collaborations/{collab_id}") resp <- httr::RETRY( diff --git a/R/boxr_comment.R b/R/boxr_comment.R index fecf358..158cbd4 100644 --- a/R/boxr_comment.R +++ b/R/boxr_comment.R @@ -41,6 +41,7 @@ box_comment_create <- function(file_id = NULL, message, comment_id = NULL) { # https://developer.box.com/reference/post-comments/ checkAuth() + file_id <- as_box_id(file_id) item <- comment_item_helper(file_id, comment_id) @@ -76,6 +77,8 @@ box_comment_create <- function(file_id = NULL, message, comment_id = NULL) { #' box_comment_get <- function(file_id) { + file_id <- as_box_id(file_id) + resp <- httr::RETRY( "GET", glue::glue("https://api.box.com/2.0/files/{file_id}/comments"), diff --git a/R/boxr_dir_verbs.R b/R/boxr_dir_verbs.R index 79622e6..8fa35d3 100644 --- a/R/boxr_dir_verbs.R +++ b/R/boxr_dir_verbs.R @@ -63,7 +63,9 @@ #' @export box_fetch <- function(dir_id = box_getwd(), local_dir = getwd(), recursive = TRUE, overwrite = FALSE, delete = FALSE) { + checkAuth() + dir_id <- as_box_id(dir_id) t1 <- Sys.time() @@ -164,6 +166,7 @@ box_push <- function(dir_id = box_getwd(), local_dir = getwd(), ignore_dots = TRUE, overwrite = FALSE, delete = FALSE) { checkAuth() + dir_id <- as_box_id(dir_id) t1 <- Sys.time() diff --git a/R/boxr_file_versions.R b/R/boxr_file_versions.R index 8a85dce..0bcdfb6 100644 --- a/R/boxr_file_versions.R +++ b/R/boxr_file_versions.R @@ -33,7 +33,9 @@ #' @export #' box_version_history <- function(file_id) { - + + file_id <- as_box_id(file_id) + content <- box_version_api(file_id) if (is_void(content)) { @@ -61,6 +63,8 @@ box_version_history <- function(file_id) { #' box_previous_versions <- function(file_id) { + file_id <- as_box_id(file_id) + lifecycle::deprecate_soft( "3.6.0", what = "boxr::box_previous_versions()", @@ -72,6 +76,8 @@ box_previous_versions <- function(file_id) { # internal function to support superseding prev_versions <- function(file_id) { + file_id <- as_box_id(file_id) + entries <- box_version_api(file_id) # The box API isn't very helpful if there are no previous versions. If this diff --git a/R/boxr_upload_download.R b/R/boxr_upload_download.R index f9a7de7..ed0203c 100644 --- a/R/boxr_upload_download.R +++ b/R/boxr_upload_download.R @@ -59,11 +59,11 @@ box_dl <- function(file_id, local_dir = getwd(), overwrite = FALSE, pb = options()$boxr.progress, filename) { checkAuth() + file_id <- as_box_id(file_id) assertthat::assert_that(assertthat::is.dir(local_dir)) assertthat::assert_that(!is.na(overwrite)) assertthat::assert_that(is.logical(overwrite)) - # TODO: in future version, remove argument if (!missing(filename)) { @@ -139,6 +139,7 @@ box_dl <- function(file_id, local_dir = getwd(), overwrite = FALSE, box_ul <- function(dir_id = box_getwd(), file, pb = options()$boxr.progress, description = NULL) { checkAuth() + dir_id <- as_box_id(dir_id) # Validate filename file <- box_filename(file)