line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Repos; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
our $VERSION = '0.01039'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Repos API |
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
160999
|
use Moo; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
95
|
|
7
|
15
|
|
|
15
|
|
4273
|
use Carp qw( croak ); |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
703
|
|
8
|
15
|
|
|
15
|
|
493
|
use Pithub::Issues; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
349
|
|
9
|
15
|
|
|
15
|
|
5491
|
use Pithub::Markdown; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
439
|
|
10
|
15
|
|
|
15
|
|
489
|
use Pithub::PullRequests; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
296
|
|
11
|
15
|
|
|
15
|
|
6140
|
use Pithub::Repos::Collaborators; |
|
15
|
|
|
|
|
42
|
|
|
15
|
|
|
|
|
373
|
|
12
|
15
|
|
|
15
|
|
6241
|
use Pithub::Repos::Commits; |
|
15
|
|
|
|
|
41
|
|
|
15
|
|
|
|
|
381
|
|
13
|
15
|
|
|
15
|
|
5922
|
use Pithub::Repos::Contents; |
|
15
|
|
|
|
|
46
|
|
|
15
|
|
|
|
|
392
|
|
14
|
15
|
|
|
15
|
|
5948
|
use Pithub::Repos::Downloads; |
|
15
|
|
|
|
|
42
|
|
|
15
|
|
|
|
|
449
|
|
15
|
15
|
|
|
15
|
|
7139
|
use Pithub::Repos::Forks; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
380
|
|
16
|
15
|
|
|
15
|
|
5859
|
use Pithub::Repos::Hooks; |
|
15
|
|
|
|
|
48
|
|
|
15
|
|
|
|
|
378
|
|
17
|
15
|
|
|
15
|
|
5993
|
use Pithub::Repos::Keys; |
|
15
|
|
|
|
|
36
|
|
|
15
|
|
|
|
|
399
|
|
18
|
15
|
|
|
15
|
|
5817
|
use Pithub::Repos::Releases; |
|
15
|
|
|
|
|
39
|
|
|
15
|
|
|
|
|
381
|
|
19
|
15
|
|
|
15
|
|
5882
|
use Pithub::Repos::Starring; |
|
15
|
|
|
|
|
44
|
|
|
15
|
|
|
|
|
377
|
|
20
|
15
|
|
|
15
|
|
5321
|
use Pithub::Repos::Stats; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
379
|
|
21
|
15
|
|
|
15
|
|
5616
|
use Pithub::Repos::Statuses; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
392
|
|
22
|
15
|
|
|
15
|
|
5579
|
use Pithub::Repos::Watching; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
17601
|
|
23
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub branch { |
27
|
3
|
|
|
3
|
1
|
10079
|
my ( $self, %args ) = @_; |
28
|
3
|
100
|
|
|
|
20
|
croak 'Missing key in parameters: branch (string)' unless defined $args{branch}; |
29
|
2
|
|
|
|
|
20
|
$self->_validate_user_repo_args( \%args ); |
30
|
|
|
|
|
|
|
return $self->request( |
31
|
|
|
|
|
|
|
method => 'GET', |
32
|
|
|
|
|
|
|
path => sprintf( |
33
|
|
|
|
|
|
|
'/repos/%s/%s/branches/%s', delete $args{user}, |
34
|
|
|
|
|
|
|
delete $args{repo}, |
35
|
|
|
|
|
|
|
delete $args{branch}, |
36
|
2
|
|
|
|
|
30
|
), |
37
|
|
|
|
|
|
|
%args, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub branches { |
43
|
9
|
|
|
9
|
1
|
1672
|
my ( $self, %args ) = @_; |
44
|
9
|
|
|
|
|
38
|
$self->_validate_user_repo_args( \%args ); |
45
|
|
|
|
|
|
|
return $self->request( |
46
|
|
|
|
|
|
|
method => 'GET', |
47
|
9
|
|
|
|
|
56
|
path => sprintf( '/repos/%s/%s/branches', delete $args{user}, delete $args{repo} ), |
48
|
|
|
|
|
|
|
%args, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub rename_branch { |
54
|
2
|
|
|
2
|
1
|
1739
|
my ( $self, %args ) = @_; |
55
|
2
|
50
|
|
|
|
12
|
croak 'Missing parameters: branch' unless $args{branch}; |
56
|
2
|
50
|
|
|
|
9
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
57
|
2
|
|
|
|
|
11
|
$self->_validate_user_repo_args( \%args ); |
58
|
|
|
|
|
|
|
return $self->request( |
59
|
|
|
|
|
|
|
method => 'POST', |
60
|
2
|
|
|
|
|
24
|
path => sprintf( '/repos/%s/%s/branches/%s/rename', delete $args{user}, delete $args{repo}, delete $args{branch} ), |
61
|
|
|
|
|
|
|
%args, |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub merge_branch { |
67
|
2
|
|
|
2
|
1
|
1697
|
my ( $self, %args ) = @_; |
68
|
2
|
50
|
|
|
|
12
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
69
|
2
|
|
|
|
|
11
|
$self->_validate_user_repo_args( \%args ); |
70
|
|
|
|
|
|
|
return $self->request( |
71
|
|
|
|
|
|
|
method => 'POST', |
72
|
2
|
|
|
|
|
21
|
path => sprintf( '/repos/%s/%s/merges', delete $args{user}, delete $args{repo} ), |
73
|
|
|
|
|
|
|
%args, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub collaborators { |
79
|
13
|
|
|
13
|
1
|
1051
|
return shift->_create_instance('Pithub::Repos::Collaborators', @_); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub commits { |
84
|
13
|
|
|
13
|
1
|
2112
|
return shift->_create_instance('Pithub::Repos::Commits', @_); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub contents { |
89
|
1
|
|
|
1
|
1
|
1576
|
return shift->_create_instance('Pithub::Repos::Contents', @_); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub contributors { |
94
|
9
|
|
|
9
|
1
|
1585
|
my ( $self, %args ) = @_; |
95
|
9
|
|
|
|
|
34
|
$self->_validate_user_repo_args( \%args ); |
96
|
|
|
|
|
|
|
return $self->request( |
97
|
|
|
|
|
|
|
method => 'GET', |
98
|
9
|
|
|
|
|
55
|
path => sprintf( '/repos/%s/%s/contributors', delete $args{user}, delete $args{repo} ), |
99
|
|
|
|
|
|
|
%args, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub create { |
105
|
6
|
|
|
6
|
1
|
7396
|
my ( $self, %args ) = @_; |
106
|
6
|
100
|
|
|
|
41
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
107
|
5
|
100
|
|
|
|
18
|
if ( my $org = delete $args{org} ) { |
108
|
3
|
|
|
|
|
24
|
return $self->request( |
109
|
|
|
|
|
|
|
method => 'POST', |
110
|
|
|
|
|
|
|
path => sprintf( '/orgs/%s/repos', $org ), |
111
|
|
|
|
|
|
|
%args, |
112
|
|
|
|
|
|
|
); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
else { |
115
|
2
|
|
|
|
|
12
|
return $self->request( |
116
|
|
|
|
|
|
|
method => 'POST', |
117
|
|
|
|
|
|
|
path => '/user/repos', |
118
|
|
|
|
|
|
|
%args, |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub delete { |
125
|
4
|
|
|
4
|
1
|
2577
|
my( $self, %args ) = @_; |
126
|
4
|
|
|
|
|
17
|
$self->_validate_user_repo_args( \%args ); |
127
|
|
|
|
|
|
|
return $self->request( |
128
|
|
|
|
|
|
|
method => 'DELETE', |
129
|
2
|
|
|
|
|
11
|
path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), |
130
|
|
|
|
|
|
|
%args, |
131
|
|
|
|
|
|
|
); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub downloads { |
136
|
13
|
|
|
13
|
1
|
2089
|
return shift->_create_instance('Pithub::Repos::Downloads', @_); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub forks { |
141
|
13
|
|
|
13
|
1
|
2180
|
return shift->_create_instance('Pithub::Repos::Forks', @_); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub get { |
146
|
2
|
|
|
2
|
1
|
1629
|
my ( $self, %args ) = @_; |
147
|
2
|
|
|
|
|
12
|
$self->_validate_user_repo_args( \%args ); |
148
|
|
|
|
|
|
|
return $self->request( |
149
|
|
|
|
|
|
|
method => 'GET', |
150
|
2
|
|
|
|
|
21
|
path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), |
151
|
|
|
|
|
|
|
%args, |
152
|
|
|
|
|
|
|
); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub hooks { |
157
|
1
|
|
|
1
|
1
|
1509
|
return shift->_create_instance('Pithub::Repos::Hooks', @_); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub issues { |
162
|
1
|
|
|
1
|
1
|
1485
|
return shift->_create_instance('Pithub::Issues', @_); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub keys { |
167
|
13
|
|
|
13
|
1
|
1730
|
return shift->_create_instance('Pithub::Repos::Keys', @_); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub languages { |
172
|
9
|
|
|
9
|
1
|
1578
|
my ( $self, %args ) = @_; |
173
|
9
|
|
|
|
|
30
|
$self->_validate_user_repo_args( \%args ); |
174
|
|
|
|
|
|
|
return $self->request( |
175
|
|
|
|
|
|
|
method => 'GET', |
176
|
9
|
|
|
|
|
53
|
path => sprintf( '/repos/%s/%s/languages', delete $args{user}, delete $args{repo} ), |
177
|
|
|
|
|
|
|
%args, |
178
|
|
|
|
|
|
|
); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub list { |
183
|
5
|
|
|
5
|
1
|
8954
|
my ( $self, %args ) = @_; |
184
|
5
|
100
|
|
|
|
21
|
if ( my $user = delete $args{user} ) { |
|
|
100
|
|
|
|
|
|
185
|
2
|
|
|
|
|
21
|
return $self->request( |
186
|
|
|
|
|
|
|
method => 'GET', |
187
|
|
|
|
|
|
|
path => sprintf( '/users/%s/repos', $user ), |
188
|
|
|
|
|
|
|
%args, |
189
|
|
|
|
|
|
|
); |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
elsif ( my $org = delete $args{org} ) { |
192
|
1
|
|
|
|
|
6
|
return $self->request( |
193
|
|
|
|
|
|
|
method => 'GET', |
194
|
|
|
|
|
|
|
path => sprintf( '/orgs/%s/repos', $org ), |
195
|
|
|
|
|
|
|
%args |
196
|
|
|
|
|
|
|
); |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
else { |
199
|
2
|
|
|
|
|
8
|
return $self->request( |
200
|
|
|
|
|
|
|
method => 'GET', |
201
|
|
|
|
|
|
|
path => '/user/repos', |
202
|
|
|
|
|
|
|
%args, |
203
|
|
|
|
|
|
|
); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub markdown { |
209
|
2
|
|
|
2
|
1
|
1519
|
my $self = shift; |
210
|
2
|
|
|
|
|
30
|
return $self->_create_instance('Pithub::Markdown', |
211
|
|
|
|
|
|
|
mode => 'gfm', context => sprintf( '%s/%s', $self->user, $self->repo ), |
212
|
|
|
|
|
|
|
@_); |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub pull_requests { |
217
|
1
|
|
|
1
|
1
|
1598
|
return shift->_create_instance('Pithub::PullRequests', @_); |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub releases { |
222
|
3
|
|
|
3
|
1
|
42222
|
return shift->_create_instance('Pithub::Repos::Releases', @_); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub starring { |
227
|
1
|
|
|
1
|
1
|
1481
|
return shift->_create_instance('Pithub::Repos::Starring', @_); |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub stats { |
232
|
1
|
|
|
1
|
1
|
1521
|
return shift->_create_instance('Pithub::Repos::Stats', @_); |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub statuses { |
237
|
1
|
|
|
1
|
1
|
1511
|
return shift->_create_instance('Pithub::Repos::Statuses', @_); |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub tags { |
242
|
9
|
|
|
9
|
1
|
1632
|
my ( $self, %args ) = @_; |
243
|
9
|
|
|
|
|
34
|
$self->_validate_user_repo_args( \%args ); |
244
|
|
|
|
|
|
|
return $self->request( |
245
|
|
|
|
|
|
|
method => 'GET', |
246
|
9
|
|
|
|
|
59
|
path => sprintf( '/repos/%s/%s/tags', delete $args{user}, delete $args{repo} ), |
247
|
|
|
|
|
|
|
%args, |
248
|
|
|
|
|
|
|
); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub teams { |
253
|
9
|
|
|
9
|
1
|
1615
|
my ( $self, %args ) = @_; |
254
|
9
|
|
|
|
|
36
|
$self->_validate_user_repo_args( \%args ); |
255
|
|
|
|
|
|
|
return $self->request( |
256
|
|
|
|
|
|
|
method => 'GET', |
257
|
9
|
|
|
|
|
57
|
path => sprintf( '/repos/%s/%s/teams', delete $args{user}, delete $args{repo} ), |
258
|
|
|
|
|
|
|
%args, |
259
|
|
|
|
|
|
|
); |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub update { |
264
|
4
|
|
|
4
|
1
|
3577
|
my ( $self, %args ) = @_; |
265
|
4
|
100
|
|
|
|
26
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
266
|
3
|
|
|
|
|
17
|
$self->_validate_user_repo_args( \%args ); |
267
|
|
|
|
|
|
|
return $self->request( |
268
|
|
|
|
|
|
|
method => 'PATCH', |
269
|
3
|
|
|
|
|
27
|
path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), |
270
|
|
|
|
|
|
|
%args, |
271
|
|
|
|
|
|
|
); |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub watching { |
276
|
13
|
|
|
13
|
1
|
2121
|
return shift->_create_instance('Pithub::Repos::Watching', @_); |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
1; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
__END__ |