| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Gitea::API::Orgs; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Gitea organizations API |
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
16
|
use Moo; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
16
|
|
|
6
|
3
|
|
|
3
|
|
914
|
use Carp qw(croak); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
242
|
|
|
7
|
3
|
|
|
3
|
|
1232
|
use WWW::Gitea::Org; |
|
|
3
|
|
|
|
|
10
|
|
|
|
3
|
|
|
|
|
106
|
|
|
8
|
3
|
|
|
3
|
|
19
|
use WWW::Gitea::Repo; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
60
|
|
|
9
|
3
|
|
|
3
|
|
12
|
use namespace::clean; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has client => ( |
|
13
|
|
|
|
|
|
|
is => 'ro', |
|
14
|
|
|
|
|
|
|
required => 1, |
|
15
|
|
|
|
|
|
|
weak_ref => 1, |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has openapi_operations => ( |
|
20
|
|
|
|
|
|
|
is => 'lazy', |
|
21
|
|
|
|
|
|
|
builder => sub { |
|
22
|
|
|
|
|
|
|
return { |
|
23
|
1
|
|
|
1
|
|
21
|
'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
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
with 'WWW::Gitea::Role::OpenAPI'; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _wrap { |
|
37
|
0
|
|
|
0
|
|
|
my ($self, $data) = @_; |
|
38
|
0
|
|
|
|
|
|
return WWW::Gitea::Org->new(client => $self->client, data => $data); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get { |
|
42
|
0
|
|
|
0
|
1
|
|
my ($self, $org) = @_; |
|
43
|
0
|
0
|
|
|
|
|
croak 'org required' unless defined $org; |
|
44
|
0
|
|
|
|
|
|
my $data = $self->call_operation('orgs.get', path => { org => $org }); |
|
45
|
0
|
|
|
|
|
|
return $self->_wrap($data); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub create { |
|
50
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
|
51
|
0
|
0
|
|
|
|
|
croak 'username required' unless defined $args{username}; |
|
52
|
0
|
|
|
|
|
|
my $data = $self->call_operation('orgs.create', body => \%args); |
|
53
|
0
|
|
|
|
|
|
return $self->_wrap($data); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub edit { |
|
58
|
0
|
|
|
0
|
1
|
|
my ($self, $org, %args) = @_; |
|
59
|
0
|
0
|
|
|
|
|
croak 'org required' unless defined $org; |
|
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
|
|
|
|
|
|
|
sub delete { |
|
67
|
0
|
|
|
0
|
1
|
|
my ($self, $org) = @_; |
|
68
|
0
|
0
|
|
|
|
|
croak 'org required' unless defined $org; |
|
69
|
0
|
|
|
|
|
|
return $self->call_operation('orgs.delete', path => { org => $org }); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub repos { |
|
74
|
0
|
|
|
0
|
1
|
|
my ($self, $org, %query) = @_; |
|
75
|
0
|
0
|
|
|
|
|
croak 'org required' unless defined $org; |
|
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
|
0
|
|
|
|
|
} @{ $data || [] } ]; |
|
|
0
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub list { |
|
85
|
0
|
|
|
0
|
1
|
|
my ($self, %query) = @_; |
|
86
|
0
|
|
|
|
|
|
my $data = $self->call_operation('orgs.list_current', query => \%query); |
|
87
|
0
|
0
|
|
|
|
|
return [ map { $self->_wrap($_) } @{ $data || [] } ]; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |