/usr/share/perl5/Pithub/Orgs/Teams.pm is in libpithub-perl 0.01033-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | package Pithub::Orgs::Teams;
$Pithub::Orgs::Teams::VERSION = '0.01033';
our $AUTHORITY = 'cpan:PLU';
# ABSTRACT: Github v3 Org Teams API
use Moo;
use Carp qw(croak carp);
extends 'Pithub::Base';
sub add_member {
my ( $self, %args ) = @_;
carp '"Add team member" API is deprecated. Use add_membership method.';
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: user' unless $args{user};
return $self->request(
method => 'PUT',
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ),
%args,
);
}
sub add_membership {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: user' unless $args{user};
croak 'Missing key in parameters: data' unless $args{data};
return $self->request(
method => 'PUT',
path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ),
%args,
);
}
sub add_repo {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: repo' unless $args{repo};
croak 'Missing key in parameters: org' unless $args{org};
return $self->request(
method => 'PUT',
path => sprintf( '/teams/%s/repos/%s/%s',
delete $args{team_id},
delete $args{org},
delete $args{repo} ),
%args,
);
}
sub create {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: org' unless $args{org};
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH';
return $self->request(
method => 'POST',
path => sprintf( '/orgs/%s/teams', delete $args{org} ),
%args,
);
}
sub delete {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
return $self->request(
method => 'DELETE',
path => sprintf( '/teams/%s', delete $args{team_id} ),
%args,
);
}
sub get {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
return $self->request(
method => 'GET',
path => sprintf( '/teams/%s', delete $args{team_id} ),
%args,
);
}
sub has_repo {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: repo' unless $args{repo};
return $self->request(
method => 'GET',
path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ),
%args,
);
}
sub is_member {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: user' unless $args{user};
return $self->request(
method => 'GET',
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ),
%args,
);
}
sub list {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: org' unless $args{org};
return $self->request(
method => 'GET',
path => sprintf( '/orgs/%s/teams', delete $args{org} ),
%args,
);
}
sub list_members {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
return $self->request(
method => 'GET',
path => sprintf( '/teams/%s/members', delete $args{team_id} ),
%args,
);
}
sub list_repos {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
return $self->request(
method => 'GET',
path => sprintf( '/teams/%s/repos', delete $args{team_id} ),
%args,
);
}
sub remove_member {
my ( $self, %args ) = @_;
carp '"Remove team member" API is deprecated. Use remove_membership method.';
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: user' unless $args{user};
return $self->request(
method => 'DELETE',
path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ),
%args,
);
}
sub remove_membership {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: user' unless $args{user};
return $self->request(
method => 'DELETE',
path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ),
%args,
);
}
sub remove_repo {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: repo' unless $args{repo};
return $self->request(
method => 'DELETE',
path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ),
%args,
);
}
sub update {
my ( $self, %args ) = @_;
croak 'Missing key in parameters: team_id' unless $args{team_id};
croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH';
return $self->request(
method => 'PATCH',
path => sprintf( '/teams/%s', delete $args{team_id} ),
%args,
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Pithub::Orgs::Teams - Github v3 Org Teams API
=head1 VERSION
version 0.01033
=head1 METHODS
=head2 add_member
=over
The "Add team member" API (described below) is deprecated and is
scheduled for removal in the next major version of the API. We
recommend using the Add team membership API instead. It allows
you to invite new organization members to your teams.
In order to add a user to a team, the authenticated user must have
'admin' permissions to the team or be an owner of the org that the
team is associated with.
PUT /teams/:id/members/:user
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->add_member(
team_id => 1,
user => 'plu',
);
=back
=head2 add_membership
=over
If the user is already a member of the team’s organization, this
endpoint will add the user to the team. In order to add a membership
between an organization member and a team, the authenticated user
must be an organization owner or a maintainer of the team.
PUT /teams/:id/memberships/:user
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->add_membership(
team_id => 1,
user => 'plu',
data => {
role => 'member',
}
);
=back
=head2 add_repo
=over
In order to add a repo to a team, the authenticated user must be
an owner of the org that the team is associated with.
PUT /teams/:id/repos/:repo
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->add_repo(
team_id => 1,
repo => 'some_repo',
org => 'our_organization',
);
=back
=head2 create
=over
In order to create a team, the authenticated user must be an
owner of the given organization.
POST /orgs/:org/teams
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->create(
org => 'CPAN-API',
data => {
name => 'new team',
permission => 'push',
repo_names => ['github/dotfiles']
}
);
=back
=head2 delete
=over
In order to delete a team, the authenticated user must be an owner
of the org that the team is associated with.
DELETE /teams/:id
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->delete( team_id => 1 );
=back
=head2 get
=over
Get team
GET /teams/:id
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->get( team_id => 1 );
=back
=head2 has_repo
=over
Get team repo
GET /teams/:id/repos/:repo
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->has_repo(
team_id => 1,
repo => 'some_repo',
);
=back
=head2 is_member
=over
In order to get if a user is a member of a team, the authenticated
user must be a member of the team.
GET /teams/:id/members/:user
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->is_member(
team_id => 1,
user => 'plu',
);
=back
=head2 list
=over
List teams
GET /orgs/:org/teams
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->list( org => 'CPAN-API' );
=back
=head2 list_members
=over
In order to list members in a team, the authenticated user must be
a member of the team.
GET /teams/:id/members
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->list_members( team_id => 1 );
=back
=head2 list_repos
=over
List team repos
GET /teams/:id/repos
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->list_repos( team_id => 1 );
=back
=head2 remove_member
=over
The "Remove team member" API (described below) is deprecated and
is scheduled for removal in the next major version of the API. We
recommend using the Remove team membership API instead. It allows
you to remove both active and pending memberships.
In order to remove a user from a team, the authenticated user must
have 'admin' permissions to the team or be an owner of the org that
the team is associated with. NOTE: This does not delete the user,
it just remove them from the team.
DELETE /teams/:id/members/:user
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->remove_member(
team_id => 1,
user => 'plu',
);
=back
=head2 remove_membership
=over
In order to remove a membership between a user and a team,
the authenticated user must have 'admin' permissions to
the team or be an owner of the organization that the team
is associated with. NOTE: This does not delete the user,
it just removes their membership from the team.
DELETE /teams/:id/memberships/:user
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->remove_membership(
team_id => 1,
user => 'plu',
);
=back
=head2 remove_repo
=over
In order to remove a repo from a team, the authenticated user must be
an owner of the org that the team is associated with.
DELETE /teams/:id/repos/:repo
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->remove_repo(
team_id => 1,
repo => 'some_repo',
);
=back
=head2 update
=over
In order to edit a team, the authenticated user must be an owner
of the org that the team is associated with.
PATCH /teams/:id
Examples:
my $t = Pithub::Orgs::Teams->new;
my $result = $t->update(
team_id => 1,
data => {
name => 'new team name',
permission => 'push',
}
);
=back
=head1 AUTHOR
Johannes Plunien <plu@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Johannes Plunien.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|