gh_url: Build the URL for the GitHub API

Description Usage Arguments Value Examples

View source: R/github-api.R

Description

This function is used to build the URL for the various endpoints in the GitHub API. Unnamed strings are used to build the path upon the API and named strings are added as queries.

Usage

1
gh_url(..., api = getOption("github.api"))

Arguments

...

(strings, optional) unnamed strings are built up into a URL path and named parameters are added as queries.

api

(string, optional) The URL of GitHub's API. Default: the value stored in the environment variable GITHUB_API_URL or https://api.github.com.

Value

Valid URL (string)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

  # URL for all repositories
  gh_url("repos")

  # URL for the main branch
  gh_url("repos", "ChadGoymer/githapi", "git/refs/heads", "main")

  # URL for a file tree with the recursive option
  gh_url(
    c("repos", "ChadGoymer/githapi", "git/trees", "234752384"),
    list(recursive = 1)
  )


## End(Not run)

ChadGoymer/githapi documentation built on Oct. 22, 2021, 10:56 a.m.