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