Commit 9aa0c68d authored by Roman Lacko's avatar Roman Lacko
Browse files

updated modules to comply with 8.17.2

parent 3434f6d4
Loading
Loading
Loading
Loading
+50 −18
Original line number Diff line number Diff line
@@ -8,20 +8,37 @@ use vars qw($VERSION);
use GitLab::API;
use Log::Any        qw($log);

our $VERSION = v8.12.1;
our $VERSION = v8.17.2;

my $requests = {
    groups  => {
        method      => "GET",
        path        => "/groups",
        query       => [ qw(search) ],
        query       => [qw(
            skip_groups
            all_available
            search
            order_by
            sort
            statistics
            owned
        )],
        paginated   => 1,
    },

    group_get_projects => {
        method      => "GET",
        path        => "/groups/<gid>/projects",
        optional    => [ qw(archived visibility order_by sort search ci_enabled_first) ],
        optional    => [qw(
            archived
            visibility
            order_by
            sort
            search
            simple
            owned
            starred
        )],
        paginated   => 1,
    },

@@ -33,8 +50,17 @@ my $requests = {
    group_create => {
        method      => "POST",
        path        => "/groups",
        required    => [ qw(name path) ],
        optional    => [ qw(description visibility_level lfs_enabled request_access_enabled) ],
        required    => [qw(
            name
            path
        )],
        optional    => [qw(
            description
            visibility
            lfs_enabled
            request_access_enabled
            parent_id
        )],
    },

    transfer_project_to_group => {
@@ -45,7 +71,14 @@ my $requests = {
    group_update => {
        method      => "PUT",
        path        => "/groups/<gid>",
        optional    => [ qw(name path description visibility_level lfs_enabled request_access_enabled) ],
        optional    => [qw(
            name
            path
            description
            visibility
            lfs_enabled
            request_access_enabled
        )],
    },

    group_delete    => {
@@ -75,8 +108,7 @@ 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>.
Implements API calls for GitLab CE C<v8.17.2>.

=head1 DESCRIPTION

@@ -91,22 +123,22 @@ Please refer to the official documentation for the full list.

=over

=item groups()
=item L<groups()|https://docs.gitlab.com/ce/api/groups.html#list-groups>

    $groups = $gitlab->groups( [:search] );
    $groups = $gitlab->groups( [:search] [:all_available] [:owned] );

Returns a list of groups.
An optional parameter C<search> can be used to filter the list by substring match on C<name>.

=item group_details()
=item L<group_details()|https://docs.gitlab.com/ce/api/groups.html#details-of-a-group>

    $details = $gitlab->group_details( :gid );

Returns details about a group with the given C<gid>.

=item group_create()
=item L<group_create()|https://docs.gitlab.com/ce/api/groups.html#new-group>

    $group = $gitlab->group_create( :name, :path, [:description], [:visibility_level] );
    $group = $gitlab->group_create( :name, :path, [:description], [:visibility] );

Creates a new group. Required arguments are

@@ -116,16 +148,16 @@ Creates a new group. Required arguments are
In addition, the following I<optional> arguments can be specified:

    description         group's description
    visibility_level    see GitLab::API for possible values
    visibility          see GitLab::API for possible values

=item group_update()
=item L<group_update()|https://docs.gitlab.com/ce/api/groups.html#update-group>

    $group = $gitlab->group_update( :gid );

Updates the grup with the given C<gid>.
Takes same arguments as C<group_create>, except they are all optional.

=item group_delete()
=item L<group_delete()|https://docs.gitlab.com/ce/api/groups.html#remove-group>

    $gitlab->group_delete( :gid );

@@ -141,13 +173,13 @@ This section was moved to a separate module L<GitLab::Members>.

=over

=item group_get_projects()
=item L<group_get_projects()|https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects>

    $projects = $gitlab->group_get_projects( :gid );

Returns a list of projects owned by the group with the given C<gid>.

=item transfer_project_to_group()
=item L<transfer_project_to_group()|https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group>

    $gitlab->transfer_project_to_group( :gid, :projid );

+44 −21
Original line number Diff line number Diff line
@@ -8,13 +8,16 @@ use vars qw($VERSION);
use GitLab::API;
use Log::Any        qw($log);

our $VERSION = v8.12.1;
our $VERSION = v8.17.2;

my $requests = {
    group_members   => {
        method      => "GET",
        path        => "/groups/<gid>/members",
        paginated   => 1,
        optional    => [qw(
            query
        )],
    },

    group_get_member => {
@@ -25,15 +28,24 @@ my $requests = {
    group_add_member => {
        method      => "POST",
        path        => "/groups/<gid>/members",
        required    => [ qw!user_id access_level! ],
        optional    => [ qw!expires_at! ],
        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! ],
        required    => [qw(
            access_level
        )],
        optional    => [qw(
            expires_at
        )],
    },

    group_delete_member => {
@@ -45,6 +57,9 @@ my $requests = {
        method      => "GET",
        path        => "/projects/<id>/members",
        paginated   => 1,
        optional    => [qw(
            query
        )],
    },

    project_get_member => {
@@ -55,15 +70,24 @@ my $requests = {
    project_add_member => {
        method      => "POST",
        path        => "/projects/<id>/members",
        required    => [ qw!user_id access_level! ],
        optional    => [ qw!expires_at! ],
        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! ],
        required    => [qw(
            access_level
        )],
        optional    => [qw(
            expires_at
        )],
    },

    project_delete_member => {
@@ -93,8 +117,7 @@ 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>.
Implements API calls for GitLab CE C<v8.17.2>.

=head1 DESCRIPTION

@@ -109,13 +132,13 @@ Please refer to the official documentation for the full list.

=over

=item group_members()
=item L<group_members()|https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project>

    $members = $gitlab->group_members( :gid );

Returns a list of members in the group with the specified C<gid>.

=item group_get_member()
=item L<group_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 )

@@ -128,7 +151,7 @@ Can also be used to check whether the given user is a member of the group if use
        # not a member
    }

=item group_add_member()
=item L<group_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] );

@@ -136,14 +159,14 @@ Adds a user with C<user_id> to the group with the given C<gid> with the specifie
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()
=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 group_delete_member()
=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 );

@@ -153,13 +176,13 @@ Removes the user with C<user_id> from the group with the specified C<gid>.

=over

=item project_members()
=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 project_get_member()
=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 )

@@ -172,7 +195,7 @@ Can also be used to check whether the given user is a member of the project if u
        # not a member
    }

=item project_add_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] );

@@ -180,14 +203,14 @@ Adds a user with C<user_id> to the project with the given C<id> with the specifi
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()
=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] );

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()
=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 );

