| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catalyst::Controller::DBIC::API::RPC; |
|
2
|
|
|
|
|
|
|
$Catalyst::Controller::DBIC::API::RPC::VERSION = '2.008001'; |
|
3
|
|
|
|
|
|
|
#ABSTRACT: Provides an RPC interface to DBIx::Class |
|
4
|
|
|
|
|
|
|
|
|
5
|
15
|
|
|
15
|
|
37112739
|
use Moose; |
|
|
15
|
|
|
|
|
149
|
|
|
|
15
|
|
|
|
|
93
|
|
|
6
|
15
|
|
|
15
|
|
94823
|
BEGIN { extends 'Catalyst::Controller::DBIC::API'; } |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->config( |
|
9
|
|
|
|
|
|
|
'action' => { object_with_id => { PathPart => 'id' } }, |
|
10
|
|
|
|
|
|
|
'default' => 'application/json', |
|
11
|
|
|
|
|
|
|
'stash_key' => 'response', |
|
12
|
|
|
|
|
|
|
'map' => { |
|
13
|
|
|
|
|
|
|
'application/x-www-form-urlencoded' => 'JSON', |
|
14
|
|
|
|
|
|
|
'application/json' => 'JSON', |
|
15
|
|
|
|
|
|
|
}, |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub create : Chained('objects_no_id') : PathPart('create') : Args(0) { |
|
21
|
6
|
|
|
6
|
1
|
2466
|
my ( $self, $c ) = @_; |
|
22
|
6
|
|
|
|
|
50
|
$self->update_or_create($c); |
|
23
|
15
|
|
|
15
|
|
100947
|
} |
|
|
15
|
|
|
|
|
46
|
|
|
|
15
|
|
|
|
|
158
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub list : Chained('deserialize') : PathPart('list') : Args(0) { |
|
27
|
30
|
|
|
30
|
1
|
14021
|
my ( $self, $c ) = @_; |
|
28
|
30
|
|
|
|
|
235
|
$self->next::method($c); |
|
29
|
15
|
|
|
15
|
|
20536
|
} |
|
|
15
|
|
|
|
|
46
|
|
|
|
15
|
|
|
|
|
94
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub item : Chained('object_with_id') : PathPart('') : Args(0) { |
|
33
|
1
|
|
|
1
|
1
|
530
|
my ( $self, $c ) = @_; |
|
34
|
1
|
|
|
|
|
7
|
$self->next::method($c); |
|
35
|
15
|
|
|
15
|
|
15335
|
} |
|
|
15
|
|
|
|
|
50
|
|
|
|
15
|
|
|
|
|
107
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub update : Chained('object_with_id') : PathPart('update') : Args(0) { |
|
39
|
7
|
|
|
7
|
1
|
3253
|
my ( $self, $c ) = @_; |
|
40
|
7
|
|
|
|
|
64
|
$self->update_or_create($c); |
|
41
|
15
|
|
|
15
|
|
15561
|
} |
|
|
15
|
|
|
|
|
48
|
|
|
|
15
|
|
|
|
|
77
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub delete : Chained('object_with_id') : PathPart('delete') : Args(0) { |
|
45
|
2
|
|
|
2
|
1
|
460
|
my ( $self, $c ) = @_; |
|
46
|
2
|
|
|
|
|
9
|
$self->next::method($c); |
|
47
|
15
|
|
|
15
|
|
15372
|
} |
|
|
15
|
|
|
|
|
58
|
|
|
|
15
|
|
|
|
|
80
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub update_bulk : Chained('objects_no_id') : PathPart('update') : Args(0) { |
|
51
|
1
|
|
|
1
|
1
|
518
|
my ( $self, $c ) = @_; |
|
52
|
1
|
|
|
|
|
7
|
$self->update_or_create($c); |
|
53
|
15
|
|
|
15
|
|
15189
|
} |
|
|
15
|
|
|
|
|
49
|
|
|
|
15
|
|
|
|
|
80
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub delete_bulk : Chained('objects_no_id') : PathPart('delete') : Args(0) { |
|
57
|
1
|
|
|
1
|
1
|
456
|
my ( $self, $c ) = @_; |
|
58
|
1
|
|
|
|
|
8
|
$self->delete($c); |
|
59
|
15
|
|
|
15
|
|
14923
|
} |
|
|
15
|
|
|
|
|
45
|
|
|
|
15
|
|
|
|
|
90
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Catalyst::Controller::DBIC::API::RPC - Provides an RPC interface to DBIx::Class |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 2.008001 |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Provides an RPC API interface to the functionality described in |
|
78
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API>. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
By default provides the following endpoints: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$base/create |
|
83
|
|
|
|
|
|
|
$base/list |
|
84
|
|
|
|
|
|
|
$base/id/[identifier] |
|
85
|
|
|
|
|
|
|
$base/id/[identifier]/delete |
|
86
|
|
|
|
|
|
|
$base/id/[identifier]/update |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Where $base is the URI described by L</setup>, the chain root of the controller. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 PROTECTED_METHODS |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 setup |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Chained: override |
|
95
|
|
|
|
|
|
|
PathPart: override |
|
96
|
|
|
|
|
|
|
CaptureArgs: 0 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
As described in L<Catalyst::Controller::DBIC::API/setup>, this action is the |
|
99
|
|
|
|
|
|
|
chain root of the controller but has no pathpart or chain parent defined by |
|
100
|
|
|
|
|
|
|
default. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
These must be defined in order for the controller to function. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The neatest way is normally to define these using the controller's config. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__PACKAGE__->config |
|
107
|
|
|
|
|
|
|
( action => { setup => { PathPart => 'track', Chained => '/api/rpc/rpc_base' } }, |
|
108
|
|
|
|
|
|
|
... |
|
109
|
|
|
|
|
|
|
); |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 create |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Chained: L</objects_no_id> |
|
114
|
|
|
|
|
|
|
PathPart: create |
|
115
|
|
|
|
|
|
|
CaptureArgs: 0 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
118
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/update_or_create>. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 list |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Chained: L</deserialize> |
|
123
|
|
|
|
|
|
|
PathPart: list |
|
124
|
|
|
|
|
|
|
CaptureArgs: 0 |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
127
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/list>. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 item |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Chained: L</object_with_id> |
|
132
|
|
|
|
|
|
|
PathPart: '' |
|
133
|
|
|
|
|
|
|
Args: 0 |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
136
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/item>. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 update |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Chained: L</object_with_id> |
|
141
|
|
|
|
|
|
|
PathPart: update |
|
142
|
|
|
|
|
|
|
Args: 0 |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
145
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/update_or_create>. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 delete |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Chained: L</object_with_id> |
|
150
|
|
|
|
|
|
|
PathPart: delete |
|
151
|
|
|
|
|
|
|
Args: 0 |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
154
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/delete>. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 update_bulk |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Chained: L</objects_no_id> |
|
159
|
|
|
|
|
|
|
PathPart: update |
|
160
|
|
|
|
|
|
|
Args: 0 |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
163
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/update_or_create> for multiple objects. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 delete_bulk |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Chained: L</objects_no_id> |
|
168
|
|
|
|
|
|
|
PathPart: delete |
|
169
|
|
|
|
|
|
|
Args: 0 |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Provides an endpoint to the functionality described in |
|
172
|
|
|
|
|
|
|
L<Catalyst::Controller::DBIC::API/delete> for multiple objects. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHORS |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=over 4 |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item * |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Nicholas Perez <nperez@cpan.org> |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item * |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Luke Saunders <luke.saunders@gmail.com> |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Alexander Hartmaier <abraxxa@cpan.org> |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Oleg Kostyuk <cub.uanic@gmail.com> |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Samuel Kaufman <sam@socialflow.com> |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Luke Saunders, Nicholas Perez, Alexander Hartmaier, et al. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
209
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |