Skip to content

Commit

Permalink
add to exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlyttle committed Jan 7, 2024
1 parent 5102143 commit 7c37398
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions R/boxr_add_description.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#'
#' @export
box_add_description <- function(file_id, description) {

file_id <- as_box_id(file_id)

Check warning on line 16 in R/boxr_add_description.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_add_description.R#L16

Added line #L16 was not covered by tests
file_id <- handle_file_id(file_id)

req <- httr::RETRY(
Expand Down
15 changes: 14 additions & 1 deletion R/boxr_collab.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 72 in R/boxr_collab.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_collab.R#L69-L72

Added lines #L69 - L72 were not covered by tests

# if login is provided, ignore user_id
if (!is_void(login)) {
user_id <- NULL
Expand Down Expand Up @@ -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)

Check warning on line 186 in R/boxr_collab.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_collab.R#L185-L186

Added lines #L185 - L186 were not covered by tests

# if login is provided, ignore user_id
if (!is_void(login)) {
user_id <- NULL
Expand Down Expand Up @@ -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)

Check warning on line 231 in R/boxr_collab.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_collab.R#L230-L231

Added lines #L230 - L231 were not covered by tests

# detect item type for API call
item_id <- dir_id %|0|% file_id

Expand Down Expand Up @@ -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)

Check warning on line 289 in R/boxr_collab.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_collab.R#L289

Added line #L289 was not covered by tests

url <- glue::glue("https://api.box.com/2.0/collaborations/{collab_id}")

resp <- httr::RETRY(
Expand Down
3 changes: 3 additions & 0 deletions R/boxr_comment.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 44 in R/boxr_comment.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_comment.R#L44

Added line #L44 was not covered by tests

item <- comment_item_helper(file_id, comment_id)

Expand Down Expand Up @@ -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)

Check warning on line 80 in R/boxr_comment.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_comment.R#L80

Added line #L80 was not covered by tests

resp <- httr::RETRY(
"GET",
glue::glue("https://api.box.com/2.0/files/{file_id}/comments"),
Expand Down
3 changes: 3 additions & 0 deletions R/boxr_dir_verbs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 68 in R/boxr_dir_verbs.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_dir_verbs.R#L68

Added line #L68 was not covered by tests

t1 <- Sys.time()

Expand Down Expand Up @@ -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)

Check warning on line 169 in R/boxr_dir_verbs.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_dir_verbs.R#L169

Added line #L169 was not covered by tests

t1 <- Sys.time()

Expand Down
8 changes: 7 additions & 1 deletion R/boxr_file_versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#' @export
#'
box_version_history <- function(file_id) {


file_id <- as_box_id(file_id)

Check warning on line 37 in R/boxr_file_versions.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_file_versions.R#L37

Added line #L37 was not covered by tests

content <- box_version_api(file_id)

if (is_void(content)) {
Expand Down Expand Up @@ -61,6 +63,8 @@ box_version_history <- function(file_id) {
#'
box_previous_versions <- function(file_id) {

file_id <- as_box_id(file_id)

Check warning on line 66 in R/boxr_file_versions.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_file_versions.R#L66

Added line #L66 was not covered by tests

lifecycle::deprecate_soft(
"3.6.0",
what = "boxr::box_previous_versions()",
Expand All @@ -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)

Check warning on line 79 in R/boxr_file_versions.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_file_versions.R#L79

Added line #L79 was not covered by tests

entries <- box_version_api(file_id)

# The box API isn't very helpful if there are no previous versions. If this
Expand Down
3 changes: 2 additions & 1 deletion R/boxr_upload_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 62 in R/boxr_upload_download.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_upload_download.R#L62

Added line #L62 was not covered by tests
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)) {

Expand Down Expand Up @@ -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)

Check warning on line 142 in R/boxr_upload_download.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_upload_download.R#L142

Added line #L142 was not covered by tests

# Validate filename
file <- box_filename(file)
Expand Down

0 comments on commit 7c37398

Please sign in to comment.