R/print.R

Defines functions print.gh_response

Documented in print.gh_response

#' Print the result of a GitHub API call
#'
#' @param x The result object.
#' @param ... Ignored.
#' @return The JSON result.
#'
#' @importFrom jsonlite prettify toJSON
#' @export
#' @method print gh_response

print.gh_response <- function(x, ...) {
  if (inherits(x, c("raw", "path"))) {
    attributes(x) <- list(class = class(x))
    print.default(x)
  } else {
    print(toJSON(unclass(x), pretty = TRUE, auto_unbox = TRUE, force = TRUE))
  }
}

Try the gh package in your browser

Any scripts or data that you put into this service are public.

gh documentation built on March 7, 2023, 5:33 p.m.