rdrop2
rdrop2 copied to clipboard
drop_list_shared_links() doesn't accept cursor or path arguments
drop_list_shared_links() doesn't accept cursor or path arguments. It seems like the dropbox API will only return a max of 200 files per call so cursors are needed to get through big lists. Here is a suggested revision to your function. It's the same on my fork but there are other small changes I made that you probably don't want to pull.
#' List all shared links
#'
#' This function returns a list of all links that are currently being shared
#' @template token
#' @param verbose Print verbose output
#' @param cursor Pass cursor value from previous call to list_shared_files
#' @param path directory to look into for shared files
#'
#' @export
#' @references \href{https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links}{API documentation}
#'
#' @examples \dontrun{
#' drop_list_shared_links()
#' }
drop_list_shared_links <-
function(cursor=NULL,path=NULL,verbose = TRUE, dtoken = get_dropbox_token()) {
shared_links_url <-
"https://api.dropboxapi.com/2/sharing/list_shared_links"
res <- httr::POST(shared_links_url,body=drop_compact(
list(
cursor= cursor, path=path
)), httr::config(token = dtoken), encode = "json")
httr::warn_for_status(res)
z <- httr::content(res)
if (verbose) {
invisible(z)
pretty_lists(z)
} else {
invisible(z)
# TODO
# Clean up the verbose and non-verbose options
}
}
Thanks @scottyaz I'll review this and merge it.
The path option does seem a bit wonky but I think its the api not rdrop
Hey @scottyaz , thank you for sharing your code! Please, by any chance do you have an updated version of your code? I am also trying to get the URLs of files already shared, and I have plenty more than 200. I tried to use your code and I am getting the error: Error: 'get_dropbox_token' is not an exported object from 'namespace:rdrop2'
Can you give any hint on what I can try?