R/run_look.R

#' Pull a look from a look id.
#'
#' @param look_id integer.
#' @param format character. The format to use. Defaults to json.
#' @param limit numeric. The \code{limit} parameter of the query.
#' @return a data.frame containing the data returned by the query
#' @export
run_look <- function(look_id, format = "json", limit = 1000) {
  looker_setup <- setup_using_env_vars()

  if (cached_token_is_invalid()) {
    login_response <- login_api_call(looker_setup$LOOKER_URL, looker_setup$LOOKER_ID, looker_setup$LOOKER_SECRET)
    put_new_token_in_cache(login_response)
  }

  httr::content(pull_look_api_call(looker_setup$LOOKER_URL, look_id, format, limit))
}
avantcredit/looker3 documentation built on May 11, 2019, 4:06 p.m.