API-MailboxOrg

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    version 1.0.2

SYNOPSIS

        use API::MailboxOrg;
        use Data::Printer;
    
        my $api = API::MailboxOrg->new(
            user     => 'test_name@example.tld',
            password => 'test1234567789',
        );
    
        my $all_videochats = $api->videochat->list(
            mail => 'test_name@example.tld',
        );
        p $all_videochats;

INFO

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

README  view on Meta::CPAN

      * domain

      * hello

      * invoice

      * mail

      * mailinglist

      * password

      * passwordreset

      * spamprotect

      * test

      * user

      * utils

      * validate

example/list_videochats.pl  view on Meta::CPAN

#!/usr/bin/perl

use strict;
use warnings;

use API::MailboxOrg;
use Data::Printer;

my $api = API::MailboxOrg->new(
    user     => 'test@example.tld',
    password => 'a_password',
);

my $result = $api->videochat->list( mail => 'test@example.tld' );

p $result;

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

use Scalar::Util qw(weaken);
use Types::Mojo qw(:all);
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

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


version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;
    use Data::Printer;

    my $api = API::MailboxOrg->new(
        user     => 'test_name@example.tld',
        password => 'test1234567789',
    );

    my $all_videochats = $api->videochat->list(
        mail => 'test_name@example.tld',
    );
    p $all_videochats;

=head1 INFO

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

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

=item * domain

=item * hello

=item * invoice

=item * mail

=item * mailinglist

=item * password

=item * passwordreset

=item * spamprotect

=item * test

=item * user

=item * utils

=item *   validate

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


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

our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'add' => validation_for(
        params => {
            account      => { type => Str, optional => 0 },
            password     => { type => Str, optional => 0 },
            plan         => { type => Enum[qw(basic profi profixl reseller)], optional => 0 },
            tarifflimits => { type => HashRefRestricted[qw(basic profi profixl reseller)], optional => 1 },
            memo         => { type => Str, optional => 1 },

        },
    ),
    'del' => validation_for(
        params => {
            account => { type => Str, optional => 0 },

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

    ),
    'get' => validation_for(
        params => {
            account => { type => Str, optional => 0 },

        },
    ),
    'set' => validation_for(
        params => {
            account                    => { type => Str, optional => 0 },
            password                   => { type => Str, optional => 1 },
            plan                       => { type => Enum[qw(basic profi profixl reseller)], optional => 1 },
            memo                       => { type => Str, optional => 1 },
            address_payment_first_name => { type => Str, optional => 1 },
            address_payment_last_name  => { type => Str, optional => 1 },
            address_payment_street     => { type => Str, optional => 1 },
            address_payment_zipcode    => { type => Str, optional => 1 },
            address_payment_town       => { type => Str, optional => 1 },
            av_contract_accept_name    => { type => Str, optional => 1 },
            tarifflimits               => { type => HashRefRestricted[qw(basic profi profixl reseller)], optional => 1 },

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Creates a new account

Available for reseller

Parameters:

=over 4

=item * account

=item * password

=item * plan

=item * tarifflimits

=item * memo

=back

returns: array

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

Eigenschaften eines Accounts verändern

Available for admin, reseller

Parameters:

=over 4

=item * account

=item * password

=item * plan

=item * memo

=item * address_payment_first_name

=item * address_payment_last_name

=item * address_payment_street

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 backup_import

Import an E-Mail-Backup into the users mailaccount

Available for admin, account, domain, mail

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 auth

Performs a login (Authentication)

Parameters:

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Adds an address to the blacklist

Available for admin, account, domain, mail

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 set

Modifies email capabilities

Available for admin, reseller, account, domain

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 list

Returns a list of Context-IDs and associated domains

Available for admin, reseller, account

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

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

our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'add' => validation_for(
        params => {
            account               => { type => Str, optional => 0 },
            domain                => { type => Str, optional => 0 },
            password              => { type => Str, optional => 0 },
            context_id            => { type => Str, optional => 1 },
            create_new_context_id => { type => Boolean, optional => 1 },
            memo                  => { type => Str, optional => 1 },

        },
    ),
    'del' => validation_for(
        params => {
            account => { type => Str, optional => 0 },
            domain  => { type => Str, optional => 0 },

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

    'list' => validation_for(
        params => {
            account => { type => Str, optional => 0 },
            filter  => { type => Str, optional => 1 },

        },
    ),
    'set' => validation_for(
        params => {
            domain                => { type => Str, optional => 0 },
            password              => { type => Str, optional => 1 },
            context_id            => { type => Str, optional => 1 },
            create_new_context_id => { type => Boolean, optional => 1 },
            memo                  => { type => Str, optional => 1 },

        },
    ),

);


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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Adds a domain

Available for admin, reseller, account

Parameters:

=over 4

=item * account

=item * domain

=item * password

=item * context_id

=item * create_new_context_id

=item * memo

=back

returns: array

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

Modifies domain properties

Available for admin, reseller, account, domain, account, account

Parameters:

=over 4

=item * domain

=item * password

=item * context_id

=item * create_new_context_id

=item * memo

=back

returns: array

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 innerworld

Returns the string 'Hello Inner-World!' if called from a valid session

Available for admin, reseller, account, domain, mail

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 get

PDF binary of an invoice

Parameters:

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


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

our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'add' => validation_for(
        params => {
            mail                   => { type => Str, optional => 0 },
            password               => { type => Str, optional => 0 },
            password_hash          => { type => Str, optional => 1 },
            plan                   => { type => Enum[qw(light standard premium)], optional => 0 },
            additional_mail_quota  => { type => Str, optional => 1 },
            additional_cloud_quota => { type => Str, optional => 1 },
            first_name             => { type => Str, optional => 0 },
            last_name              => { type => Str, optional => 0 },
            inboxsave              => { type => Boolean, optional => 0 },
            forwards               => { type => ArrayRef, optional => 0 },
            memo                   => { type => Str, optional => 1 },
            catchall               => { type => Boolean, optional => 1 },
            create_own_context     => { type => Boolean, optional => 1 },

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

    'list' => validation_for(
        params => {
            domain => { type => Str, optional => 0 },

        },
    ),
    'register' => validation_for(
        params => {
            token          => { type => Str, optional => 0 },
            mail           => { type => Str, optional => 0 },
            password       => { type => Str, optional => 0 },
            alternate_mail => { type => Str, optional => 1 },
            first_name     => { type => Str, optional => 0 },
            last_name      => { type => Str, optional => 0 },
            lang           => { type => Enum[qw(de en fr)], optional => 1 },

        },
    ),
    'set' => validation_for(
        params => {
            mail                   => { type => Str, optional => 0 },
            password               => { type => Str, optional => 1 },
            password_hash          => { type => Str, optional => 1 },
            plan                   => { type => Enum[qw(MAIL MAILXL MAILXXL MAILXXXL Office OfficeXL OfficeXXL OfficeXXXL light standard premium)], optional => 1 },
            additional_mail_quota  => { type => Str, optional => 1 },
            additional_cloud_quota => { type => Str, optional => 1 },
            first_name             => { type => Str, optional => 1 },
            last_name              => { type => Str, optional => 1 },
            inboxsave              => { type => Boolean, optional => 1 },
            forwards               => { type => ArrayRef, optional => 1 },
            aliases                => { type => ArrayRef, optional => 1 },
            alternate_mail         => { type => Str, optional => 1 },
            memo                   => { type => Str, optional => 1 },

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Adds an e-mail address

Available for admin, account, domain

Parameters:

=over 4

=item * mail

=item * password

=item * password_hash

=item * plan

=item * additional_mail_quota

=item * additional_cloud_quota

=item * first_name

=item * last_name

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

Adds an e-mail address (using a predefined token)

Parameters:

=over 4

=item * token

=item * mail

=item * password

=item * alternate_mail

=item * first_name

=item * last_name

=item * lang

=back

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

Modifies e-mail address properties

Available for admin, reseller, account, domain, mail, domain

Parameters:

=over 4

=item * mail

=item * password

=item * password_hash

=item * plan

=item * additional_mail_quota

=item * additional_cloud_quota

=item * first_name

=item * last_name

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


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

our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'add' => validation_for(
        params => {
            mailinglist => { type => Str, optional => 0 },
            password    => { type => Str, optional => 0 },
            account     => { type => Str, optional => 0 },
            adminmail   => { type => Str, optional => 1 },

        },
    ),
    'del' => validation_for(
        params => {
            mailinglist => { type => Str, optional => 0 },
            account     => { type => Str, optional => 0 },

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

    'list' => validation_for(
        params => {
            account => { type => Str, optional => 0 },

        },
    ),
    'set' => validation_for(
        params => {
            mailinglist => { type => Str, optional => 0 },
            account     => { type => Str, optional => 0 },
            password    => { type => Str, optional => 1 },
            adminmail   => { type => Str, optional => 1 },

        },
    ),

);


sub add ($self, %params) {
    my $validator = $validators{'add'};

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Adds a mailing list

Available for admin, account

Parameters:

=over 4

=item * mailinglist

=item * password

=item * account

=item * adminmail

=back

returns: boolean

    $api->mailinglist->add(%params);

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

Available for admin, account

Parameters:

=over 4

=item * mailinglist

=item * account

=item * password

=item * adminmail

=back

returns: boolean

    $api->mailinglist->set(%params);

=head1 AUTHOR

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


        },
    ),
    'sendsms' => validation_for(
        params => {
            mail       => { type => Str, optional => 0 },
            cell_phone => { type => Str, optional => 0 },

        },
    ),
    'setpassword' => validation_for(
        params => {
            mail     => { type => Str, optional => 0 },
            token    => { type => Str, optional => 0 },
            password => { type => Str, optional => 0 },

        },
    ),

);


sub listmethods ($self, %params) {
    my $validator = $validators{'listmethods'};
    %params       = $validator->(%params) if $validator;

    my %opt = ();

    return $self->_request( 'mail.passwordreset.listmethods', \%params, \%opt );
}

sub sendsms ($self, %params) {
    my $validator = $validators{'sendsms'};
    %params       = $validator->(%params) if $validator;

    my %opt = ();

    return $self->_request( 'mail.passwordreset.sendsms', \%params, \%opt );
}

sub setpassword ($self, %params) {
    my $validator = $validators{'setpassword'};
    %params       = $validator->(%params) if $validator;

    my %opt = ();

    return $self->_request( 'mail.passwordreset.setpassword', \%params, \%opt );
}


1;

__END__

=pod

=encoding UTF-8

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 listmethods

Returns a list of available password reset methods for the given user

Parameters:

=over 4

=item * mail

=back

returns: array

    $api->passwordreset->listmethods(%params);

=head2 sendsms

Send a password reset token by SMS

Parameters:

=over 4

=item * mail

=item * cell_phone

=back

returns: boolean

    $api->passwordreset->sendsms(%params);

=head2 setpassword

Set a new password using a password reset token

Parameters:

=over 4

=item * mail

=item * token

=item * password

=back

returns: boolean

    $api->passwordreset->setpassword(%params);

=head1 AUTHOR

Renee Baecker <reneeb@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Renee Baecker.

This is free software, licensed under:

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 get

Read spamprotection settings

Available for admin, account, domain, mail

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 accountallowed

Confirms if the account can be administrated using the current ACLs

Parameters:

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 validator

Performs a validation

Parameters:

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 spf

Returns SPF details about a domain

Available for admin, reseller, account, domain

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

        params => {
            mail => { type => Str, optional => 0 },

        },
    ),
    'update' => validation_for(
        params => {
            mail                => { type => Str, optional => 0 },
            room_id             => { type => Int, optional => 0 },
            room_name           => { type => Str, optional => 1 },
            room_password       => { type => Str, optional => 1 },
            room_admin_password => { type => Str, optional => 1 },
            room_memo           => { type => Str, optional => 1 },

        },
    ),

);


sub add ($self, %params) {
    my $validator = $validators{'add'};

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


=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';
    my $password = '1234abc';

    my $api      = API::MailboxOrg->new(
        user     => $user,
        password => $password,
    );

=head1 METHODS

=head2 add

Add a new video channel for an e-mail address

Available for admin, account, domain, mail

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

Parameters:

=over 4

=item * mail

=item * room_id

=item * room_name

=item * room_password

=item * room_admin_password

=item * room_memo

=back

returns: boolean

    $api->videochat->update(%params);

=head1 AUTHOR

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

        method  => $method,
    };

    $rpc_data->{params} = $params->%* ? $params : "";

    my $api = $self->api;

    if ( $opts->{needs_auth} && !$api->token ) {
        my $auth_result = $api->base->auth(
            user => $api->user,
            pass => $api->password,
        );

        my $token = ref $auth_result ?
            $auth_result->{session} :
            croak 'Could not login: ' . $auth_result;

        $api->_set_token( $token );
    }

    my %header = ( 'Content-Type' => 'application/json' );

t/001_base.t  view on Meta::CPAN


use Types::Mojo;
diag( "Types::Mojo: " . Types::Mojo->VERSION);

use Types::Standard;
diag( "Types::Standard: " . Types::Standard->VERSION);

my $base    = "API::MailboxOrg";

my $methods = {
    $base                          => [qw/user password client token host base_uri/],
    $base . '::APIBase'            => [qw/_request/],
    $base . '::API::Account'       => [qw/add del get set list/],
    $base . '::API::Backup'        => [qw/backup_import list/],
    $base . '::API::Base'          => [qw/auth deauth search/],
    $base . '::API::Blacklist'     => [qw/add del list/],
    $base . '::API::Capabilities'  => [qw/set/],
    $base . '::API::Context'       => [qw/list/],
    $base . '::API::Domain'        => [qw/add del get list set/],
    $base . '::API::Hello'         => [qw/innerworld world/],
    $base . '::API::Invoice'       => [qw/get list/],
    $base . '::API::Mailinglist'   => [qw/add del get list set/],
    $base . '::API::Mail'          => [qw/add del get list register set/],
    $base . '::API::Passwordreset' => [qw/listmethods sendsms setpassword/],
    $base . '::API::Spamprotect'   => [qw/get set/],
    $base . '::API::Test'          => [qw/accountallowed domainallowed/],
    $base . '::API::Utils'         => [qw/validator/],
    $base . '::API::Validate'      => [qw/spf/],
    $base . '::API::Videochat'     => [qw/add del update list/],
};

for my $mod ( sort keys %{$methods} ) {
    use_ok $mod;
}

t/002_hello-world.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More;
use Test::RequiresInternet;

use API::MailboxOrg;

my $api = API::MailboxOrg->new(
    user     => 'dummy',
    password => 'dummy',
);

my $result = $api->hello->world;
is $result, "Hello World!";

done_testing;



( run in 1.029 second using v1.01-cache-2.11-cpan-49f99fa48dc )