class GitLab
- GitLab
- Reference
- Object
Overview
A GitLab API client with some bells and whistles. It detects whether it's
running in CI using the CI
environment variable, and honours configuration
from the lab.*
git config sections.
Direct Known Subclasses
Defined in:
gitlab.crgitlab/cli.cr
gitlab/collection.cr
gitlab/context.cr
gitlab/lint.cr
gitlab/markdown.cr
gitlab/namespace.cr
gitlab/project.cr
gitlab/projects.cr
gitlab/resource.cr
gitlab/user.cr
gitlab/users.cr
gitlab/version.cr
Constant Summary
-
NoToken =
Error.new("no GITLAB_TOKEN, set one with `git config lab.token`")
-
The error raised if the token is unset and cannot be determined.
-
VERSION =
"0.0.1"
Class Method Summary
Instance Method Summary
-
#api : URI
The REST API (v4) endpoint URI.
-
#api=(api : URI)
The REST API (v4) endpoint URI.
-
#get(path : String, & : HTTP::Client::Response -> )
Gets the given resource (prepending the API path if needed) and yields the response to the block if it was successful.
-
#get(path : String)
Gets the given resource.
-
#get(uri : URI)
Returns the response to a GET request to the given URI.
-
#home : Path
The local directory under which to store working directories, in a hierarchy which mirrors groups, subgroups and projects.
-
#home=(home : Path)
The local directory under which to store working directories, in a hierarchy which mirrors groups, subgroups and projects.
- #markdown(text : String, gfm : Bool = true, project : UInt128 | String | Nil = nil)
- #namespace
- #post(path : String, data : NamedTuple)
- #project
- #project?
-
#token : String
The bearer token used to authorize API calls.
-
#token=(token : String)
The bearer token used to authorize API calls.
- #user(id) : User
- #user : Me
- #users
- #version
Class Method Detail
Instance Method Detail
The REST API (v4) endpoint URI. Defaults to checking the lab.api
git
config value, or falls back to https://gitlab.com/api/v4. In CI, it will
try the CI_API_V4_URL
The REST API (v4) endpoint URI. Defaults to checking the lab.api
git
config value, or falls back to https://gitlab.com/api/v4. In CI, it will
try the CI_API_V4_URL
Gets the given resource (prepending the API path if needed) and yields the response to the block if it was successful. Non successful responses are ignored.
The local directory under which to store working directories, in a hierarchy which mirrors groups, subgroups and projects. Defaults to
The local directory under which to store working directories, in a hierarchy which mirrors groups, subgroups and projects. Defaults to
The bearer token used to authorize API calls. It defaults to the first value found in
-
$GITLAB_TOKEN
-
- (only if
$CI
is truthy)$CI_DEPLOY_TOKEN
or$CI_JOB_TOKEN
- (only if
-
- the value of git-config(1)
lab.token
- the value of git-config(1)
-
- the output of executing the value of git-config(1)
lab.tokenCommand
- the output of executing the value of git-config(1)
The bearer token used to authorize API calls. It defaults to the first value found in
-
$GITLAB_TOKEN
-
- (only if
$CI
is truthy)$CI_DEPLOY_TOKEN
or$CI_JOB_TOKEN
- (only if
-
- the value of git-config(1)
lab.token
- the value of git-config(1)
-
- the output of executing the value of git-config(1)
lab.tokenCommand
- the output of executing the value of git-config(1)