| 1 | package WWW::MailboxOrg::API::Blacklist; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Blacklist 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); | ||||||||
|
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 | add => validation_for( | ||||||||||
| 27 | params => { | ||||||||||
| 28 | account => { type => Str, optional => 0 }, | ||||||||||
| 29 | email => { type => Str, optional => 0 }, | ||||||||||
| 30 | }, | ||||||||||
| 31 | ), | ||||||||||
| 32 | del => validation_for( | ||||||||||
| 33 | params => { | ||||||||||
| 34 | account => { type => Str, optional => 0 }, | ||||||||||
| 35 | email => { type => Str, optional => 0 }, | ||||||||||
| 36 | }, | ||||||||||
| 37 | ), | ||||||||||
| 38 | list => validation_for( | ||||||||||
| 39 | params => { | ||||||||||
| 40 | account => { type => Str, optional => 0 }, | ||||||||||
| 41 | }, | ||||||||||
| 42 | ), | ||||||||||
| 43 | ); | ||||||||||
| 44 | |||||||||||
| 45 | sub add { | ||||||||||
| 46 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
add: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 47 | 0 | my $v = $validators{'add'}; | |||||||||
| 48 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | return $self->_rpc('blacklist.add', \%params); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | sub del { | ||||||||||
| 53 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
del: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 54 | 0 | my $v = $validators{'del'}; | |||||||||
| 55 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | return $self->_rpc('blacklist.del', \%params); | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | sub list { | ||||||||||
| 60 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 61 | 0 | my $v = $validators{'list'}; | |||||||||
| 62 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | return $self->_rpc('blacklist.list', \%params); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 1 | 1; | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||
| 69 | |||||||||||
| 70 | =pod | ||||||||||
| 71 | |||||||||||
| 72 | =encoding UTF-8 | ||||||||||
| 73 | |||||||||||
| 74 | =head1 NAME | ||||||||||
| 75 | |||||||||||
| 76 | WWW::MailboxOrg::API::Blacklist - Blacklist API | ||||||||||
| 77 | |||||||||||
| 78 | =head1 VERSION | ||||||||||
| 79 | |||||||||||
| 80 | version 0.001 | ||||||||||
| 81 | |||||||||||
| 82 | =head1 NAME | ||||||||||
| 83 | |||||||||||
| 84 | WWW::MailboxOrg::API::Blacklist - Blacklist API | ||||||||||
| 85 | |||||||||||
| 86 | =head2 add | ||||||||||
| 87 | |||||||||||
| 88 | $api->blacklist->add( | ||||||||||
| 89 | account => 'admin@example.com', | ||||||||||
| 90 | email => 'spam@example.com', | ||||||||||
| 91 | ); | ||||||||||
| 92 | |||||||||||
| 93 | Add an email to blacklist. Required: C<account>, C<email>. | ||||||||||
| 94 | |||||||||||
| 95 | =head2 del | ||||||||||
| 96 | |||||||||||
| 97 | $api->blacklist->del( | ||||||||||
| 98 | account => 'admin@example.com', | ||||||||||
| 99 | email => 'spam@example.com', | ||||||||||
| 100 | ); | ||||||||||
| 101 | |||||||||||
| 102 | Remove an email from blacklist. | ||||||||||
| 103 | |||||||||||
| 104 | =head2 list | ||||||||||
| 105 | |||||||||||
| 106 | $api->blacklist->list(account => 'admin@example.com'); | ||||||||||
| 107 | |||||||||||
| 108 | List blacklist entries. Required: C<account>. | ||||||||||
| 109 | |||||||||||
| 110 | =cut | ||||||||||
| 111 | |||||||||||
| 112 | =head1 SUPPORT | ||||||||||
| 113 | |||||||||||
| 114 | =head2 Issues | ||||||||||
| 115 | |||||||||||
| 116 | Please report bugs and feature requests on GitHub at | ||||||||||
| 117 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||||||||||
| 118 | |||||||||||
| 119 | =head2 IRC | ||||||||||
| 120 | |||||||||||
| 121 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||||||||||
| 122 | |||||||||||
| 123 | =head1 CONTRIBUTING | ||||||||||
| 124 | |||||||||||
| 125 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||
| 126 | |||||||||||
| 127 | =head1 AUTHOR | ||||||||||
| 128 | |||||||||||
| 129 | Torsten Raudssus <getty@cpan.org> | ||||||||||
| 130 | |||||||||||
| 131 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 132 | |||||||||||
| 133 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||
| 134 | |||||||||||
| 135 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 136 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 137 | |||||||||||
| 138 | =cut | ||||||||||