gl_connection: Connect to a specific gitlab instance API
Description
Creates a function that can be used to issue requests to the specified
gitlab API instance with the specified user private token and (for gl_project_connection)
only to a specified project.
URL to the gitlab instance (e.g. https://gitlab.myserver.com)
private_token
private_token with which to identify. You can generate one in the webinterface under
GITLABINSTANCEURL/profile/personal_access_tokens when logged on.
api_version
Either "v3" or "v4" for one of the two gitlab API version. See Details section on API versions.
api_location
location of the gitlab API under the gitlab_url, usually and by default "/api/$api_version/"
project
id or name of project to issue requests to
Value
A function to access a specific gitlab API as a specific user, see details
API versions
"v4" is the standard API since Gitlab version 9.0 and only this version is officially supported by
gitlabr since version 1.1.6. "v3" as a parameter value is not removed, since for many instances, gitlabr
code will still work if you try.
Details
The returned function should serve as the primary way to access the gitlab
API in the following. It can take vector/character arguments in the same way
as the function gitlab does, as well as the convenience functions
provided by this package or written by the user. If it is passed such that
function it calls it with the arguments provided in ... and the gitlab
URL, api location and private_token provided when creating it via gl_connection.
Note: currently gitlab API v4 is supported. Gitlab API v3 is no longer supported, but
you can give it a try.
# NOT RUN {my_gitlab <- gl_connection("http://gitlab.example.com", "123####89")
my_gitlab("projects")
my_gitlab(gl_get_file, "test-project", "README.md", ref = "dev")
# }# NOT RUN {# }