github_api:

Usage Arguments Examples

View source: R/webAPI.R

Usage

1
github_api(path)

Arguments

path

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (path) 
{
    url <- modify_url("https://api.github.com", path = path)
    resp <- GET(url)
    if (http_type(resp) != "application/json") {
        stop("API did not return json", call. = FALSE)
    }
    parsed <- jsonlite::fromJSON(content(resp, "text"), simplifyVector = FALSE)
    if (http_error(resp)) {
        stop(sprintf("GitHub API request failed [%s]\n%s\n<%s>", 
            status_code(resp), parsed$message, parsed$documentation_url), 
            call. = FALSE)
    }
    structure(list(content = parsed, path = path, response = resp), 
        class = "github_api")
  }

Xiaolin-Jiang/lab5webAPI documentation built on Dec. 18, 2021, 7:22 p.m.