| 1 | package WWW::Gitea::API::Orgs; | ||||||||||||
| 2 | |||||||||||||
| 3 | # ABSTRACT: Gitea organizations API | ||||||||||||
| 4 | |||||||||||||
| 5 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 5 | ▶ | use Carp qw(croak); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 5 | ▶ | use WWW::Gitea::Org; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 5 | ▶ | use WWW::Gitea::Repo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 5 | ▶ | use namespace::clean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | 5 | has client => ( | |||||||||||
| 13 | is => 'ro', | ||||||||||||
| 14 | required => 1, | ||||||||||||
| 15 | weak_ref => 1, | ||||||||||||
| 16 | ); | ||||||||||||
| 17 | |||||||||||||
| 18 | |||||||||||||
| 19 | has openapi_operations => ( | ||||||||||||
| 20 | is => 'lazy', | ||||||||||||
| 21 | 0 | ▶ | builder => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Subroutine
_build_openapi_operations: called CC=1 SCAR=1.2
| |||||||||||||
| 22 | return { | ||||||||||||
| 23 | 0 | 'orgs.get' => { method => 'GET', path => '/orgs/{org}' }, | |||||||||||
| 24 | 'orgs.create' => { method => 'POST', path => '/orgs' }, | ||||||||||||
| 25 | 'orgs.edit' => { method => 'PATCH', path => '/orgs/{org}' }, | ||||||||||||
| 26 | 'orgs.delete' => { method => 'DELETE', path => '/orgs/{org}' }, | ||||||||||||
| 27 | 'orgs.list_repos' => { method => 'GET', path => '/orgs/{org}/repos' }, | ||||||||||||
| 28 | 'orgs.list_current' => { method => 'GET', path => '/user/orgs' }, | ||||||||||||
| 29 | }; | ||||||||||||
| 30 | }, | ||||||||||||
| 31 | 5 | ); | |||||||||||
| 32 | |||||||||||||
| 33 | |||||||||||||
| 34 | 5 | with 'WWW::Gitea::Role::OpenAPI'; | |||||||||||
| 35 | |||||||||||||
| 36 | 0 | ▶ | sub _wrap { | ||||||||||
|
Subroutine
_wrap: not called CC=1 SCAR=6.9
| |||||||||||||
| 37 | 0 | my ($self, $data) = @_; | |||||||||||
| 38 | 0 | return WWW::Gitea::Org->new(client => $self->client, data => $data); | |||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 0 | ▶ | sub get { | ||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 42 | 0 | my ($self, $org) = @_; | |||||||||||
| 43 | 0 | ▶ | croak 'org required' unless defined $org; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | my $data = $self->call_operation('orgs.get', path => { org => $org }); | |||||||||||
| 45 | 0 | return $self->_wrap($data); | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | |||||||||||||
| 49 | 0 | ▶ | sub create { | ||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 50 | 0 | my ($self, %args) = @_; | |||||||||||
| 51 | 0 | ▶ | croak 'username required' unless defined $args{username}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | 0 | my $data = $self->call_operation('orgs.create', body => \%args); | |||||||||||
| 53 | 0 | return $self->_wrap($data); | |||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | |||||||||||||
| 57 | 0 | ▶ | sub edit { | ||||||||||
|
Subroutine
edit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 58 | 0 | my ($self, $org, %args) = @_; | |||||||||||
| 59 | 0 | ▶ | croak 'org required' unless defined $org; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 60 | 0 | my $data = $self->call_operation('orgs.edit', | |||||||||||
| 61 | path => { org => $org }, body => \%args); | ||||||||||||
| 62 | 0 | return $self->_wrap($data); | |||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | 0 | ▶ | sub delete { | ||||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 67 | 0 | my ($self, $org) = @_; | |||||||||||
| 68 | 0 | ▶ | croak 'org required' unless defined $org; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 69 | 0 | return $self->call_operation('orgs.delete', path => { org => $org }); | |||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | |||||||||||||
| 73 | 0 | ▶ | sub repos { | ||||||||||
|
Subroutine
repos: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 74 | 0 | my ($self, $org, %query) = @_; | |||||||||||
| 75 | 0 | ▶ | croak 'org required' unless defined $org; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 76 | 0 | my $data = $self->call_operation('orgs.list_repos', | |||||||||||
| 77 | path => { org => $org }, query => \%query); | ||||||||||||
| 78 | return [ map { | ||||||||||||
| 79 | 0 | WWW::Gitea::Repo->new(client => $self->client, data => $_) | |||||||||||
| 80 | 0 | ▶ | } @{ $data || [] } ]; | ||||||||||
|
Condition0%0/2
$data || []
MC/DC0%0/1
$data || []
$data
Truth table0%0/2
A
A= $data
| |||||||||||||
| 81 | } | ||||||||||||
| 82 | |||||||||||||
| 83 | |||||||||||||
| 84 | 0 | ▶ | sub list { | ||||||||||
|
Subroutine
list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 85 | 0 | my ($self, %query) = @_; | |||||||||||
| 86 | 0 | my $data = $self->call_operation('orgs.list_current', query => \%query); | |||||||||||
| 87 | 0 | ▶ | return [ map { $self->_wrap($_) } @{ $data || [] } ]; | ||||||||||
|
Condition0%0/2
$data || []
MC/DC0%0/1
$data || []
$data
Truth table0%0/2
A
A= $data
| |||||||||||||
| 88 | } | ||||||||||||
| 89 | |||||||||||||
| 90 | |||||||||||||
| 91 | |||||||||||||
| 92 | 5 | 1; | |||||||||||
| 93 | |||||||||||||
| 94 | __END__ | ||||||||||||