Group
Extension

Matches 5

Dancer2-Plugin-RPC ( A/AB/ABELTJE/Dancer2-Plugin-RPC-2.02.tar.gz, ABELTJE, 2022; MetaCPAN )
Dancer2-Plugin-RPC/lib/Dancer2/RPCPlugin/CallbackResultFactory.pm ( view source; MetaCPAN )
g Callback-results.

=head1 SYNOPSIS

    use Dancer2::Plugin::RPC::JSON;
    use Dancer2::RPCPlugin::CallbackResultFactory;
    jsonrpc '/admin' => {
        publish => 'config',
        callback => 
Dancer2-Plugin-RPC ( A/AB/ABELTJE/Dancer2-Plugin-RPC-2.02.tar.gz, ABELTJE, 2022; MetaCPAN )
Dancer2-Plugin-RPC/lib/Dancer2/Plugin/RPC/JSONRPC.pm ( view source; MetaCPAN )
package Dancer2::Plugin::RPC::JSONRPC;
use Dancer2::Plugin;
use Moo;

with 'Dancer2::RPCPlugin';

our $VERSION = '2.00';
use constant PLUGIN_NAME => 'jsonrpc';

use Dancer2::RPCPlugin::CallbackResultF
Response;
use Dancer2::RPCPlugin::FlattenData;

use JSON;
use Scalar::Util 'blessed';
use Time::HiRes 'time';

plugin_keywords PLUGIN_NAME;

sub jsonrpc {
    my ($plugin, $endpoint, $config) = @_;

 
 $callback = $config->{callback};

    $plugin->app->log(debug => "Starting jsonrpc-handler build: ", $lister);
    my $jsonrpc_handler = sub {
        my ($dsl) = @_;

        my $http_request = $dsl
Dancer2-Plugin-RPC ( A/AB/ABELTJE/Dancer2-Plugin-RPC-2.02.tar.gz, ABELTJE, 2022; MetaCPAN )
Dancer2-Plugin-RPC/lib/Dancer2/RPCPlugin/DispatchItem.pm ( view source; MetaCPAN )
head1 SYNOPSIS

    use Dancer2::RPCPlugin::DispatchItem;
    use Dancer2::Plugin::RPC::JSON;
    jsonrpc '/json' => {
        publish => sub {
            return {
                'system.ping' => Da
Dancer2-Plugin-RPC ( A/AB/ABELTJE/Dancer2-Plugin-RPC-2.02.tar.gz, ABELTJE, 2022; MetaCPAN )
Dancer2-Plugin-RPC/lib/Dancer2/Plugin/RPC/RESTRPC.pm ( view source; MetaCPAN )
ckResultFactory;
use Dancer2::RPCPlugin::ErrorResponse;
use Dancer2::RPCPlugin::FlattenData;

use JSON;
use Scalar::Util 'blessed';
use Time::HiRes 'time';

plugin_keywords PLUGIN_NAME;

sub restrpc {
       my ($ct) = (split /;\s*/, $http_request->content_type, 2);
        if ($ct ne 'application/json') {
            $dsl->pass();
        }
        $dsl->app->log(
            debug => "[handle_res

        $dsl->response->content_type('application/json');
        my $response;
        my $method_args = $http_request->body
            ? from_json($http_request->body)
            : undef;
       
Dancer2-Plugin-RPC ( A/AB/ABELTJE/Dancer2-Plugin-RPC-2.02.tar.gz, ABELTJE, 2022; MetaCPAN )
Dancer2-Plugin-RPC/lib/Dancer2/RPCPlugin/DefaultRoute.pm ( view source; MetaCPAN )
 configming to spec: $@"

=item B<application/json>

If the B<body> is valid JSONRPC (ie. is has a I<'jsonrpc': '2.0'> field/value),
the response is a JSONRPC-error:

    code => -32601
    message =>
 "Method '%s' not found"

If the B<body> is I<not> valid JSONRPC, the response is a generic json struct:

    'error': {
        'code':  -32601,
        'message': "Method '$request->path' not found"
elsif ( $content_type eq 'application/json' ) {
            content_type('application/json');

            my $request = request->body
                ? from_json(request->body, {allow_nonref => 1})
 

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.