Commit afecb7a1 authored by Roman Lacko's avatar Roman Lacko
Browse files

API: added version() method from GitLab API

parent 30dcdd85
......@@ -77,7 +77,14 @@ sub new {
croak "GitLab authentication failed: ", $response->message
unless $response->is_success;
$log->debug("setup complete, logged in as '$user->{username}' ($user->{name})");
my $version = $self->version(-immortal => 1);
my $vn = defined $version
? "$version->{version} ($version->{revision})"
: "unknown (probably before 8.13)";
$log->debug("setup complete, logged in as '$user->{username}' ($user->{name}), GitLab version is $vn");
return $self;
......@@ -340,6 +347,10 @@ BEGIN {
name => "whoami",
method => "GET",
path => "/user",
}, {
name => "version",
method => "GET",
path => "/version",
......@@ -358,7 +369,7 @@ __END__
=head1 NAME
GitLab::API - lightweight GitLab API client.
Also implements B<Session> API to obtain authentication token if needed.
Also implements B<Session> API to obtain authentication token.
Other modules are needed for additional methods.
See L<GitLab API|> for details.
......@@ -434,6 +445,10 @@ You can test for that with the L</whoami> method this way:
Returns the user whose authentication key is used for the request (or impersonated user if L</sudo> is in effect).
See L</"REQUEST METHODS"> below.
=item version()
Returns the current GitLab version and revision.
=item is_admin()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment