Hey @Zuki! This is a great question!!
I think this workflow should be usable for you:
- If you are an admin (or have an admin do this), create a tag / tag hierarchy for this content
- Every deployment to RStudio Connect requires a
manifest.json. You can build this pretty easily for each document (in a temporary directory) with:
tmpdir <- tempfile("directory")
dir.create(tmpdir, recursive = TRUE)
pdf_path <- fs::file_copy("myexample.pdf", tmpdir)
rsconnect::writeManifest(appDir = tmpdir, appFiles = "myexample.pdf", appPrimaryDoc = "myexample.pdf")
- Then you can deploy this programmatically using
connectapi. This uses the RStudio Connect Server API, which is documented here: https://docs.rstudio.com/connect/api . There is a way to do this with
rsconnect too, I believe, but I am less familiar with it:
client <- connect()
bnd <- bundle_dir(tmpdir)
myapp <- deploy(client, bnd, name = "uniquename", title = "My Title")
- Lastly, to enable other users to do this type of thing, you could build a simple Shiny app that does this type of deployment for you. You would just inject the API key necessary to do the deployment into the Shiny application's "Environment Variables"
The one piece I have left off here is programmatically setting the tag. There is not a great way to do this today, unfortunately. There is an experimental
myapp$tag_set() function that uses the tag ID, but that is not super usable. I will have to do some thinking on that front and whether there is a better approach to doing so programmatically
I hope that is helpful as a start though! I'm curious what your thoughts are on whether this will be workable in your context or not.