File Coverage

blib/lib/WWW/Gitea/API/Misc.pm
Criterion Covered Total %
statement 9 16 56.2
branch n/a
condition n/a
subroutine 3 6 50.0
pod 2 2 100.0
total 14 24 58.3


line stmt bran cond sub pod time code
1             package WWW::Gitea::API::Misc;
2              
3             # ABSTRACT: Instance-level Gitea endpoints (version, current user)
4              
5 3     3   16 use Moo;
  3         9  
  3         14  
6 3     3   1944 use WWW::Gitea::User;
  3         14  
  3         103  
7 3     3   21 use namespace::clean;
  3         5  
  3         22  
8              
9              
10             has client => (
11             is => 'ro',
12             required => 1,
13             weak_ref => 1,
14             );
15              
16              
17             has openapi_operations => (
18             is => 'lazy',
19             builder => sub {
20             return {
21 0     0     'misc.version' => { method => 'GET', path => '/version' },
22             'user.current' => { method => 'GET', path => '/user' },
23             };
24             },
25             );
26              
27              
28             with 'WWW::Gitea::Role::OpenAPI';
29              
30             sub version {
31 0     0 1   my ($self) = @_;
32 0           my $data = $self->call_operation('misc.version');
33 0           return $data->{version};
34             }
35              
36              
37             sub current_user {
38 0     0 1   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             1;
46              
47             __END__