line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Issues::Labels; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
our $VERSION = '0.01040'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Issue Labels API |
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
110
|
use Moo; |
|
17
|
|
|
|
|
30
|
|
|
17
|
|
|
|
|
86
|
|
7
|
17
|
|
|
17
|
|
4396
|
use Carp qw( croak ); |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
12890
|
|
8
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub add { |
12
|
6
|
|
|
6
|
1
|
9449
|
my ( $self, %args ) = @_; |
13
|
6
|
100
|
|
|
|
47
|
croak 'Missing key in parameters: issue_id' unless $args{issue_id}; |
14
|
5
|
100
|
|
|
|
30
|
croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; |
15
|
3
|
|
|
|
|
23
|
$self->_validate_user_repo_args( \%args ); |
16
|
|
|
|
|
|
|
return $self->request( |
17
|
|
|
|
|
|
|
method => 'POST', |
18
|
3
|
|
|
|
|
33
|
path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), |
19
|
|
|
|
|
|
|
%args, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub create { |
25
|
5
|
|
|
5
|
1
|
4121
|
my ( $self, %args ) = @_; |
26
|
5
|
100
|
|
|
|
40
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
27
|
3
|
|
|
|
|
15
|
$self->_validate_user_repo_args( \%args ); |
28
|
|
|
|
|
|
|
return $self->request( |
29
|
|
|
|
|
|
|
method => 'POST', |
30
|
3
|
|
|
|
|
28
|
path => sprintf( '/repos/%s/%s/labels', delete $args{user}, delete $args{repo} ), |
31
|
|
|
|
|
|
|
%args, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub delete { |
37
|
4
|
|
|
4
|
1
|
3346
|
my ( $self, %args ) = @_; |
38
|
4
|
100
|
|
|
|
28
|
croak 'Missing key in parameters: label' unless $args{label}; |
39
|
3
|
|
|
|
|
16
|
$self->_validate_user_repo_args( \%args ); |
40
|
|
|
|
|
|
|
return $self->request( |
41
|
|
|
|
|
|
|
method => 'DELETE', |
42
|
3
|
|
|
|
|
29
|
path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), |
43
|
|
|
|
|
|
|
%args, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub get { |
49
|
3
|
|
|
3
|
1
|
2130
|
my ( $self, %args ) = @_; |
50
|
3
|
100
|
|
|
|
26
|
croak 'Missing key in parameters: label' unless $args{label}; |
51
|
2
|
|
|
|
|
12
|
$self->_validate_user_repo_args( \%args ); |
52
|
|
|
|
|
|
|
return $self->request( |
53
|
|
|
|
|
|
|
method => 'GET', |
54
|
2
|
|
|
|
|
22
|
path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), |
55
|
|
|
|
|
|
|
%args, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub list { |
61
|
4
|
|
|
4
|
1
|
5242
|
my ( $self, %args ) = @_; |
62
|
4
|
|
|
|
|
20
|
$self->_validate_user_repo_args( \%args ); |
63
|
4
|
100
|
|
|
|
28
|
if ( my $milestone_id = delete $args{milestone_id} ) { |
|
|
100
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return $self->request( |
65
|
|
|
|
|
|
|
method => 'GET', |
66
|
2
|
|
|
|
|
21
|
path => sprintf( '/repos/%s/%s/milestones/%s/labels', delete $args{user}, delete $args{repo}, $milestone_id ), |
67
|
|
|
|
|
|
|
%args, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
elsif ( my $issue_id = delete $args{issue_id} ) { |
71
|
|
|
|
|
|
|
return $self->request( |
72
|
|
|
|
|
|
|
method => 'GET', |
73
|
1
|
|
|
|
|
9
|
path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, $issue_id ), |
74
|
|
|
|
|
|
|
%args |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
return $self->request( |
78
|
|
|
|
|
|
|
method => 'GET', |
79
|
1
|
|
|
|
|
9
|
path => sprintf( '/repos/%s/%s/labels', delete $args{user}, delete $args{repo} ), |
80
|
|
|
|
|
|
|
%args, |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub remove { |
86
|
6
|
|
|
6
|
1
|
6102
|
my ( $self, %args ) = @_; |
87
|
6
|
|
|
|
|
26
|
$self->_validate_user_repo_args( \%args ); |
88
|
6
|
100
|
|
|
|
42
|
croak 'Missing key in parameters: issue_id' unless $args{issue_id}; |
89
|
5
|
100
|
|
|
|
25
|
if ( my $label = delete $args{label} ) { |
90
|
|
|
|
|
|
|
return $self->request( |
91
|
|
|
|
|
|
|
method => 'DELETE', |
92
|
3
|
|
|
|
|
26
|
path => sprintf( '/repos/%s/%s/issues/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{issue_id}, $label ), |
93
|
|
|
|
|
|
|
%args, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
return $self->request( |
97
|
|
|
|
|
|
|
method => 'DELETE', |
98
|
2
|
|
|
|
|
16
|
path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), |
99
|
|
|
|
|
|
|
%args, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub replace { |
105
|
6
|
|
|
6
|
1
|
4791
|
my ( $self, %args ) = @_; |
106
|
6
|
100
|
|
|
|
38
|
croak 'Missing key in parameters: issue_id' unless $args{issue_id}; |
107
|
5
|
100
|
|
|
|
28
|
croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; |
108
|
3
|
|
|
|
|
15
|
$self->_validate_user_repo_args( \%args ); |
109
|
|
|
|
|
|
|
return $self->request( |
110
|
|
|
|
|
|
|
method => 'PUT', |
111
|
3
|
|
|
|
|
39
|
path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), |
112
|
|
|
|
|
|
|
%args, |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub update { |
118
|
5
|
|
|
5
|
1
|
4110
|
my ( $self, %args ) = @_; |
119
|
5
|
100
|
|
|
|
33
|
croak 'Missing key in parameters: label' unless $args{label}; |
120
|
4
|
100
|
|
|
|
21
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
121
|
3
|
|
|
|
|
13
|
$self->_validate_user_repo_args( \%args ); |
122
|
|
|
|
|
|
|
return $self->request( |
123
|
|
|
|
|
|
|
method => 'PATCH', |
124
|
3
|
|
|
|
|
40
|
path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), |
125
|
|
|
|
|
|
|
%args, |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |