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
Show whitespace changes
Inline
Side-by-side
GitLab/Groups.pm
View file @
2dc2d186
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
my
$requests
=
{
groups
=>
{
groups
=>
{
...
@@ -26,6 +26,21 @@ my $requests = {
...
@@ -26,6 +26,21 @@ my $requests = {
paginated
=>
1
,
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
=>
{
group_get_projects
=>
{
method
=>
"
GET
",
method
=>
"
GET
",
path
=>
"
/groups/<gid>/projects
",
path
=>
"
/groups/<gid>/projects
",
...
@@ -108,7 +123,7 @@ response formats.
...
@@ -108,7 +123,7 @@ response formats.
=head1 VERSION
=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
=head1 DESCRIPTION
...
@@ -130,6 +145,13 @@ Please refer to the official documentation for the full list.
...
@@ -130,6 +145,13 @@ Please refer to the official documentation for the full list.
Returns a list of groups.
Returns a list of groups.
An optional parameter C<search> can be used to filter the list by substring match on C<name>.
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>
=item L<group_details()|https://docs.gitlab.com/ce/api/groups.html#details-of-a-group>
$details = $gitlab->group_details( :gid );
$details = $gitlab->group_details( :gid );
...
...
GitLab/Members.pm
View file @
2dc2d186
...
@@ -8,26 +8,26 @@ use vars qw($VERSION);
...
@@ -8,26 +8,26 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
my
$requests
=
{
group
_members
=>
{
"
<ENTITY>
_members
"
=>
{
method
=>
"
GET
",
method
=>
"
GET
",
path
=>
"
/
group
s/<gid>/members
",
path
=>
"
/
<ENTITY>
s/<gid>/members
",
paginated
=>
1
,
paginated
=>
1
,
optional
=>
[
qw(
optional
=>
[
qw(
query
query
)
],
)
],
},
},
group
_get_member
=>
{
"
<ENTITY>
_get_member
"
=>
{
method
=>
"
GET
",
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
",
method
=>
"
POST
",
path
=>
"
/
group
s/<
g
id>/members
",
path
=>
"
/
<ENTITY>
s/<id>/members
",
required
=>
[
qw(
required
=>
[
qw(
user_id
user_id
access_level
access_level
...
@@ -37,9 +37,9 @@ my $requests = {
...
@@ -37,9 +37,9 @@ my $requests = {
)
],
)
],
},
},
group
_update_member
=>
{
"
<ENTITY>
_update_member
"
=>
{
method
=>
"
PUT
",
method
=>
"
PUT
",
path
=>
"
/
group
s/<
g
id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<id>/members/<user_id>
",
required
=>
[
qw(
required
=>
[
qw(
access_level
access_level
)
],
)
],
...
@@ -48,40 +48,9 @@ my $requests = {
...
@@ -48,40 +48,9 @@ my $requests = {
)
],
)
],
},
},
group_delete_member
=>
{
"
<ENTITY>_update_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
=>
{
method
=>
"
PUT
",
method
=>
"
PUT
",
path
=>
"
/
project
s/<id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<id>/members/<user_id>
",
required
=>
[
qw(
required
=>
[
qw(
access_level
access_level
)
],
)
],
...
@@ -90,17 +59,34 @@ my $requests = {
...
@@ -90,17 +59,34 @@ my $requests = {
)
],
)
],
},
},
project
_delete_member
=>
{
"
<ENTITY>
_delete_member
"
=>
{
method
=>
"
DELETE
",
method
=>
"
DELETE
",
path
=>
"
/
project
s/<id>/members/<user_id>
",
path
=>
"
/
<ENTITY>
s/<
g
id>/members/<user_id>
",
},
},
};
};
sub
import
{
sub
import
{
$log
->
debug
("
initializing
"
.
__PACKAGE__
);
$log
->
debug
("
initializing
"
.
__PACKAGE__
);
my
$emap
=
{
group
=>
"
gid
",
project
=>
"
id
",
};
while
(
my
(
$name
,
$tmpl
)
=
each
(
%$requests
))
{
while
(
my
(
$name
,
$tmpl
)
=
each
(
%$requests
))
{
$tmpl
->
{
name
}
=
$name
unless
exists
$tmpl
->
{
name
};
foreach
my
$entity
(
keys
%$emap
)
{
GitLab::
API
->
register
(
$tmpl
);
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.
...
@@ -117,7 +103,7 @@ response formats.
=head1 VERSION
=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
=head1 DESCRIPTION
...
@@ -128,21 +114,27 @@ Please see the documentation for the L<GitLab::Users> module.
...
@@ -128,21 +114,27 @@ Please see the documentation for the L<GitLab::Users> module.
Note that not all optional arguments are listed.
Note that not all optional arguments are listed.
Please refer to the official documentation for the full list.
Please refer to the official documentation for the full list.
=head2 Group Members
=head2 Group
and Project
Members
=over
=over
=item L<group_members()|https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project>
=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->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<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->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 >>:
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)) {
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
...
@@ -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<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->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>.
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.
See L<GitLab::API> module for possible access level values.
The optional argument C<expires_at> expects format C<YYYY-MM-DD>.
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>
=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>
=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>.
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>.
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<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->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
=back
...
...
GitLab/Namespaces.pm
View file @
2dc2d186
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
my
$requests
=
{
namespaces
=>
{
namespaces
=>
{
...
@@ -18,7 +18,12 @@ my $requests = {
...
@@ -18,7 +18,12 @@ my $requests = {
search
search
)
],
)
],
paginated
=>
1
,
paginated
=>
1
,
}
},
namespace_by_id
=>
{
method
=>
"
GET
",
path
=>
"
/namespaces/<id>
",
},
};
};
sub
import
{
sub
import
{
...
@@ -50,10 +55,11 @@ See L<GitLab API -- Namespaces|http://doc.gitlab.com/ce/api/namespaces.html> for
...
@@ -50,10 +55,11 @@ See L<GitLab API -- Namespaces|http://doc.gitlab.com/ce/api/namespaces.html> for
$api->sudo("john.doe");
$api->sudo("john.doe");
my $namespaces = $api->namespaces(search => "group1");
my $namespaces = $api->namespaces(search => "group1");
my $namespace = $api->namespace_by_id(id => 10);
=head1 VERSION
=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
=head1 DESCRIPTION
...
@@ -61,7 +67,7 @@ From GitLab API: I<"Usernames and groupnames fall under a special category calle
...
@@ -61,7 +67,7 @@ From GitLab API: I<"Usernames and groupnames fall under a special category calle
=over
=over
=item namespaces()
=item
L<
namespaces()
|https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces>
$namespaces = $gitlab->namespaces();
$namespaces = $gitlab->namespaces();
$namespaces = $gitlab->namespaces(search => $what);
$namespaces = $gitlab->namespaces(search => $what);
...
@@ -77,6 +83,12 @@ To get namespaces of user with login C<$login>, you can do this:
...
@@ -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>.
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.
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
=back
=head1 AUTHOR
=head1 AUTHOR
...
...
GitLab/Projects.pm
View file @
2dc2d186
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
...
@@ -8,7 +8,7 @@ use vars qw($VERSION);
use
GitLab::
API
;
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v
8
.17.2
;
our
$VERSION
=
v
10
.3.3
;
my
$requests
=
{
my
$requests
=
{
projects
=>
{
projects
=>
{
...
@@ -22,7 +22,11 @@ my $requests = {
...
@@ -22,7 +22,11 @@ my $requests = {
search
search
simple
simple
owned
owned
membership
starred
starred
statistics
with_issues_enabled
with_merge_requests_enabled
)
],
)
],
paginated
=>
1
,
paginated
=>
1
,
},
},
...
@@ -32,30 +36,10 @@ my $requests = {
...
@@ -32,30 +36,10 @@ my $requests = {
path
=>
"
/projects/<id>
",
path
=>
"
/projects/<id>
",
encode
=>
[
qw(
encode
=>
[
qw(
id
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
=>
{
project_create
=>
{
method
=>
"
POST
",
method
=>
"
POST
",
path
=>
"
/projects
",
path
=>
"
/projects
",
...
@@ -66,19 +50,23 @@ my $requests = {
...
@@ -66,19 +50,23 @@ my $requests = {
description
description
issues_enabled
issues_enabled
merge_requests_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
wiki_enabled
snippets_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
container_registry_enabled
shared_runners_enabled
shared_runners_enabled
visibility
visibility
public_builds
import_url
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
lfs_enabled
request_access_enabled
request_access_enabled
tag_list
avatar
printing_merge_request_link_enabled
ci_config_path
)
],
)
],
},
},
...
@@ -95,18 +83,23 @@ my $requests = {
...
@@ -95,18 +83,23 @@ my $requests = {
description
description
issues_enabled
issues_enabled
merge_requests_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
wiki_enabled
snippets_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
container_registry_enabled
shared_runners_enabled
shared_runners_enabled
visibility
visibility
import_url
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
lfs_enabled
request_access_enabled
request_access_enabled
tag_list
avatar
printing_merge_request_link_enabled
ci_config_path
)
],
)
],
},
},
...
@@ -119,21 +112,27 @@ my $requests = {
...
@@ -119,21 +112,27 @@ my $requests = {
optional
=>
[
qw(
optional
=>
[
qw(
path
path
default_branch
default_branch
namespace_id
description
description
issues_enabled
issues_enabled
merge_requests_enabled
merge_requests_enabled
build
s_enabled
job
s_enabled
wiki_enabled
wiki_enabled
snippets_enabled
snippets_enabled
resolve_outdated_diff_discussions
container_registry_enabled
container_registry_enabled
shared_runners_enabled
shared_runners_enabled
visibility
visibility
import_url
import_url
public_
build
s
public_
job
s
only_allow_merge_if_build_succeeds
only_allow_merge_if_build_succeeds
only_allow_merge_if_all_discussions_are_resolved
only_allow_merge_if_all_discussions_are_resolved
lfs_enabled
lfs_enabled
request_access_enabled
request_access_enabled