This is gitlabr's core function to talk to Gitlab's server API via HTTP(S). Usually you will not
use this function directly too often, but either use gitlabr's convenience wrappers or write your
own. See the gitlabr
vignette for more information on this.
gitlab(req, api_root, verb = httr::GET, auto_format = TRUE,
debug = FALSE, gitlab_con = "default", page = "all",
max_page = 100, enforce_api_root = TRUE, argname_verb = if
(identical(verb, httr::GET) | identical(verb, httr::DELETE)) {
"query" } else { "body" }, ...)
vector of characters that represents the call (e.g. c("projects", project_id, "events")
)
URL where the gitlab API to request resides (e.g. https://gitlab.myserver.com/api/v3/
)
whether to format the returned object automatically to a flat data.frame
if TRUE API URL and query will be printed, defaults to FALSE
function to use for issuing API requests (e.g. as returned by
gitlab_connection
number of page of API response to get; if "all" (default), all pages (up to max_page parameter!) are queried successively and combined.
maximum number of pages to retrieve. Defaults to 100. This is an upper limit to prevent gitlabr getting stuck in retrieving an unexpectedly high number of entries (e.g. of a project list). It can be set to NA/Inf to retrieve all available pages without limit, but this is recommended only under controlled circumstances.
if multiple pages are requested, the API root URL is ensured to be the same as in the original call for all calls using the "next page" URL returned by gitlab. This makes sense for security and in cases where gitlab is behind a reverse proxy and ignorant about its URL from external.
name of the argument of the verb that fields and information are passed on to
named parameters to pass on to gitlab API (technically: modifies query parameters of request URL), may include private_token and all other parameters as documented for the Gitlab API
the response from the Gitlab API, usually as a `data_frame` and including all pages
Note: currently gitlab API v3 is supported. Support for Gitlab API v4 (for Gitlab version >= 9.0) will be added soon.
# NOT RUN {
gitlab(req = "projects",
api_root = "https://gitlab.example.com/api/v4/",
private_token = "123####89")
gitlab(req = c("projects", 21, "issues"),
state = "closed",
gitlab_con = my_gitlab)
# }
Run the code above in your browser using DataLab