line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Orgs::Teams; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Org Teams API |
4
|
|
|
|
|
|
|
|
5
|
15
|
|
|
15
|
|
95
|
use Moo; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
73
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01039'; |
8
|
|
|
|
|
|
|
|
9
|
15
|
|
|
15
|
|
4145
|
use Carp qw( carp croak ); |
|
15
|
|
|
|
|
46
|
|
|
15
|
|
|
|
|
15589
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub add_member { |
15
|
5
|
|
|
5
|
1
|
8738
|
my ( $self, %args ) = @_; |
16
|
5
|
100
|
|
|
|
24
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
17
|
4
|
100
|
|
|
|
21
|
croak 'Missing key in parameters: user' unless $args{user}; |
18
|
3
|
|
|
|
|
42
|
carp q{"Add team member" API is deprecated. Use add_membership method.}; |
19
|
|
|
|
|
|
|
return $self->request( |
20
|
|
|
|
|
|
|
method => 'PUT', |
21
|
3
|
|
|
|
|
990
|
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), |
22
|
|
|
|
|
|
|
%args, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add_membership { |
28
|
6
|
|
|
6
|
1
|
4356
|
my ( $self, %args ) = @_; |
29
|
6
|
100
|
|
|
|
25
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
30
|
5
|
100
|
|
|
|
19
|
croak 'Missing key in parameters: user' unless $args{user}; |
31
|
4
|
100
|
|
|
|
19
|
croak 'Missing key in parameters: data' unless $args{data}; |
32
|
|
|
|
|
|
|
return $self->request( |
33
|
|
|
|
|
|
|
method => 'PUT', |
34
|
3
|
|
|
|
|
29
|
path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ), |
35
|
|
|
|
|
|
|
%args, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub add_repo { |
41
|
6
|
|
|
6
|
1
|
4164
|
my ( $self, %args ) = @_; |
42
|
6
|
100
|
|
|
|
55
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
43
|
5
|
100
|
|
|
|
21
|
croak 'Missing key in parameters: repo' unless $args{repo}; |
44
|
4
|
100
|
|
|
|
16
|
croak 'Missing key in parameters: org' unless $args{org}; |
45
|
|
|
|
|
|
|
return $self->request( |
46
|
|
|
|
|
|
|
method => 'PUT', |
47
|
|
|
|
|
|
|
path => sprintf( '/teams/%s/repos/%s/%s', |
48
|
|
|
|
|
|
|
delete $args{team_id}, |
49
|
|
|
|
|
|
|
delete $args{org}, |
50
|
3
|
|
|
|
|
30
|
delete $args{repo} ), |
51
|
|
|
|
|
|
|
%args, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub create { |
57
|
5
|
|
|
5
|
1
|
3637
|
my ( $self, %args ) = @_; |
58
|
5
|
100
|
|
|
|
22
|
croak 'Missing key in parameters: org' unless $args{org}; |
59
|
4
|
100
|
|
|
|
23
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
60
|
|
|
|
|
|
|
return $self->request( |
61
|
|
|
|
|
|
|
method => 'POST', |
62
|
3
|
|
|
|
|
28
|
path => sprintf( '/orgs/%s/teams', delete $args{org} ), |
63
|
|
|
|
|
|
|
%args, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitBuiltinHomonyms) |
69
|
|
|
|
|
|
|
sub delete { |
70
|
4
|
|
|
4
|
1
|
3123
|
my ( $self, %args ) = @_; |
71
|
4
|
100
|
|
|
|
22
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
72
|
|
|
|
|
|
|
return $self->request( |
73
|
|
|
|
|
|
|
method => 'DELETE', |
74
|
3
|
|
|
|
|
29
|
path => sprintf( '/teams/%s', delete $args{team_id} ), |
75
|
|
|
|
|
|
|
%args, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
## use critic |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub get { |
82
|
4
|
|
|
4
|
1
|
3072
|
my ( $self, %args ) = @_; |
83
|
4
|
100
|
|
|
|
29
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
84
|
|
|
|
|
|
|
return $self->request( |
85
|
|
|
|
|
|
|
method => 'GET', |
86
|
3
|
|
|
|
|
24
|
path => sprintf( '/teams/%s', delete $args{team_id} ), |
87
|
|
|
|
|
|
|
%args, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub has_repo { |
93
|
5
|
|
|
5
|
1
|
3732
|
my ( $self, %args ) = @_; |
94
|
5
|
100
|
|
|
|
25
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
95
|
4
|
100
|
|
|
|
17
|
croak 'Missing key in parameters: repo' unless $args{repo}; |
96
|
|
|
|
|
|
|
return $self->request( |
97
|
|
|
|
|
|
|
method => 'GET', |
98
|
3
|
|
|
|
|
31
|
path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ), |
99
|
|
|
|
|
|
|
%args, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub is_member { |
105
|
5
|
|
|
5
|
1
|
3646
|
my ( $self, %args ) = @_; |
106
|
5
|
100
|
|
|
|
23
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
107
|
4
|
100
|
|
|
|
18
|
croak 'Missing key in parameters: user' unless $args{user}; |
108
|
|
|
|
|
|
|
return $self->request( |
109
|
|
|
|
|
|
|
method => 'GET', |
110
|
3
|
|
|
|
|
28
|
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), |
111
|
|
|
|
|
|
|
%args, |
112
|
|
|
|
|
|
|
); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub list { |
117
|
4
|
|
|
4
|
1
|
3036
|
my ( $self, %args ) = @_; |
118
|
4
|
100
|
|
|
|
23
|
croak 'Missing key in parameters: org' unless $args{org}; |
119
|
|
|
|
|
|
|
return $self->request( |
120
|
|
|
|
|
|
|
method => 'GET', |
121
|
3
|
|
|
|
|
27
|
path => sprintf( '/orgs/%s/teams', delete $args{org} ), |
122
|
|
|
|
|
|
|
%args, |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub list_members { |
128
|
4
|
|
|
4
|
1
|
3069
|
my ( $self, %args ) = @_; |
129
|
4
|
100
|
|
|
|
24
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
130
|
|
|
|
|
|
|
return $self->request( |
131
|
|
|
|
|
|
|
method => 'GET', |
132
|
3
|
|
|
|
|
26
|
path => sprintf( '/teams/%s/members', delete $args{team_id} ), |
133
|
|
|
|
|
|
|
%args, |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub list_repos { |
139
|
4
|
|
|
4
|
1
|
3154
|
my ( $self, %args ) = @_; |
140
|
4
|
100
|
|
|
|
20
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
141
|
|
|
|
|
|
|
return $self->request( |
142
|
|
|
|
|
|
|
method => 'GET', |
143
|
3
|
|
|
|
|
28
|
path => sprintf( '/teams/%s/repos', delete $args{team_id} ), |
144
|
|
|
|
|
|
|
%args, |
145
|
|
|
|
|
|
|
); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub remove_member { |
150
|
5
|
|
|
5
|
1
|
3687
|
my ( $self, %args ) = @_; |
151
|
5
|
100
|
|
|
|
25
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
152
|
4
|
100
|
|
|
|
17
|
croak 'Missing key in parameters: user' unless $args{user}; |
153
|
3
|
|
|
|
|
49
|
carp q{"Remove team member" API is deprecated. Use remove_membership method.}; |
154
|
|
|
|
|
|
|
return $self->request( |
155
|
|
|
|
|
|
|
method => 'DELETE', |
156
|
3
|
|
|
|
|
989
|
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), |
157
|
|
|
|
|
|
|
%args, |
158
|
|
|
|
|
|
|
); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub remove_membership { |
163
|
5
|
|
|
5
|
1
|
3691
|
my ( $self, %args ) = @_; |
164
|
5
|
100
|
|
|
|
31
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
165
|
4
|
100
|
|
|
|
18
|
croak 'Missing key in parameters: user' unless $args{user}; |
166
|
|
|
|
|
|
|
return $self->request( |
167
|
|
|
|
|
|
|
method => 'DELETE', |
168
|
3
|
|
|
|
|
33
|
path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ), |
169
|
|
|
|
|
|
|
%args, |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub remove_repo { |
175
|
5
|
|
|
5
|
1
|
3938
|
my ( $self, %args ) = @_; |
176
|
5
|
100
|
|
|
|
24
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
177
|
4
|
100
|
|
|
|
20
|
croak 'Missing key in parameters: repo' unless $args{repo}; |
178
|
|
|
|
|
|
|
return $self->request( |
179
|
|
|
|
|
|
|
method => 'DELETE', |
180
|
3
|
|
|
|
|
30
|
path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ), |
181
|
|
|
|
|
|
|
%args, |
182
|
|
|
|
|
|
|
); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub update { |
187
|
5
|
|
|
5
|
1
|
3641
|
my ( $self, %args ) = @_; |
188
|
5
|
100
|
|
|
|
24
|
croak 'Missing key in parameters: team_id' unless $args{team_id}; |
189
|
4
|
100
|
|
|
|
21
|
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; |
190
|
|
|
|
|
|
|
return $self->request( |
191
|
|
|
|
|
|
|
method => 'PATCH', |
192
|
3
|
|
|
|
|
26
|
path => sprintf( '/teams/%s', delete $args{team_id} ), |
193
|
|
|
|
|
|
|
%args, |
194
|
|
|
|
|
|
|
); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
1; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
__END__ |