gh_find: Find an entity by matching a property value

Description Usage Arguments Value Examples

View source: R/github-api.R

Description

This function pages through a collection of entities searching for a specified property value. It returns the first match found. For example, you can search for an issue by specifying the title.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
gh_find(
  url,
  property,
  value,
  max_pages = 100,
  page_size = 100,
  headers = NULL,
  accept = "application/vnd.github.v3+json",
  token = getOption("github.token"),
  proxy = getOption("github.proxy"),
  ...
)

Arguments

url

(string) The address of the API endpoint.

property

(string) The property to search.

value

(scalar) The property value to search for.

max_pages

(integer, optional) The maximum number of pages to search through. Default: 100.

page_size

(integer, optional) The size of each page. Default: 100.

headers

(character, optional) Headers to add to the request. Default: NULL.

accept

(string, optional) The mime format to accept when making the call. Default: "application/vnd.github.v3+json".

token

(string or Token, optional) An authorisation token to include with the request. If NULL the OAuth process is triggered. Default: NULL.

proxy

(character, optional) The proxy server to use to connect to the github API. If NULL then no proxy is used. Can be set in the option github.proxy or the environment variable GITHUB_PROXY. Default: NULL.

...

Parameters passed to gh_request().

Value

A github list object consisting of the response, parsed into a list, with the attributes:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

  # Find an issue by title
  gh_find(
    url      = "https://api.github.com/repos/ChadGoymer/githapi/issues",
    property = "title",
    value    = "Test issue"
  )


## End(Not run)

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