API-MailboxOrg

 view release on metacpan or  search on metacpan

CONTRIBUTING.md  view on Meta::CPAN

```

The project uses [`Dist::Zilla`](https://metacpan.org/pod/Dist::Zilla) to
build the distribution, hence this will need to be installed before
continuing:

```
$ cpanm Dist::Zilla
```

To install the required prequisite packages, run the following set of
commands:

```
$ dzil authordeps --missing | cpanm
$ dzil listdeps --author --missing | cpanm
```

The distribution can be tested like so:

```
$ dzil test
```

To run the full set of tests (including author and release-process tests),
add the `--author` and `--release` options:

```
$ dzil test --author --release
```

MANIFEST  view on Meta::CPAN

lib/API/MailboxOrg/API/Backup.pm
lib/API/MailboxOrg/API/Base.pm
lib/API/MailboxOrg/API/Blacklist.pm
lib/API/MailboxOrg/API/Capabilities.pm
lib/API/MailboxOrg/API/Context.pm
lib/API/MailboxOrg/API/Domain.pm
lib/API/MailboxOrg/API/Hello.pm
lib/API/MailboxOrg/API/Invoice.pm
lib/API/MailboxOrg/API/Mail.pm
lib/API/MailboxOrg/API/Mailinglist.pm
lib/API/MailboxOrg/API/Passwordreset.pm
lib/API/MailboxOrg/API/Spamprotect.pm
lib/API/MailboxOrg/API/Test.pm
lib/API/MailboxOrg/API/Utils.pm
lib/API/MailboxOrg/API/Validate.pm
lib/API/MailboxOrg/API/Videochat.pm
lib/API/MailboxOrg/APIBase.pm
lib/API/MailboxOrg/Types.pm
perlcritic.rc
t/001_base.t
t/002_hello-world.t

META.json  view on Meta::CPAN

         "version" : "v1.0.2"
      },
      "API::MailboxOrg::API::Mail" : {
         "file" : "lib/API/MailboxOrg/API/Mail.pm",
         "version" : "v1.0.2"
      },
      "API::MailboxOrg::API::Mailinglist" : {
         "file" : "lib/API/MailboxOrg/API/Mailinglist.pm",
         "version" : "v1.0.2"
      },
      "API::MailboxOrg::API::Passwordreset" : {
         "file" : "lib/API/MailboxOrg/API/Passwordreset.pm",
         "version" : "v1.0.2"
      },
      "API::MailboxOrg::API::Spamprotect" : {
         "file" : "lib/API/MailboxOrg/API/Spamprotect.pm",
         "version" : "v1.0.2"
      },
      "API::MailboxOrg::API::Test" : {
         "file" : "lib/API/MailboxOrg/API/Test.pm",
         "version" : "v1.0.2"
      },

META.yml  view on Meta::CPAN

    version: v1.0.2
  API::MailboxOrg::API::Invoice:
    file: lib/API/MailboxOrg/API/Invoice.pm
    version: v1.0.2
  API::MailboxOrg::API::Mail:
    file: lib/API/MailboxOrg/API/Mail.pm
    version: v1.0.2
  API::MailboxOrg::API::Mailinglist:
    file: lib/API/MailboxOrg/API/Mailinglist.pm
    version: v1.0.2
  API::MailboxOrg::API::Passwordreset:
    file: lib/API/MailboxOrg/API/Passwordreset.pm
    version: v1.0.2
  API::MailboxOrg::API::Spamprotect:
    file: lib/API/MailboxOrg/API/Spamprotect.pm
    version: v1.0.2
  API::MailboxOrg::API::Test:
    file: lib/API/MailboxOrg/API/Test.pm
    version: v1.0.2
  API::MailboxOrg::API::Utils:
    file: lib/API/MailboxOrg/API/Utils.pm
    version: v1.0.2

README  view on Meta::CPAN

      * hello

      * invoice

      * mail

      * mailinglist

      * password

      * passwordreset

      * spamprotect

      * test

      * user

      * utils

      * validate

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

=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

            account => { type => Str, optional => 0 },

        },
    ),
    '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 },

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


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

    my %opt = (needs_auth => 1);

    return $self->_request( 'account.list', \%params, \%opt );
}

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

    my %opt = (needs_auth => 1);

    return $self->_request( 'account.set', \%params, \%opt );
}


1;

__END__

=pod

=encoding UTF-8

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

=head2 list

Returns a list of all accounts that can be administrated

Available for admin, reseller

returns: array

    $api->account->list(%params);

=head2 set

Eigenschaften eines Accounts verändern

Available for admin, reseller

Parameters:

=over 4

=item * account

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

=item * address_payment_town

=item * av_contract_accept_name

=item * tarifflimits

=back

returns: array

    $api->account->set(%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/Capabilities.pm  view on Meta::CPAN

extends 'API::MailboxOrg::APIBase';

with 'MooX::Singleton';

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

our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'set' => validation_for(
        params => {
            mail         => { type => Str, optional => 0 },
            capabilities => { type => ArrayRef[Enum[qw(MAIL_SPAMPROTECTION MAIL_BLACKLIST MAIL_BACKUPRECOVER MAIL_OTP MAIL_PASSWORDRESET_SMS BMBO_VIDEOCHAT)]], optional => 0 },

        },
    ),

);


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

    my %opt = (needs_auth => 1);

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


1;

__END__

=pod

=encoding UTF-8

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

    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

Parameters:

=over 4

=item * mail

=item * capabilities

=back

returns: boolean

    $api->capabilities->set(%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/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


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

    my %opt = (needs_auth => 1);

    return $self->_request( 'domain.list', \%params, \%opt );
}

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

    my %opt = (needs_auth => 1);

    return $self->_request( 'domain.set', \%params, \%opt );
}


1;

__END__

=pod

=encoding UTF-8

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

=item * account

=item * filter

=back

returns: array

    $api->domain->list(%params);

=head2 set

Modifies domain properties

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

Parameters:

=over 4

=item * domain

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

=item * context_id

=item * create_new_context_id

=item * memo

=back

returns: array

    $api->domain->set(%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/Mail.pm  view on Meta::CPAN

            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 },

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


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

    my %opt = ();

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

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

    my %opt = (needs_auth => 1);

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


1;

__END__

=pod

=encoding UTF-8

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

=item * last_name

=item * lang

=back

returns: boolean

    $api->mail->register(%params);

=head2 set

Modifies e-mail address properties

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

Parameters:

=over 4

=item * mail

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

=item * phone

=item * fax

=item * cell_phone

=back

returns: array

    $api->mail->set(%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/Mailinglist.pm  view on Meta::CPAN

            account     => { type => Str, optional => 0 },

        },
    ),
    '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 },

        },
    ),

);

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


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

    my %opt = (needs_auth => 1);

    return $self->_request( 'mailinglist.list', \%params, \%opt );
}

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

    my %opt = (needs_auth => 1);

    return $self->_request( 'mailinglist.set', \%params, \%opt );
}


1;

__END__

=pod

=encoding UTF-8

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

=over 4

=item * account

=back

returns: array

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

=head2 set

Edits a mailing list

Available for admin, account

Parameters:

=over 4

=item * mailinglist

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

=item * account

=item * password

=item * adminmail

=back

returns: boolean

    $api->mailinglist->set(%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/Passwordreset.pm  view on Meta::CPAN

package API::MailboxOrg::API::Passwordreset;

# ABSTRACT: MailboxOrg::API::Passwordreset

# ---
# This class is auto-generated by bin/get_mailbox_api.pl
# ---

use v5.24;

use strict;
use warnings;

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

=head1 NAME

API::MailboxOrg::API::Passwordreset - MailboxOrg::API::Passwordreset

=head1 VERSION

version 1.0.2

=head1 SYNOPSIS

    use API::MailboxOrg;

    my $user     = '1234abc';

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


    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


our $VERSION = '1.0.2'; # VERSION

my %validators = (
    'get' => validation_for(
        params => {
            mail => { type => Str, optional => 0 },

        },
    ),
    'set' => validation_for(
        params => {
            mail                 => { type => Str, optional => 0 },
            greylist             => { type => Enum[qw(0 1)], optional => 0 },
            smtp_plausibility    => { type => Enum[qw(0 1)], optional => 0 },
            rbl                  => { type => Enum[qw(0 1)], optional => 0 },
            bypass_banned_checks => { type => Enum[qw(0 1)], optional => 0 },
            tag2level            => { type => Str, optional => 0 },
            killevel             => { type => Enum[qw(reject route)], optional => 0 },
            route_to             => { type => Str, optional => 0 },

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


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

    my %opt = (needs_auth => 1);

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

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

    my %opt = (needs_auth => 1);

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


1;

__END__

=pod

=encoding UTF-8

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


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

=head1 METHODS

=head2 get

Read spamprotection settings

Available for admin, account, domain, mail

Parameters:

=over 4

=item * mail

=back

returns: array

    $api->spamprotect->get(%params);

=head2 set

Sets the spamprotection settings

Available for admin, account, domain, mail

Parameters:

=over 4

=item * mail

=item * greylist

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

=item * tag2level

=item * killevel

=item * route_to

=back

returns: array

    $api->spamprotect->set(%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/APIBase.pm  view on Meta::CPAN

    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' );
    $header{'HPLS-AUTH'} = $api->token if $api->token;

    my $uri = join '/',
        $api->host,
        $api->base_uri;

    my $tx = $api->client->post(

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

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/author-no-bom.t  view on Meta::CPAN

    'lib/API/MailboxOrg/API/Backup.pm',
    'lib/API/MailboxOrg/API/Base.pm',
    'lib/API/MailboxOrg/API/Blacklist.pm',
    'lib/API/MailboxOrg/API/Capabilities.pm',
    'lib/API/MailboxOrg/API/Context.pm',
    'lib/API/MailboxOrg/API/Domain.pm',
    'lib/API/MailboxOrg/API/Hello.pm',
    'lib/API/MailboxOrg/API/Invoice.pm',
    'lib/API/MailboxOrg/API/Mail.pm',
    'lib/API/MailboxOrg/API/Mailinglist.pm',
    'lib/API/MailboxOrg/API/Passwordreset.pm',
    'lib/API/MailboxOrg/API/Spamprotect.pm',
    'lib/API/MailboxOrg/API/Test.pm',
    'lib/API/MailboxOrg/API/Utils.pm',
    'lib/API/MailboxOrg/API/Validate.pm',
    'lib/API/MailboxOrg/API/Videochat.pm',
    'lib/API/MailboxOrg/APIBase.pm',
    'lib/API/MailboxOrg/Types.pm',
    't/001_base.t',
    't/002_hello-world.t',
    't/types/001_hashref_restricted.t',

t/author-no-tabs.t  view on Meta::CPAN

    'lib/API/MailboxOrg/API/Backup.pm',
    'lib/API/MailboxOrg/API/Base.pm',
    'lib/API/MailboxOrg/API/Blacklist.pm',
    'lib/API/MailboxOrg/API/Capabilities.pm',
    'lib/API/MailboxOrg/API/Context.pm',
    'lib/API/MailboxOrg/API/Domain.pm',
    'lib/API/MailboxOrg/API/Hello.pm',
    'lib/API/MailboxOrg/API/Invoice.pm',
    'lib/API/MailboxOrg/API/Mail.pm',
    'lib/API/MailboxOrg/API/Mailinglist.pm',
    'lib/API/MailboxOrg/API/Passwordreset.pm',
    'lib/API/MailboxOrg/API/Spamprotect.pm',
    'lib/API/MailboxOrg/API/Test.pm',
    'lib/API/MailboxOrg/API/Utils.pm',
    'lib/API/MailboxOrg/API/Validate.pm',
    'lib/API/MailboxOrg/API/Videochat.pm',
    'lib/API/MailboxOrg/APIBase.pm',
    'lib/API/MailboxOrg/Types.pm',
    't/001_base.t',
    't/002_hello-world.t',
    't/types/001_hashref_restricted.t',

t/types/001_hashref_restricted.t  view on Meta::CPAN

    it 'allows an empty hash' => sub {
        my $type = HashRefRestricted([qw/a b/]); # allow keys a and b only
        ok $type->( {} );
    };

    it 'allows only the defined keys, using all allowed keys' => sub {
        my $type = HashRefRestricted([qw/a b/]); # allow keys a and b only
        ok $type->( { a => 1, b => 2 } );
    };

    it 'allows only the defined keys, using a subset of the keys' => sub {
        my $type = HashRefRestricted([qw/a b/]); # allow keys a and b only
        ok $type->( { a => 1 } );
    };

    it 'dies on disallowed keys' => sub {
        my $type = HashRefRestricted([qw/a b/]); # allow keys a and b only
        dies_ok { $type->( { c => 1 } ) };
    };

    it 'dies on disallowed keys, even when allowed keys are present' => sub {



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