Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Roman Lacko
gitlab_api
Commits
2dc2d186
Commit
2dc2d186
authored
Jan 08, 2018
by
Roman Lacko
Browse files
update existing modules to v10.3.3
parent
66a35075
Changes
5
Hide whitespace changes
Inline
Side-by-side
GitLab/Groups.pm
View file @
2dc2d186
...
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
groups
=>
{
...
...
@@ -26,6 +26,21 @@ my $requests = {
paginated
=>
1
,
},
subgroups
=>
{
method
=>
"
GET
",
path
=>
"
/groups/<gid>/subgroups
",
query
=>
[
qw(
skip_groups
all_available
search
order_by
sort
statistics
owned
)
],
paginated
=>
1
,
},
group_get_projects
=>
{
method
=>
"
GET
",
path
=>
"
/groups/<gid>/projects
",
...
...
@@ -108,7 +123,7 @@ response formats.
=head1 VERSION
Implements API calls for GitLab CE C<v
8.17.2
>.
Implements API calls for GitLab CE C<v
10.3.3
>.
=head1 DESCRIPTION
...
...
@@ -130,6 +145,13 @@ Please refer to the official documentation for the full list.
Returns a list of groups.
An optional parameter C<search> can be used to filter the list by substring match on C<name>.
=item L<subgroups()|https://docs.gitlab.com/ce/api/groups.html#list-a-groups-39-s-subgroups>
$subgroups = $gitlab->subgroups( :gid );
Returns subgroups of the given group.
Accepts same filtering parameters as L</groups()>.
=item L<group_details()|https://docs.gitlab.com/ce/api/groups.html#details-of-a-group>
$details = $gitlab->group_details( :gid );
...
...
GitLab/Members.pm
View file @
2dc2d186
...
...
@@ -8,26 +8,26 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
group
_members
=>
{
"
<ENTITY>
_members
"
=>
{
method
=>
"
GET
",
path
=>
"
/
group
s/<gid>/members
",
path
=>
"
/
<ENTITY>
s/<gid>/members
",
paginated
=>
1
,
optional
=>
[
qw(
query
)
],
},
group
_get_member
=>
{
"
<ENTITY>
_get_member
"
=>
{
method
=>
"
GET
",
path
=>
"
/
group
s/<
g
id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<id>/members/<user_id>
",
},
group
_add_member
=>
{
"
<ENTITY>
_add_member
"
=>
{
method
=>
"
POST
",
path
=>
"
/
group
s/<
g
id>/members
",
path
=>
"
/
<ENTITY>
s/<id>/members
",
required
=>
[
qw(
user_id
access_level
...
...
@@ -37,9 +37,9 @@ my $requests = {
)
],
},
group
_update_member
=>
{
"
<ENTITY>
_update_member
"
=>
{
method
=>
"
PUT
",
path
=>
"
/
group
s/<
g
id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<id>/members/<user_id>
",
required
=>
[
qw(
access_level
)
],
...
...
@@ -48,40 +48,9 @@ my $requests = {
)
],
},
group_delete_member
=>
{
method
=>
"
DELETE
",
path
=>
"
/groups/<gid>/members/<user_id>
",
},
project_members
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<id>/members
",
paginated
=>
1
,
optional
=>
[
qw(
query
)
],
},
project_get_member
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<id>/members/<user_id>
",
},
project_add_member
=>
{
method
=>
"
POST
",
path
=>
"
/projects/<id>/members
",
required
=>
[
qw(
user_id
access_level
)
],
optional
=>
[
qw(
expires_at
)
],
},
project_update_member
=>
{
"
<ENTITY>_update_member
"
=>
{
method
=>
"
PUT
",
path
=>
"
/
project
s/<id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<id>/members/<user_id>
",
required
=>
[
qw(
access_level
)
],
...
...
@@ -90,17 +59,34 @@ my $requests = {
)
],
},
project
_delete_member
=>
{
"
<ENTITY>
_delete_member
"
=>
{
method
=>
"
DELETE
",
path
=>
"
/
project
s/<id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<
g
id>/members/<user_id>
",
},
};
sub
import
{
$log
->
debug
("
initializing
"
.
__PACKAGE__
);
my
$emap
=
{
group
=>
"
gid
",
project
=>
"
id
",
};
while
(
my
(
$name
,
$tmpl
)
=
each
(
%$requests
))
{
$tmpl
->
{
name
}
=
$name
unless
exists
$tmpl
->
{
name
};
GitLab::
API
->
register
(
$tmpl
);
foreach
my
$entity
(
keys
%$emap
)
{
my
$copy
=
{
%$tmpl
};
$copy
->
{
name
}
=
$name
unless
exists
$copy
->
{
name
};
foreach
my
$v
(
values
%$copy
)
{
$v
=~
s/<ENTITY>/$entity/g
;
$v
=~
s/<id>/<$emap->{$entity}>/g
;
}
GitLab::
API
->
register
(
$copy
);
}
}
}
...
...
@@ -117,7 +103,7 @@ response formats.
=head1 VERSION
Implements API calls for GitLab CE C<v
8.17.2
>.
Implements API calls for GitLab CE C<v
10.3.3
>.
=head1 DESCRIPTION
...
...
@@ -128,21 +114,27 @@ Please see the documentation for the L<GitLab::Users> module.
Note that not all optional arguments are listed.
Please refer to the official documentation for the full list.
=head2 Group Members
=head2 Group
and Project
Members
=over
=item L<group_members()|https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project>
=item L<project_members()|https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project>
$members = $gitlab->group_members( :gid );
$members = $gitlab->project_members( :id );
Returns a list of members
in
the
group with the specified C<g
id>.
Returns a list of members
of
the
namespace specified by C<gid> or C<
id>.
=item L<group_get_member()|https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project>
=item L<project_get_member()|https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project>
$gitlab->group_get_member( :gid, :user_id )
$gitlab->project_get_member( :id, :user_id )
Returns the information about a member of the group.
Returns the information about a member of the group
or project
.
Can also be used to check whether the given user is a member of the group if used with C<< -immortal => 1 >>:
if (defined $gitlab->group_get_member(gid => $gid, $user_id => $user_id, -immortal => 1)) {
...
...
@@ -153,68 +145,35 @@ Can also be used to check whether the given user is a member of the group if use
=item L<group_add_member()|https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project>
=item L<project_add_member()|https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project>
$gitlab->group_add_member( :gid, :user_id, :access_level, [:expires_at] );
$gitlab->project_add_member( :id, :user_id, :access_level, [:expires_at] );
Adds a user with C<user_id> to the group with the given C<gid> with the specified C<access_level>.
Similarly for the project API.
See L<GitLab::API> module for possible access level values.
The optional argument C<expires_at> expects format C<YYYY-MM-DD>.
=item L<group_update_member()|https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project>
$gitlab->group_update_member( :gid, :user_id, :access_level, [:expires_at] );
For user with the given C<user_id> the function changes his C<access_level> in the group with the specified C<gid>.
It can also remove the C<expires_at> property if set to C<undef>.
=item L<group_delete_member()|https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project>
$gitlab->group_delete_member( :gid, :user_id );
Removes the user with C<user_id> from the group with the specified C<gid>.
=head2 Project Members
=over
=item L<project_members()|https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project>
$members = $gitlab->project_members( :gid );
Returns a list of members in the project with the specified C<id>.
=item L<project_get_member()|https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project>
$gitlab->project_get_member( :gid, :user_id )
Returns the information about a member of the project.
Can also be used to check whether the given user is a member of the project if used with C<< -immortal => 1 >>:
if (defined $gitlab->project_get_member(id => $id, $user_id => $user_id, -immortal => 1)) {
# is a member
} else {
# not a member
}
=item L<project_add_member()|https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project>
$gitlab->project_add_member( :gid, :user_id, :access_level, [:expires_at] );
Adds a user with C<user_id> to the project with the given C<id> with the specified C<access_level>.
See L<GitLab::API> module for possible access level values.
The optional argument C<expires_at> expects format C<YYYY-MM-DD>.
=item L<project_update_member()|https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project>
$gitlab->project_update_member( :gid, :user_id, :access_level, [:expires_at] );
$gitlab->group_update_member( :gid, :user_id, :access_level, [:expires_at] );
$gitlab->project_update_member( :id, :user_id, :access_level, [:expires_at] );
For user with the given C<user_id> the function changes his C<access_level> in the group with the specified C<gid>.
It can also remove the C<expires_at> property if set to C<undef>.
=item L<group_delete_member()|https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project>
=item L<project_delete_member()|https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project>
$gitlab->group_delete_member( :gid, :user_id );
$gitlab->project_delete_member( :id, :user_id );
Removes the user with C<user_id> from the group with the specified C<gid>.
Removes the user with C<user_id> from the group with the specified C<gid>
or a project specidied by the C<id>.
=back
...
...
GitLab/Namespaces.pm
View file @
2dc2d186
...
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
namespaces
=>
{
...
...
@@ -18,7 +18,12 @@ my $requests = {
search
)
],
paginated
=>
1
,
}
},
namespace_by_id
=>
{
method
=>
"
GET
",
path
=>
"
/namespaces/<id>
",
},
};
sub
import
{
...
...
@@ -50,10 +55,11 @@ See L<GitLab API -- Namespaces|http://doc.gitlab.com/ce/api/namespaces.html> for
$api->sudo("john.doe");
my $namespaces = $api->namespaces(search => "group1");
my $namespace = $api->namespace_by_id(id => 10);
=head1 VERSION
Implements API calls for GitLab CE C<v
8.17.2
>.
Implements API calls for GitLab CE C<v
10.3.3
>.
=head1 DESCRIPTION
...
...
@@ -61,7 +67,7 @@ From GitLab API: I<"Usernames and groupnames fall under a special category calle
=over
=item namespaces()
=item
L<
namespaces()
|https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces>
$namespaces = $gitlab->namespaces();
$namespaces = $gitlab->namespaces(search => $what);
...
...
@@ -77,6 +83,12 @@ To get namespaces of user with login C<$login>, you can do this:
Note that the authenticated user must be an administrator to use L<GitLab::API/sudo>.
If the user with login C<$login> is an administrator, the call will return B<all> namespaces.
=item L<namespace_by_id()|https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id>
$namespace = $gitlab->namespace_by_id( :id )
Returns a given namespace by its C<id>.
=back
=head1 AUTHOR
...
...
GitLab/Projects.pm
View file @
2dc2d186
...
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
projects
=>
{
...
...
@@ -22,7 +22,11 @@ my $requests = {
search
simple
owned
membership
starred
statistics
with_issues_enabled
with_merge_requests_enabled
)
],
paginated
=>
1
,
},
...
...
@@ -32,30 +36,10 @@ my $requests = {
path
=>
"
/projects/<id>
",
encode
=>
[
qw(
id
statistics
)
],
},
project_users
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<id>/users
",
optional
=>
[
qw(
search
)
],
encode
=>
[
qw(
id
)
],
paginated
=>
1
,
},
project_events
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<id>/events
",
encode
=>
[
qw(
id
)
],
paginated
=>
1
,
},
project_create
=>
{
method
=>
"
POST
",
path
=>
"
/projects
",
...
...
@@ -66,19 +50,23 @@ my $requests = {
description
issues_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
shared_runners_enabled
visibility
public_builds
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
request_access_enabled
tag_list
avatar
printing_merge_request_link_enabled
ci_config_path
)
],
},
...
...
@@ -95,18 +83,23 @@ my $requests = {
description
issues_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
shared_runners_enabled
visibility
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
request_access_enabled
tag_list
avatar
printing_merge_request_link_enabled
ci_config_path
)
],
},
...
...
@@ -119,21 +112,27 @@ my $requests = {
optional
=>
[
qw(
path
default_branch
namespace_id
description
issues_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
shared_runners_enabled
visibility
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
request_access_enabled
tag_list
avatar
printing_merge_request_link_enabled
ci_config_path
)
],
},
...
...
@@ -250,7 +249,7 @@ my $requests = {
merge_requests_events
tag_push_events
note_events
build
_events
job
_events
pipeline_events
wiki_page_events
enable_ssl_verification
...
...
@@ -270,7 +269,7 @@ my $requests = {
merge_requests_events
tag_push_events
note_events
build
_events
job
_events
pipeline_events
wiki_page_events
enable_ssl_verification
...
...
@@ -333,7 +332,7 @@ response formats.
=head1 VERSION
Implements API calls for GitLab CE C<v
8.17.2
>.
Implements API calls for GitLab CE C<v
10.3.3
>.
=head1 DESCRIPTION
...
...
@@ -362,15 +361,14 @@ Returns the project with the given ID, which can be either a number or a string
=item L<project_users()|https://docs.gitlab.com/ce/api/projects.html#get-project-users>
$gitlab->project_users( [:search] );
B<This method has been removed from API>.
Returns the user list of a project
.
Use L<GitLab::Members::project_members()|GitLab::Members/project_members()> instead
.
=item L<project_events()|https://docs.gitlab.com/ce/api/projects.html#get-project-events>
$gitlab->project_events( :id );
Returns the list of events for the given project.
This method has been moved to
L<GitLab::Events::project_evens()|GitLab::Events/project_events()>.
=back
...
...
GitLab/Users.pm
View file @
2dc2d186
...
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
8.17.2
;
our
$VERSION
=
v10
.3.3
;
my
$requests
=
{
users
=>
{
...
...
@@ -19,6 +19,11 @@ my $requests = {
search
blocked
active
extern_uid
provider
created_before
created_after
custom_attributes
)
],
paginated
=>
1
,
},
...
...
@@ -51,8 +56,9 @@ my $requests = {
location
admin
can_create_group
confirm
skip_
confirm
ation
external
avatar
)
],
},
...
...
@@ -80,8 +86,9 @@ my $requests = {
location
admin
can_create_group
confirm
skip_
confirm
ation
external
avatar
)
],
},
...
...
@@ -90,38 +97,40 @@ my $requests = {
path
=>
"
/users/<uid>
",
},
user
=>
{
method
=>
"
GET
",
path
=>
"
/user
",
},
# SSH keys
self_ssh_keys
=>
{
method
=>
"
GET
",
path
=>
"
/user/keys
",
paginated
=>
1
,
},
se
lf_get
_ssh_key
=>
{
u
se
r
_ssh_key
s
=>
{
method
=>
"
GET
",
path
=>
"
/user/keys/<keyid>
",
path
=>
"
/users/<uid>/keys
",
paginated
=>
1
,
},
u
se
r
_get_ssh_key
s
=>
{
se
lf
_get_ssh_key
=>
{
method
=>
"
GET
",
path
=>
"
/users/<uid>/keys
",
paginated
=>
1
,
path
=>
"
/user/keys/<keyid>
",
},
self_add_ssh_key
=>
{
method
=>
"
POST
",
path
=>
"
/user/keys
",
required
=>
[
qw!title key!
],
required
=>
[
qw(
title
key
)
],
},
user_add_ssh_key
=>
{
method
=>
"
POST
",
path
=>
"
/users/<uid>/keys
",
required
=>
[
qw!title key!
],
required
=>
[
qw(
title
key
)
],
},
self_delete_ssh_key
=>
{
...
...
@@ -134,6 +143,56 @@ my $requests = {
path
=>
"
/users/<uid>/keys/<keyid>
",
},
# GPG keys
self_gpg_keys
=>
{
method
=>
"
GET
",
path
=>
"
/user/gpg_keys
",
paginated
=>
1
,
},
user_gpg_keys
=>
{
method
=>
"
GET
",
path
=>
"
/users/<uid>/gpg_keys
",
paginated
=>
1
,
},
self_get_gpg_key
=>
{
method
=>
"
GET
",
path
=>
"
/user/gpg_keys/<keyid>
",
},
user_get_gpg_key
=>
{
method
=>
"
GET
",
path
=>
"
/users/<uid>/gpg_keys/<keyid>
",
},
self_add_gpg_key
=>
{
method
=>
"
POST
",