line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Repos::Contents; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
our $VERSION = '0.01039'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Repo Contents API |
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
93
|
use Moo; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
70
|
|
7
|
15
|
|
|
15
|
|
3815
|
use Carp qw( croak ); |
|
15
|
|
|
|
|
49
|
|
|
15
|
|
|
|
|
4502
|
|
8
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub archive { |
12
|
5
|
|
|
5
|
1
|
9040
|
my ( $self, %args ) = @_; |
13
|
5
|
100
|
|
|
|
32
|
croak 'Missing key in parameters: archive_format' unless $args{archive_format}; |
14
|
4
|
100
|
|
|
|
29
|
croak 'Invalid archive_format. Valid formats: tarball, zipball' unless grep $args{archive_format} eq $_, qw(tarball zipball); |
15
|
3
|
|
|
|
|
26
|
$self->_validate_user_repo_args( \%args ); |
16
|
|
|
|
|
|
|
return $self->request( |
17
|
|
|
|
|
|
|
method => 'GET', |
18
|
3
|
|
100
|
|
|
44
|
path => sprintf( '/repos/%s/%s/%s/%s', delete $args{user}, delete $args{repo}, delete $args{archive_format}, delete $args{ref} || q{} ), |
19
|
|
|
|
|
|
|
%args, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get { |
25
|
3
|
|
|
3
|
1
|
3678
|
my ( $self, %args ) = @_; |
26
|
3
|
|
|
|
|
20
|
$self->_validate_user_repo_args( \%args ); |
27
|
3
|
100
|
|
|
|
13
|
if ( my $path = delete $args{path} ) { |
28
|
|
|
|
|
|
|
return $self->request( |
29
|
|
|
|
|
|
|
method => 'GET', |
30
|
1
|
|
|
|
|
8
|
path => sprintf( '/repos/%s/%s/contents/%s', delete $args{user}, delete $args{repo}, $path ), |
31
|
|
|
|
|
|
|
%args, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
return $self->request( |
35
|
|
|
|
|
|
|
method => 'GET', |
36
|
2
|
|
|
|
|
26
|
path => sprintf( '/repos/%s/%s/contents', delete $args{user}, delete $args{repo} ), |
37
|
|
|
|
|
|
|
%args, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub readme { |
43
|
2
|
|
|
2
|
1
|
1641
|
my ( $self, %args ) = @_; |
44
|
2
|
|
|
|
|
12
|
$self->_validate_user_repo_args( \%args ); |
45
|
|
|
|
|
|
|
return $self->request( |
46
|
|
|
|
|
|
|
method => 'GET', |
47
|
2
|
|
|
|
|
21
|
path => sprintf( '/repos/%s/%s/readme', delete $args{user}, delete $args{repo} ), |
48
|
|
|
|
|
|
|
%args, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |