NAME

WWW::MailboxOrg::Role::HTTP - JSON-RPC HTTP client role

VERSION

version 0.001

SYNOPSIS

package WWW::MailboxOrg;
use Moo;

has token => ( is => 'ro' );
has base_url => ( is => 'ro', default => 'https://api.mailbox.org/v1' );

with 'WWW::MailboxOrg::Role::HTTP';

DESCRIPTION

This role provides JSON-RPC 2.0 call and notification methods. It handles JSON encoding/decoding, authentication, and error handling.

HTTP transport is delegated to a pluggable WWW::MailboxOrg::Role::IO backend (default: WWW::MailboxOrg::LWPIO), making it possible to use async HTTP clients.

Uses Log::Any for logging.

REQUIRED ATTRIBUTES

Classes consuming this role must provide:

  • token - Session ID for HPLS-AUTH header

  • base_url - Base URL for the API

io

Pluggable JSON-RPC backend implementing WWW::MailboxOrg::Role::IO. Defaults to WWW::MailboxOrg::LWPIO.

call

my $result = $self->call('account.get', account => 'test@example.tld');

Execute a JSON-RPC call and return the result. Croaks on error.

notification

$self->notification('mail.send', %params);

Send a fire-and-forget notification (no response ID expected).

SEE ALSO

WWW::MailboxOrg, WWW::MailboxOrg::Role::IO, WWW::MailboxOrg::LWPIO, Log::Any

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/getty/p5-www-mailboxorg/issues.

IRC

Join #perl-help on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.