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
a9383206
Verified
Commit
a9383206
authored
Oct 12, 2018
by
Roman Lacko
Browse files
add Repositories API
parent
1fe6a4f4
Changes
2
Show whitespace changes
Inline
Side-by-side
GitLab.pm
View file @
a9383206
...
...
@@ -13,6 +13,7 @@ use GitLab::Groups;
use
GitLab::
Members
;
use
GitLab::
Namespaces
;
use
GitLab::
Projects
;
use
GitLab::
Repositories
;
use
GitLab::
Runners
;
use
GitLab::
Users
;
use
Try::
Tiny
;
...
...
GitLab/Repositories.pm
0 → 100644
View file @
a9383206
package
GitLab::
Repositories
;
use
utf8
;
use
strict
;
use
warnings
;
use
vars
qw($VERSION)
;
use
GitLab::
API
;
use
Log::
Any
qw($log)
;
our
$VERSION
=
v11
.3.4
;
my
$requests
=
{
ls_tree
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/tree
",
optional
=>
[
qw(
path
ref
recursive
)
],
paginated
=>
1
,
},
get_blob
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/blobs/<sha>
",
},
get_blob_raw
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/blobs/<sha>/raw
",
},
get_archive
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/archive
",
optional
=>
[
qw(
sha
format
)
],
},
compare_refs
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/compare
",
required
=>
[
qw(
from
to
)
],
optional
=>
[
qw(
straight
)
],
},
contributors
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/contributos
",
optional
=>
[
qw(
order_by
sort
)
],
},
merge_base
=>
{
method
=>
"
GET
",
path
=>
"
/projects/<pid>/repository/merge_base
",
required
=>
[
qw(
refs
)
],
},
};
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::Repository - implements repositories API calls
See L<GitLab API -- Users|http://doc.gitlab.com/ce/api/repositories.html> for details and
response formats.
=head1 VERSION
Implements API calls for GitLab CE C<v11.3.4>.
=head1 DESCRIPTION
=over
=item L<ls_tree()|https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree>
$objects = $gitlab->ls_tree( :pid );
Get a list of repository files and directories in a project.
This endpoint can be accessed without authentication if the repository is publicly accessible.
=item L<get_blob()|https://docs.gitlab.com/ce/api/repositories.html#get-a-blob-from-repository>
=item L<get_blob_raw()|https://docs.gitlab.com/ce/api/repositories.html#raw-blob-content>
$blob_base64 = $gitlab->get_blob( :id, :sha );
$blob = $gitlab->get_blob_raw( :id, :sha );
Allows you to receive information about blob in repository like size and content.
=item L<get_archive()|https://docs.gitlab.com/ce/api/repositories.html#get-file-archive>
$archive = $gitlab->get_archive( :pid, [:sha], [:format] );
Get an archive of the repository.
This endpoint can be accessed without authentication if the repository is
publicly accessible.
Archive formats are
=over
=item C<tar.gz>
Default.
=item C<tar.bz2>
=item C<tbz>
=item C<tbz2>
=item C<tb2>
=item C<bz2>
=item C<tar>
=item C<zip>
=back
=item L<compare_refs()|https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits>
$cmp = $gitlab->compare_refs( :pid, :from, :to, [:straight] );
Compare branches, tags or commits.
=item L<contributors()|https://docs.gitlab.com/ce/api/repositories.html#contributors>
$list = $gitlab->contributors( :pid, [:order_by], [:sort] );
Get repository contributors list. This endpoint can be accessed without
authentication if the repository is publicly accessible.
=item L<merge_base()|https://docs.gitlab.com/ce/api/repositories.html#merge-base>
$base = $gitlab->merge_base( :id, :refs );
Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
=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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment