| 1 | package WWW::Gitea::API::Misc; | ||
| 2 | |||
| 3 | # ABSTRACT: Instance-level Gitea endpoints (version, current user) | ||
| 4 | |||
| 5 | 5 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use WWW::Gitea::User; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 5 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | |||
| 10 | 5 | has client => ( | |
| 11 | is => 'ro', | ||
| 12 | required => 1, | ||
| 13 | weak_ref => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | |||
| 17 | has openapi_operations => ( | ||
| 18 | is => 'lazy', | ||
| 19 | 0 | ▶ | builder => sub { |
|
Subroutine
_build_openapi_operations: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 20 | return { | ||
| 21 | 0 | 'misc.version' => { method => 'GET', path => '/version' }, | |
| 22 | 'user.current' => { method => 'GET', path => '/user' }, | ||
| 23 | }; | ||
| 24 | }, | ||
| 25 | 5 | ); | |
| 26 | |||
| 27 | |||
| 28 | 5 | with 'WWW::Gitea::Role::OpenAPI'; | |
| 29 | |||
| 30 | 0 | ▶ | sub version { |
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 31 | 0 | my ($self) = @_; | |
| 32 | 0 | my $data = $self->call_operation('misc.version'); | |
| 33 | 0 | return $data->{version}; | |
| 34 | } | ||
| 35 | |||
| 36 | |||
| 37 | 0 | ▶ | sub current_user { |
|
Subroutine
current_user: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | 0 | my ($self) = @_; | |
| 39 | 0 | my $data = $self->call_operation('user.current'); | |
| 40 | 0 | return WWW::Gitea::User->new(client => $self->client, data => $data); | |
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | 5 | 1; | |
| 46 | |||
| 47 | __END__ | ||