| 1 | package WWW::MailboxOrg::API::Spamprotect; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Spam protection API | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooX::Singleton; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Params::ValidationCompiler qw(validation_for); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Types::Standard qw(Str Bool); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.001'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has client => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | weak_ref => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | sub _rpc { | ||||||||||
| 20 | 0 | ▶ | my ($self, $method, @params) = @_; | ||||||||
|
Subroutine
_rpc: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | ▶ | my $client = $self->client or croak "No client set"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | return $client->call($method, @params); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | my %validators = ( | |||||||||
| 26 | status => validation_for( | ||||||||||
| 27 | params => { | ||||||||||
| 28 | account => { type => Str, optional => 0 }, | ||||||||||
| 29 | }, | ||||||||||
| 30 | ), | ||||||||||
| 31 | set => validation_for( | ||||||||||
| 32 | params => { | ||||||||||
| 33 | account => { type => Str, optional => 0 }, | ||||||||||
| 34 | active => { type => Bool, optional => 0 }, | ||||||||||
| 35 | }, | ||||||||||
| 36 | ), | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | sub status { | ||||||||||
| 40 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
status: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | my $v = $validators{'status'}; | |||||||||
| 42 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | return $self->_rpc('spamprotect.status', \%params); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | sub set { | ||||||||||
| 47 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
set: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 48 | 0 | my $v = $validators{'set'}; | |||||||||
| 49 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 0 | return $self->_rpc('spamprotect.set', \%params); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||
| 56 | |||||||||||
| 57 | =pod | ||||||||||
| 58 | |||||||||||
| 59 | =encoding UTF-8 | ||||||||||
| 60 | |||||||||||
| 61 | =head1 NAME | ||||||||||
| 62 | |||||||||||
| 63 | WWW::MailboxOrg::API::Spamprotect - Spam protection API | ||||||||||
| 64 | |||||||||||
| 65 | =head1 VERSION | ||||||||||
| 66 | |||||||||||
| 67 | version 0.001 | ||||||||||
| 68 | |||||||||||
| 69 | =head1 NAME | ||||||||||
| 70 | |||||||||||
| 71 | WWW::MailboxOrg::API::Spamprotect - Spam protection API | ||||||||||
| 72 | |||||||||||
| 73 | =head2 status | ||||||||||
| 74 | |||||||||||
| 75 | my $status = $api->spamprotect->status(account => 'admin@example.com'); | ||||||||||
| 76 | |||||||||||
| 77 | Get spam protection status. Required: C<account>. | ||||||||||
| 78 | |||||||||||
| 79 | =head2 set | ||||||||||
| 80 | |||||||||||
| 81 | $api->spamprotect->set( | ||||||||||
| 82 | account => 'admin@example.com', | ||||||||||
| 83 | active => 1, | ||||||||||
| 84 | ); | ||||||||||
| 85 | |||||||||||
| 86 | Enable or disable spam protection. Required: C<account>, C<active>. | ||||||||||
| 87 | |||||||||||
| 88 | =cut | ||||||||||
| 89 | |||||||||||
| 90 | =head1 SUPPORT | ||||||||||
| 91 | |||||||||||
| 92 | =head2 Issues | ||||||||||
| 93 | |||||||||||
| 94 | Please report bugs and feature requests on GitHub at | ||||||||||
| 95 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||||||||||
| 96 | |||||||||||
| 97 | =head2 IRC | ||||||||||
| 98 | |||||||||||
| 99 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||||||||||
| 100 | |||||||||||
| 101 | =head1 CONTRIBUTING | ||||||||||
| 102 | |||||||||||
| 103 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||
| 104 | |||||||||||
| 105 | =head1 AUTHOR | ||||||||||
| 106 | |||||||||||
| 107 | Torsten Raudssus <getty@cpan.org> | ||||||||||
| 108 | |||||||||||
| 109 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 110 | |||||||||||
| 111 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||
| 112 | |||||||||||
| 113 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 114 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 115 | |||||||||||
| 116 | =cut | ||||||||||