Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop_list_shared_links() doesn't accept cursor or path arguments #184

Open
scottyaz opened this issue Sep 1, 2020 · 3 comments
Open

drop_list_shared_links() doesn't accept cursor or path arguments #184

scottyaz opened this issue Sep 1, 2020 · 3 comments

Comments

@scottyaz
Copy link

scottyaz commented Sep 1, 2020

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
        }
    }
@karthik
Copy link
Owner

karthik commented Sep 1, 2020

Thanks @scottyaz
I'll review this and merge it.

@scottyaz
Copy link
Author

scottyaz commented Sep 1, 2020

The path option does seem a bit wonky but I think its the api not rdrop

@Alexandrarma
Copy link

Alexandrarma commented Sep 10, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants