API-MailboxOrg

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    This is still pretty alpha. The API of this distribution might change.

ATTRIBUTES

      * base_uri

      (optional) Default: /v1

      * client

      (optional) A Mojo::UserAgent compatible user agent. By default a new
      object of Mojo::UserAgent is created.

      * host

      (optional) This is the URL to Mailbox.org API. Defaults to
      https://api.mailbox.org

      * token

      After authenticating, this will be the auth id.

lib/API/MailboxOrg.pm  view on Meta::CPAN

use Types::Standard qw(Str);

use feature 'signatures';
no warnings 'experimental::signatures';

our $VERSION = '1.0.2'; # VERSION

has user     => ( is => 'ro', isa => Str, required => 1 );
has password => ( is => 'ro', isa => Str, required => 1 );
has token    => ( is => 'rwp', isa => Str );
has host     => ( is => 'ro', isa => MojoURL["https?"], default => sub { 'https://api.mailbox.org' }, coerce => 1 );
has base_uri => ( is => 'ro', isa => Str, default => sub { 'v1/' } );

has client   => (
    is      => 'ro',
    lazy    => 1,
    isa     => MojoUserAgent,
    default => sub {
        Mojo::UserAgent->new
    }
);

sub _load_namespace ($package) {
    my @modules = find_modules $package . '::API', { recursive => 1 };

    for my $module ( @modules ) {
        load_class( $module );

lib/API/MailboxOrg.pm  view on Meta::CPAN

=head1 ATTRIBUTES

=over 4

=item * base_uri

I<(optional)> Default: C</v1>

=item * client 

I<(optional)> A C<Mojo::UserAgent> compatible user agent. By default a new object of C<Mojo::UserAgent>
is created.

=item * host

I<(optional)> This is the URL to Mailbox.org API. Defaults to C<https://api.mailbox.org>

=item * token

After authenticating, this will be the auth id.

lib/API/MailboxOrg/APIBase.pm  view on Meta::CPAN

use Params::ValidationCompiler qw(validation_for);
use Types::Mojo qw(:all);
use Types::Standard qw(Str Object Int);

use feature 'signatures';
no warnings 'experimental::signatures';

our $VERSION = '1.0.2'; # VERSION

has api      => ( is => 'ro', isa => Object, required => 1 );
has json_rpc => ( is => 'ro', isa => Str, default => sub { '2.0' } );

state $request_id = 1;

sub _request ( $self, $method, $params = {}, $opts = {} ) {
    my $rpc_data = {
        jsonrpc => $self->json_rpc,
        id      => $request_id++,
        method  => $method,
    };



( run in 0.605 second using v1.01-cache-2.11-cpan-0a6323c29d9 )