Loading GitLab.pm +1 −0 Original line number Original line Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Log::Any qw($log); use Carp; use Carp; use GitLab::API; use GitLab::API; use GitLab::Groups; use GitLab::Groups; use GitLab::Members; use GitLab::Namespaces; use GitLab::Namespaces; use GitLab::Projects; use GitLab::Projects; use GitLab::Users; use GitLab::Users; Loading GitLab/Groups.pm +1 −51 Original line number Original line Diff line number Diff line Loading @@ -52,29 +52,6 @@ my $requests = { method => "DELETE", method => "DELETE", path => "/groups/<gid>", path => "/groups/<gid>", }, }, group_members => { method => "GET", path => "/groups/<gid>/members", paginated => 1, }, group_add_member => { method => "POST", path => "/groups/<gid>/members", required => [ qw!user_id access_level! ], }, group_update_member => { method => "PUT", path => "/groups/<gid>/members/<user_id>", required => [ qw!access_level! ], }, group_delete_member => { method => "DELETE", path => "/groups/<gid>/members/<user_id>", }, }; }; sub import { sub import { Loading Loading @@ -158,34 +135,7 @@ Deletes the group with the given C<gid>. =head2 Group members =head2 Group members =over This section was moved to a separate module L<GitLab::Members>. =item group_members() $members = $gitlab->group_members( :gid ); Returns a list of members in the grup with the specified C<gid>. =item group_add_member() $gitlab->group_add_member( :gid, :user_id, :access_level ); Adds a user with C<user_id> to the group with the given C<gid> with the specified C<access_level>. See L<GitLab::API> module for possible access level values. =item group_update_member() $gitlab->group_update_member( :gid, :user_id, :access_level ); For user with the given C<user_id> the function changes his C<access_level> in the group with the specified C<gid>. =item group_delete_member() $gitlab->group_delete_member( :gid, :user_id ); Removes the user with C<user_id> from the group with the specified C<gid>. =back =head2 Group projects and transfer =head2 Group projects and transfer Loading GitLab/Members.pm 0 → 100644 +210 −0 Original line number Original line Diff line number Diff line package GitLab::Members; use utf8; use strict; use warnings; use vars qw($VERSION); use GitLab::API; use Log::Any qw($log); our $VERSION = v8.12.1; my $requests = { group_members => { method => "GET", path => "/groups/<gid>/members", paginated => 1, }, group_get_member => { method => "GET", path => "/groups/<gid>/members/<user_id>", }, group_add_member => { method => "POST", path => "/groups/<gid>/members", required => [ qw!user_id access_level! ], optional => [ qw!expires_at! ], }, group_update_member => { method => "PUT", path => "/groups/<gid>/members/<user_id>", required => [ qw!access_level! ], optional => [ qw!expires_at! ], }, group_delete_member => { method => "DELETE", path => "/groups/<gid>/members/<user_id>", }, project_members => { method => "GET", path => "/projects/<id>/members", paginated => 1, }, 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", path => "/projects/<id>/members/<user_id>", required => [ qw!access_level! ], optional => [ qw!expires_at! ], }, project_delete_member => { method => "DELETE", path => "/projects/<id>/members/<user_id>", }, }; sub import { $log->debug("initializing " . __PACKAGE__); while (my ($name, $tmpl) = each(%$requests)) { $tmpl->{name} = $name unless exists $tmpl->{name}; GitLab::API->register($tmpl); } } 1; __END__ =head1 NAME GitLab::Members - implements group and project members API calls See L<GitLab API -- Group and Project Members|https://docs.gitlab.com/ce/api/members.html> for details and response formats. =head1 VERSION Implements API calls for GitLab CE C<v8.10.0>. Checked 2016-09-29 for GitLab CE C<v8.12.1>. =head1 DESCRIPTION =head2 Notation 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 =over =item group_members() $members = $gitlab->group_members( :gid ); Returns a list of members in the group with the specified C<gid>. =item group_get_member() $gitlab->group_get_member( :gid, :user_id ) Returns the information about a member of the group. 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)) { # is a member } else { # not a member } =item group_add_member() $gitlab->group_add_member( :gid, :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>. See L<GitLab::API> module for possible access level values. The optional argument C<expires_at> expects format C<YYYY-MM-DD>. =item group_update_member() $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 group_delete_member() $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 project_members() $members = $gitlab->project_members( :gid ); Returns a list of members in the project with the specified C<id>. =item project_get_member() $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 project_add_member() $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 project_update_member() $gitlab->project_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 group_delete_member() $gitlab->group_delete_member( :gid, :user_id ); Removes the user with C<user_id> from the group with the specified C<gid>. =back =head1 AUTHOR Roman Lacko <L<xlacko1@fi.muni.cz>> =head1 SEE ALSO =over =item L<GitLab> Wrapper around L<GitLab::API> and other C<GitLab::*> modules. =back GitLab/Projects.pm +1 −1 Original line number Original line Diff line number Diff line Loading @@ -360,7 +360,7 @@ B<NOT SUPPORTED YET> =head2 Project Members =head2 Project Members See L<GitLab::Members> package. See L<GitLab::Members> module. =head2 Hooks =head2 Hooks Loading Loading
GitLab.pm +1 −0 Original line number Original line Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Log::Any qw($log); use Carp; use Carp; use GitLab::API; use GitLab::API; use GitLab::Groups; use GitLab::Groups; use GitLab::Members; use GitLab::Namespaces; use GitLab::Namespaces; use GitLab::Projects; use GitLab::Projects; use GitLab::Users; use GitLab::Users; Loading
GitLab/Groups.pm +1 −51 Original line number Original line Diff line number Diff line Loading @@ -52,29 +52,6 @@ my $requests = { method => "DELETE", method => "DELETE", path => "/groups/<gid>", path => "/groups/<gid>", }, }, group_members => { method => "GET", path => "/groups/<gid>/members", paginated => 1, }, group_add_member => { method => "POST", path => "/groups/<gid>/members", required => [ qw!user_id access_level! ], }, group_update_member => { method => "PUT", path => "/groups/<gid>/members/<user_id>", required => [ qw!access_level! ], }, group_delete_member => { method => "DELETE", path => "/groups/<gid>/members/<user_id>", }, }; }; sub import { sub import { Loading Loading @@ -158,34 +135,7 @@ Deletes the group with the given C<gid>. =head2 Group members =head2 Group members =over This section was moved to a separate module L<GitLab::Members>. =item group_members() $members = $gitlab->group_members( :gid ); Returns a list of members in the grup with the specified C<gid>. =item group_add_member() $gitlab->group_add_member( :gid, :user_id, :access_level ); Adds a user with C<user_id> to the group with the given C<gid> with the specified C<access_level>. See L<GitLab::API> module for possible access level values. =item group_update_member() $gitlab->group_update_member( :gid, :user_id, :access_level ); For user with the given C<user_id> the function changes his C<access_level> in the group with the specified C<gid>. =item group_delete_member() $gitlab->group_delete_member( :gid, :user_id ); Removes the user with C<user_id> from the group with the specified C<gid>. =back =head2 Group projects and transfer =head2 Group projects and transfer Loading
GitLab/Members.pm 0 → 100644 +210 −0 Original line number Original line Diff line number Diff line package GitLab::Members; use utf8; use strict; use warnings; use vars qw($VERSION); use GitLab::API; use Log::Any qw($log); our $VERSION = v8.12.1; my $requests = { group_members => { method => "GET", path => "/groups/<gid>/members", paginated => 1, }, group_get_member => { method => "GET", path => "/groups/<gid>/members/<user_id>", }, group_add_member => { method => "POST", path => "/groups/<gid>/members", required => [ qw!user_id access_level! ], optional => [ qw!expires_at! ], }, group_update_member => { method => "PUT", path => "/groups/<gid>/members/<user_id>", required => [ qw!access_level! ], optional => [ qw!expires_at! ], }, group_delete_member => { method => "DELETE", path => "/groups/<gid>/members/<user_id>", }, project_members => { method => "GET", path => "/projects/<id>/members", paginated => 1, }, 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", path => "/projects/<id>/members/<user_id>", required => [ qw!access_level! ], optional => [ qw!expires_at! ], }, project_delete_member => { method => "DELETE", path => "/projects/<id>/members/<user_id>", }, }; sub import { $log->debug("initializing " . __PACKAGE__); while (my ($name, $tmpl) = each(%$requests)) { $tmpl->{name} = $name unless exists $tmpl->{name}; GitLab::API->register($tmpl); } } 1; __END__ =head1 NAME GitLab::Members - implements group and project members API calls See L<GitLab API -- Group and Project Members|https://docs.gitlab.com/ce/api/members.html> for details and response formats. =head1 VERSION Implements API calls for GitLab CE C<v8.10.0>. Checked 2016-09-29 for GitLab CE C<v8.12.1>. =head1 DESCRIPTION =head2 Notation 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 =over =item group_members() $members = $gitlab->group_members( :gid ); Returns a list of members in the group with the specified C<gid>. =item group_get_member() $gitlab->group_get_member( :gid, :user_id ) Returns the information about a member of the group. 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)) { # is a member } else { # not a member } =item group_add_member() $gitlab->group_add_member( :gid, :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>. See L<GitLab::API> module for possible access level values. The optional argument C<expires_at> expects format C<YYYY-MM-DD>. =item group_update_member() $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 group_delete_member() $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 project_members() $members = $gitlab->project_members( :gid ); Returns a list of members in the project with the specified C<id>. =item project_get_member() $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 project_add_member() $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 project_update_member() $gitlab->project_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 group_delete_member() $gitlab->group_delete_member( :gid, :user_id ); Removes the user with C<user_id> from the group with the specified C<gid>. =back =head1 AUTHOR Roman Lacko <L<xlacko1@fi.muni.cz>> =head1 SEE ALSO =over =item L<GitLab> Wrapper around L<GitLab::API> and other C<GitLab::*> modules. =back
GitLab/Projects.pm +1 −1 Original line number Original line Diff line number Diff line Loading @@ -360,7 +360,7 @@ B<NOT SUPPORTED YET> =head2 Project Members =head2 Project Members See L<GitLab::Members> package. See L<GitLab::Members> module. =head2 Hooks =head2 Hooks Loading