Verified Commit 17f5ef6a authored by Roman Lacko's avatar Roman Lacko
Browse files

Add Commits API

parent a9383206
......@@ -7,6 +7,7 @@ use Log::Any qw($log);
use Carp;
use GitLab::API;
use GitLab::Commits;
use GitLab::CustomAttributes;
use GitLab::Events;
use GitLab::Groups;
......
package GitLab::Commits;
use utf8;
use strict;
use warnings;
use vars qw($VERSION);
use GitLab::API;
use Log::Any qw($log);
our $VERSION = v11.4.4;
my $requests = {
commits => {
method => "GET",
path => "/projects/<pid>/repository/commits",
query => [qw(
ref_name
since
until
path
all
with_stats
)],
paginated => 1,
},
commit_get => {
method => "GET",
path => "/projects/<pid>/repository/commits/<sha>",
query => [qw(
stats
)],
},
get_references => {
method => "GET",
path => "/projects/<pid>/repository/commits/<sha>/refs",
query => [qw(
type
)],
},
cherry_pick => {
method => "POST",
path => "/projects/<pid>/repository/commits/<sha>/cherry_pick",
required => [qw(
branch
)],
},
commit_revert => {
method => "POST",
path => "/projects/<pid>/repository/commits/<sha>/revert",
required => [qw(
branch
)],
},
commit_diff => {
method => "GET",
path => "/projects/<pid>/repository/commits/<sha>/diff",
},
commit_comments => {
method => "GET",
path => "/projects/<pid>/repository/commits/<sha>/comments",
},
};
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::Commits - implements commits API calls
See L<GitLab API -- Commits|https://docs.gitlab.com/ee/api/commits.html> for details and
response formats.
=head1 VERSION
Implements API calls for GitLab EE C<v11.4.4>.
=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 Commits
=over
=item L<commits()|https://docs.gitlab.com/ee/api/commits.html#list-repository-commits>
$gitlab->commits( :pid [,...] );
List repository commits.
=item L<commit_get()|https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit>
$gitlab->commit_get( :pid, :sha [, :stats] );
Get a single commit.
=item L<get_references()|https://docs.gitlab.com/ee/api/commits.html#get-references-a-commit-is-pushed-to>
$gitlab->get_references( :pid, :sha [, :type] );
Get references a commit is pushed to.
=item L<cherry_pick()|https://docs.gitlab.com/ee/api/commits.html#cherry-pick-a-commit>
$gitlab->cherry_pick( :pid, :sha, :branch );
Cherry pick a commit to a given branch.
=item L<commit_revert()|https://docs.gitlab.com/ee/api/commits.html#revert-a-commit>
$gitlab->commit_revert( :pid, :sha, :branch );
Reverts a commit in a given branch.
=item L<commit_diff()|https://docs.gitlab.com/ee/api/commits.html#get-the-diff-of-a-commit>
$gitlab->commit_diff( :pid, :sha );
Get the diff of a commit in a project.
=item L<commit_comments()|https://docs.gitlab.com/ee/api/commits.html#get-the-comments-of-a-commit>
$gitlab->commit_comments( :pid, :sha );
Get the comments of a commit in a project.
=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
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