+5 −4
Original line number Diff line number Diff line
@@ -8,13 +8,15 @@ use vars qw($VERSION);
use GitLab::API;
use Log::Any        qw($log);

our $VERSION = v8.12.1;
our $VERSION = v8.17.2;

my $requests = {
    namespaces => {
        method      => "GET",
        path        => "/namespaces",
        query       => [ qw(search) ],
        query       => [qw(
            search
        )],
        paginated   => 1,
    }
};
@@ -51,8 +53,7 @@ See L<GitLab API -- Namespaces|http://doc.gitlab.com/ce/api/namespaces.html> for

=head1 VERSION

Implements API calls for GitLab CE C<v8.10.0>.
Checked 2016-09-29 for GitLab CE C<v8.12.1>.
Implements API calls for GitLab CE C<v8.17.2>.

=head1 DESCRIPTION

+239 −122

File changed.

Preview size limit exceeded, changes collapsed.

+94 −32
Original line number Diff line number Diff line
@@ -8,13 +8,18 @@ use vars qw($VERSION);
use GitLab::API;
use Log::Any        qw($log);

our $VERSION = 8.12.1;
our $VERSION = 8.17.2;

my $requests = {
    users => {
        method      => "GET",
        path        => "/users",
        query       => [ qw(username search) ],
        query       => [qw(
            username
            search
            blocked
            active
        )],
        paginated   => 1,
    },

@@ -26,18 +31,58 @@ my $requests = {
    user_create     => {
        method      => "POST",
        path        => "/users",
        required    => [ qw(email password username name) ],
        optional    => [ qw(skype linkedin twitter website_url projects_limit
        extern_uid provider bio location admin confirm can_create_group external) ],
        required    => [qw(
            email
            username
            name
        )],
        optional    => [qw(
            password
            reset_password
            skype
            linkedin
            twitter
            website_url
            organization
            projects_limit
            extern_uid
            provider
            bio
            location
            admin
            can_create_group
            confirm
            external
        )],
    },

    user_update     => {
        method      => "PUT",
        path        => "/users/<uid>",
        # update can cause Conflict, but API always returns 404
        ret         => { 404 => "Not found or Conflict" },
        optional    => [ qw(email password name username skype linkedin twitter
        website_url projects_limit extern_uid provider bio location admin can_create_group external) ],
        ret         => {
            404 => "Not found or Conflict"
        },
        optional    => [qw(
            email
            username
            name
            password
            skype
            linkedin
            twitter
            website_url
            organization
            projects_limit
            extern_uid
            provider
            bio
            location
            admin
            can_create_group
            confirm
            external
        )],
    },

    user_delete     => {
@@ -143,6 +188,12 @@ my $requests = {
        method      => "PUT",
        path        => "/users/<uid>/unblock",
    },

    user_events     => {
        method      => "GET",
        path        => "/users/<uid>/events",
        paginated   => 1,
    },
};

sub import {
@@ -166,8 +217,7 @@ 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>.
Implements API calls for GitLab CE C<v8.17.2>.

=head1 SYNOPSIS

@@ -209,7 +259,7 @@ Please refer to the official documentation for the full list.

=over

=item users()
=item L<users()|https://docs.gitlab.com/ce/api/users.html#list-users>

    $users = $gitlab->users( [:username], [:search] );

@@ -222,13 +272,13 @@ to filter out the results:
Note that the returned value is still an array even when C<< users(username => $username) >>
always returns at most one result.

=item user_by_id()
=item L<user_by_id()|https://docs.gitlab.com/ce/api/users.html#single-user>

    $user = $gitlab->user_by_id( :uid );

Returns a user with the given C<uid>.

=item user_create()
=item L<user_create()|https://docs.gitlab.com/ce/api/users.html#user-creation>

    $user = $gitlab->user_create( :email, :password, :username, :name );

@@ -247,7 +297,7 @@ the full list. Most interesting arguments are:
    external            create an external account (bool)
    projects_limit      maximum number of projects the user can own

=item user_update()
=item L<user_update()|https://docs.gitlab.com/ce/api/users.html#user-modification>

    $user = $gitlab->user_update( :uid );

@@ -260,7 +310,7 @@ Also, from documentation:
    Note, at the moment this method does only return a 404 error, even in cases where
    a 409 (Conflict) would be more appropriate, e.g. when renaming the email address to some existing one.

=item user_delete()
=item L<user_delete()|https://docs.gitlab.com/ce/api/users.html#user-deletion>

    $gitlab->user_delete( :uid );

@@ -273,7 +323,7 @@ Note that

(from the GitLab API documentation).

=item user()
=item L<user()|https://docs.gitlab.com/ce/api/users.html#user>

    $user = $gitlab->user();

@@ -288,25 +338,25 @@ Behaves the same as the L<GitLab::API/whoami> method.

=over

=item self_ssh_keys()
=item L<self_ssh_keys()|https://docs.gitlab.com/ce/api/users.html#list-ssh-keys>

    $keys = $gitlab->self_ssh_keys();

Returns a list of SSH keys for the user that makes the request.

=item self_get_ssh_key()
=item L<self_get_ssh_key()|https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user>

    $key = $gitlab->self_get_ssh_key( :keyid );

For the user that makes the request, the function returns the SSH key with the given C<keyid>.

=item user_get_ssh_keys()
=item L<user_get_ssh_keys()|https://docs.gitlab.com/ce/api/users.html#single-ssh-key>

    $keys = $gitlab->user_get_ssh_keys( :uid );

Returns a list of SSH keys for the user with the given C<uid>.

=item self_add_ssh_key()
=item L<self_add_ssh_key()|https://docs.gitlab.com/ce/api/users.html#add-ssh-key>

    $key = $gitlab->self_add_ssh_key( :title, :key );

@@ -315,19 +365,19 @@ Adds a new key for the user that makes the request. Required arguments are
    title               the title of the key
    key                 public SSH key

=item user_add_ssh_key()
=item L<user_add_ssh_key()|https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user>

    $key = $gitlab->user_add_ssh_key( :uid, :title, :key );

Similar to C<self_add_ssh_key>, but targets the user with the given C<uid>.

=item self_delete_ssh_key()
=item L<self_delete_ssh_key()|https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-current-user>

    $gitlab->self_delete_ssh_key( :keyid )

Removes the SSH key with the given C<keyid> for the user that makes the request.

=item user_delete_ssh_key()
=item L<user_delete_ssh_key()|https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-given-user>

    $gitlab->user_delete_ssh_key( :uid, :keyid );

@@ -339,7 +389,7 @@ Removes the SSH key with the C<keyid> for the user with the given C<uid>.

=over

=item self_get_emails()
=item L<self_get_emails()|https://docs.gitlab.com/ce/api/users.html#list-emails>

    $emails = $gitlab->self_get_emails();

@@ -347,7 +397,7 @@ Returns a list of B<secondary> e-mails for the user that makes the request.

Note that primary e-mail can be obtained from the result of C<whoami>.

=item user_get_emails()
=item L<user_get_emails()|https://docs.gitlab.com/ce/api/users.html#list-emails-for-user>

    $emails = $gitlab->user_get_emails( :uid );

@@ -355,33 +405,33 @@ Returns a list of B<secondary> e-mails for the user with the C<uid>.

Note that primary e-mail can be obtained from the result of C<user_by_id>.

=item self_get_email()
=item L<self_get_email()|https://docs.gitlab.com/ce/api/users.html#single-email>

    $email = $gitlab->self_get_email( :eid );

Returns the e-mail with the given C<eid> of the user that makes the request.

=item self_add_email()
=item L<self_add_email()|https://docs.gitlab.com/ce/api/users.html#add-email>

    $email = $gitlab->self_add_email( :email );

Adds a new C<email> for the user that makes the request. The e-mail must
not exist in GitLab.

=item user_add_email()
=item L<user_add_email()|https://docs.gitlab.com/ce/api/users.html#add-email-for-user>

    $email = $gitlab->user_add_email( :uid, :email );

Adds a new C<email> for the user with the given C<uid>. The e-mail must
not exist in GitLab.

=item self_delete_email()
=item L<self_delete_email()|https://docs.gitlab.com/ce/api/users.html#delete-email-for-current-user>

    $gitlab->self_delete_email( :eid );

Deletes the e-mail with C<eid> of the user that makes the request.

=item user_delete_email()
=item L<user_delete_email()|https://docs.gitlab.com/ce/api/users.html#delete-email-for-given-user>

    $gitlab->user_delete_email( :uid, :eid );

@@ -393,13 +443,13 @@ Removes the e-mail with C<eid> of the user with the given C<uid>.

=over

=item user_block()
=item L<user_block()|https://docs.gitlab.com/ce/api/users.html#block-user>

    $gitlab->user_block( :uid );

Blocks the user with C<uid> in the GitLab.

=item user_unblock()
=item L<user_unblock()|https://docs.gitlab.com/ce/api/users.html#unblock-user>

    $gitlab->user_unblock( :uid );

@@ -409,6 +459,18 @@ In that case the API would return C<403 Forbidden>.

=back

=head2 Miscellaneous

=over

=item L<user_events()|https://docs.gitlab.com/ce/api/users.html#get-user-contribution-events>

    $gitlab->user_events( :uid );

Get the contribution events for the specified user, sorted from newest to oldest.

=back

=head1 AUTHOR

Roman Lacko <L<xlacko1@fi.muni.cz>>