Show and pull available fields of a GitHub response.

ghr_show_fields(gh_response)

ghr_pull(gh_response, field)

Arguments

gh_response

A list object of class "gh_response".

field

Character string giving the name of the the element to extract from the github-response list.

Value

A character string.

See also

ghr_get gh_branches

Examples

gh_response <- ghr_get("maurolepore/ghr/R") ghr_show_fields(gh_response)
#> [1] "name" "path" "sha" "size" "url" #> [6] "html_url" "git_url" "download_url" "type" "_links"
ghr_pull(gh_response, "name")
#> [1] "ghr-package.R" "ghr_get.R" "ghr_ls.R" #> [4] "ghr_show_fields.R"
# Working with non-default branches ghr_pull(ghr_get("maurolepore/ghr", ref = "gh-pages"), "path")
#> [1] "CHANGELOG.html" "CODE_OF_CONDUCT.html" "CONTRIBUTING.html" #> [4] "ISSUE_TEMPLATE.html" "LICENSE.html" "SUPPORT.html" #> [7] "articles" "authors.html" "docsearch.css" #> [10] "docsearch.js" "index.html" "link.svg" #> [13] "news" "pkgdown.css" "pkgdown.js" #> [16] "pkgdown.yml" "reference"
# Same ghr_pull(ghr_get("maurolepore/ghr@gh-pages"), "path")
#> [1] "CHANGELOG.html" "CODE_OF_CONDUCT.html" "CONTRIBUTING.html" #> [4] "ISSUE_TEMPLATE.html" "LICENSE.html" "SUPPORT.html" #> [7] "articles" "authors.html" "docsearch.css" #> [10] "docsearch.js" "index.html" "link.svg" #> [13] "news" "pkgdown.css" "pkgdown.js" #> [16] "pkgdown.yml" "reference"
ghr_pull(ghr_get("maurolepore/ghr/reference@gh-pages"), "path")
#> [1] "reference/gh_branches.html" "reference/gh_get.html" #> [3] "reference/ghr-package.html" "reference/ghr_branches.html" #> [5] "reference/ghr_fields.html" "reference/ghr_get.html" #> [7] "reference/ghr_ls.html" "reference/ghr_show_branches.html" #> [9] "reference/ghr_show_fields.html" "reference/index.html"