1 package Catalyst::Controller::DBIC::API::RPC;
2 #ABSTRACT: Provides an RPC interface to DBIx::Class
5 BEGIN { extends 'Catalyst::Controller::DBIC::API'; }
8 'action' => { object_with_id => { PathPart => 'id' } },
9 'default' => 'application/json',
10 'stash_key' => 'response',
12 'application/x-www-form-urlencoded' => 'JSON',
13 'application/json' => 'JSON',
19 Provides an RPC API interface to the functionality described in L<Catalyst::Controller::DBIC::API>.
21 By default provides the following endpoints:
26 $base/id/[identifier]/delete
27 $base/id/[identifier]/update
29 Where $base is the URI described by L</setup>, the chain root of the controller.
31 =method_protected setup
37 As described in L<Catalyst::Controller::DBIC::API/setup>, this action is the chain root of the controller but has no pathpart or chain parent defined by default, so these must be defined in order for the controller to function. The neatest way is normally to define these using the controller's config.
40 ( action => { setup => { PathPart => 'track', Chained => '/api/rpc/rpc_base' } },
46 =method_protected create
48 Chained: L</objects_no_id>
52 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/update_or_create>.
56 sub create :Chained('objects_no_id') :PathPart('create') :Args(0)
59 $self->update_or_create($c);
62 =method_protected list
64 Chained: L</deserialize>
68 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/list>.
72 sub list :Chained('deserialize') :PathPart('list') :Args(0)
75 $self->next::method($c);
78 =method_protected item
80 Chained: L</object_with_id>
84 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/item>.
88 sub item :Chained('object_with_id') :PathPart('') :Args(0)
91 $self->next::method($c);
94 =method_protected update
96 Chained: L</object_with_id>
100 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/update_or_create>.
104 sub update :Chained('object_with_id') :PathPart('update') :Args(0)
107 $self->update_or_create($c);
110 =method_protected delete
112 Chained: L</object_with_id>
116 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/delete>.
120 sub delete :Chained('object_with_id') :PathPart('delete') :Args(0)
123 $self->next::method($c);
126 =method_protected update_bulk
128 Chained: L</objects_no_id>
132 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/update_or_create> for multiple objects.
136 sub update_bulk :Chained('objects_no_id') :PathPart('update') :Args(0)
139 $self->update_or_create($c);
142 =method_protected delete_bulk
144 Chained: L</objects_no_id>
148 Provides an endpoint to the functionality described in L<Catalyst::Controller::DBIC::API/delete> for multiple objects.
152 sub delete_bulk :Chained('objects_no_id') :PathPart('delete') :Args(0)