connectapi icon indicating copy to clipboard operation
connectapi copied to clipboard

Implement client$runtimes to get all runtimes

Open gshotwell opened this issue 9 months ago • 0 comments

We currently have client$server_settings_r but I couldn't find a good way to get everything. Here's a possible implementation:

library(connectapi)
library(purrr)
client <- connect()

tidy_settings <- function(type = c("r", "python", "quarto")) {
  type = match.arg(type)
  settings = client$GET(paste0("v1/server_settings/", type))
  out = map_dfr(settings$installations, ~as.data.frame(.))
  out$runtime = type
  return(out[, c("runtime", "version")])
}

map_dfr(c("python", "r", "quarto"), tidy_settings)

gshotwell avatar May 17 '24 14:05 gshotwell