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

Specify paths with shared_folder_id #189

Open
mkirzon opened this issue Oct 18, 2020 · 1 comment
Open

Specify paths with shared_folder_id #189

mkirzon opened this issue Oct 18, 2020 · 1 comment

Comments

@mkirzon
Copy link

mkirzon commented Oct 18, 2020

I'm trying to build an R script that will be run by various people but all collaborating on the same folder. So I set up a shared dropbox folder. However, we know that users can rename and move their pointers at the shared folder within their space (even though it preserves the linkage).

For this reason, when users execute my package, the relative path isn't guaranteed. I found that the shared_folder_id attribute is indeed consistent for all users. I'd like to be able to run drop_ commands using that id.

While I recognize that not all dropbox api commands may support that, it looks like the get_folder_metadata function does. Is there a way to query by the shared folder id? See their docs here

I'd like to be able to run something like:

drop_get_metadata("shared_folder_id:123123")
@mkirzon
Copy link
Author

mkirzon commented Nov 12, 2020

Here's a stab at using the appropriate dropbox api

#' Get shared folder info
#'
#' Returns folder metadata by its shared folder ID
#'
#' @inheritParams drop_download_folder
#' @param shared_folder_id Dropbox shared folder id
#'
#' @return possibly-nested list of all available metadata for specified shared_folder_id
#' @author Mark Kirzon, \email{[email protected]}

drop_get_folder_metadata <- function(shared_folder_id, dtoken = rdrop2::drop_auth())
{
  url <- "https://api.dropboxapi.com/2/sharing/get_folder_metadata"

  req <- httr::POST(
    url    = url,
    config = httr::config(token = dtoken),
    body   = list(shared_folder_id = shared_folder_id),
    encode = "json")
  httr::stop_for_status(req)
  httr::content(req)
}

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

1 participant